/* Moonfall — styles
   Six colour roles, one accent hue (corruption crimson), two faces. */

:root {
  --canvas:     #0C0D1F;   /* deep space, indigo-black */
  --surface:    #17182F;
  --ink:        #E6E9EE;   /* cold silver-bone */
  --ink-soft:   #ABADCC;
  --accent:     #C8243F;   /* corruption crimson (UI stop) */
  --accent-hi:  #FF5C74;   /* same hue, light stop: focus rings, hover */
  --accent-ink: #FFF1F3;
  --ph:         #F2C14E;   /* placeholder marker. Delete .ph / .slot rules when real content is in. */

  --font-display: "Archivo", system-ui, sans-serif;
  --font-text:    "Geist", system-ui, sans-serif;

  --gutter: clamp(20px, 4vw, 56px);
  --map-w: 132px;
  --radius: 2px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);

  --t-hero: clamp(3.4rem, 10.5vw, 9.5rem);
  --t-story: clamp(1.6rem, 3.1vw, 2.9rem);
  --t-h2: clamp(1.7rem, 2.6vw, 2.4rem);
  --t-body: 1.0625rem;
  --t-small: 0.875rem;

  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--canvas); scrollbar-color: #3A4458 var(--canvas); }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--t-body);
  line-height: 1.62;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--accent-hi);
}
::selection { background: var(--accent); color: var(--accent-ink); }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 3px; border-radius: var(--radius); }
h1, h2, h3, p { margin: 0; }

/* ---------- world ---------- */
#world {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh; height: 100lvh;
  display: block; z-index: 0;
}
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.spacer { position: relative; z-index: -1; width: 1px; height: 1200vh; pointer-events: none; }

/* ---------- bar ---------- */
.bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px var(--gutter);
  pointer-events: none;
}
.bar > * { pointer-events: auto; }
.bar__mark {
  font-family: var(--font-display);
  font-weight: 800; font-stretch: 125%;
  font-size: 1.05rem; letter-spacing: 0.02em;
  text-decoration: none;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 20px;
  font: 600 0.95rem/1 var(--font-text); letter-spacing: 0.01em;
  white-space: nowrap; text-decoration: none; cursor: pointer;
  border-radius: var(--radius); border: 1px solid transparent;
  transition: background-color 160ms var(--ease-out), border-color 160ms var(--ease-out),
              color 160ms var(--ease-out), transform 120ms var(--ease-out);
}
.btn:active { transform: translateY(1px) scale(0.98); }
.btn--primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 20px -8px rgba(200, 36, 63, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.14); }
.btn--ghost { background: rgba(12, 13, 31, 0.35); color: var(--ink); border-color: rgba(171, 173, 204, 0.55); }
@media (hover: hover) and (pointer: fine) {
  .btn--primary:hover { background: #DA2E4A; }
  .btn--ghost:hover { border-color: var(--ink); background: rgba(230, 233, 238, 0.06); }
}
.btn--big { min-height: 56px; padding: 0 30px; font-size: 1.05rem; }
/* Link not set yet (see LINKS in moonfall.js): keeps full styling, gains the placeholder outline */
.btn[aria-disabled="true"] { outline: 1px dashed var(--ph); outline-offset: 3px; }

/* ---------- map (waypoint nav) ---------- */
.map {
  position: fixed; z-index: 15;
  left: var(--gutter); top: 50%; transform: translateY(-50%);
  width: var(--map-w);
}
.map__list { list-style: none; margin: 0; padding: 0 0 0 18px; display: grid; gap: 6px; }
.map__list button {
  all: unset; box-sizing: border-box; cursor: pointer;
  display: block; padding: 3px 0;
  font: 500 0.78rem/1.3 var(--font-text); letter-spacing: 0.04em;
  color: rgba(171, 173, 204, 0.55);
  transition: color 160ms var(--ease-out);
}
.map__list button[aria-current="step"] { color: var(--ink); }
.map__list button:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .map__list button:hover { color: var(--ink); } }
.map__line { position: absolute; left: 0; top: 6px; bottom: 6px; width: 1px; background: rgba(171, 173, 204, 0.25); }
.map__head {
  position: absolute; left: -3px; top: 0; width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink); top: calc(var(--map-p, 0) * 100% - 3px);
}

