/* ============================================================
   Earlian — content hub layer
   masthead (docu / messages / the list), signup overlay,
   docu + messages page styles. Loads after soon.css.
   ============================================================ */

:root {
  --cream: #f2ead8;
  --red: #c8332b;
  --ink: #0a0a0a;
}

/* ---------------- masthead ---------------- */

.mast {
  position: fixed;
  top: 20px;
  left: 0;
  right: 0;
  z-index: 55;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.45s ease, transform 0.45s ease, top 0.45s ease;
  pointer-events: none;
  will-change: transform, opacity;
}

/* The brand mark rides above the wordmark, so the hub masthead needs
   clearance or the cloud clips off the top of the page. */
body.hub .mast { top: 28px; gap: 8px; }

/* On the wide Docu composition, bring the navigation a touch closer to the
   mark without disturbing the headline's dedicated row below. */
@media (min-width: 721px) {
  body.hub .mast-links { transform: translateY(-42px); }
}

/* Notched phones need the same visual clearance plus the safe-area inset.
   Keep this after the base hub rule so it wins in the cascade. */
@media (max-width: 720px) {
  .mast { top: calc(10px + env(safe-area-inset-top)); }
  body.hub .mast { top: calc(34px + env(safe-area-inset-top)); }
}

.mast-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  width: min(78vw, 760px);
}

/* narrow phones + folded foldables: don't let the three links collide */
@media (max-width: 380px) {
  .mast-links { width: 96vw; }
  .mast a { padding: 8px 10px; }
}

/* The compact docked lockup owns the top row; navigation gets a dedicated
   row beneath it so "messages" never sits inside the wordmark. */
body:not(.hub) .mast { top: calc(7vh + 88px); }

/* (mobile override must stay after the 14vh rule above to win) */
@media (max-width: 720px) {
  body:not(.hub) .mast { top: calc(7vh + 70px + env(safe-area-inset-top)); }
}

body.stage-live:not(.hub) .mast { top: calc(5vh + 76px); }
@media (max-width: 720px) {
  body.stage-live:not(.hub) .mast { top: calc(3vh + 52px + env(safe-area-inset-top)); }
}

