/*
 * Simam Spaces — portal styles.
 *
 * The hub borrows the grammar of the app our creators are leaving: one dark
 * ground (#171717), one typeface in heavy weights, a full-bleed hero, rows of
 * 16:9 cards that scroll sideways, and pill buttons in a single bright blue.
 * The grammar is borrowed; the brand is not — the name, mark and words are
 * ours, and nothing here should be mistaken for anyone else's product.
 *
 * Dark only, on purpose. Every colour is a token on :root and nothing reads
 * `prefers-color-scheme`. The one exception is the roadmap's "paper" surface
 * at the bottom of this file: a long document is read, not browsed, and it
 * redefines the same tokens rather than restyling anything.
 */

:root {
  --void:        #171717;  /* the page */
  --surface:     #212121;  /* cards, fields, panels */
  --surface-2:   #2c2c2c;
  --ink:         #ffffff;
  --ink-2:       rgba(255, 255, 255, 0.78);
  --ink-3:       rgba(255, 255, 255, 0.6);   /* 6.1:1 on --void */
  --line:        rgba(255, 255, 255, 0.14);
  --line-soft:   rgba(255, 255, 255, 0.07);
  --pill-line:   rgba(255, 255, 255, 0.2);

  --accent:       #0077ff;  /* buttons: white text on it is 4.6:1 */
  --accent-hover: #2b8dff;
  /* #0077ff on #171717 is ~4.0:1 — fine for a button fill, short of the 4.5:1
     that small text needs. Text and hairlines in the accent use this. */
  --accent-text:  #5aa9ff;
  --warn:         #f0b44c;
  --good:         #6fd08c;
  --bad:          #ff7a6b;
  --live:         #ff3b5c;

  --font: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --gutter: clamp(16px, 4vw, 56px);
  --head: 64px;
  --radius: 8px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: var(--void); }

body {
  margin: 0;
  background: var(--void);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Rails scroll sideways; the page never does. */
  overflow-x: clip;
}

img, video { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
  border-radius: 4px;
}

.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;
}

/* ---------- shared type ---------- */

.eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-text);
}

h1, h2 {
  font-family: var(--font);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0;
  text-wrap: balance;
}

h1 em, h2 em { font-style: normal; color: var(--ink-2); }

.lede {
  font-size: clamp(1rem, 1.4vw, 1.125rem);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 46ch;
  margin: 1rem 0 0;
}

.note { margin: 1rem 0 0; font-size: 0.875rem; color: var(--ink-3); }
.dim { color: var(--ink-3); }
.small { font-size: 0.8125rem; }

code {
  font-family: var(--mono);
  font-size: 0.9em;
  color: var(--ink);
}

/* ---------- masthead ---------- */

/*
 * Sticky, and see-through over the hub's hero: on the hub the header pulls the
 * hero up underneath itself, so the first thing on screen is a world rather
 * than a bar. Where the browser supports scroll-driven animation it firms up
 * into a solid bar as the page scrolls; elsewhere a top-down fade keeps it
 * legible over whatever passes beneath.
 */
.masthead {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--head);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 var(--gutter);
  background: rgba(23, 23, 23, 0.94);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.hub .masthead {
  margin-bottom: calc(-1 * var(--head));
  background: linear-gradient(to bottom, rgba(23, 23, 23, 0.85), rgba(23, 23, 23, 0));
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

@supports (animation-timeline: scroll()) {
  .hub .masthead {
    animation: masthead-firm linear both;
    animation-timeline: scroll(root);
    animation-range: 0 40vh;
  }
  @keyframes masthead-firm {
    to { background-color: rgba(23, 23, 23, 0.96); }
  }
}

.wordmark { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }

/* Our own mark: an aperture ring, drawn in CSS so it costs no request. */
.wordmark-mark {
  flex: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  box-shadow: inset 0 0 0 3px var(--void), inset 0 0 0 7px var(--accent);
}

.wordmark-text {
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.nav { display: flex; align-items: center; gap: 0.5rem; }

.nav-link {
  padding: 0.5rem 0.9rem;
  border-radius: 100px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink-2);
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.nav-link:hover, .nav-link[aria-current="page"] { color: var(--ink); background: rgba(255, 255, 255, 0.08); }
.nav .btn { margin-left: 0.5rem; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 44px;
  padding: 0 40px;
  /* A <button> brings its own UA background and font; neutralised here, not in
     a `button.btn` rule, which would out-specify `.btn-primary`. */
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid var(--pill-line);
  border-radius: 100px;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.36); }

.btn-small { height: 36px; padding: 0 20px; font-size: 0.875rem; }
.btn-large { height: 48px; padding: 0 44px; font-size: 1rem; }

/* A button that is a sentence, not a call to action. */
.linkish {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--accent-text);
  cursor: pointer;
  white-space: nowrap;
}
.linkish:hover { color: var(--ink); }

