@layer reset, base, components, layout, responsive;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  body, h1, h2, h3, p, dl, dd, ol { margin: 0; }
  img { display: block; max-width: 100%; }
  button, a { font: inherit; }
}

@layer base {
  :root {
    color-scheme: dark;
    --ink: #090c0b;
    --ink-soft: #111714;
    --surface: #151b18;
    --surface-2: #1c2420;
    --line: rgba(227, 235, 218, .14);
    --line-strong: rgba(227, 235, 218, .28);
    --paper: #f2eee3;
    --muted: #a8b1a7;
    --sage: #a8bfaa;
    --ember: #e26034;
    --ember-hot: #ff7a42;
    --gold: #f4bf55;
    --green: #70d995;
    --danger: #f06d62;
    --display: "Arial Narrow", "Roboto Condensed", "Helvetica Neue", sans-serif;
    --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    --shadow: 0 24px 80px rgba(0, 0, 0, .35);
    --max: 1240px;
  }

  html { background: var(--ink); }
  body {
    min-width: 320px;
    overflow-x: hidden;
    color: var(--paper);
    background:
      radial-gradient(circle at 82% 12%, rgba(226, 96, 52, .08), transparent 30rem),
      var(--ink);
    font-family: var(--sans);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
  }
  a { color: inherit; }
  ::selection { color: var(--ink); background: var(--gold); }
  :focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
  h1, h2, h3 { font-family: var(--display); line-height: .98; text-transform: uppercase; }
  h1 { font-size: clamp(3.55rem, 8.7vw, 8.25rem); letter-spacing: -.065em; }
  h2 { font-size: clamp(2.6rem, 5.2vw, 5.2rem); letter-spacing: -.045em; }
  h3 { font-size: 1.35rem; letter-spacing: -.02em; }
  .sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
  }
  .skip-link {
    position: fixed; z-index: 100; left: 1rem; top: 1rem; transform: translateY(-180%);
    padding: .75rem 1rem; color: var(--ink); background: var(--gold); font-weight: 800;
  }
  .skip-link:focus { transform: none; }
}