.mast.on {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.mast a {
  position: relative;
  font-family: 'Rock Salt', cursive;
  font-size: clamp(14px, 2vw, 19px);
  color: var(--mast-color, var(--ink)); /* landing is paper — dark ink; hub pages flip to cream below */
  text-decoration: none;
  padding: 10px 18px;
  letter-spacing: 1px;
  white-space: nowrap;
  text-align: center;
  transform: translateY(var(--mast-drop, 0px)) rotate(var(--rot, 0deg));
  transition: color 0.45s ease;
}

body.hub .mast a { color: var(--cream); }

/* index: once the scroll drops into the dark docu stage, the mast rides
   over the ink — flip its links to cream so they stay legible */
body.stage-live .mast a { color: var(--cream); }

/* the page you're on: red + underlined (scribble stays drawn) */
.mast a.active {
  color: var(--red);
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 2px;
}
body.hub .mast a.active { color: var(--red); }

.mast a.mast-brand {
  font-size: clamp(34px, 4vw, 48px);
  letter-spacing: 0;
  padding: 0 24px 8px;
}
/* Docu uses the same sun-and-cloud lockup as the dark landing stage. */
body.hub .mast a.mast-brand .brand-mark { top: -0.48em; right: -0.60em; width: 2.15em; }

.mast a.mast-brand:hover { color: var(--red); }

/* index already has the giant draw-text wordmark — no double branding */
body:not(.hub) .mast a.mast-brand { display: none; }

/* At the globe handoff, bring Earlian back as the white masthead mark. */
body.stage-live .mast a.mast-brand {
  display: none;
}

.mast a .scribble {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.mast a .scribble path {
  fill: none;
  stroke: var(--red);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
  transition: stroke-dashoffset 0.28s ease, opacity 0.15s ease;
}

.mast a:hover .scribble path,
.mast a:focus-visible .scribble path,
.mast a.active .scribble path {
  stroke-dashoffset: 0;
  opacity: 1;
}

/* ---------------- signup overlay ("the list") ---------------- */

.list-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4, 4, 4, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  padding: 24px;
}

.list-overlay.open { display: flex; }

.list-card {
  position: relative;
  background: var(--cream);
  color: var(--ink);
  max-width: 460px;
  width: 100%;
  padding: 56px 44px 40px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

/* one quiet tape at the top center — not four shouting corners */
.list-card::before,
.list-section::before {
  content: '';
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 120px;
  height: 30px;
  background: rgba(242, 234, 216, 0.85);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  opacity: 0.9;
  pointer-events: none;
}

/* the old corner strips are gone — keep the markup harmless */
.list-card .tape,
.list-section .tape { display: none; }

.list-card h2 {
  font-family: 'Rock Salt', cursive;
  font-size: clamp(22px, 4vw, 30px);
  margin: 0 0 14px;
  text-align: center;
}

.list-sub {
  font-family: 'Special Elite', monospace;
  font-size: 14px;
  line-height: 1.6;
  opacity: 0.75;
  margin: 0 auto 30px;
  max-width: 320px;
  text-align: center;
}

.list-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  font-family: 'Special Elite', monospace;
  font-size: 20px;
  color: var(--ink);
  opacity: 0.55;
  cursor: pointer;
  line-height: 1;
  padding: 6px;
}

.list-close:hover { opacity: 1; color: var(--red); }

/* form (shared by overlay + inline section) */

.list-form input {
  width: 100%;
  box-sizing: border-box;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(10, 10, 10, 0.6);
  font-family: 'Special Elite', monospace;
  font-size: 16px;
  padding: 10px 2px;
  margin-bottom: 16px;
  color: inherit;
  outline: none;
}

.list-form input:focus { border-bottom-color: var(--red); }

.list-submit {
  display: block;
  width: 100%;
  margin-top: 8px;
  background: var(--ink);
  border: none;
  color: var(--cream);
  font-family: 'Special Elite', monospace;
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 14px 8px;
  transition: background 0.2s ease;
}

.list-submit:hover { background: var(--red); }

.list-err {
  font-family: 'Special Elite', monospace;
  color: var(--red);
  font-size: 13px;
  min-height: 18px;
  margin: 12px 0 0;
  text-align: center;
}

.list-done {
  font-family: 'Rock Salt', cursive;
  font-size: clamp(20px, 4vw, 26px);
  text-align: center;
  padding: 26px 0 10px;
  margin: 0;
}

/* ---------------- hub pages (docu / messages) ---------------- */

body.hub {
  background: var(--ink);
  color: var(--cream);
  margin: 0;
  min-height: 100vh;
}

/* Docu's archive is lit by the same sun that sits in the Earlian lockup.
   The soft halo reads first; the tapered wash makes its direction tangible
   without competing with the globe. */
body.hub:has(.page-globe)::before,
body.hub:has(.page-globe)::after {
  content: "";
  position: fixed;
  z-index: 0;
  pointer-events: none;
}
body.hub:has(.page-globe)::before {
  inset: 0;
  background: radial-gradient(ellipse 26vw 33vh at calc(50% + 112px) -4vh, rgba(217, 138, 85, .25), rgba(217, 138, 85, .08) 40%, transparent 74%);
}
body.hub:has(.page-globe)::after {
  top: 0;
  left: calc(50% - 22vw + 112px);
  width: 44vw;
  height: min(58vh, 620px);
  background: linear-gradient(to bottom, rgba(217, 138, 85, .13), rgba(217, 138, 85, .035) 58%, transparent 100%);
  clip-path: polygon(47% 0, 53% 0, 100% 100%, 0 100%);
}

.page {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: 100px 24px 90px;
  padding-left: calc(24px + env(safe-area-inset-left));
  padding-right: calc(24px + env(safe-area-inset-right));
  padding-bottom: calc(90px + env(safe-area-inset-bottom));
}

.page-title {
  font-family: 'Rock Salt', cursive;
  font-size: clamp(38px, 8vw, 62px);
  margin: 0;
  display: inline-block;
  transform: rotate(-1.5deg);
}

.page-rule {
  height: 6px;
  width: min(300px, 58%);
  margin-top: 8px;
  background: var(--red);
  border-radius: 50%;
  transform: rotate(-0.6deg);
  opacity: 0.9;
}

/* docu grid */

.page-sub {
  font-family: 'Special Elite', monospace;
  font-size: 15px;
  opacity: 0.6;
  margin: 18px 0 0;
}

/* the web — city route strip */

.route {
  display: flex;
  align-items: center;
  margin-top: 44px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.route-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transform: rotate(var(--r, 0deg));
  flex-shrink: 0;
}

.route-city {
  font-family: 'Rock Salt', cursive;
  font-size: 15px;
  color: var(--cream);
  letter-spacing: 1px;
  white-space: nowrap;
}

.route-node:hover .route-city { color: var(--red); }

.route-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
}

