/* ===========================================================================
   History of (tele) communication
   Everything inside #world is authored in design units (6495 x 1123) and
   scaled by --s at runtime.
   ========================================================================= */

:root{
  --red:#D62828;
  --red-deep:#991C1C;
  --tick:#F0ABAF;
  --ink:#000;
  --paper:#fff;
  --s:1;               /* design unit -> css px, set by app.js */
}

*{ box-sizing:border-box; }

html,body{
  height:100%;
  margin:0;
  background:var(--paper);
  color:var(--ink);
  font-family:"Inter",system-ui,-apple-system,sans-serif;
  font-synthesis:none;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  overflow:hidden;
  overscroll-behavior:none;
}

/* ─────────────────────────────  stage  ───────────────────────────── */

#scene{
  position:fixed;
  inset:0;
  overflow:hidden;
  cursor:grab;
  outline:none;
  touch-action:none;
}
#scene.dragging{ cursor:grabbing; }

#world{
  position:absolute;
  left:0; top:0;
  width:6495px;          /* placeholder: app.js sets the real width */
  height:1123px;
  transform-origin:0 0;
  will-change:transform;
}

/* the layers are full-bleed and transparent — they must not eat clicks
   meant for the media underneath (segments re-enable this per frame) */
.layer{ position:absolute; inset:0; pointer-events:none; }
#rail  { z-index:3; }
#years { z-index:4; }
#flags { z-index:5; }
#eras  { z-index:2; }   /* the tall marks pass behind the bands */
#stages{ z-index:6; }
#social{ z-index:6; }
#stages[hidden],#social[hidden]{ display:none; }

/* ─────────────────────────────  the rail  ───────────────────────────── */

.rail-solid,.rail-dash{
  position:absolute;
  height:4px;
  top:1006px;
}
.rail-solid{ background:var(--red); }
.rail-dash{
  background:repeating-linear-gradient(90deg,var(--red) 0 16px,transparent 16px 32px);
}

.ticks{ position:absolute; left:0; right:0; }
/* a measuring scale: hairlines every unit, taller marks every 5 and every 10,
   all hanging from the same baseline */