@layer components {
  .brand { display: inline-flex; align-items: center; gap: .7rem; text-decoration: none; font-size: 1rem; letter-spacing: .04em; }
  .brand img { flex: none; }
  .brand strong { color: var(--ember-hot); }
  .eyebrow, .section-index, .card-label, .button-kicker, .live-label, .phase-pill {
    font-family: var(--mono); font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  }
  .eyebrow { display: flex; gap: .55rem; flex-wrap: wrap; margin-bottom: 1.35rem; }
  .eyebrow span { padding: .4rem .65rem; border: 1px solid var(--line-strong); background: rgba(9, 12, 11, .54); }
  .eyebrow span:first-child { color: var(--ink); background: var(--gold); border-color: var(--gold); }
  .button {
    display: inline-flex; min-height: 4.1rem; min-width: 11.2rem; justify-content: center; flex-direction: column;
    padding: .72rem 1.2rem; border: 1px solid transparent; text-decoration: none; cursor: pointer;
    transition: transform .18s ease, background .18s ease, border-color .18s ease;
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  }
  .button:hover { transform: translateY(-2px); }
  .button strong { font-family: var(--display); font-size: 1.05rem; letter-spacing: .05em; text-transform: uppercase; }
  .button-kicker { opacity: .75; }
  .button-primary { color: #130b07; background: var(--ember-hot); }
  .button-primary:hover { background: #ff8d5c; }
  .button-secondary { color: var(--paper); border-color: var(--line-strong); background: rgba(9, 12, 11, .65); backdrop-filter: blur(10px); }
  .button-secondary:hover, .button-quiet:hover { border-color: var(--paper); }
  .button-light { color: var(--ink); background: var(--paper); font-weight: 800; }
  .button.compact { min-height: 3rem; min-width: auto; padding: .6rem 1rem; flex-direction: row; align-items: center; }
  .button-quiet { color: var(--paper); background: transparent; border-color: var(--line-strong); }
  button.button { appearance: none; }
  .section-index { color: var(--ember-hot); margin-bottom: 1.4rem; }
  .section-heading { max-width: 890px; margin-bottom: 3.4rem; }
  .section-heading.narrow { max-width: 760px; }
  .section-heading > p:last-child { max-width: 680px; margin-top: 1.3rem; color: var(--muted); font-size: 1.05rem; }
  .text-link { display: inline-flex; gap: .55rem; margin-top: 2rem; color: var(--gold); font-weight: 800; text-underline-offset: .3em; }
  .not-found-actions { margin-top: 2rem; }
}

@layer layout {
  .site-shell { min-height: 100vh; }
  .site-header {
    position: absolute; z-index: 20; inset: 0 0 auto; display: grid; grid-template-columns: 1fr auto 1fr;
    align-items: center; gap: 2rem; width: min(calc(100% - 3rem), var(--max)); margin: auto; padding: 1.2rem 0;
    border-bottom: 1px solid rgba(242, 238, 227, .18);
  }
  .nav-links { display: flex; gap: clamp(1rem, 2.4vw, 2.2rem); }
  .nav-links a, .nav-discord { color: #d8ded5; font-size: .76rem; font-weight: 750; letter-spacing: .09em; text-decoration: none; text-transform: uppercase; }
  .nav-links a:hover, .nav-discord:hover { color: var(--gold); }
  .nav-discord { justify-self: end; color: var(--gold); }

  .hero { position: relative; min-height: max(760px, 100svh); display: grid; align-items: center; isolation: isolate; overflow: hidden; }
  .hero-art { position: absolute; z-index: -3; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
  .hero-scrim { position: absolute; z-index: -2; inset: 0; background: linear-gradient(90deg, rgba(5, 8, 7, .96) 0%, rgba(5, 8, 7, .78) 40%, rgba(5, 8, 7, .28) 75%), linear-gradient(0deg, var(--ink) 0%, transparent 28%); }
  .hero-content { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr); gap: clamp(2rem, 6vw, 7rem); align-items: end; width: min(calc(100% - 3rem), var(--max)); margin: auto; padding: 9.5rem 0 7rem; }
  .hero-copy { max-width: 820px; }
  .hero h1 em { color: var(--ember-hot); font-style: normal; }
  .hero-lede { max-width: 610px; margin-top: 1.6rem; color: #c5ccc4; font-size: clamp(1rem, 1.6vw, 1.25rem); }
  .hero-actions { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 2rem; }
  .scroll-cue { position: absolute; left: 50%; bottom: 1.2rem; display: flex; gap: .7rem; color: var(--muted); font-family: var(--mono); font-size: .7rem; letter-spacing: .12em; text-decoration: none; text-transform: uppercase; transform: translateX(-50%); }

  .command-panel { border: 1px solid var(--line-strong); background: rgba(10, 14, 12, .84); box-shadow: var(--shadow); backdrop-filter: blur(14px); }
  .panel-heading { display: grid; grid-template-columns: auto 1fr auto; gap: .75rem; align-items: center; padding: 1.15rem 1.25rem; border-bottom: 1px solid var(--line); }
  .panel-heading p { color: var(--muted); font-size: .72rem; }
  .panel-heading strong { display: block; font-size: .95rem; }
  .live-label { color: var(--green); }
  .status-dot { width: .65rem; height: .65rem; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 .35rem rgba(168, 177, 167, .1); }
  .status-dot.is-online { background: var(--green); box-shadow: 0 0 0 .35rem rgba(112, 217, 149, .13), 0 0 1.2rem rgba(112, 217, 149, .65); animation: pulse 2s infinite; }
  .status-dot.is-offline { background: var(--danger); }
  .status-dot.is-unknown { background: var(--gold); }
  .status-grid { display: grid; grid-template-columns: repeat(2, 1fr); }
  .status-grid > div { padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--line); }
  .status-grid > div:nth-child(odd) { border-right: 1px solid var(--line); }
  .status-grid dt { color: var(--muted); font-family: var(--mono); font-size: .65rem; letter-spacing: .08em; text-transform: uppercase; }
  .status-grid dd { margin-top: .2rem; font-family: var(--display); font-size: 1.45rem; font-weight: 800; line-height: 1.05; text-transform: uppercase; }
  .status-grid dd small { color: var(--muted); font-size: .7em; }
  .wipe-compact { padding: 1.25rem; background: linear-gradient(135deg, rgba(226, 96, 52, .13), transparent); }
  .wipe-compact > p:first-child { color: var(--gold); font-family: var(--mono); font-size: .65rem; text-transform: uppercase; }
  .wipe-compact > strong { display: block; margin-top: .3rem; font-size: 1.05rem; }
  .countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: .35rem; margin-top: 1rem; }
  .countdown span { padding: .65rem .25rem; text-align: center; background: rgba(0, 0, 0, .25); border: 1px solid var(--line); }
  .countdown b { display: block; font-family: var(--mono); font-size: 1.15rem; }
  .countdown small { color: var(--muted); font-size: .58rem; letter-spacing: .08em; text-transform: uppercase; }
  .estimate-note { margin-top: .7rem; color: var(--muted); font-size: .7rem; line-height: 1.4; }

  .section { width: min(calc(100% - 3rem), var(--max)); margin: auto; padding: clamp(5rem, 10vw, 9rem) 0; }
  .server-section { border-top: 1px solid var(--line); }
  .intel-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
  .intel-card { min-height: 310px; padding: 1.5rem; background: var(--ink-soft); }
  .intel-card.feature-card { display: flex; justify-content: space-between; flex-direction: column; background: var(--ember); }
  .card-number { font-family: var(--display); font-size: 7rem; font-weight: 900; letter-spacing: -.08em; line-height: .8; }
  .card-icon { display: grid; place-items: center; width: 3rem; height: 3rem; margin-bottom: 5rem; border: 1px solid var(--line-strong); color: var(--gold); font-family: var(--mono); }
  .intel-card h3 { margin: .55rem 0 .8rem; }
  .intel-card p:last-child { color: var(--muted); font-size: .88rem; }
  .feature-card p:last-child { color: rgba(20, 10, 6, .75); }
  .feature-card .card-label { color: #32150b; }

  .join-section { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(3rem, 9vw, 8rem); align-items: center; }
  .join-copy h2 { max-width: 620px; }
  .join-steps { display: grid; gap: 1rem; margin-top: 2.2rem; padding: 0; list-style: none; }
  .join-steps li { display: grid; grid-template-columns: 2.7rem 1fr; gap: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
  .join-steps li > span { color: var(--ember-hot); font-family: var(--mono); font-size: .75rem; }
  .join-steps strong { text-transform: uppercase; }
  .join-steps p { color: var(--muted); font-size: .9rem; }
  .join-terminal { border: 1px solid var(--line-strong); background: #080b0a; box-shadow: var(--shadow); }
  .terminal-bar { display: flex; align-items: center; gap: .4rem; padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
  .terminal-bar span { width: .55rem; height: .55rem; border-radius: 50%; background: var(--muted); }
  .terminal-bar span:first-child { background: var(--ember); }
  .terminal-bar span:nth-child(2) { background: var(--gold); }
  .terminal-bar span:nth-child(3) { background: var(--green); }
  .terminal-bar small { margin-left: auto; color: var(--muted); font-family: var(--mono); }
  .terminal-body { padding: clamp(1.3rem, 4vw, 2.4rem); font-family: var(--mono); }
  .prompt { color: var(--ember-hot); }
  .terminal-body code { display: block; margin: .7rem 0 1.4rem; color: var(--gold); font-size: clamp(1rem, 2.1vw, 1.4rem); overflow-wrap: anywhere; }
  .terminal-ready { color: var(--green); font-size: .75rem; }
  .terminal-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.5rem; }
  .copy-feedback { min-height: 1.5rem; margin-top: .7rem; color: var(--muted); font-size: .7rem; }

  .rules-section { position: relative; }
  .rules-section::before { content: "RP"; position: absolute; z-index: -1; right: 0; top: 2rem; color: rgba(242, 238, 227, .025); font-family: var(--display); font-size: clamp(14rem, 34vw, 34rem); font-weight: 900; line-height: 1; }
  .rules-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
  .rules-grid article { padding: 1.5rem; border-top: 2px solid var(--ember); background: var(--surface); }
  .rules-grid span { color: var(--gold); font-family: var(--mono); font-size: .7rem; }
  .rules-grid h3 { margin: 2.5rem 0 .8rem; }
  .rules-grid p { color: var(--muted); }

  .roadmap-section { border-top: 1px solid var(--line); }
  .roadmap-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
  .roadmap-card { overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
  .roadmap-card > :not(.roadmap-visual) { margin-inline: 1.35rem; }
  .roadmap-card .phase-pill { display: inline-flex; margin-top: 1.35rem; padding: .35rem .55rem; color: var(--gold); border: 1px solid var(--line-strong); }
  .roadmap-card h3 { margin-top: 1rem; }
  .roadmap-card p { min-height: 8.5rem; margin-top: .8rem; margin-bottom: 1.5rem; color: var(--muted); font-size: .9rem; }
  .roadmap-visual { position: relative; height: 190px; overflow: hidden; background: #0d1210; border-bottom: 1px solid var(--line); }
  .leaderboard-preview { display: flex; align-items: end; justify-content: center; gap: 1.2rem; padding: 2rem; }
  .leaderboard-preview i { width: 2.4rem; height: 42%; background: var(--surface-2); border-top: 2px solid var(--sage); }
  .leaderboard-preview i:nth-child(2) { height: 72%; border-color: var(--gold); }
  .leaderboard-preview i:nth-child(3) { height: 58%; border-color: var(--ember); }
  .leaderboard-preview i:nth-child(4) { height: 30%; }
  .map-preview { background: radial-gradient(circle at 50% 45%, #283b2f 0 9%, transparent 10%), radial-gradient(circle at 37% 60%, #26382e 0 16%, transparent 17%), #101714; }
  .map-preview::before, .map-preview::after { content: ""; position: absolute; inset: 20%; border: 1px solid rgba(244, 191, 85, .3); border-radius: 45% 55% 65% 35%; transform: rotate(18deg); }
  .map-preview::after { inset: 36%; border-color: var(--ember); }
  .map-preview i { position: absolute; width: .55rem; height: .55rem; border-radius: 50%; background: var(--gold); box-shadow: 0 0 1rem var(--gold); }
  .map-preview i:nth-child(1) { left: 34%; top: 42%; }.map-preview i:nth-child(2) { left: 62%; top: 55%; }.map-preview i:nth-child(3) { left: 51%; top: 27%; }
  .merch-preview { display: flex; align-items: center; justify-content: center; gap: 1rem; }
  .merch-preview i { display: block; width: 72px; height: 92px; background: #26302b; clip-path: polygon(21% 0, 38% 12%, 62% 12%, 79% 0, 100% 22%, 82% 39%, 76% 30%, 76% 100%, 24% 100%, 24% 30%, 18% 39%, 0 22%); }
  .merch-preview i:nth-child(2) { width: 82px; height: 106px; background: var(--ember); }
  .merch-preview i:nth-child(3) { background: #b09b71; }

  .discord-band { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: clamp(3rem, 7vw, 6rem) max(1.5rem, calc((100vw - var(--max)) / 2)); background: var(--ember); }
  .discord-band .section-index { color: #38150c; }
  .discord-band h2 { max-width: 800px; color: #140b08; }
  .site-footer { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 2rem; width: min(calc(100% - 3rem), var(--max)); margin: auto; padding: 2rem 0; color: var(--muted); font-size: .72rem; }

  @keyframes pulse { 50% { opacity: .55; } }
}

@layer responsive {
  @media (max-width: 980px) {
    .site-header { grid-template-columns: 1fr auto; }
    .nav-links { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; padding-top: .8rem; border-top: 1px solid var(--line); }
    .hero-content { grid-template-columns: 1fr; padding-top: 11.5rem; }
    .command-panel { max-width: 660px; }
    .intel-grid { grid-template-columns: repeat(2, 1fr); }
    .join-section { grid-template-columns: 1fr; }
    .join-terminal { max-width: 680px; }
    .roadmap-grid { grid-template-columns: 1fr; }
    .roadmap-card { display: grid; grid-template-columns: minmax(220px, .7fr) 1fr; grid-template-rows: auto auto 1fr; }
    .roadmap-visual { grid-row: 1 / 4; height: 100%; min-height: 240px; border-right: 1px solid var(--line); border-bottom: 0; }
    .discord-band { align-items: flex-start; flex-direction: column; }
    .site-footer { grid-template-columns: 1fr 1fr; }
    .site-footer p:last-child { grid-column: 1 / -1; }
  }

  @media (max-width: 660px) {
    html { scroll-padding-top: 6rem; }
    h1 { font-size: clamp(3.3rem, 17vw, 5rem); }
    h2 { font-size: clamp(2.5rem, 12vw, 4rem); }
    .site-header { width: calc(100% - 2rem); gap: .8rem; }
    .site-header .brand span { max-width: 7rem; line-height: 1.1; }
    .nav-discord { font-size: .68rem; }
    .nav-links { gap: 1.2rem; justify-content: flex-start; overflow-x: auto; padding-bottom: .4rem; scrollbar-width: none; }
    .nav-links::-webkit-scrollbar { display: none; }
    .hero { min-height: auto; }
    .hero-art { object-position: 62% center; }
    .hero-scrim { background: linear-gradient(0deg, var(--ink) 0%, rgba(5, 8, 7, .82) 48%, rgba(5, 8, 7, .7) 100%); }
    .hero-content { width: calc(100% - 2rem); padding: 10.5rem 0 5rem; }
    .hero-lede { font-size: .98rem; }
    .hero-actions .button { flex: 1; min-width: 9.5rem; }
    .scroll-cue { display: none; }
    .section { width: calc(100% - 2rem); padding: 5rem 0; }
    .intel-grid, .rules-grid { grid-template-columns: 1fr; }
    .intel-card { min-height: 250px; }
    .card-icon { margin-bottom: 3rem; }
    .join-section { gap: 3rem; }
    .countdown b { font-size: 1rem; }
    .roadmap-card { display: block; }
    .roadmap-visual { height: 180px; min-height: 0; border-right: 0; border-bottom: 1px solid var(--line); }
    .roadmap-card p { min-height: 0; }
    .discord-band { padding-inline: 1rem; }
    .site-footer { width: calc(100% - 2rem); grid-template-columns: 1fr; gap: 1rem; }
    .site-footer p:last-child { grid-column: auto; }
  }

  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  }

  @media (prefers-contrast: more) {
    :root { --line: rgba(255, 255, 255, .42); --line-strong: rgba(255, 255, 255, .72); --muted: #d3d8d2; }
  }
}