/* ---------- hub: hero ---------- */

.spotlight {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  height: 65vh;
  min-height: 440px;
  max-height: 780px;
  background: var(--surface);
}

.spot-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.9s var(--ease), visibility 0s linear 0.9s;
}
.spot-slide.is-active {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.9s var(--ease), visibility 0s;
}

/* The words swap faster than the picture, so two titles never overlap mid-fade. */
.spot-copy { transition: opacity 0.35s var(--ease); }
.spot-slide:not(.is-active) .spot-copy { opacity: 0; }

.spot-bg { position: absolute; inset: 0; z-index: -2; }
.spot-bg img { width: 100%; height: 100%; object-fit: cover; }

/* Darkest at the bottom-left where the words are, and fading into the page at
   the bottom edge so the first row reads as part of the same surface. */
.spot-scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to top, var(--void) 0%, rgba(23, 23, 23, 0) 32%),
    linear-gradient(35deg, rgba(23, 23, 23, 0.92) 0%, rgba(23, 23, 23, 0.55) 38%, rgba(23, 23, 23, 0) 72%);
}

.spot-copy {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: clamp(2rem, 7vh, 4rem);
  max-width: 40rem;
}

.spot-kicker {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--ink-2);
}

.spot-title {
  margin: 0;
  font-size: clamp(2rem, 4.2vw, 3rem);
  font-weight: 900;
  line-height: 1.04;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.spot-desc {
  margin: 0.75rem 0 0;
  max-width: 36rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.spot-actions { margin: 1.5rem 0 0; }

/* Our own pitch is two sentences and both are the point; do not clip it. */
.spotlight-pitch .spot-desc { display: block; overflow: visible; }

.spot-dots {
  position: absolute;
  right: var(--gutter);
  bottom: clamp(2.4rem, 7.5vh, 4.4rem);
  display: flex;
  gap: 6px;
}
.spot-dot {
  width: 8px; height: 8px;
  padding: 0;
  border: 0;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: width 0.3s var(--ease), background-color 0.3s var(--ease);
}
.spot-dot[aria-current="true"] { width: 22px; background: var(--ink); }

/* The pitch, when nothing is featured: our own gradient, not a world's. */
.cover-pitch {
  background:
    radial-gradient(70% 90% at 80% 20%, rgba(0, 119, 255, 0.55) 0%, transparent 60%),
    radial-gradient(60% 80% at 20% 90%, rgba(130, 60, 255, 0.35) 0%, transparent 60%),
    linear-gradient(160deg, #1d2433 0%, var(--void) 70%);
}

/* ---------- generated covers ---------- */

/*
 * Two hues from a hash of the slug (see `coverHues` in pages.js), a soft light
 * in one corner, and the world's name set large. It sizes its type to its own
 * width, so the same cover works on a 160px phone card and a full hero.
 */
.cover {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 7% 8%;
  container-type: inline-size;
  /* OKLCH so every hue lands at the same perceived brightness — in HSL a
     yellow at 40% lightness is olive and a blue is navy. */
  background-color: var(--surface-2);
  background-image:
    radial-gradient(90% 120% at 100% 0%, oklch(0.74 0.16 var(--h2, 250) / 0.9) 0%, transparent 60%),
    radial-gradient(80% 100% at 0% 100%, oklch(0.26 0.09 var(--h1, 290) / 0.95) 0%, transparent 70%),
    linear-gradient(135deg, oklch(0.52 0.17 var(--h1, 290)) 0%, oklch(0.42 0.15 var(--h2, 250)) 100%);
  transition: transform 0.5s var(--ease);
}

.cover-name {
  font-size: clamp(1rem, 11cqi, 4rem);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: #fff;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.25);
  text-wrap: balance;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- hub: rows ---------- */

main { display: block; }

.row { padding: 0 var(--gutter); margin-top: clamp(1.75rem, 4vw, 2.75rem); }
.spotlight + .row { margin-top: 0.5rem; }

.row-head {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0 0 0.75rem;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.row-head .chev { flex: none; width: 20px; height: 20px; color: var(--ink-3); }

.row .note { margin-top: 0; }

/*
 * A rail: one line of cards that scrolls sideways and snaps. It bleeds to the
 * edges of the viewport (the negative margin undoes the row's gutter) so a
 * card cut off at the right says "there is more", which is the whole cue.
 * About 4.5 cards on a desktop, 2.5 on a tablet, 1.6 on a phone.
 */
.rail {
  --gap: 16px;
  --per: 4.5;
  list-style: none;
  margin: 0 calc(-1 * var(--gutter));
  padding: 0 var(--gutter) 6px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - (var(--per) - 0.5) * var(--gap)) / var(--per));
  gap: var(--gap);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail > .card { scroll-snap-align: start; min-width: 0; }

@media (max-width: 1024px) { .rail { --per: 2.5; } }
@media (max-width: 600px)  { .rail { --gap: 12px; --per: 1.6; } }

.row-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.row-bar .row-head { margin: 0; }

.worlds { padding-bottom: clamp(3rem, 8vh, 5rem); }

/* ---------- search ---------- */

.search { display: flex; gap: 0.5rem; align-items: center; min-width: 0; }

.search input {
  height: 36px;
  min-width: 0;
  width: 16rem;
  max-width: 100%;
  padding: 0 1rem;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 100px;
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
  transition: border-color 0.2s var(--ease);
}
.search input::placeholder { color: var(--ink-3); }
.search input:hover { border-color: var(--line); }
.search input:focus { border-color: var(--accent); outline: none; }

/* ---------- cards ---------- */

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  gap: 24px 16px;
}

.card a { display: flex; flex-direction: column; min-width: 0; }

.thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
}

.thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}

.card a:hover .thumb img, .card a:hover .cover { transform: scale(1.04); }

.card-name {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-mark {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--live);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
}

/* ---------- empty and message pages ---------- */

.page { padding: 0 var(--gutter) 6rem; }

.empty {
  border-radius: 12px;
  background: var(--surface);
  padding: clamp(2.5rem, 7vw, 4.5rem) clamp(1.25rem, 5vw, 3.5rem);
  text-align: center;
}

.empty.tall { margin: 4rem auto 0; max-width: 44rem; }

.empty-title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.empty-line {
  margin: 0.5rem auto 0;
  max-width: 44ch;
  color: var(--ink-2);
  font-size: 0.9375rem;
}

.empty-line a:not(.btn) { color: var(--accent-text); font-weight: 600; }
.empty-line .btn { margin-top: 1.25rem; }

/* ---------- waking (a ready world with a sleeping container) ---------- */

/* Hidden until the inline script decides the wait is long enough to say
   something about, so a warm world shows only the heading before it jumps. */
.waking-slow, .waking-long { margin-top: 1rem; }
.waking-long .btn { margin: 1rem 0.3rem 0; }

.waking-bar {
  width: 12rem;
  max-width: 60%;
  height: 4px;
  margin: 1.75rem auto 0;
  border-radius: 100px;
  background: var(--line);
  overflow: hidden;
}
.waking-bar span {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: 100px;
  background: var(--accent);
  animation: waking-sweep 1.4s ease-in-out infinite;
}
@keyframes waking-sweep {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* ---------- world page ---------- */

.world {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
  padding-top: clamp(1.5rem, 5vh, 3rem);
}

.world-media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  background: var(--surface);
}
.world-media img { width: 100%; height: 100%; object-fit: cover; }

.world h1 { font-size: clamp(2rem, 4.5vw, 3rem); }
.world .btn { margin-top: 1.75rem; }

/* ---------- footer ---------- */

.foot {
  margin-top: 2rem;
  border-top: 1px solid var(--line-soft);
  padding: 2rem var(--gutter) 3rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 2rem;
  justify-content: space-between;
}
.foot-line { margin: 0; font-size: 0.875rem; color: var(--ink-2); }
.foot-dim { color: var(--ink-3); }
.foot a { font-weight: 600; color: var(--ink); }
.foot a:hover { color: var(--accent-text); }

/* ---------- Create world: the panel over the hub ---------- */

.create {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow-y: auto;
  background: var(--void);
}
.create[hidden] { display: none; }
.create-inner { max-width: 72rem; margin: 0 auto; padding: 1.25rem var(--gutter) 4rem; }
.create-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--line-soft);
}
.create-head h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
body.creating { overflow: hidden; }

