@layer reset, base, components, utilities;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
  body, h1, h2, h3, h4, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }
  ul, ol { padding: 0; list-style: none; }
  a { color: inherit; text-decoration: none; }
  img, svg { display: block; max-width: 100%; }
  button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
  ::selection { background: var(--accent); color: var(--bg); }
}

@layer base {
  :root {
    --bg: #0e0d12;
    --bg-2: #131218;
    --surface: #181721;
    --surface-2: #211f2c;
    --text: #e4e2e8;
    --text-dim: #918f9d;
    --text-muted: #5a5867;
    --accent: #e8a85c;
    --accent-hover: #f0b46d;
    --accent-soft: rgba(232, 168, 92, 0.12);
    --border: rgba(255, 255, 255, 0.06);
    --border-strong: rgba(255, 255, 255, 0.12);
    --font-display: "Sora", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    --font-body: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    --container: 1160px;
    --radius: 16px;
    --radius-sm: 10px;
    --ease: cubic-bezier(0.25, 1, 0.5, 1);
    --dur: 0.3s;
  }

  body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.02em;
  }

  .container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
  }

  .skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--accent);
    color: var(--bg);
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 200;
    transition: top var(--dur) var(--ease);
  }
  .skip-link:focus { top: 0; }

  .kicker {
    display: inline-block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 16px;
  }
}