.route-seg {
  flex: 1;
  min-width: 42px;
  height: 2px;
  margin: 0 10px 22px;
  background-image: repeating-linear-gradient(
    90deg, var(--red) 0 7px, transparent 7px 14px
  );
  opacity: 0.75;
  transform: scaleX(0);
  transform-origin: left center;
  animation: route-draw 0.5s ease forwards;
  animation-delay: var(--d, 0s);
}

@keyframes route-draw {
  to { transform: scaleX(1); }
}

/* postcard stamps */

.stamp {
  position: absolute;
  top: 18px;
  right: 16px;
  z-index: 2;
  font-family: 'Sedgwick Ave Display', cursive;
  font-size: clamp(22px, 3vw, 30px);
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 3px;
  padding: 2px 10px;
  border: 3px double var(--red);
  transform: rotate(7deg);
  opacity: 0.85;
  pointer-events: none;
}

.kind {
  position: absolute;
  top: 20px;
  left: 16px;
  z-index: 2;
  font-family: 'Special Elite', monospace;
  font-size: 13px;
  letter-spacing: 2px;
  padding: 3px 8px;
  transform: rotate(-4deg);
  pointer-events: none;
}

.kind-docu { color: var(--red); border: 1px solid var(--red); }

.kind-skit {
  color: var(--ink);
  background: var(--cream);
  border: 1px solid var(--cream);
}

.postmark {
  float: right;
  color: var(--red);
  letter-spacing: 2px;
}

/* ---------------- globe (docu — the web) ---------------- */

.globe-wrap {
  position: relative;
  margin: 26px auto 0;
  max-width: 560px;
  text-align: center;
}

.page-globe {
  box-sizing: border-box;
  max-width: none;
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  /* Full-screen composition: masthead, language, then a single globe. */
  padding: clamp(190px, 19vh, 240px) 20px 30px;
  text-align: center;
}

body.hub:has(.page-globe) { height: 100dvh; overflow: hidden; }

.docu-intro { text-align: center; }
.docu-intro span {
  margin: 0;
  font-family: 'Special Elite', monospace;
  font-size: 10px;
  letter-spacing: .24em;
  text-transform: uppercase;
  opacity: .55;
}
.docu-intro h1 {
  margin: 0 0 10px;
  color: var(--cream);
  font-family: 'Rock Salt', cursive;
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 400;
  transform: rotate(-1.5deg);
}
.docu-intro h1 span {
  display: inline-block;
  min-width: 7.5ch;
  color: var(--red);
  font: inherit;
  letter-spacing: inherit;
  opacity: 1;
  text-transform: none;
  transition: opacity .28s ease, transform .28s ease;
}
.docu-intro h1 span.is-changing { opacity: 0; transform: translateY(5px); }
.page-globe .globe-wrap {
  width: min(56vh, 640px, 90vw);
  margin: clamp(16px, 2vh, 26px) auto 0;
}