/*
 * The stage: one rectangle that holds the hero media until a package is
 * dropped on it, and then the visitor's own world in the same place. The
 * before and after are the same shape in the same spot — that substitution is
 * the pitch, and it only reads if nothing moves.
 */
.hero-stage {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  /* Full width, with a height that tracks the width but is capped: 16:10
     across the panel is ~720px on a laptop, which puts Create below the fold,
     and an aspect-ratio fighting a max-height shrinks the width instead. A
     floor keeps a phone's stage a real preview, not a letterbox. The canvas
     fills whatever box it is given. */
  width: 100%;
  height: clamp(320px, 56vw, min(62vh, 36rem));
  margin: 1.25rem 0;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 0.2s var(--ease);
}
.hero-stage.over { border-color: var(--accent); }

.hero-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}

/* Until the hero video is recorded, a still gradient rather than a broken
   <video> or a grey box. */
.hero-fallback {
  background:
    radial-gradient(120% 90% at 18% 8%, rgba(0, 119, 255, 0.28) 0%, transparent 55%),
    radial-gradient(100% 80% at 88% 92%, rgba(130, 60, 255, 0.22) 0%, transparent 60%),
    linear-gradient(168deg, #1f1f22 0%, var(--void) 62%);
}

.hero-scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to top, rgba(23, 23, 23, 0.72) 0%, rgba(23, 23, 23, 0.28) 55%, rgba(23, 23, 23, 0.1) 100%);
}

.stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #0f1216;
  touch-action: none;
  cursor: grab;
}
.stage:active { cursor: grabbing; }
.stage[hidden] { display: none; }

/* Reads over the hero media before a world is mounted and over the world
   after, so it brings its own ground. */
.stage-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 2;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.9rem;
  background: linear-gradient(to top, rgba(23, 23, 23, 0.9), rgba(23, 23, 23, 0));
  font-size: 0.8125rem;
  color: var(--ink-2);
}
.stage-status { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.hero-demo { margin: 1.25rem 0 0; font-size: 0.875rem; color: var(--ink-3); }

/* Fills the stage it sits in, so the world that replaces it lands in exactly
   the rectangle the invitation occupied. */
.drop {
  position: absolute;
  inset: 0.75rem;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  border: 2px dashed var(--pill-line);
  border-radius: 10px;
  background: rgba(23, 23, 23, 0.35);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.drop:hover, .drop:focus-visible, .hero-stage.over .drop {
  border-color: var(--accent);
  background: rgba(0, 119, 255, 0.08);
}
/* `display: flex` beats the `hidden` attribute's UA rule, and a drop zone
   painted over someone's world is the one thing this page cannot do. */
.drop[hidden] { display: none; }
.drop-main { margin: 0; font-size: 1.125rem; font-weight: 800; color: var(--ink); }
.drop-sub { margin: 0.6rem 0 0; max-width: 26rem; font-size: 0.875rem; color: var(--ink-3); }

/* The privacy claim: the loudest sentence in the panel after the world itself. */
.privacy {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  margin: 1.25rem 0 0;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  background: var(--surface);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--ink-2);
}
.privacy strong { color: var(--ink); font-weight: 700; }
.privacy a { color: var(--accent-text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.privacy-mark {
  flex: none;
  width: 8px; height: 8px;
  margin-top: 0.5rem;
  border-radius: 50%;
  background: var(--good);
}

/* ---------- preview and keep ---------- */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.section-head h2 { font-size: 18px; font-weight: 900; letter-spacing: -0.01em; }

.preview { padding: clamp(2rem, 6vh, 3.5rem) 0 0; }
.preview-file { margin: 0; font-size: 0.875rem; color: var(--ink-3); }
.preview-note { max-width: 60ch; margin: 0 0 1.5rem; }
.preview .stats { margin-top: 1.5rem; }

.keep {
  margin-top: clamp(2rem, 6vh, 3.5rem);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border-radius: 12px;
  background: var(--surface);
}
.keep-inner { max-width: 62rem; }
.keep h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); }
.keep-lede { margin: 0.75rem 0 0; max-width: 52ch; color: var(--ink-2); font-size: 1rem; line-height: 1.55; }
.keep .send-form { margin-top: 1.75rem; }
.keep-upload {
  margin: 1.25rem 0 0;
  max-width: 52ch;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--ink-2);
}
.keep-upload strong { color: var(--ink); font-weight: 700; }
.keep .field input { background: var(--void); }

