:root {
  --bg: #ffffff;
  --soft: #f5f5f7;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --faint: #86868b;
  --line: #d2d2d7;
  --hair: #ececf0;
  --accent: #127fa3;          /* the one coloured pencil */
  --crayon: #127fa3;
  --pencil: #2c2c2e;          /* graphite */
  --pencil-light: #a9a9ae;
  --hand: "Caveat", "Bradley Hand", "Segoe Print", cursive;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --move: .9s cubic-bezier(.65, 0, .25, 1);
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.07);
  --shadow-lg: 0 2px 6px rgba(0,0,0,.05), 0 24px 48px rgba(0,0,0,.12);
  --nav: 52px;
  --band: 215px;              /* start page timeline band (keep in sync with app.js geom) */
  --band-gap: 56px;           /* space below the band for the scroll hint */
  --strip: 104px;             /* timeline strip while reading */
  --red: #d33a2c;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.47;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
h1, h2, h3 { margin: 0; letter-spacing: -0.025em; }
.hand { font-family: var(--hand); font-weight: 600; letter-spacing: 0; }

/* Layers that fade in/out between views */
.hero, .tl-toolbar, .tl-bottom, .scroll-hint, .map-panel, .list-panel, .reader {
  transition: opacity .7s var(--ease), transform var(--move), visibility 0s linear .7s;
}
body:not([data-view=home]) .hero,
body:not([data-view=home]) .scroll-hint,
body:not([data-view=timeline]) .tl-toolbar,
body:not([data-view=timeline]) .tl-bottom,
body:not([data-view=map]) .map-panel,
body:not([data-view=list]) .list-panel,
body:not([data-view^=post]) .reader,
body[data-view=map] .tl-viewport, body[data-view=list] .tl-viewport,
body[data-view=timeline] #map-svg, body[data-view=list] #map-svg, body[data-view^=post] #map-svg {
  opacity: 0; visibility: hidden; pointer-events: none;
}
body[data-view=home] .hero, body[data-view=timeline] .tl-toolbar, body[data-view=timeline] .tl-bottom,
body[data-view=map] .map-panel, body[data-view=list] .list-panel, body[data-view^=post] .reader {
  transition: opacity .8s var(--ease) .25s, transform var(--move), visibility 0s;
}

/* ---------- Pencil & scribbles ---------- */
.scribble { overflow: visible; }
.scribble path {
  fill: none; stroke: var(--crayon); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1; stroke-dashoffset: 1;
}
body[data-view=home] .hero .scribble path,
body[data-view=home] .mini-only .scribble path,
body[data-view=timeline] .tl-toolbar .scribble path,
body[data-view=map] .map-panel .scribble path,
body[data-view=list] .list-panel .scribble path,
.tl-now .scribble path {
  animation: drawIn .9s cubic-bezier(.6,.05,.3,1) forwards; animation-delay: calc(.6s + var(--i, 0) * .35s);
}
@keyframes drawIn { to { stroke-dashoffset: 0; } }
.underline { position: absolute; left: -2%; width: 104%; height: 12px; bottom: -8px; }
h2 { position: relative; display: inline-block; }
h2 .underline { bottom: -6px; height: 11px; }

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50; height: var(--nav);
  background: rgba(255,255,255,.78);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.nav-inner {
  height: 100%; margin: 0 auto; padding: 0 22px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
}
.nav-links { justify-self: end; display: flex; gap: 18px; }
.nav-links a { font-size: 13px; color: var(--faint); text-decoration: none; transition: color .2s; }
.nav-links a:hover { color: var(--text); }
.imprint-link { display: none; }
.brand { justify-self: start; font-weight: 600; font-size: 19px; letter-spacing: -0.02em; }
.brand span { color: var(--faint); font-weight: 500; }
.seg { position: relative; display: flex; gap: 2px; background: rgba(118,118,128,.12); border-radius: 999px; padding: 3px; }
.seg button { position: relative; z-index: 1; font-size: 13px; font-weight: 500; padding: 5px 16px; border-radius: 999px; color: var(--muted); transition: color .3s; }
.seg button.active { color: var(--text); }
.seg .house { display: inline-block; vertical-align: -2px; margin-right: 5px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.seg-pill {
  position: absolute; top: 3px; bottom: 3px; left: 0; width: 0; opacity: 0;
  background: #fff; border-radius: 999px; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 1px 1px rgba(0,0,0,.04);
  transition: transform .45s var(--ease), width .45s var(--ease), opacity .3s;
}

/* ---------- Hero (start page) ---------- */
.hero {
  position: fixed; left: 0; right: 0; top: var(--nav); z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 0 22px; pointer-events: none;
}
body[data-view=timeline] .hero, body[data-view=list] .hero, body[data-view^=post] .hero { transform: translateY(-60px) scale(.96); }
body[data-view=map] .hero { transform: scale(1.08); }
.eyebrow { font-size: 28px; color: var(--crayon); margin: 0 0 6px; }
.hero h1 { font-size: clamp(40px, min(8.4vw, 10.5vh), 96px); line-height: 1.04; font-weight: 700; letter-spacing: -0.035em; }
.hero h1 .u { position: relative; white-space: nowrap; }
.hero h1 .underline { bottom: -.08em; height: .2em; }
.hero h1 .scribble path { stroke-width: 3.4; }
.lede { max-width: 560px; margin: 30px auto 0; font-size: clamp(16px, 2.4vh, 21px); line-height: 1.45; color: var(--muted); }
.scroll-hint {
  position: fixed; left: 0; right: 0; bottom: 16px; z-index: 4; margin: 0; text-align: center;
  font-size: 22px; color: var(--faint); pointer-events: none;
}
body[data-view=home] .scroll-hint { animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(5px); } }

