@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

/* ===== CSS Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: #f0f0f8;
  background-color: #1A1A2E;
  overflow-x: hidden;
}

/* ===== CSS Custom Properties ===== */
:root {
  --c-dark: #1A1A2E;
  --c-red: #E63946;
  --c-yellow: #F4D03F;
  --c-dark2: #22223b;
  --c-dark3: #2d2d48;
  --c-dark4: #3a3a5c;
  --c-text: #f0f0f8;
  --c-text-muted: #a0a0c0;
  --c-border: #3a3a5c;
  --header-h: 64px;
  --aside-w: 220px;
  --max-content: 860px;
  --radius: 4px;
  --radius-card: 10px;
  --transition: 160ms ease;
}

/* ===== Scroll Margin for Sections ===== */
div[id] {
  scroll-margin-top: calc(var(--header-h) + 12px);
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  font-weight: 600;
  color: #fff;
}

h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.75rem); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.35rem); }

p { margin-bottom: 1em; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--c-red);
  text-decoration: none;
  transition: color var(--transition), opacity var(--transition);
}
a:hover { color: var(--c-yellow); }

ul, ol {
  padding-left: 1.4em;
  margin-bottom: 1em;
}
li { margin-bottom: 0.3em; }

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ===== Site Header ===== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--c-dark);
  border-bottom: 2px solid var(--c-red);
  height: var(--header-h);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 0;
  height: var(--header-h);
  padding: 0 24px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Brand Logo */
.brand-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-right: 32px;
  min-height: 40px;
}

.brand-logo img {
  height: 36px;
  width: auto;
}

.brand-text {
  font-size: 1.2rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
}
.brand-text:hover { color: var(--c-yellow); }

/* Nav */
.site-nav {
  flex: 1;
  overflow: hidden;
}

.site-nav > p {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  margin: 0;
}

.site-nav > p > a {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  min-height: 40px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--c-text-muted);
  border-radius: var(--radius);
  white-space: nowrap;
  transition: color var(--transition), background var(--transition);
}

.site-nav > p > a:hover,
.site-nav > p > a:focus {
  color: #fff;
  background: var(--c-dark3);
}

/* Search */
.header-search {
  margin-left: 16px;
  flex-shrink: 0;
}

.search-form {
  display: flex;
  align-items: center;
  background: var(--c-dark3);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
}

.search-form:focus-within {
  border-color: var(--c-red);
}

.search-input {
  background: none;
  border: none;
  outline: none;
  color: var(--c-text);
  font-family: inherit;
  font-size: 0.875rem;
  padding: 8px 12px;
  width: 160px;
  min-height: 40px;
}

.search-input::placeholder {
  color: var(--c-text-muted);
}

.search-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--c-text-muted);
  padding: 8px 12px;
  min-height: 40px;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition);
}

.search-btn:hover { color: var(--c-red); }

/* Mobile Nav Toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 10px 12px;
  min-height: 40px;
  min-width: 44px;
  margin-left: 12px;
  flex-shrink: 0;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--c-text);
  border-radius: 1px;
  transition: transform var(--transition), opacity var(--transition);
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile Nav Drawer */
.mobile-nav {
  display: none;
  background: var(--c-dark2);
  border-top: 1px solid var(--c-border);
  padding: 8px 16px 16px;
  position: absolute;
  top: var(--header-h);
  left: 0;
  right: 0;
  z-index: 99;
}

.mobile-nav.is-open {
  display: block;
}

.mobile-nav > p {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
}

.mobile-nav > p > a {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  min-height: 44px;
  font-size: 0.95rem;
  color: var(--c-text-muted);
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
}

.mobile-nav > p > a:hover {
  color: #fff;
  background: var(--c-dark3);
}

/* ===== Hero Section ===== */
.hero-section {
  position: relative;
  margin-top: var(--header-h);
  width: 100%;
  height: 45vh;
  min-height: 260px;
  max-height: 480px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(26,26,46,0.88) 0%, rgba(230,57,70,0.22) 100%);
}

/* Fallback background when no image */
.hero-section:not(:has(.hero-bg-img)) .hero-media,
.hero-media:empty {
  background: var(--c-dark2);
}

.hero-content {
  position: relative;
  z-index: 1;
  padding: 32px 40px 40px;
  max-width: 700px;
  text-align: left;
}

.hero-badge {
  display: inline-flex;
  margin-bottom: 14px;
}

.hero-badge span {
  background: var(--c-red);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 4px 12px;
  border-radius: var(--radius);
  text-transform: uppercase;
}

.hero-title {
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  font-weight: 600;
  color: #fff;
  margin-bottom: 12px;
  line-height: 1.25;
}

.hero-desc {
  font-size: 1rem;
  color: rgba(240,240,248,0.8);
  max-width: 560px;
  margin-bottom: 0;
  line-height: 1.6;
}

/* ===== Page Layout (Aside + Main) ===== */
.page-layout {
  display: flex;
  align-items: flex-start;
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 24px;
  gap: 32px;
}

/* ===== Aside ===== */
.site-aside {
  flex: 0 0 var(--aside-w);
  width: var(--aside-w);
  position: sticky;
  top: calc(var(--header-h) + 20px);
}

.aside-inner {
  background: var(--c-dark2);
  border: 1px solid var(--c-border);
  border-top: 3px solid var(--c-red);
  border-radius: var(--radius-card);
  padding: 20px;
}

.aside-title {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--c-yellow);
  text-transform: uppercase;
  margin-bottom: 14px;
}

.aside-title span {
  display: inline;
}