@media (max-width: 720px) {
  body.hub .mast { top: calc(20px + env(safe-area-inset-top)); }
  .mast a.mast-brand { font-size: 32px; padding-bottom: 5px; }
  body.hub .mast a.mast-brand .brand-mark { top: -0.46em; right: -0.58em; width: 2em; }
  /* Fixed one-screen composition on phones: title stays above, never on,
     the model. The city panel remains independently scrollable. */
  .page-globe { padding: calc(160px + env(safe-area-inset-top)) 14px calc(24px + env(safe-area-inset-bottom)); }
  .docu-intro h1 { font-size: clamp(21px, 7vw, 29px); }
  .page-globe .globe-wrap { width: min(45vh, 94vw); margin-top: 14px; }
  /* A low, warm spill reads as sunlight on a narrow screen. The desktop cone
     becomes a heavy black-and-amber column here, so keep it short and soft. */
  body.hub:has(.page-globe)::before {
    background: radial-gradient(ellipse 62vw 24vh at 72% -3vh, rgba(217, 138, 85, .22), rgba(217, 138, 85, .055) 48%, transparent 76%);
  }
  body.hub:has(.page-globe)::after {
    display: none;
  }
}

#globe {
  display: block;
  margin: 0 auto;
  cursor: grab;
  touch-action: none;
}

#globe:active { cursor: grabbing; }

.globe-hint {
  font-family: 'Special Elite', monospace;
  font-size: 13px;
  opacity: 0.5;
  margin: 2px 0 0;
}

/* city detail panel */

.city-panel {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  background: radial-gradient(ellipse at center, rgba(8, 7, 5, 0.55) 0%, rgba(2, 2, 2, 0.94) 78%);
}

.city-panel.open { display: flex; }

/* the landing's messages, typed out slowly in the dark stage around the video */
.theater-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.theater-line {
  position: absolute;
  margin: 0;
  max-width: 44vw;
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.9);
  opacity: 0.85;
  white-space: pre-wrap;
}
.theater-line.slot-0 { top: 9vh; left: 5vw; }
.theater-line.slot-1 { top: 27vh; right: 4vw; text-align: right; }
.theater-line.slot-2 { bottom: 24vh; left: 6vw; }
.theater-line.slot-3 { bottom: 11vh; right: 7vw; text-align: right; }

.city-sheet {
  position: relative;
  background: #101010;
  color: var(--cream);
  border: 1px solid rgba(242, 234, 216, 0.14);
  width: min(96vw, 1100px);
  max-width: 1100px;
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  padding: 18px 18px 14px;
  margin: auto;
  text-align: center;
}

.city-sheet .list-close { color: var(--cream); }

.city-name {
  font-family: 'Rock Salt', cursive;
  font-size: clamp(24px, 3.5vw, 34px);
  color: var(--cream);
  margin: 0 0 2px;
}

.city-sheet .page-rule { margin: 4px auto 14px; }

.city-sub {
  font-family: 'Special Elite', monospace;
  font-size: 14px;
  color: var(--red);
  letter-spacing: 2px;
  margin: 0;
}

.city-vid { margin: 0 auto; }

/* city chooser (country → city) */

.chooser {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4, 4, 4, 0.55);
  padding: 24px;
}

.chooser.open { display: flex; }

.chooser-card {
  position: relative;
  background: #101010;
  border: 2px solid rgba(242, 234, 216, 0.15);
  max-width: 420px;
  width: 100%;
  padding: 40px 30px 34px;
  text-align: center;
  transform: rotate(-0.8deg);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
}

.chooser-card .list-close { color: var(--cream); }

.chooser-name {
  font-family: 'Rock Salt', cursive;
  font-size: clamp(22px, 5vw, 30px);
  margin: 0 0 22px;
}

.chooser-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.chooser-btn {
  background: none;
  border: none;
  font-family: 'Permanent Marker', cursive;
  font-size: clamp(22px, 4.5vw, 28px);
  color: var(--cream);
  cursor: pointer;
  padding: 4px 14px;
  transform: rotate(var(--r, 0deg));
}

.chooser-btn:hover { color: var(--red); }

/* vignette scene UI (back button + city label over the canvas) */