/* ---------- The island / map ---------- */
#map-svg {
  position: fixed; z-index: 1; overflow: visible;
  pointer-events: none; border: 1px solid transparent; border-radius: 22px; background: transparent;
  transition: top var(--move), left var(--move), width var(--move), height var(--move),
              opacity .7s var(--ease), transform var(--move), background .5s, border-color .5s, visibility 0s;
}
body[data-view=home] #map-svg { left: 0; top: calc(var(--nav) + 8px); width: 100vw; height: calc(100vh - var(--nav) - 60px); }
body[data-view=home] #map-svg .reef, body[data-view=home] #map-svg .islet { opacity: .5; }
body[data-view=home].map-hover #map-svg .coast { stroke: #6e6e73; }
body[data-view=map] #map-svg { left: 16px; top: calc(var(--nav) + 8px); width: calc(100vw - 440px); height: calc(100vh - var(--nav) - 24px); }
body[data-view=timeline] #map-svg, body[data-view=list] #map-svg, body[data-view^=post] #map-svg {
  left: 0; top: calc(var(--nav) + 8px); width: 100vw; height: calc(100vh - var(--nav) - 60px); transform: scale(.9);
}
body[data-view=home] #map-svg .land { pointer-events: fill; cursor: pointer; }
/* while the map flies into / out of a story's "where" box */
body.map-flying #map-svg { opacity: 1 !important; visibility: visible !important; transform: none; z-index: 20; }
body[data-view=map] #map-svg .pins { pointer-events: auto; }

#map-svg .lagoon { fill: url(#hatch); opacity: .9; }
#map-svg .reef { fill: none; stroke: #7cc6da; stroke-width: 1.4; stroke-dasharray: 1 5; stroke-linecap: round; }
#map-svg .land { fill: #fff; stroke: none; }
body[data-view=home] #map-svg .land { fill: transparent; }
#map-svg .coast { fill: none; stroke: var(--pencil); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; transition: stroke .6s, stroke-width .6s; }
#map-svg .coast.faint { stroke-width: 1; opacity: .4; }
body[data-view=home] #map-svg .coast { stroke: #b4b4b9; }
#map-svg .islet, #map-svg .sketchy path { fill: none; stroke: var(--pencil); stroke-width: 1.2; stroke-linecap: round; }
#map-svg .mtn path { fill: none; stroke: #8e8e93; stroke-width: 1.1; stroke-linecap: round; }
#map-svg .mtn .h { stroke-width: .8; opacity: .8; }
#map-svg .town { fill: #8e8e93; }
#map-svg .lbl { font-family: var(--hand); font-size: 18px; fill: #6e6e73; font-weight: 500; }
#map-svg .lbl.has { fill: var(--pencil); font-weight: 700; font-size: 19px; }
#map-svg .hand-lbl { font-family: var(--hand); font-size: 20px; font-weight: 700; fill: var(--pencil); }
#map-svg .hand-lbl.small { font-size: 16px; font-weight: 500; fill: var(--muted); }
#map-svg .ocean { font-family: var(--hand); font-size: 22px; fill: #6fb8cc; }
#map-svg .draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 2.6s var(--ease) .2s forwards; }
#map-svg .draw.faint { animation-delay: .7s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
#map-svg .detail, #map-svg .pins { opacity: 0; transition: opacity .5s; }
body[data-view=map] #map-svg .detail { opacity: 1; transition: opacity .8s .45s; }
body[data-view=map] #map-svg .pins { opacity: 1; }