.aside-link {
  display: flex;
  align-items: center;
  padding: 9px 10px;
  min-height: 40px;
  font-size: 0.875rem;
  color: var(--c-text-muted);
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition), padding-left var(--transition);
  border-left: 2px solid transparent;
}

.aside-link:hover {
  color: #fff;
  background: var(--c-dark3);
  padding-left: 14px;
  border-left-color: var(--c-red);
}

.aside-tip {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--c-border);
}

.aside-tip-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--c-yellow);
  margin-bottom: 8px;
  letter-spacing: 0.06em;
}

.aside-tip-title span {
  display: inline;
}

.aside-tip p {
  font-size: 0.8rem;
  color: var(--c-text-muted);
  line-height: 1.55;
}

/* ===== Main Content ===== */
.site-main {
  flex: 1;
  min-width: 0;
}

.wrap {
  max-width: var(--max-content);
}

.content-section {
  /* div wrapper */
}

.content-article {
  /* article wrapper */
}

/* Content styles from page.content */
.content-article h2 {
  font-size: clamp(1.2rem, 2.8vw, 1.65rem);
  font-weight: 600;
  color: #fff;
  margin: 2.2em 0 0.7em;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--c-red);
  display: flex;
  align-items: center;
  gap: 10px;
}

.content-article h2:first-child { margin-top: 0; }

.content-article h2 span {
  display: inline;
}

.content-article h3 {
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  color: var(--c-yellow);
  margin: 1.8em 0 0.5em;
}

.content-article h3 span {
  display: inline;
}

.content-article p {
  color: rgba(240,240,248,0.88);
  line-height: 1.8;
  margin-bottom: 1em;
}

.content-article ul,
.content-article ol {
  color: rgba(240,240,248,0.85);
}

.content-article li { margin-bottom: 0.4em; }

.content-article a {
  color: var(--c-red);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.content-article a:hover { color: var(--c-yellow); }

.content-article strong { color: #fff; font-weight: 600; }

.content-article blockquote {
  border-left: 3px solid var(--c-red);
  padding: 12px 18px;
  margin: 1.4em 0;
  background: var(--c-dark2);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--c-text-muted);
  font-style: italic;
}

.content-article div {
  padding: 40px 0;
  border-bottom: 1px solid var(--c-border);
}

.content-article div:last-child {
  border-bottom: none;
}

.content-article img {
  border-radius: var(--radius-card);
  margin: 1.2em 0;
}

/* Section card-like block */
.content-article div > * + * {
  margin-top: 0.9em;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--c-dark2);
  border-top: 2px solid var(--c-border);
  padding: 0;
}

.site-footer > div {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.footer-brand {
  border-bottom: 1px solid var(--c-border);
}

.footer-brand,
.footer-copy {
  width: 100%;
}

.footer-logo-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--c-yellow);
  letter-spacing: 0.04em;
}

.footer-sep {
  color: var(--c-text-muted);
  padding: 0 4px;
}

.footer-slogan {
  font-size: 0.875rem;
  color: var(--c-text-muted);
}

.footer-copy {
  font-size: 0.8rem;
  color: var(--c-text-muted);
}

.footer-host {
  font-size: 0.8rem;
  color: var(--c-text-muted);
}

/* ===== Utility ===== */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* ===== Carousel / Auto-Rotation (if used in content) ===== */
.carousel {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-card);
}

.carousel-track {
  display: flex;
  transition: transform 400ms ease;
}

.carousel-item {
  flex: 0 0 100%;
}

/* ===== Responsive Breakpoints ===== */

/* Large screens: full layout */
@media (min-width: 1100px) {
  .page-layout { padding: 48px 40px; }
}

/* Medium: reduce aside */
@media (max-width: 900px) {
  :root { --aside-w: 180px; }
  .search-input { width: 120px; }
  .site-nav > p > a { padding: 8px 8px; font-size: 0.82rem; }
}

/* Tablet and below: collapse aside */
@media (max-width: 720px) {
  .page-layout {
    flex-direction: column;
    padding: 24px 16px;
    gap: 24px;
  }

  .site-aside {
    flex: none;
    width: 100%;
    position: static;
    order: -1;
  }

  .aside-inner {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
  }

  .aside-title {
    width: 100%;
    margin-bottom: 4px;
  }

  .aside-link {
    flex: 0 0 auto;
    padding: 8px 12px;
    background: var(--c-dark3);
    border-radius: 20px;
    border-left: none;
    font-size: 0.82rem;
    min-height: 40px;
  }

  .aside-link:hover {
    padding-left: 12px;
    border-left: none;
  }

  .aside-tip {
    width: 100%;
    display: none;
  }

  .site-nav { display: none; }
  .header-search { display: none; }
  .nav-toggle { display: flex; }

  .hero-content {
    padding: 20px 20px 28px;
  }
}

/* Mobile: 375px base */
@media (max-width: 480px) {
  :root { --header-h: 56px; }

  .hero-section {
    min-height: 220px;
    max-height: 360px;
  }

  .hero-title {
    font-size: 1.4rem;
  }

  .hero-badge span {
    font-size: 0.7rem;
  }

  .page-layout {
    padding: 16px 12px;
    gap: 16px;
  }

  .site-footer > div {
    padding: 12px 16px;
  }

  .brand-logo { margin-right: 0; flex: 1; }

  .wrap { max-width: 100%; }
}

/* ===== prefers-reduced-motion ===== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  .carousel-track { transition: none; }
}

button[aria-expanded]{min-width:44px;min-height:44px}