.keep-progress { margin: 1rem 0 0; display: flex; align-items: center; gap: 0.75rem; }
.keep-progress progress {
  flex: 1 1 auto;
  min-width: 0;
  height: 0.4rem;
  accent-color: var(--accent);
  background: var(--surface-2);
  border: none;
}
.keep-progress span { flex: 0 0 auto; white-space: nowrap; }

.keep-panel { margin-top: 2rem; max-width: 30rem; }
.keep-stage { margin: 0 0 0.75rem; font-size: 0.9375rem; color: var(--ink-2); }
.keep-ready-lede { margin: 0 0 1.25rem; max-width: 48ch; color: var(--ink-2); font-size: 0.9375rem; line-height: 1.6; }
.keep-ready-lede strong { color: var(--ink); font-weight: 700; }
.mono-field { font-family: var(--mono); font-size: 0.8125rem; }
.keep-error { margin-top: 0.5rem; }
.keep-error .btn { margin-top: 0.75rem; }

/* The one place an error is shown: where the world would have been. */
.notice {
  margin: 0;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  background: var(--surface);
  border-left: 3px solid var(--line);
}
.notice-bad { border-left-color: var(--bad); }
.notice-title { margin: 0 0 0.4rem; color: var(--ink); font-weight: 700; }
.notice p { margin: 0; color: var(--ink-2); font-size: 0.9375rem; line-height: 1.6; }

.report-block { margin: 2.25rem 0 0; }

.h2, .h3 { font-family: var(--font); font-weight: 800; margin: 0 0 0.75rem; }
.h2 { font-size: 1.125rem; }
.h3 { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }

.verdict { padding: 1.25rem 1.5rem; border-radius: 10px; background: var(--surface); border-left: 3px solid var(--ink-3); }
.verdict-clean { border-left-color: var(--good); }
.verdict-partial { border-left-color: var(--warn); }
.verdict-blocked { border-left-color: var(--bad); }
.verdict-head { margin: 0; font-size: 1.25rem; font-weight: 800; line-height: 1.25; }
.verdict-detail { margin: 0.5rem 0 0; color: var(--ink-2); font-size: 0.9375rem; line-height: 1.6; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 8px;
  margin: 0;
}
.stat { background: var(--surface); border-radius: var(--radius); padding: 0.9rem 1rem; }
.stat dt { font-size: 0.75rem; font-weight: 600; color: var(--ink-3); }
.stat dd { margin: 0.3rem 0 0; font-size: 1.375rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat dd.small { font-size: 0.9375rem; font-weight: 500; color: var(--ink-2); }

.mono { font-family: var(--mono); font-size: 0.875rem; word-break: break-all; }

/* Wide content scrolls inside itself; the page never scrolls sideways. */
.tablewrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.table th, .table td { text-align: left; padding: 0.65rem 1rem 0.65rem 0; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table th { font-size: 0.75rem; font-weight: 700; color: var(--ink-3); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; padding-right: 1.5rem; }

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge-full { color: var(--good); border-color: rgba(111, 208, 140, 0.4); }
.badge-partial { color: var(--warn); border-color: rgba(240, 180, 76, 0.4); }
.badge-none { color: var(--bad); border-color: rgba(255, 122, 107, 0.4); }

.warnings { margin: 0; padding: 0; list-style: none; }
.warnings li {
  padding: 0.5rem 0 0.5rem 1rem;
  border-left: 3px solid rgba(240, 180, 76, 0.5);
  margin-bottom: 0.75rem;
  color: var(--ink-2);
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* ---------- forms ---------- */

.send-form { margin: 1.5rem 0 0; max-width: 30rem; }
.field { display: block; margin-bottom: 1rem; }
.field span { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--ink-2); margin-bottom: 0.4rem; }
.field input {
  width: 100%;
  height: 44px;
  padding: 0 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
}
.field input:hover { border-color: rgba(255, 255, 255, 0.3); }
.field input:focus { border-color: var(--accent); outline: none; }
.field input::placeholder { color: var(--ink-3); }
.field input:disabled { opacity: 0.5; }
.send-status { margin: 0.9rem 0 0; font-size: 0.875rem; min-height: 1.2rem; }
.send-status.ok { color: var(--good); }
.send-status.bad { color: var(--bad); }

/* ---------- the shared roadmap ---------- */

/*
 * A working document, on the same ground as everything else. One column at
 * every width; the measure is held by `max-width` on the text.
 *
 * Status is carried by a word first and a colour second — the badge says
 * "Working now" in words and its colour only reinforces it.
 */

.gate-page { display: grid; place-items: center; min-height: 62vh; }

.gate {
  width: 100%;
  max-width: 30rem;
  margin-top: clamp(2rem, 8vh, 5rem);
  padding: clamp(1.5rem, 5vw, 2.5rem);
  border-radius: 12px;
  background: var(--surface);
}
.gate h1 { font-size: clamp(1.75rem, 5vw, 2.25rem); }
.gate .lede { font-size: 1rem; margin-top: 1rem; }
.gate-form { margin-top: 1.75rem; }
.gate-form .btn { width: 100%; }

.roadmap { padding-top: clamp(1.5rem, 5vh, 3rem); max-width: 62rem; margin: 0 auto; }

.road-head { padding-bottom: clamp(1.5rem, 5vh, 3rem); }
.road-head h1 { font-size: clamp(2rem, 5.5vw, 3.25rem); }
.road-head .privacy { max-width: 58ch; }

/* Sticky on a phone, where the four groups are a long way apart. It sits
   under the sticky masthead rather than behind it. */
.road-jump {
  position: sticky;
  top: var(--head);
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.75rem;
  padding: 0.75rem 0;
  background: var(--void);
}
.road-jump a {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 100px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-2);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.road-jump a:hover { color: var(--ink); border-color: var(--ink-3); }

.road-count {
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent-text);
}
.section-head .road-count { vertical-align: super; }

.road-group { padding-top: clamp(2rem, 6vh, 3.5rem); }
.road-group .section-head { margin-bottom: 0; }
.road-group .section-head h2 { font-size: clamp(1.375rem, 3vw, 1.75rem); }
.road-blurb { margin: 0; max-width: 46ch; font-size: 0.875rem; line-height: 1.6; color: var(--ink-3); }

.road-empty {
  margin: 1.5rem 0 0;
  padding: 1.25rem 1.5rem;
  max-width: 60ch;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--ink-2);
  font-size: 0.9375rem;
  line-height: 1.65;
}