@layer components {
  /* ===== Buttons ===== */
  .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9375rem;
    transition: all var(--dur) var(--ease);
    border: 1px solid transparent;
  }
  .btn--accent { background: var(--accent); color: var(--bg); }
  .btn--accent:hover { background: var(--accent-hover); }
  .btn--ghost { border-color: var(--border-strong); color: var(--text); }
  .btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

  /* ===== Header ===== */
  .site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    border-bottom: 1px solid transparent;
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
  }
  .site-header.is-scrolled {
    background: rgba(14, 13, 18, 0.92);
    border-bottom-color: var(--border);
  }
  .header-inner {
    display: flex;
    align-items: center;
    gap: 32px;
    height: 64px;
  }
  .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.0625rem;
    letter-spacing: -0.01em;
  }
  .brand em { font-style: normal; color: var(--text-dim); font-weight: 400; }
  .brand-mark { width: 30px; height: 30px; flex-shrink: 0; }

  .site-nav {
    display: flex;
    gap: 28px;
    margin: 0 auto;
  }
  .site-nav a {
    font-size: 0.875rem;
    color: var(--text-dim);
    transition: color var(--dur) var(--ease);
  }
  .site-nav a:hover { color: var(--text); }

  .header-actions { display: flex; align-items: center; gap: 12px; }
  .lang-toggle {
    padding: 6px 12px;
    font-size: 0.8125rem;
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: all var(--dur) var(--ease);
  }
  .lang-toggle:hover { color: var(--accent); border-color: var(--accent); }

  .header-cta {
    padding: 8px 18px;
    background: var(--accent);
    color: var(--bg);
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.875rem;
    transition: background var(--dur) var(--ease);
  }
  .header-cta:hover { background: var(--accent-hover); }

  .nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
  }
  .nav-toggle span {
    width: 22px; height: 2px;
    background: var(--text);
    transition: transform var(--dur) var(--ease), opacity var(--dur);
  }
  .nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle.is-open span:nth-child(2) { opacity: 0; }
  .nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* ===== Mobile Menu ===== */
  .mobile-menu {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--dur) var(--ease), visibility var(--dur);
  }
  .mobile-menu.is-open { opacity: 1; visibility: visible; }
  .mobile-menu nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
  }
  .mobile-menu a {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
  }

  /* ===== Hero ===== */
  .hero { padding: 120px 0 80px; }
  .hero-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 64px;
    align-items: center;
  }
  .hero h1 {
    font-size: clamp(2.5rem, 5.5vw, 4.25rem);
    font-weight: 700;
    line-height: 1.05;
    margin-bottom: 24px;
  }
  .hero h1 em { font-style: normal; color: var(--accent); }
  .hero-desc {
    font-size: 1.125rem;
    color: var(--text-dim);
    max-width: 30rem;
    margin-bottom: 32px;
  }
  .hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }

  /* Featured game card */
  .featured-card {
    background: var(--art, linear-gradient(140deg, #c45a3a, #8b3a4e, #4a2840)) center/cover no-repeat;
    border-radius: var(--radius);
    padding: 28px;
    min-height: 340px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
  }
  .featured-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(14,13,18,0.25) 0%, rgba(14,13,18,0.7) 100%);
    pointer-events: none;
  }
  .featured-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255,255,255,0.55);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    position: relative;
  }
  .featured-wordmark {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: rgba(255,255,255,0.95);
    line-height: 1;
    position: relative;
    margin-bottom: 8px;
  }
  .featured-meta {
    font-size: 0.875rem;
    color: rgba(255,255,255,0.45);
    position: relative;
  }

  /* ===== Stats Band ===== */
  .stats-band {
    padding: 28px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }
  .stats-line {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 28px;
    font-size: 0.875rem;
    color: var(--text-muted);
    align-items: center;
    justify-content: center;
  }
  .stats-line strong { color: var(--text); font-weight: 600; }
  .stats-line .sep {
    width: 3px; height: 3px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
  }

  /* ===== Section Head ===== */
  .section-head { margin-bottom: 56px; }
  .section-head h2 {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    max-width: 36rem;
  }
  .section-head .lede {
    margin-top: 16px;
    color: var(--text-dim);
    font-size: 1.0625rem;
    max-width: 32rem;
  }

  /* ===== Games ===== */
  .games { padding: 100px 0; }
  .games-list { display: flex; flex-direction: column; gap: 24px; }
  .game-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
    transition: border-color var(--dur) var(--ease);
  }
  .game-card:hover { border-color: var(--border-strong); }
  .game-card--reverse .game-art { order: 2; }

  .game-art {
    background: var(--art) center/cover no-repeat;
    min-height: 280px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
  }
  .game-art::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(14,13,18,0.15) 0%, rgba(14,13,18,0.6) 100%);
    pointer-events: none;
  }
  .game-num {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255,255,255,0.4);
    letter-spacing: 0.08em;
    position: relative;
  }
  .game-wordmark {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: rgba(255,255,255,0.95);
    line-height: 1;
    position: relative;
    margin-bottom: 6px;
  }
  .game-genre-tag {
    font-size: 0.8125rem;
    color: rgba(255,255,255,0.5);
    position: relative;
  }

  .game-info {
    padding: 36px 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
  }
  .game-info h3 { font-size: 1.5rem; font-weight: 700; }
  .game-info p { color: var(--text-dim); line-height: 1.6; }
  .game-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
  .game-tag {
    font-size: 0.75rem;
    color: var(--text-dim);
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 20px;
  }

  /* ===== Studio ===== */
  .studio {
    padding: 100px 0;
    background: var(--bg-2);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }
  .studio-inner { max-width: 720px; }
  .studio h2 {
    font-size: clamp(2rem, 4vw, 3.25rem);
    font-weight: 700;
    margin-bottom: 24px;
  }
  .studio p {
    font-size: 1.125rem;
    color: var(--text-dim);
    line-height: 1.7;
    margin-bottom: 16px;
  }

  /* ===== Approach ===== */
  .approach { padding: 100px 0; }
  .steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
  }
  .step {
    padding: 24px 0;
    border-top: 1px solid var(--border);
  }
  .step-num {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 12px;
  }
  .step h3 { font-size: 1.125rem; font-weight: 600; margin-bottom: 8px; }
  .step p { font-size: 0.875rem; color: var(--text-dim); line-height: 1.6; }

  /* ===== Contact ===== */
  .contact { padding: 100px 0; text-align: center; }
  .contact .section-head { margin-bottom: 40px; }
  .contact .lede {
    color: var(--text-dim);
    max-width: 30rem;
    margin: 0 auto 32px;
    font-size: 1.0625rem;
  }
  .contact-email {
    display: inline-block;
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 32px;
    transition: opacity var(--dur) var(--ease);
  }
  .contact-email:hover { opacity: 0.8; }

  /* ===== Footer ===== */
  .site-footer { border-top: 1px solid var(--border); padding: 48px 0 32px; }
  .footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 32px;
    flex-wrap: wrap;
  }
  .footer-brand p {
    color: var(--text-dim);
    font-size: 0.875rem;
    margin-top: 12px;
    max-width: 20rem;
  }
  .footer-cols { display: flex; gap: 48px; flex-wrap: wrap; }
  .footer-col h4 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 12px;
  }
  .footer-col ul { display: flex; flex-direction: column; gap: 8px; }
  .footer-col a {
    font-size: 0.875rem;
    color: var(--text-dim);
    transition: color var(--dur) var(--ease);
  }
  .footer-col a:hover { color: var(--text); }
  .footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
  }
  .privacy-note {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    color: var(--text-dim);
  }
  .privacy-note .dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
  }
  .footer-legal { display: flex; gap: 16px; }
  .footer-legal a { font-size: 0.8125rem; color: var(--text-dim); }
  .footer-legal a:hover { color: var(--text); }
  .footer-copy { font-size: 0.8125rem; color: var(--text-muted); }

  /* ===== Legal Pages ===== */
  .legal-nav {
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
  }
  .legal-nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
  }
  .legal-nav .header-actions { display: flex; align-items: center; gap: 12px; }
  .legal-nav .back {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: color var(--dur) var(--ease);
  }
  .legal-nav .back svg { width: 14px; height: 14px; }
  .legal-nav .back:hover { color: var(--text); }

  .legal-hero { padding: 80px 0 48px; }
  .legal-hero h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    margin-bottom: 20px;
  }
  .legal-hero .lede {
    color: var(--text-dim);
    font-size: 1.0625rem;
    max-width: 36rem;
    margin-bottom: 16px;
  }
  .legal-hero .meta { font-size: 0.8125rem; color: var(--text-muted); }
  .legal-body { padding-bottom: 80px; }
  .legal-block {
    padding: 28px 0;
    border-top: 1px solid var(--border);
  }
  .legal-block:first-child { border-top: none; padding-top: 0; }
  .legal-block h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 12px; }
  .legal-block p { color: var(--text-dim); line-height: 1.7; }
  .legal-block a { color: var(--accent); }
  .legal-block ul {
    list-style: disc;
    padding-left: 1.25em;
    color: var(--text-dim);
  }
  .legal-block ul li { margin-bottom: 8px; line-height: 1.6; }
}

@layer utilities {
  [data-reveal] {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
  }
  [data-reveal].is-revealed { opacity: 1; transform: none; }
  [data-reveal][data-delay="1"] { transition-delay: 0.1s; }
  [data-reveal][data-delay="2"] { transition-delay: 0.2s; }
  [data-reveal][data-delay="3"] { transition-delay: 0.3s; }

  @media (max-width: 1024px) {
    .hero-grid { grid-template-columns: 1fr; gap: 48px; }
    .game-card { grid-template-columns: 1fr; }
    .game-card--reverse .game-art { order: 0; }
    .game-art { min-height: 200px; }
    .steps { grid-template-columns: repeat(2, 1fr); }
    .footer-cols { gap: 32px; }
  }

  @media (max-width: 768px) {
    .site-nav, .header-cta { display: none; }
    .nav-toggle { display: flex; }
    .footer-inner { flex-direction: column; }
    .footer-bottom { flex-direction: column; align-items: flex-start; }
  }

  @media (max-width: 480px) {
    .steps { grid-template-columns: 1fr; }
    .hero { padding: 100px 0 60px; }
    .games, .studio, .approach, .contact { padding: 64px 0; }
  }

  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
    [data-reveal] { opacity: 1 !important; transform: none !important; }
  }
}