.home-x { pointer-events: auto; cursor: pointer; }
.home-x .hit { fill: transparent; }
body:not([data-view=map]) .home-x { visibility: hidden; pointer-events: none; }
.home-x path { fill: none; stroke: var(--red); stroke-width: 3.6; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.home-x path.thin { stroke-width: 1.4; opacity: .6; }
.home-x text { font-family: var(--hand); font-size: 20px; font-weight: 700; fill: var(--red); opacity: 0; }
body[data-view=map] .home-x path { animation: drawIn .5s cubic-bezier(.6,.05,.3,1) .9s forwards; }
body[data-view=map] .home-x path:nth-of-type(2) { animation-delay: 1.25s; }
body[data-view=map] .home-x path.thin { animation-delay: 1.5s; }
body[data-view=map] .home-x text { animation: fadeIn .6s 1.7s forwards; }
.home-x:hover path { stroke-width: 4.4; }
@keyframes fadeIn { to { opacity: 1; } }
.pin { cursor: pointer; outline: none; }
.pin:focus-visible .head { stroke: var(--accent); }
.pin .pin-in { transform-box: fill-box; transform-origin: 50% 100%; opacity: 0; transition: transform .6s var(--ease), opacity .4s; }
body[data-view=map] .pin .pin-in { animation: pinDrop .9s var(--ease) forwards; animation-delay: var(--delay); }
@keyframes pinDrop { 0% { opacity: 0; transform: translateY(-30px) scale(.6); } 60% { opacity: 1; } 100% { opacity: 1; transform: none; } }
.pin .pin-body { transition: transform .35s var(--ease); transform-box: fill-box; transform-origin: 50% 100%; }
.pin:hover .pin-body, .pin.hot .pin-body { transform: scale(1.2); }
.pin circle.head { stroke: #fff; stroke-width: 2; }
.pin .outline { fill: none; stroke: var(--pencil); stroke-width: 1; opacity: .7; }
.pin text { font-size: 10px; font-weight: 700; fill: #fff; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.pin .ring { fill: none; stroke: var(--crayon); stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; pointer-events: none; }
body[data-view=map] .pin.sel .ring { animation: drawIn .7s cubic-bezier(.6,.05,.3,1) forwards; }

.map-tip {
  position: fixed; pointer-events: none; z-index: 60;
  background: var(--pencil); color: #fff; font-family: var(--hand); font-size: 18px; padding: 2px 10px; border-radius: 8px;
  transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; opacity: 0; transition: opacity .2s;
}
.map-tip.show { opacity: 1; }

.map-panel {
  position: fixed; top: var(--nav); right: 0; bottom: 0; width: 420px; z-index: 5;
  overflow-y: auto; padding: 28px 32px 40px 16px;
}
body:not([data-view=map]) .map-panel { transform: translateX(30px); }
.map-panel h2 { font-size: 40px; font-weight: 700; line-height: 1.1; margin-bottom: 4px; }
.map-panel h3 { font-size: 24px; font-weight: 700; margin-bottom: 2px; }
.map-panel .sub { margin: 10px 0 16px; font-size: 15px; }
.panel-anim { animation: fadeUp .5s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.place-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; border-radius: 14px; text-align: left; transition: background .2s; }
.place-row:hover, .place-row.hot { background: var(--soft); }
.place-row .sw { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.place-row .nm { flex: 1; font-weight: 500; }
.place-row .ct { color: var(--faint); font-size: 14px; }
.back { color: var(--accent); font-size: 15px; font-weight: 500; margin-bottom: 10px; }
.mini-post { display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; padding: 10px; border-radius: 16px; transition: background .2s; }
.mini-post:hover { background: var(--soft); }
.mini-post .art { width: 76px; height: 76px; border-radius: 12px; flex: none; }
.mini-post .d { font-size: 12px; color: var(--muted); }
.mini-post .t { font-weight: 600; line-height: 1.25; margin-top: 2px; }

/* ---------- Common controls ---------- */
.sub { margin: 6px 0 0; color: var(--muted); font-size: 17px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { font-size: 13px; font-weight: 500; padding: 7px 14px; border-radius: 999px; background: var(--soft); color: var(--text); transition: background .25s, color .25s, transform .2s; }
.chips button:hover { background: #e8e8ed; }
.chips button.active { background: var(--text); color: #fff; }
.chips button:active { transform: scale(.96); }
.round { width: 34px; height: 34px; border-radius: 50%; background: var(--soft); font-size: 19px; line-height: 1; display: grid; place-items: center; transition: background .2s, opacity .2s, transform .2s; }
.round:hover { background: #e8e8ed; }
.round:active { transform: scale(.92); }
.round:disabled { opacity: .35; cursor: default; }
.link-btn { color: var(--accent); font-size: 15px; font-weight: 500; }
.link-btn:hover { text-decoration: underline; }

/* ---------- Timeline ---------- */
.tl-toolbar {
  position: fixed; top: calc(var(--nav) + 10px); left: 22px; right: 22px; z-index: 4;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap;
}
body:not([data-view=timeline]) .tl-toolbar { transform: translateY(-10px); }
.tl-toolbar h2 { font-size: 34px; font-weight: 700; line-height: 1.1; }
.tl-toolbar .sub { font-size: 15px; margin-top: 8px; }
.tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.zoom { display: flex; gap: 6px; }
.tl-bottom { position: fixed; left: 0; right: 0; bottom: 8px; z-index: 4; }
.hint { text-align: center; font-family: var(--hand); font-size: 19px; color: var(--faint); margin: 2px 0 0; }

.tl-viewport {
  position: fixed; left: 0; right: 0; z-index: 3; overflow: hidden;
  cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; outline: none;
  transition: top var(--move), height var(--move), opacity .7s var(--ease), transform var(--move), background .5s, visibility 0s;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 48px, #000 calc(100% - 48px), transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 48px, #000 calc(100% - 48px), transparent 100%);
}
body[data-view=home] .tl-viewport { cursor: zoom-in; }
body[data-view=post-tl] .tl-viewport { background: rgba(255,255,255,.94); }
.tl-viewport.dragging { cursor: grabbing; }
.tl-viewport.dragging .tl-card { transition-property: top, width, height, opacity; }
.tl-track { position: relative; height: 100%; --ppd: 4px; --pad: 140px; --axis: 128px; }
.tl-track > * { --x: calc(var(--pad) + var(--d) * var(--ppd)); }

.tick-month { position: absolute; top: calc(var(--axis) + 8px); bottom: 0; left: var(--x); transition: top var(--move); width: 4px; margin-left: -2px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 100' preserveAspectRatio='none'%3E%3Cpath d='M2 0 C1.2 20 2.8 40 2 60 S1.4 85 2.2 100' fill='none' stroke='%23e2e2e6' stroke-width='1.1' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") center / 4px 100% no-repeat; }
.tick-month span { position: absolute; bottom: 22px; left: 9px; font-family: var(--hand); font-size: 21px; font-weight: 600; white-space: nowrap; color: var(--pencil); transition: bottom var(--move), color .8s; }
.st-mini .tick-month span { color: #c2c2c7; }
.st-strip .tick-month span { bottom: 6px; font-size: 18px; }
.st-strip .tick-day { display: none !important; }
.tick-month b { font-weight: 600; }
.tick-month em { font-style: normal; font-weight: 500; color: var(--faint); }
.tick-month .s, .tick-month .n, .tl-track.z-short .tick-month .l, .tl-track.z-tiny .tick-month .s { display: none; }
.tl-track.z-short .tick-month .s { display: inline; }
.tl-track.z-tiny .tick-month .n { display: inline; }
.tl-track.z-tiny .tick-month .s { display: none; }
.tl-track.z-tiny .tick-month span { left: 4px; font-size: 16px; }
.tl-track.z-short .tick-month em { display: none; }
.tl-track.st-mini .tick-month span { bottom: 12px; font-size: 19px; }
.tick-day { position: absolute; bottom: 0; height: 7px; left: var(--x); width: 4px; margin-left: -2px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 100' preserveAspectRatio='none'%3E%3Cpath d='M2 0 C1.2 20 2.8 40 2 60 S1.4 85 2.2 100' fill='none' stroke='%23a9a9ae' stroke-width='1.1' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") center / 4px 100% no-repeat; display: none; }
.tick-day span { position: absolute; bottom: 7px; left: -8px; width: 20px; text-align: center; font-size: 10px; color: var(--faint); }
.tl-track.z-week .tick-day.wk, .tl-track.z-day .tick-day { display: block; }
.tl-track.z-week .tick-month span { bottom: 26px; }

.tl-axis, .tl-axis-past > div { position: absolute; left: var(--pad); width: calc(var(--d) * var(--ppd)); top: calc(var(--axis) - 6px); height: 12px; transition: top var(--move); }
.tl-axis-past { position: absolute; left: var(--pad); width: calc(var(--d) * var(--ppd)); top: calc(var(--axis) - 6px); height: 12px; overflow: hidden; transition: top var(--move); }
.tl-axis-past > div { left: 0; top: 0; }
.tl-arrow { position: absolute; left: calc(var(--x) - 15px); top: calc(var(--axis) - 10px); width: 20px; height: 20px; transition: top var(--move); }
.tl-arrow svg { display: block; width: 100%; height: 100%; overflow: visible; }
.tl-arrow path { fill: none; stroke: #b4b4b9; stroke-width: 1.6; stroke-linecap: round; }
.tl-axis svg, .tl-axis-past svg { display: block; width: 100%; height: 100%; overflow: visible; }
.tl-axis path, .tl-axis-past path { fill: none; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.tl-axis path { stroke: #cfcfd4; stroke-width: 1.4; }
.tl-axis-past path { stroke: var(--pencil); stroke-width: 1.7; }

.tl-future {
  position: absolute; top: 0; bottom: 0; left: var(--x); right: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='46' height='46'%3E%3Cg stroke='%23000' stroke-opacity='.07' stroke-width='1' stroke-linecap='round'%3E%3Cpath d='M2 22 L22 3'/%3E%3Cpath d='M9 26 L28 6.5'/%3E%3Cpath d='M17 29 L34 11'/%3E%3Cpath d='M26 44 L44 25'/%3E%3C/g%3E%3C/svg%3E");
}
/* start page: shading of the future only underneath the timeline */
.tl-future { transition: top var(--move); }
.st-mini .tl-future { top: calc(var(--axis) + 8px); }
.tl-future-label { position: absolute; top: calc(var(--axis) + 18px); left: 28px; font-family: var(--hand); font-size: 22px; font-weight: 500; color: var(--faint); white-space: nowrap; transition: opacity .4s, top var(--move); }
.st-mini .tl-future-label, .st-strip .tl-future-label { opacity: 0; }
.tl-now { position: absolute; top: 44px; bottom: 50px; left: var(--x); width: 4px; margin-left: -2px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 100' preserveAspectRatio='none'%3E%3Cpath d='M2 0 C1.2 20 2.8 40 2 60 S1.4 85 2.2 100' fill='none' stroke='%23127fa3' stroke-width='1.6' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") center / 4px 100% no-repeat; }
.tl-now > span { position: absolute; top: -40px; left: -4px; font-size: 26px; color: var(--crayon); white-space: nowrap; transform: rotate(-4deg); transition: opacity .4s; }
.tl-now .now-arrow { position: absolute; top: -12px; left: 4px; transition: opacity .4s; }
.st-mini .tl-now, .st-strip .tl-now { background: none; }
.st-mini .tl-now > span, .st-mini .now-arrow, .st-strip .tl-now > span, .st-strip .now-arrow { opacity: 0; }
.tl-now::after {
  content: ""; position: absolute; top: calc(var(--axis) - 44px - 5px); left: -3.5px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent); animation: pulse 2.4s infinite; transition: top var(--move);
}
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(18,127,163,.45); } 70% { box-shadow: 0 0 0 12px rgba(18,127,163,0); } 100% { box-shadow: 0 0 0 0 rgba(18,127,163,0); } }

/* title of the story being read, above its dot in the strip */
.tl-cur { position: absolute; left: var(--x); top: calc(var(--axis) - 42px); transform: translateX(-50%); font-size: 21px; color: var(--crayon); white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .4s, left .1s; }
.st-strip .tl-cur.on { opacity: 1; transition: opacity .6s .5s; }
.st-strip .tl-dot:hover::after { top: 18px; transform: translate(-50%, 0) scale(.67); transform-origin: top center; }

/* start-page-only notes on the timeline */
.mini-only { opacity: 0; pointer-events: none; transition: opacity .4s; }
.st-mini .mini-only { opacity: 1; pointer-events: auto; transition: opacity .8s .5s; }
.tl-here { position: absolute; left: calc(var(--x) + 8px); top: calc(var(--axis) + 6px); display: flex; align-items: flex-start; gap: 2px; }
.tl-here .hand { font-size: 23px; color: var(--crayon); margin-top: 18px; white-space: nowrap; }
.tl-newest { position: absolute; left: calc(var(--x) - 150px); top: 2px; display: flex; align-items: flex-start; gap: 4px; }
.tl-newest .hand { font-size: 21px; color: var(--crayon); white-space: nowrap; line-height: 1; }
.tl-hl {
  position: absolute; left: var(--x); top: calc(var(--axis) + 12px + var(--row) * 20px); transform: translateX(-50%);
  font-size: 19px; font-weight: 600; color: var(--pencil); white-space: nowrap; line-height: 1.1;
}
.tl-hl:hover { color: var(--crayon); }
.tl-track:not(.hl-on) .tl-hl { opacity: 0 !important; pointer-events: none; }

.tl-dot {
  position: absolute; top: var(--axis); left: var(--x); width: 12px; height: 12px; margin: -5px 0 0 -6px;
  border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px #fff;
  transition: transform .3s var(--ease), opacity .4s, top var(--move);
}
.tl-dot:hover, .tl-dot.hot { transform: scale(1.5); }
.tl-dot.current { transform: scale(1.6); box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--crayon); }
.st-mini .tl-dot:not(.hl):not(.is-latest) { opacity: 0; transform: scale(.2); pointer-events: none; }
.st-mini .tl-dot.hl { transform: scale(1.25); }
.tl-dot::after {
  content: attr(data-title); position: absolute; left: 50%; top: -12px; transform: translate(-50%, -100%) scale(.67);
  background: rgba(29,29,31,.9); color: #fff; font-size: 12px; font-weight: 500; padding: 5px 10px; border-radius: 8px;
  white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .2s;
}
.tl-dot:hover::after { opacity: 1; }
.st-mini .tl-dot::after { display: none; }
.tl-stem {
  position: absolute; left: var(--x); width: 4px; margin-left: -2px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 100' preserveAspectRatio='none'%3E%3Cpath d='M2 0 C1.2 20 2.8 40 2 60 S1.4 85 2.2 100' fill='none' stroke='%238e8e93' stroke-width='1.1' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") center / 4px 100% no-repeat;
  transition: top .7s var(--ease), height .7s var(--ease), opacity .4s;
}
.tl-card {
  position: absolute; left: calc(var(--x) - 18px - var(--shift, 0px)); top: 0;
  width: 250px; height: 196px; border-radius: 18px; overflow: hidden;
  background: #fff; box-shadow: var(--shadow); cursor: pointer; text-align: left;
  transition: top .7s var(--ease), width .5s var(--ease), height .5s var(--ease), border-radius .5s var(--ease),
              opacity .4s, transform .45s var(--ease), box-shadow .45s var(--ease);
}
.tl-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); z-index: 5; }
.tl-card.current { box-shadow: 0 0 0 2px var(--crayon), var(--shadow); z-index: 4; }
.tl-card.off, .tl-stem.off { opacity: 0; pointer-events: none; }
.tl-card.off { transform: scale(.9); }
.tl-card [data-thumb] { position: absolute; top: 0; left: 0; width: 100%; height: 120px; border-radius: 0; transition: all .5s var(--ease); }
.tl-card .meta { position: absolute; top: 120px; left: 0; right: 0; padding: 11px 16px; transition: all .5s var(--ease); }
.tl-card .date { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-card .date i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--c); margin-right: 6px; vertical-align: 1px; }
.tl-card .title { font-size: 16px; font-weight: 600; line-height: 1.25; margin-top: 3px; letter-spacing: -0.015em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tl-card .badge { position: absolute; top: 6px; right: 12px; z-index: 2; color: #fff; font-size: 24px; transform: rotate(-8deg); text-shadow: 0 1px 6px rgba(0,0,0,.25); transition: opacity .3s; }
.tl-track.compact .tl-card { width: 196px; height: 56px; border-radius: 14px; }
.tl-track.compact .tl-card [data-thumb] { top: 6px; left: 6px; width: 44px; height: 44px; border-radius: 10px; }
.tl-track.compact .tl-card .meta { top: 0; left: 50px; padding: 8px 12px 0 10px; }
.tl-track.compact .tl-card .title { font-size: 13px; -webkit-line-clamp: 1; margin-top: 1px; }
.tl-track.compact .tl-card .date { font-size: 11px; }
.tl-track.compact .tl-card .badge, .st-mini .tl-card .badge { opacity: 0; }
/* the newest story on the start page */
.st-mini .tl-card { width: 260px; height: 76px; border-radius: 16px; }
.st-mini .tl-card [data-thumb] { top: 6px; left: 6px; width: 64px; height: 64px; border-radius: 11px; }
.st-mini .tl-card .meta { top: 0; left: 70px; padding: 11px 12px 0 10px; }
.st-mini .tl-card .title { font-size: 15px; }

/* overview scrubber */
.tl-overview { position: relative; height: 46px; margin: 0 48px; cursor: pointer; touch-action: none; user-select: none; }
.ov-line { position: absolute; left: 0; right: 0; top: 15px; height: 2px; border-radius: 2px; background: var(--hair); }
.ov-past { position: absolute; left: 0; top: 15px; height: 2px; border-radius: 2px; background: var(--pencil); }
.ov-dot { position: absolute; top: 16px; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1.5px #fff; }
.ov-month { position: absolute; top: 28px; font-size: 10px; color: var(--faint); transform: translateX(-50%); white-space: nowrap; }
.ov-window { position: absolute; top: 2px; height: 28px; min-width: 10px; background: rgba(18,127,163,.06); border: 1.5px solid rgba(18,127,163,.6); border-radius: 10px 7px 11px 8px; cursor: grab; }
.tl-overview.dragging .ov-window { cursor: grabbing; }

/* ---------- Placeholder art ---------- */
.art { background: var(--art, #ddd); background-size: cover; background-position: center; position: relative; overflow: hidden; }
.art::before {
  content: ""; position: absolute; inset: 0; z-index: 1; mix-blend-mode: multiply; opacity: .5;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 .45 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.art.photo::before, .art.photo::after { display: none; }
.art::after {
  content: ""; position: absolute; left: -2%; right: -2%; bottom: 8%; height: 34%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 100' preserveAspectRatio='none'%3E%3Cg fill='none' stroke='white' stroke-linecap='round'%3E%3Cpath d='M-5 30 C40 18 80 44 130 30 S220 14 270 28 S350 40 405 24' stroke-opacity='.7' stroke-width='1.4' vector-effect='non-scaling-stroke'/%3E%3Cpath d='M20 34 C60 26 110 42 150 33' stroke-opacity='.35' stroke-width='1' vector-effect='non-scaling-stroke'/%3E%3Cpath d='M-5 62 C60 50 120 76 190 60 S320 48 405 64' stroke-opacity='.55' stroke-width='1.2' vector-effect='non-scaling-stroke'/%3E%3Cpath d='M60 88 C120 80 170 96 240 86 S330 80 380 90' stroke-opacity='.4' stroke-width='1' vector-effect='non-scaling-stroke'/%3E%3C/g%3E%3C/svg%3E") center / 100% 100% no-repeat;
}

/* ---------- List ---------- */
.list-panel { position: fixed; top: var(--nav); left: 0; right: 0; bottom: 0; z-index: 5; overflow-y: auto; background: #fff; }
body:not([data-view=list]) .list-panel { transform: translateY(24px); }
.list-inner { max-width: 1180px; margin: 0 auto; padding: 28px 22px 60px; }
.list-inner h2 { font-size: 40px; font-weight: 700; line-height: 1.1; }
.cat-chips { margin: 22px 0 8px; }
.chips button .n { color: var(--faint); margin-left: 4px; }
.chips button.active .n { color: rgba(255,255,255,.6); }
.chips button .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.cat-section { margin-top: 44px; }
.cat-section h3 { font-size: 28px; font-weight: 700; display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.cat-section h3 .dot { width: 12px; height: 12px; border-radius: 50%; }
.cat-section h3 small { font-size: 17px; font-weight: 500; color: var(--faint); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; }
.card {
  display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch;
  text-align: left; width: 100%; border-radius: 22px; overflow: hidden; background: #fff; box-shadow: var(--shadow);
  opacity: 0; transform: translateY(20px); animation: cardIn .8s var(--ease) forwards; animation-delay: var(--delay, 0s);
  transition: box-shadow .45s var(--ease);
}
.card:hover { box-shadow: var(--shadow-lg); }
.card .ph { overflow: hidden; }
.card .art { aspect-ratio: 4 / 3; transition: transform 1.2s var(--ease); }
.card:hover .art { transform: scale(1.04); }
.card .bd { padding: 16px 20px 22px; }
.card .d { font-size: 13px; color: var(--muted); }
.card .t { font-size: 20px; font-weight: 700; line-height: 1.2; margin: 4px 0 8px; letter-spacing: -0.02em; }
.card .x { font-size: 15px; color: var(--muted); margin: 0; }
@keyframes cardIn { to { opacity: 1; transform: none; } }

/* ---------- Story reader ---------- */
.reader { position: fixed; right: 0; bottom: 0; z-index: 6; overflow-y: auto; background: #fff; overscroll-behavior: contain; }
body[data-view^=post] .reader { top: calc(var(--nav) + var(--strip)); left: 0; border-top: 1px solid var(--hair); }
body:not([data-view^=post]) .reader { top: calc(var(--nav) + var(--strip)); left: 0; transform: translateY(40px); }
.reader-inner { max-width: 780px; margin: 0 auto; padding: 28px 28px 70px; }
.close {
  position: sticky; top: 14px; float: right; margin: 14px 14px 0 0; z-index: 3;
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--soft); color: var(--text); transition: background .2s, transform .2s;
}
.close:hover { background: #e8e8ed; transform: scale(1.06); }
.post-figure { position: relative; }
#post-doodle .doodle { position: absolute; right: -20px; bottom: -30px; }
.post-hero { aspect-ratio: 5 / 2; max-height: 40vh; width: 100%; border-radius: 22px; }
.post-hero.hide { visibility: hidden; }
.post-body { padding: 30px 8px 0; }
body[data-view^=post] .post-body { animation: fadeUp .8s var(--ease) .2s backwards; }
.post-eyebrow { font-size: 15px; font-weight: 600; margin: 0 0 8px; }
.post-body h1 { font-size: clamp(32px, 5vw, 48px); font-weight: 700; line-height: 1.08; letter-spacing: -0.03em; }
.post-meta { color: var(--muted); margin: 12px 0 0; font-size: 15px; }
.post-text { margin-top: 26px; }
.post-text p { font-size: 19px; line-height: 1.6; margin: 0 0 1.1em; }
.post-where { display: flex; align-items: center; gap: 22px; margin-top: 26px; padding: 20px; background: var(--soft); border-radius: 20px; }

.post-where { cursor: pointer; transition: background .25s, transform .25s var(--ease); }
.post-where:hover { background: #ececf0; }
.post-where:hover .go { color: var(--crayon); }
.post-where .go { margin: 4px 0 0; font-size: 14px; color: var(--faint); transition: color .2s; }
#post-map { width: 118px; height: 128px; flex: none; }
#post-map .land { fill: #fff; stroke: var(--pencil); stroke-width: 5; }
#post-map .land.faint { fill: none; stroke-width: 3.5; opacity: .4; }
#post-map .ring { fill: none; stroke: var(--crayon); stroke-width: 7; stroke-linecap: round; }
.post-where .label { margin: 0; font-family: var(--hand); font-size: 20px; color: var(--crayon); }
.post-where .place { margin: 2px 0 0; font-size: 21px; font-weight: 600; }
.post-nav { display: flex; justify-content: space-between; gap: 16px; margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--hair); }
.post-nav button { max-width: 48%; text-align: left; color: var(--accent); font-size: 15px; line-height: 1.35; }
.post-nav button small { display: block; color: var(--faint); font-size: 12px; }
.post-nav button:last-child { text-align: right; margin-left: auto; }
.post-nav button:disabled { visibility: hidden; }
.post-nav button:hover span { text-decoration: underline; }
.ghost { position: fixed; z-index: 80; pointer-events: none; }
.post-hero.zoomable { cursor: zoom-in; }

/* photos & videos inside a story */
.post-media { display: flex; flex-direction: column; gap: 18px; margin-top: 8px; }
.post-media:empty { display: none; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.g-item { aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--soft); cursor: zoom-in; }
.g-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .8s var(--ease); }
.g-item:hover img { transform: scale(1.05); }
.embed { border-radius: 18px; overflow: hidden; background: var(--soft); }
.embed.yt { aspect-ratio: 16 / 9; }
.embed iframe { display: block; width: 100%; height: 100%; border: 0; }
.embed.ig.live { max-width: 480px; margin: 0 auto; width: 100%; background: #fff; border: 1px solid var(--hair); }
.embed.ig.live iframe { height: 640px; }
.embed-cover {
  position: relative; display: flex; align-items: flex-end; width: 100%; height: 100%; min-height: 120px; text-align: left;
  background: #1d1d1f center / cover no-repeat; color: #fff;
}
.embed.yt .embed-cover::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 45%, rgba(0,0,0,.55)); }
.embed .play {
  position: absolute; left: 50%; top: 50%; width: 68px; height: 68px; margin: -34px 0 0 -34px; border-radius: 50%;
  background: rgba(255,255,255,.92); box-shadow: 0 8px 24px rgba(0,0,0,.25); transition: transform .3s var(--ease);
}
.embed .play::after { content: ""; position: absolute; left: 27px; top: 22px; border-style: solid; border-width: 12px 0 12px 19px; border-color: transparent transparent transparent var(--pencil); }
.embed-cover:hover .play { transform: scale(1.08); }
.embed-meta { position: relative; display: flex; flex-direction: column; padding: 16px 20px; }
.embed-meta b { font-size: 17px; line-height: 1.3; }
.embed-meta small { font-size: 12px; opacity: .8; margin-top: 2px; }
.ig-cover { align-items: center; gap: 4px; padding: 6px 10px; min-height: 96px; background: linear-gradient(120deg, #feda75, #fa7e1e 30%, #d62976 60%, #962fbf 85%, #4f5bd5); }
.ig-logo { flex: none; width: 46px; height: 46px; margin-left: 12px; border: 3px solid #fff; border-radius: 14px; position: relative; }
.ig-logo::before { content: ""; position: absolute; inset: 9px; border: 3px solid #fff; border-radius: 50%; }
.ig-logo::after { content: ""; position: absolute; right: 5px; top: 5px; width: 5px; height: 5px; border-radius: 50%; background: #fff; }

/* lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 120; display: grid; place-items: center;
  background: rgba(250,250,252,.94); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  opacity: 0; transition: opacity .3s var(--ease);
}
.lightbox.open { opacity: 1; }
.lightbox img { max-width: calc(100vw - 150px); max-height: calc(100vh - 110px); border-radius: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.18);
  opacity: 0; transform: scale(.97); transition: opacity .35s var(--ease), transform .45s var(--ease); user-select: none; -webkit-user-drag: none; }
.lightbox img.in { opacity: 1; transform: none; }
.lb-close, .lb-prev, .lb-next {
  position: absolute; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; box-shadow: var(--shadow); font-size: 26px; line-height: 1; color: var(--text); transition: transform .2s;
}
.lb-close { top: 18px; right: 18px; }
.lb-prev { left: 22px; top: 50%; margin-top: -22px; }
.lb-next { right: 22px; top: 50%; margin-top: -22px; }
.lb-prev:hover, .lb-next:hover, .lb-close:hover { transform: scale(1.08); }
.lightbox.single .lb-prev, .lightbox.single .lb-next { display: none; }
.lb-count { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; margin: 0; font-size: 22px; color: var(--faint); }
@media (max-width: 760px) {
  .lightbox img { max-width: calc(100vw - 24px); }
  .lb-prev, .lb-next { top: auto; bottom: 14px; margin: 0; }
  .gallery { grid-template-columns: repeat(3, 1fr); gap: 6px; }
}

/* category doodles */
.doodle { overflow: visible; }
.doodle path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.doodle .halo path { stroke: #fff; stroke-width: 7; opacity: .9; }
.doodle .ink path { stroke: var(--pencil); stroke-width: 2.3; }
.doodle.bare .halo { display: none; }
.reader .doodle .ink path { stroke-dasharray: 1; stroke-dashoffset: 1; }
body[data-view^=post] .reader .doodle .ink path { animation: drawIn .6s cubic-bezier(.6,.05,.3,1) forwards; animation-delay: calc(.7s + var(--i) * .14s); }
.cat-sketch { display: inline-block; width: 76px; height: 76px; margin: -28px 0 -28px 6px; transform: rotate(-6deg); pointer-events: none; }
.cat-sketch .doodle .ink path { stroke: #c7c7cc; stroke-width: 2.4; }
/* bigger sketch beside the story when there is room */
.reader-doodle { display: none; position: absolute; top: 330px; width: 190px; text-align: center; pointer-events: none; }
.reader-doodle { left: calc(50% - 390px - 230px); transform: rotate(-3deg); }
.reader-doodle .hand { display: block; font-size: 24px; color: var(--faint); margin-top: 4px; }
.reader-inner { position: relative; }
.reader { overflow-x: hidden; }
@media (min-width: 1240px) { body[data-view^=post] .reader-doodle { display: block; } }

/* ---------- Small screens ---------- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .nav-inner { grid-template-columns: auto 1fr; padding: 0 14px; }
  .nav-links { display: none; }
  body[data-view=home] .imprint-link { display: block; position: fixed; left: 14px; bottom: 16px; z-index: 5; font-size: 12px; color: var(--faint); text-decoration: none; }
  .scroll-hint { left: auto; right: 14px; text-align: right; }
  .seg { justify-self: end; }
  .seg button { padding: 5px 10px; }
  .seg button[data-mode=home] span { display: none; }
  .seg .house { margin-right: 0; }
  .brand span { display: none; }
  .scroll-hint { font-size: 19px; }
  .tl-toolbar h2 { font-size: 28px; }
  .tl-overview { margin: 0 14px; }
  .tl-viewport { -webkit-mask-image: none; mask-image: none; }
  body[data-view=map] #map-svg { left: 8px; width: calc(100vw - 16px); height: 52vh; }
  .map-panel { top: calc(var(--nav) + 52vh + 8px); width: auto; left: 0; padding: 8px 16px 30px; }
  .map-panel h2 { display: none; }
  #post-doodle .doodle { right: -6px; width: 64px; height: 64px; }
  .reader-inner { padding: 16px 16px 50px; }
  .post-text p { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