.scene-ui {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: none;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.scene-ui.on { display: flex; }

.scene-back {
  background: none;
  border: none;
  font-family: 'Permanent Marker', cursive;
  font-size: 18px;
  color: var(--cream);
  cursor: pointer;
  padding: 6px 10px;
  pointer-events: auto;
  transform: rotate(-1.5deg);
}

.scene-back:hover { color: var(--red); }

.scene-name {
  font-family: 'Rock Salt', cursive;
  font-size: clamp(16px, 3vw, 22px);
  color: var(--cream);
  opacity: 0.75;
  margin: 0;
  transform: rotate(1deg);
}

.city-vid-cap {
  font-family: 'Special Elite', monospace;
  font-size: 14px;
  color: rgba(242, 234, 216, 0.72);
  opacity: 0.75;
  margin: 7px 0 0;
  text-align: center;
}

.city-vid-cap .postmark {
  float: none;
  margin-left: 10px;
}

@media (min-width: 700px) {
  .city-sheet {
    box-shadow: 0 18px 52px rgba(0, 0, 0, 0.55);
  }
}

/* Keep the centered card clear of the gesture bar on mobile. */
.city-sheet {
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
}

/* foldable in dual-screen: keep content on one pane, off the hinge */
@media (spanning: single-fold-vertical) {
  .page { max-width: calc(env(fold-left, 50vw)); margin-left: 0; }
}
@media (spanning: single-fold-horizontal) {
  .page { max-height: calc(env(fold-top, 50vh)); margin-top: 0; overflow-y: auto; }
}

/* ultrawide: cap the reading column so the globe isn't dwarfed */
@media (min-width: 1600px) {
  .page { max-width: 1100px; }
}

.vid-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 52px;
  margin-top: 60px;
}

@media (max-width: 720px) {
  .vid-grid { grid-template-columns: 1fr; }
}

.vid-card {
  position: relative;
  margin: 0;
  background: #111;
  padding: 10px;
  transform: rotate(var(--r, 0deg));
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
}

.city-sheet .vid-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.vid-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.vid-card figcaption {
  font-family: 'Special Elite', monospace;
  font-size: 14px;
  opacity: 0.75;
  padding: 12px 4px 4px;
}

/* messages feed */

.msg {
  padding: 36px 0 30px;
  border-bottom: 2px dashed rgba(242, 234, 216, 0.18);
}

.msg:first-child { margin-top: 34px; }

.msg h2 {
  font-family: 'Permanent Marker', cursive;
  font-size: clamp(24px, 4vw, 32px);
  margin: 0 0 8px;
}

.msg time {
  font-family: 'Special Elite', monospace;
  color: var(--red);
  font-size: 14px;
  letter-spacing: 2px;
}

.msg p {
  font-family: 'Special Elite', monospace;
  font-size: 17px;
  line-height: 1.7;
  white-space: pre-wrap;
  margin: 14px 0 0;
  opacity: 0.92;
}

.msg-empty {
  font-family: 'Special Elite', monospace;
  opacity: 0.6;
  font-size: 18px;
  margin-top: 54px;
}

/* inline signup section (messages page footer) */

.list-section {
  margin-top: 80px;
  padding: 52px 36px 42px;
  background: var(--cream);
  color: var(--ink);
  position: relative;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}

.list-section h2 {
  font-family: 'Rock Salt', cursive;
  font-size: clamp(22px, 4vw, 30px);
  margin: 0 0 14px;
  text-align: center;
}

/* ---------------- page-transition veil ----------------
   The departing page wipes to a flat color (ink for the dark hub,
   paper for the landing), the arriving page wipes in from it. */

.veil {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.veil.show {
  opacity: 1;
  pointer-events: auto;
}

/* ---------------- hub film grain ----------------
   The landing's paper grain multiplies (dark speckle on cream). Hub
   pages are ink — multiply vanishes on black, so flip to a faint
   white-noise screen blend: film static on the dark. */

body.hub .grain {
  mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)'/%3E%3C/svg%3E");
  opacity: 0.3;
}

@media (prefers-reduced-motion: reduce) {
  .veil { transition: none; }
}