.ticks i{
  position:absolute;
  bottom:0;
  width:2px;
  background:var(--tick);
  opacity:.75;
}
.ticks i.yr { width:2px; background:#E8949A; opacity:1; }
.ticks i.dec{ width:3px; background:var(--red); opacity:.75; }

.mark{
  position:absolute;
  width:4px;
  background:var(--red);
  transform-origin:50% 100%;
}
.mark.dash{
  background:repeating-linear-gradient(180deg,var(--red) 0 16px,transparent 16px 32px);
}

.year{
  position:absolute;
  font-size:19px;
  opacity:.75;
  line-height:134%;
  letter-spacing:-0.005em;
  color:var(--red);
  white-space:nowrap;
}
.year.c{ font-weight:700; font-size:22px; opacity:1; }

/* ─────────────────────────────  eras  ─────────────────────────────
   title and note are stacked in one group anchored by its bottom edge, so the
   lettering grows upward out of the rail as its era arrives  */

.era-grp{
  position:absolute;
  transform-origin:0% 100%;
  will-change:transform,opacity;
}
.era-title{
  font-weight:700;
  letter-spacing:-0.022em;
  color:var(--red);
  white-space:nowrap;
}
.era-body{
  font-size:19px;
  line-height:134%;
  letter-spacing:-0.005em;
  color:var(--ink);
  opacity:.6;
  margin-bottom:14px;
  will-change:opacity;
}

/* ─────────────────  the active ticker  ─────────────────
   one dot per content segment, sitting on the rail. the ruler ticks are the
   scale; these are the events, so they are drawn as discs rather than lines and
   can't be mistaken for one another. whichever event is in the panel grows a
   stalk and lights the run of ruler ticks beneath it. */

.pin{
  position:absolute;
  top:1000px;
  translate:-50% 0;
  width:9px; height:9px;
  border-radius:50%;
  background:var(--tick);
  box-shadow:0 0 0 2px #fff;
  transition:width .18s, height .18s, top .18s, background .18s;
}
.pin.l-market{ background:#E8949A; }
.pin.l-social{ background:#B79BCE; }
.pin.l-stage { background:#DFAE63; }
.pin[hidden]{ display:none; }
.pin.on{
  width:15px; height:15px;
  top:997px;
  translate:-50% 0;
  background:var(--red);
  box-shadow:0 0 0 3px #fff, 0 0 0 5px #d6282833, 0 8px 20px -6px #d62828aa;
}
.pin.on::before{
  content:"";
  position:absolute; left:50%; bottom:100%;
  width:3px; height:76px;
  background:linear-gradient(180deg,#d6282800,var(--red));
  translate:-50% 0;
}
.ticks i.live{ background:var(--red); opacity:1; }

/* ─────────────────  invention flags, under the line  ───────────────── */

.flag{ position:absolute; }
.flag-stem{
  position:absolute; left:0; top:0;
  width:1.5px;
  background:var(--tick);
  display:block;
  transition:background .2s;
}
.flag-label{
  position:absolute; left:7px;
  transform:translateY(-50%);
  display:flex; align-items:baseline; gap:8px;
  white-space:nowrap;
  background:none; border:0; padding:3px 6px 3px 0; margin:0;
  font:inherit; text-align:left; cursor:pointer;
  color:var(--ink);
  opacity:.42;
  pointer-events:auto;
  transition:opacity .2s, color .2s;
  -webkit-tap-highlight-color:transparent;
}
.flag-label b{ font-size:15px; font-weight:700; color:var(--red); opacity:.75; }
.flag-label span{ font-size:17px; letter-spacing:-0.005em; }
.flag.near .flag-label,
.flag-label:hover{ opacity:1; }
.flag.near .flag-stem{ background:var(--red); }

/* ─────────────────  the four-stage roll-out  ───────────────── */

.cyc-label{
  position:absolute;
  display:flex; align-items:center; justify-content:flex-end;
  font-size:19px; letter-spacing:.01em;
  color:var(--ink); opacity:.4;
  padding-right:12px;
  white-space:nowrap;
}
.chip{
  position:absolute;
  display:flex; align-items:center; gap:9px;
  padding:0 12px;
  border-radius:8px;
  overflow:hidden;
  font-size:17px; letter-spacing:-0.005em;
  color:#5A3B1E;
  background:#F4E3C8;
  box-shadow:inset 0 0 0 1px #00000010;
  cursor:pointer;
  pointer-events:auto;
  opacity:.5;
  transition:opacity .2s, transform .2s, box-shadow .2s;
}
.chip b{ font-weight:700; opacity:.55; flex:0 0 auto; }
.chip span{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chip.s1{ background:#FBEBD2; }
.chip.s2{ background:#F7D9AE; }
.chip.s3{ background:#F0BE87; }
.chip.s4{ background:#E39F67; }
.chip.proj{ background:repeating-linear-gradient(45deg,#F2E6D6 0 7px,#E8D6BE 7px 14px); color:#7A6049; }
.chip.now{ box-shadow:inset 0 0 0 2px var(--red); }
/* the segment in the panel points at the exact stage it is an example of */
.chip.cued{
  opacity:1;
  transform:translateY(-3px);
  box-shadow:inset 0 0 0 2px var(--red), 0 10px 26px -10px #d62828aa;
}
.chip.cued b{ opacity:1; color:var(--red); }
.chip.on{ opacity:1; transform:translateY(-2px); box-shadow:inset 0 0 0 1px #00000018, 0 8px 20px -10px #00000066; }
.chip:hover{ opacity:.9; }

/* ─────────────────  the social read  ───────────────── */

.strip{
  position:absolute;
  display:flex; align-items:center;
  padding:0 16px;
  border-left:3px solid #C9B7D6;
  background:linear-gradient(90deg,#C9B7D622,#C9B7D608);
  overflow:hidden;
  opacity:.45;
  transition:opacity .25s, background .25s;
}
.strip span{
  font-size:21px; line-height:130%; letter-spacing:-0.008em;
  color:var(--ink);
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;
  overflow:hidden;
}
.strip.on{
  opacity:1;
  border-left-color:#8E6FA8;
  background:linear-gradient(90deg,#C9B7D644,#C9B7D610);
}

/* ─────────────────  the playhead  ───────────────── */

#head{
  position:fixed;
  z-index:12;
  width:0;
  pointer-events:none;
  border-left:1px dashed #d6282855;
}
#head::before{
  content:"";
  position:absolute; left:0; top:-1px;
  width:0; height:0;
  border-left:7px solid transparent;
  border-right:7px solid transparent;
  border-top:9px solid var(--red);
  translate:-50% 0;
}

/* ─────────────────────────────  media segments  ───────────────────────────── */

/* ───────── the content panel ─────────
   fixed on screen and centred in the clear band above the rail. it never moves;
   scrolling only changes which child is showing. #stage-inner is a zero-size
   anchor scaled by the same factor as the world, so everything inside it can
   keep the artboard's own units. */

#stage{
  position:fixed;
  left:0; right:0;
  z-index:6;
  pointer-events:none;
  display:flex;
  align-items:center;
  justify-content:center;
}
#stage-inner{
  position:relative;
  width:0; height:0;
  transform-origin:50% 50%;
}
.seg{
  position:absolute;
  left:0; top:0;
  translate:-50% -50%;
  display:none;
}
.seg.on{ display:block; }
.seg.on{ pointer-events:auto; }
.seg[hidden]{ display:none; }
.seg-body{ position:relative; width:100%; }

.seg-cap{
  margin-top:18px;
  font-size:20px;
  line-height:140%;
  letter-spacing:-0.005em;
  color:var(--ink);
  opacity:.55;
  max-width:620px;
}

/* image */
.seg-img{
  width:100%;
  height:100%;
  border-radius:12px;
  object-fit:contain;
  display:block;
  background:#F6F3F0;
  box-shadow:0 0 0 1px #00000014, 0 20px 50px -30px #00000066;
}

/* text */
.seg-eyebrow{
  font-size:20px;
  line-height:140%;
  letter-spacing:.02em;
  text-transform:uppercase;
  color:var(--red);
  margin-bottom:18px;
}
.seg-text{
  font-size:44px;
  line-height:128%;
  letter-spacing:-0.02em;
  color:var(--ink);
  opacity:.82;
}

/* link preview */
.seg-link{
  display:block;
  text-decoration:none;
  color:inherit;
  border:2px solid #00000014;
  border-radius:14px;
  overflow:hidden;
  background:var(--paper);
  box-shadow:0 18px 50px -26px #00000040;
  transition:border-color .25s, transform .25s, box-shadow .25s;
}
.seg-link:hover{ border-color:var(--red); transform:translateY(-4px); box-shadow:0 26px 60px -26px #0000004d; }
.seg-link-thumb{
  display:block;
  width:100%;
  aspect-ratio:16/9;
  object-fit:cover;
  background:#f4f1ee;
}
.seg-link-meta{ padding:26px 28px 30px; }
.seg-link-site{
  display:flex; align-items:center; gap:10px;
  font-size:18px; letter-spacing:.01em;
  color:var(--red);
  margin-bottom:12px;
}
.seg-link-site::before{
  content:""; width:9px; height:9px; border-radius:50%;
  background:var(--red); flex:0 0 auto;
}
.seg-link-title{
  font-size:30px; font-weight:700; line-height:126%;
  letter-spacing:-0.018em; margin:0 0 10px;
}
.seg-link-desc{
  font-size:20px; line-height:140%; letter-spacing:-0.005em;
  margin:0; opacity:.55;
}

/* youtube + video */
.seg-player{
  position:relative;
  width:100%; height:100%;
  border-radius:12px;
  overflow:hidden;
  background:#111;
  box-shadow:inset 0 0 1px 2px #00000040;
}
.seg-player iframe,
.seg-player video{
  position:absolute; inset:0;
  width:100%; height:100%;
  border:0; display:block; object-fit:cover;
}
.seg-poster{
  position:absolute; inset:0;
  width:100%; height:100%;
  object-fit:cover;
  display:block;
}
.seg-play{
  position:absolute; inset:0;
  display:flex; align-items:center; justify-content:center;
  border:0; padding:0; margin:0;
  background:linear-gradient(180deg,#0000 38%,#00000080 100%);
  cursor:pointer;
  font:inherit; color:#fff;
}
.seg-play .disc{
  position:relative;
  width:96px; height:96px; border-radius:50%;
  background:var(--red);
  box-shadow:0 10px 40px #00000059;
  display:flex; align-items:center; justify-content:center;
  transition:transform .25s;
}
.seg-play:hover .disc{ transform:scale(1.08); }
.seg-play .tri{
  width:0; height:0;
  border-left:30px solid #fff;
  border-top:18px solid transparent;
  border-bottom:18px solid transparent;
  translate:5px 0;
}
.seg-play .ttl{
  position:absolute; left:28px; right:28px; bottom:24px;
  font-size:22px; font-weight:500; letter-spacing:-0.01em;
  text-align:left; text-shadow:0 1px 14px #0009;
}

/* ─────────────────────────────  the intro block  ─────────────────────────────
   this lives inside #world at the artboard's own 91/91 origin, so it scrolls
   away with the rest of the timeline instead of hanging over it  */

#intro{ z-index:5; }
#intro-title,
#intro-sub,
#intro-toggles{ position:absolute; left:91px; }
#intro-title{
  margin:0;
  top:91px;
  font-family:"Roboto",system-ui,sans-serif;
  font-weight:700;
  font-size:36px;
  line-height:52px;
  color:var(--red);
  white-space:nowrap;
}
#intro-sub{
  margin:0;
  top:161px;
  width:514px;
  font-size:24px;
  line-height:134%;
  letter-spacing:-0.005em;
  opacity:.6;
}
#intro-toggles{
  top:325px;
  display:flex;
  flex-direction:column;
  gap:16px;
  align-items:flex-start;
  pointer-events:auto;
}

.tg{
  display:flex; align-items:center; gap:12px;
  background:none; border:0; padding:0; margin:0;
  font:inherit; cursor:pointer; color:var(--ink);
  -webkit-tap-highlight-color:transparent;
}
.tg-box{
  width:28px; height:28px; border-radius:10px;
  border:2px solid #CBC6C2; background:var(--paper);
  flex:0 0 auto;
  display:flex; align-items:center; justify-content:center;
  transition:background .18s, border-color .18s;
}
.tg[aria-pressed="true"] .tg-box{
  background:var(--red); border-color:var(--red-deep);
}
.tg-box svg{ opacity:0; transition:opacity .18s; }
.tg[aria-pressed="true"] .tg-box svg{ opacity:1; }
.tg-label{
  font-size:24px; line-height:134%; letter-spacing:-0.005em;
  white-space:nowrap;
}
.tg[aria-pressed="false"] .tg-label{ opacity:.55; }

/* hover read-out over the ruler */
#probe{
  position:fixed; inset:0;
  z-index:15;
  pointer-events:none;
  opacity:0;
  transition:opacity .2s;
}
#probe.on{ opacity:1; }
#probe-line{
  position:absolute;
  top:0; bottom:0;
  width:1px;
  background:linear-gradient(180deg,#d6282800 0%,#d6282833 45%,var(--red) 100%);
}
#probe-year{
  position:absolute;
  transform:translate(-50%,-100%);
  background:var(--red);
  color:#fff;
  font-size:14px;
  font-weight:500;
  letter-spacing:.04em;
  padding:6px 11px;
  border-radius:999px;
  white-space:nowrap;
}
#probe-year[hidden]{ display:none; }

#hint{
  position:fixed;
  right:34px; bottom:13%;
  z-index:20;
  display:flex; align-items:center; gap:10px;
  font-size:14px; letter-spacing:.14em; text-transform:uppercase;
  color:var(--red);
  pointer-events:none;
  transition:opacity .5s;
}
#hint.gone{ opacity:0; }

#progress{
  position:fixed;
  left:0; right:0; bottom:0;
  height:2px;
  z-index:20;
  background:#d628281a;
  pointer-events:none;
}
#progress i{
  display:block; height:100%; width:0;
  background:var(--red);
  transform-origin:0 50%;
}

@media (prefers-reduced-motion:reduce){
  .seg-link{ transition:none; }
}