/* ---------- copy layer ---------- */
.copy { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.block, .scrim, .foot { position: absolute; opacity: 0; visibility: hidden; will-change: opacity, transform; }
.block.is-live { pointer-events: auto; }

.scrim { inset: 0; pointer-events: none; }
.scrim--lead      { background: radial-gradient(ellipse 60% 70% at 12% 55%, rgba(12,13,31,.78), rgba(12,13,31,0) 70%); }
.scrim--lead-low  { background: radial-gradient(ellipse 60% 55% at 10% 85%, rgba(12,13,31,.8), rgba(12,13,31,0) 72%); }
.scrim--lead-top  { background: radial-gradient(ellipse 55% 55% at 8% 22%, rgba(12,13,31,.8), rgba(12,13,31,0) 72%); }
.scrim--band      { background: linear-gradient(to top, rgba(12,13,31,.92) 0%, rgba(12,13,31,.75) 34%, rgba(12,13,31,0) 64%); }
.scrim--trail     { background: radial-gradient(ellipse 55% 50% at 88% 80%, rgba(12,13,31,.72), rgba(12,13,31,0) 72%); }
.scrim--full      { background: rgba(12, 13, 31, 0.8); }

.left-col { left: calc(var(--gutter) + var(--map-w) + 24px); }

.block--hero {
  left: calc(var(--gutter) + var(--map-w) + 24px); top: 50%;
  margin-top: -8rem; max-width: 40rem;
}
.hero__title {
  font-family: var(--font-display); font-weight: 800; font-stretch: 125%;
  font-size: var(--t-hero); line-height: 0.92; letter-spacing: -0.035em;
  margin-left: -0.04em;
}
.hero__line { margin-top: 20px; font-size: 1.2rem; color: var(--ink); max-width: 30ch; }
.hero__actions { margin-top: 32px; display: flex; gap: 12px; }

.story {
  font-family: var(--font-display); font-weight: 600; font-stretch: 112%;
  font-size: var(--t-story); line-height: 1.08; letter-spacing: -0.02em;
  text-wrap: balance; max-width: 18ch;
}
.block--approach { left: calc(var(--gutter) + var(--map-w) + 24px); bottom: 14vh; }
.block--fracture { left: calc(var(--gutter) + var(--map-w) + 24px); right: var(--gutter); bottom: 10vh; }
.block--fracture .story { max-width: 24ch; }
.story--second { margin-top: 28px; }
[data-beat] { opacity: 0; }

.h2 {
  font-family: var(--font-display); font-weight: 700; font-stretch: 118%;
  font-size: var(--t-h2); line-height: 1.02; letter-spacing: -0.02em;
  text-wrap: balance;
}
.body { margin-top: 12px; color: var(--ink-soft); max-width: 44ch; text-wrap: pretty; }

.block--bob { left: calc(var(--gutter) + var(--map-w) + 24px); top: 17vh; max-width: 26rem; }
.block--bob .h2 { font-size: clamp(2.4rem, 4.6vw, 4.4rem); }

/* Glimpse: text column + trailer, shots under the trailer */
.block--glimpse {
  left: calc(var(--gutter) + var(--map-w) + 24px); right: var(--gutter);
  top: 50%; margin-top: min(-15rem, -30vh);
  display: grid; gap: 20px 40px;
  grid-template-columns: minmax(14rem, 0.8fr) 2fr;
  grid-template-areas: "text trailer" "text shots";
  align-items: start;
}
.glimpse__text { grid-area: text; padding-top: 4px; }
.media--trailer { grid-area: trailer; aspect-ratio: 16 / 9; }
.shots { grid-area: shots; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.shots .media { aspect-ratio: 16 / 9; }
.media { position: relative; background: rgba(23, 24, 47, 0.7); border-radius: var(--radius); overflow: hidden; }
.media iframe, .media img { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover; }

/* Signal: devlog + community */
.block--signal {
  left: calc(var(--gutter) + var(--map-w) + 24px); right: var(--gutter);
  top: 50%; margin-top: min(-14rem, -28vh);
  display: grid; grid-template-columns: 1.25fr 1fr; gap: 40px 64px; align-items: start;
}
.devlog__list { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 4px; }
.post { padding: 14px 0; border-top: 1px solid rgba(171, 173, 204, 0.2); }
.post time { font-size: var(--t-small); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.post__title { margin-top: 2px; font: 600 1.1rem/1.3 var(--font-text); }
.post__sum { color: var(--ink-soft); font-size: 0.95rem; }
.community .btn { margin-top: 20px; }
.news { margin-top: 36px; max-width: 28rem; }
.news__label { display: block; font-weight: 600; margin-bottom: 8px; }
.news__row { display: flex; gap: 8px; }
.news__input {
  flex: 1; min-width: 0; min-height: 44px; padding: 0 14px;
  font: inherit; color: var(--ink);
  background: rgba(12, 13, 31, 0.6); border: 1px solid rgba(171, 173, 204, 0.45); border-radius: var(--radius);
  transition: border-color 160ms var(--ease-out);
}
.news__input::placeholder { color: rgba(171, 173, 204, 0.6); }
.news__input:focus-visible { border-color: var(--accent-hi); outline-offset: 2px; }
.news__status { min-height: 1.6em; margin-top: 8px; font-size: var(--t-small); color: var(--ink-soft); }

/* Landfall: trail anchor, quiet */
.block--landfall {
  right: var(--gutter); bottom: 14vh;
  max-width: 28rem; text-align: right;
  display: flex; flex-direction: column; align-items: flex-end;
}
.landfall__line {
  font-family: var(--font-display); font-weight: 600; font-stretch: 112%;
  font-size: clamp(1.5rem, 2.6vw, 2.4rem); line-height: 1.1; letter-spacing: -0.02em;
  text-wrap: balance; margin-bottom: 28px;
}
.foot { left: 0; right: 0; bottom: 0; padding: 16px var(--gutter); text-align: center; }
.foot p { font-size: 0.78rem; color: var(--ink-soft); }

/* ---------- placeholders (delete when real content lands) ---------- */
.ph { outline: 1px dashed var(--ph); outline-offset: 6px; }
.ph::before {
  content: "Placeholder"; display: block; width: max-content;
  font: 600 0.68rem/1 var(--font-text); letter-spacing: 0.04em;
  color: #1A1405; background: var(--ph); padding: 3px 6px; margin-bottom: 8px; border-radius: var(--radius);
}
.post.ph::before, .hero__line.ph::before { display: none; }
p.ph, .story.ph { color: var(--ink); }
.slot { border: 1px dashed var(--ph); display: grid; place-items: center; }
.slot__tag { font-size: 0.8rem; color: var(--ph); text-align: center; padding: 8px; }

/* ---------- phone ---------- */
@media (max-width: 760px) {
  :root { --map-w: 0px; --t-hero: clamp(3rem, 16vw, 4.6rem); --t-story: 1.55rem; --t-h2: 1.5rem; --t-body: 1rem; }
  .bar { padding: 14px var(--gutter); }
  .bar__cta { min-height: 40px; padding: 0 14px; font-size: 0.85rem; }

  .map { left: 0; right: 0; top: 64px; transform: none; width: auto; padding: 0 var(--gutter); }
  .map__line { display: none; }
  .map__list { display: flex; gap: 6px; padding: 0; }
  .map__list li { flex: 1; }
  .map__list button { width: 100%; height: 14px; padding: 0; font-size: 0; position: relative; }
  .map__list button::after { content: ""; position: absolute; left: 0; right: 0; top: 6px; height: 2px; background: rgba(171, 173, 204, 0.3); border-radius: 1px; }
  .map__list button[aria-current="step"]::after { background: var(--ink); }
  .map__list button.is-past::after { background: rgba(230, 233, 238, 0.6); }

  .block { left: var(--gutter) !important; right: var(--gutter) !important; max-width: none; }
  .block--hero { top: auto; bottom: 9vh; margin-top: 0; }
  .block--approach { bottom: 9vh; }
  .block--fracture { bottom: 8vh; }
  .block--bob { top: auto; bottom: 4vh; }
  .block--bob .h2 { font-size: 2.2rem; }
  .block--bob .body { margin-top: 6px; }
  .scrim--lead, .scrim--lead-low, .scrim--lead-top, .scrim--trail { background: linear-gradient(to top, rgba(12,13,31,.9) 0%, rgba(12,13,31,.6) 30%, rgba(12,13,31,0) 52%); }

  .block--glimpse, .block--signal {
    top: 96px; bottom: 16px; margin-top: 0; overflow-y: auto; overscroll-behavior: contain;
    display: flex; flex-direction: column; align-items: stretch; gap: 16px;
  }
  .block--signal { gap: 28px; }
  .shots { gap: 8px; }
  .news { margin-top: 24px; }
  .post { padding: 10px 0; }

  .block--landfall { top: 33vh; bottom: auto; margin-top: 0; text-align: left; align-items: flex-start; }
  .landfall__line { margin-bottom: 20px; }
  .foot { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
}