.road-list { list-style: none; margin: 0; padding: 0; }

.road-item {
  padding: 1.75rem 0 1.5rem;
  border-bottom: 1px solid var(--line-soft);
  /* An item linked to directly must not land under the two sticky bars. */
  scroll-margin-top: calc(var(--head) + 4rem);
}
.road-item:target { border-left: 3px solid var(--accent); padding-left: 1.25rem; }

.road-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.road-title { font-weight: 800; font-size: clamp(1.25rem, 2.6vw, 1.5rem); line-height: 1.2; margin: 0; letter-spacing: -0.01em; }

.badge-shipped { color: var(--good); border-color: rgba(111, 208, 140, 0.4); }
.badge-building { color: var(--accent-text); border-color: rgba(90, 169, 255, 0.45); }
.badge-next { color: var(--ink-2); border-color: var(--line); }
.badge-considering { color: var(--ink-3); border-color: var(--line-soft); }

.road-what { margin: 0.9rem 0 0; max-width: 62ch; font-size: 1.0625rem; line-height: 1.6; color: var(--ink); }
.road-why { margin: 0.75rem 0 0; max-width: 62ch; font-size: 0.9375rem; line-height: 1.65; color: var(--ink-2); }
.road-source { margin: 0.6rem 0 0; max-width: 62ch; font-size: 0.8125rem; line-height: 1.5; color: var(--ink-3); }

.road-notes { list-style: none; margin: 1.5rem 0 0; padding: 0; max-width: 62ch; }
.road-note {
  padding: 0.9rem 1rem 0.9rem 1.1rem;
  border-left: 3px solid rgba(90, 169, 255, 0.45);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 0.5rem;
  background: var(--surface);
}
.road-note-meta { margin: 0 0 0.35rem; font-size: 0.75rem; font-weight: 700; color: var(--ink-3); }
/* Line breaks she typed are line breaks she meant. */
.road-note-body { margin: 0; font-size: 0.9375rem; line-height: 1.6; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: break-word; }

.road-add { margin: 1.25rem 0 0; }
.road-add summary { cursor: pointer; font-size: 0.875rem; font-weight: 600; color: var(--accent-text); width: fit-content; }
.road-add summary:hover { color: var(--ink); }
.road-form { margin: 1.25rem 0 0; max-width: 34rem; }
.road-form textarea {
  width: 100%;
  padding: 0.7rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.55;
  resize: vertical;
}
.road-form textarea:hover { border-color: rgba(255, 255, 255, 0.3); }
.road-form textarea:focus { border-color: var(--accent); outline: none; }
.road-form textarea::placeholder { color: var(--ink-3); }

/* ---------------------------------------------------------------------------
   Paper — the roadmap's reading surface
   ---------------------------------------------------------------------------
   The hub is browsed and earns its dark ground. The roadmap is a long document
   somebody reads top to bottom and writes notes into, and light text on dark
   is tiring at that length. Only the tokens are redefined; every component
   above follows from them. The blue stays the blue.
--------------------------------------------------------------------------- */
.paper {
  --void:        #f6f6f4;
  --surface:     #ffffff;
  --surface-2:   #ececea;
  --ink:         #171717;
  --ink-2:       rgba(23, 23, 23, 0.76);
  --ink-3:       rgba(23, 23, 23, 0.6);
  --line:        rgba(23, 23, 23, 0.16);
  --line-soft:   rgba(23, 23, 23, 0.08);
  --pill-line:   rgba(23, 23, 23, 0.22);
  --accent-text: #0060d1;  /* #5aa9ff is 2.4:1 on paper */
  --good:        #22803f;
  --warn:        #9a6200;
  --bad:         #c0392b;
}
.paper .masthead { background: rgba(246, 246, 244, 0.94); }
.paper .nav-link:hover, .paper .nav-link[aria-current="page"] { background: rgba(23, 23, 23, 0.06); }
.paper .btn-ghost:hover { background: rgba(23, 23, 23, 0.05); border-color: rgba(23, 23, 23, 0.36); }
.paper .wordmark-mark { box-shadow: inset 0 0 0 3px var(--void), inset 0 0 0 7px var(--accent); }
.paper .road-item { padding: 2.25rem 0 2rem; }
.paper .road-what { line-height: 1.72; max-width: 58ch; }
.paper .road-why  { line-height: 1.72; max-width: 58ch; }
.paper .road-note { border-left-color: rgba(0, 96, 209, 0.4); }

/* ---------- responsive ---------- */

@media (max-width: 980px) {
  .world { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  :root { --head: 56px; }
  /* The Create pill is the one thing the header must keep on a phone. */
  .nav-link { display: none; }
  .nav .btn { margin-left: 0; }
  .wordmark-text { font-size: 1rem; }
  .spotlight { min-height: 420px; }
  .spot-copy { right: calc(var(--gutter) + 4rem); }
  .spot-actions .btn { width: auto; }
  .row-bar { align-items: stretch; flex-direction: column; }
  .search input { flex: 1 1 auto; width: auto; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; }
  .drop { inset: 0.5rem; padding: 1rem; }
  .drop-main { font-size: 1rem; }
  .stage-bar { flex-wrap: wrap; }
  /* iOS zooms a focused input whose text is under 16px, and the zoom does not
     come back — a large font is better than a page that swallows itself. */
  .road-form textarea, .field input, .search input { font-size: 16px; }
  .road-item-head { gap: 0.5rem; }
  .road-jump { gap: 0.4rem; }
  .road-jump a { padding: 0.35rem 0.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  video.hero-media { display: none; }
}

/* ---------------------------------------------------------------------------
   Start from a template — the Create panel's first choice, above the drop.
   The cards are the hub's own cards, as buttons: picking one opens the name
   field, and Create is what makes the world.
   --------------------------------------------------------------------------- */
.templates { margin-bottom: 1.5rem; }
.template-pick {
  display: flex; flex-direction: column; min-width: 0; width: 100%;
  padding: 0; border: 0; background: none; color: inherit; font: inherit;
  text-align: left; cursor: pointer;
}
.template-pick:hover .thumb img, .template-pick:hover .cover { transform: scale(1.04); }
.template-pick[aria-pressed="true"] .thumb { outline: 3px solid var(--accent); outline-offset: 2px; }
.template-form { margin-top: 1rem; max-width: 30rem; }
.templates-or { margin-top: 1.5rem; font-weight: 700; color: var(--ink-3); }

/* A world with a password: a small padlock before its name on the hub. */
.card-lock { display: inline-block; vertical-align: -2px; margin-right: 5px; opacity: 0.8; }
