:root{
  --bg:#08080a;--ink:#f4f2ec;--dim:#8a877d;--line:#26262c;--surface:#141419;--text2:#dddad3;
  --art:#ff5a36;--fiction:#19c3c3;--language:#f5b21a;--philosophy:#a56bff;--history:#3dbe5a;
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
html{background:var(--bg)}
body{background:transparent;color:var(--ink);font-family:"Space Grotesk",system-ui,sans-serif; overflow:hidden;height:100vh}
.bgvideo{position:fixed;inset:0;width:100%;height:100%;object-fit:cover;z-index:-1;opacity:.5;pointer-events:none}

a {color:var(--ink)}
a:hover {color: #fff}

.panel{position:fixed;top:20px;left:24px;z-index:30;max-width:calc(100vw - 48px)}
.brand{font-family:"Fraunces";font-weight:600;font-size:24px;letter-spacing:-.01em}
.filters{display:flex;gap:7px;align-items:center;margin-top:13px}
.chip{font:inherit;font-size:12.5px;cursor:pointer;border:2px solid transparent;color:var(--bg);
  padding:4px 13px;border-radius:20px;font-weight:500;box-shadow:0 0 0 1px rgba(255,255,255,.08);transition:.13s}
.chip:hover{transform:translateY(-1px)}
.chip.all{background:var(--ink)}.chip.art{background:var(--art)}.chip.fiction{background:var(--fiction)}
.chip.language{background:var(--language)}.chip.philosophy{background:var(--philosophy)}.chip.history{background:var(--history)}
.chip[data-on="1"]{border-color:#fff}
.tools{display:flex;gap:7px;align-items:center;margin-top:12px}
select.tool{font:inherit;font-size:12.5px;cursor:pointer;background:var(--bg);border:2px solid var(--line); padding:5px 14px;border-radius:20px;color:var(--ink);appearance:none;padding-right:26px}
select.tool option{background:var(--bg);color:var(--ink)}
input.search{font:inherit;font-size:12.5px;background:var(--bg);border:2px solid var(--line);padding:5px 14px;border-radius:20px;color:var(--ink);width:150px}
input.search::placeholder{color:var(--dim)}
.modal .more{margin-top:22px}
.modal .more a{display:inline-block;font-size:13px;font-weight:500;color:var(--bg);background:var(--ink);padding:8px 18px;border-radius:20px;text-decoration:none;transition:.13s}
.modal .more a:hover{transform:translateY(-1px)}

.stage{position:absolute;inset:0;overflow:auto;scrollbar-width:none;z-index:2}
.stage::-webkit-scrollbar{display:none}
.canvas{position:relative}
svg.axis{position:absolute;left:0;top:0;z-index:1;pointer-events:none}
.node{position:absolute;z-index:3;cursor:pointer;transition:transform .2s ease}
.node:hover{transform:rotate(0deg) scale(1.05)!important;z-index:20}
.node .pic{overflow:hidden;border-radius:3px;box-shadow:0 12px 34px rgba(0,0,0,.55);border:1px solid rgba(255,255,255,.08);background:var(--surface)}
.node .pic img,.node .pic svg{width:100%;height:100%;object-fit:cover;display:block}
.node.hasimg .pic{width:fit-content;height:fit-content}
.node.hasimg .pic img{max-width:190px;max-height:min(230px,26vh)}
.node .tag{margin-top:8px}
.node .yr{font-family:"Fraunces";font-weight:700;font-size:36px;line-height:1}
.node .ti{font-size:18px;color:var(--text2);margin-top:3px;max-width:300px;line-height:1.25}
.node .ti .dot{width:9px;height:9px;border-radius:50%;display:inline-block;margin-right:5px;vertical-align:middle}
.node .precis{font-size:12.5px;color:#b5b1a5;margin-top:5px;max-width:240px;line-height:1.4; display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.node.hidden{display:none}
.stem{display:none}
.stem.hidden{display:none}
.dot.art{background:var(--art)}.dot.fiction{background:var(--fiction)}.dot.language{background:var(--language)}
.dot.philosophy{background:var(--philosophy)}.dot.history{background:var(--history)}

.hint{margin-top:10px; font-size:12px;color:#fff}

.overlay{position:fixed;inset:0;background:rgba(4,4,6,.95);z-index:50;display:none;align-items:flex-start;justify-content:center;padding:5vh 5vw;overflow:auto}
.overlay[data-open="1"]{display:flex}
.modal{background:var(--surface);width:100%;border-radius:6px}
.modal.side{max-width:1000px;display:flex;align-items:stretch;background-color: var(--line)}
.modal.stack{max-width:820px}
.modal .media{display:flex;align-items:center;justify-content:center}
.modal.side .media{align-items:flex-start;width:48%;padding:30px;min-height:420px}
.modal.stack .media{width:100%;padding:18px}
.modal.stack .media img,.modal.stack .media svg{height:auto;object-fit:unset}
.modal .media img,.modal .media svg,.modal .media webp{width:100%;height:100%;object-fit:contain;object-position:top;display:block}
.modal.side .media img,.modal.side .media svg{max-height:64vh}
.modal .inner{padding:30px 30px 40px 15px}
.modal.side .inner{width:52%;align-self:center}
.modal{position:relative}
.mnav-btn{position:absolute;top:80px;width:30px;height:49px;background:none;border:0;padding:0;color:var(--ink);cursor:pointer;display:flex;align-items:center;justify-content:center;z-index:52;filter:drop-shadow(0 2px 6px rgba(0,0,0,.6));transition:opacity .16s,transform .16s}
.mnav-btn svg{width:20px;height:30px;display:block}
.mnav-btn.prev{left:-16px}
.mnav-btn.next{right:-16px}
.mnav-btn:hover:not(:disabled){transform:scale(1.12)}
.mnav-btn:disabled{display:none}
.modal .yr{font-family:"Fraunces";font-weight:600;font-size:56px;line-height:.9}
.modal h2{font-size:26px;font-weight:500;margin:8px 0 18px;color:#d9d5ca}
.modal .prose{font-family:"Fraunces";font-size:16px;line-height:1.62;color:var(--text2);overflow-wrap:break-word}
.modal .prose .loading{color:var(--dim);font-style:italic}
.modal .prose p{margin-bottom:1em}
.modal .prose p:last-child{margin-bottom:0}
.modal .prose a.xref{cursor:pointer}
.modal .prose a.xref::after{content:"\2197";font-size:0.8em;margin-left:2px;vertical-align:super}
.modal .prose img{max-width:100%;height:auto;display:block;margin:1em 0}
.modal .prose ol{margin:0 0 1em;padding-left:0;list-style:none;counter-reset:item}
.modal .prose ol li{counter-increment:item;padding-left:2.2em;position:relative}
.modal .prose ol li::before{content:counter(item) ".";position:absolute;left:0;text-align:left}
.modal .prose ol p{margin-bottom:0}
.modal .prose hr {border:0;height: 2px;background: var(--dim);margin: 1.6em 0}
.modal .cats{display:flex;gap:16px;margin-top:22px;font-size:13px;color:var(--dim)}
.modal .cats span{display:flex;align-items:center;gap:6px}
.modal .cats .dot{width:8px;height:8px;border-radius:50%}
.close{position:absolute;top:4vh;right:4vw;width:64px;height:64px;border-radius:50%;background:#25252f;border:0;color:var(--ink);font-size:64px;line-height:1;cursor:pointer;z-index:51; display:flex;align-items:center;justify-content:center;transition:background .16s,transform .16s}
.close:hover{background:#3d3d51;transform:scale(1.1)}
.info{position:fixed;right:18px;bottom:34px;z-index:40;width:34px;height:34px;border-radius:50%;background:var(--bg);border:2px solid var(--ink);color:var(--ink);font-family:"Fraunces",serif;font-size:19px;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0;transition:.13s}
.info:hover{background:var(--surface);transform:scale(1.1)}
.vidtoggle{position:fixed;right:60px;bottom:34px;z-index:40;width:34px;height:34px;border-radius:50%;background:var(--bg);border:2px solid var(--ink);color:var(--ink);cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0;transition:.13s}
.vidtoggle svg{width:16px;height:16px;display:block}
.vidtoggle:hover{background:var(--surface);transform:scale(1.1)}
.modal.about{max-width:760px}
.modal.about .inner{padding:36px 40px 44px}
.modal.about h2{font-family:"Fraunces";font-size:30px;font-weight:600;margin:0 0 20px}

/* scrubber: full width at the foot, click or drag to move through time */
.scrub{position:fixed;left:0;right:0;bottom:0;height:20px;z-index:40;cursor:pointer;
  touch-action:none;transition:transform .28s ease}
.scrub.away{transform:translateY(160%)}
.scrub .track{position:absolute;left:0;right:0;top:7px;height:6px;border-radius:3px;background:#2d2d36}
.scrub .thumb{position:absolute;top:5px;height:10px;min-width:26px;border-radius:3px;background:var(--ink)}

/* desktop: the timeline can be dragged to reposition it */
@media (min-width:900px){
  .stage{cursor:grab}
  .stage.dragging,.stage.dragging .node{cursor:grabbing}
}

@media (max-width:760px){
  /* a) filter chips fit the screen width on one line */
  .panel{left:14px;width:calc(100vw - 28px);max-width:none}
  .filters{flex-wrap:nowrap;gap:4px;width:100%}
  .chip{font-size:10.5px;padding:4px 7px;white-space:nowrap;flex:1 1 auto;min-width:0}

  /* b) search fills the space left by jump to */
  .tools{width:100%;gap:6px}
  select.tool{flex:0 0 auto}
  input.search{flex:1 1 auto;width:auto;min-width:0}

  /* c) info button bottom left, smaller */
  .info{right:auto;left:14px;bottom:30px;width:28px;height:28px;font-size:16px}
  .vidtoggle{right:auto;left:50px;bottom:30px;width:28px;height:28px}
  .vidtoggle svg{width:14px;height:14px}

  /* d) modal side padding halved */
  .modal .inner{padding:30px 20px 40px}
  .modal.about .inner{padding:36px 20px 44px}

  /* e) every entry stacks: image on top, text full width below */
  .modal.side{display:block;max-width:100%}
  .modal.side .media{width:100%;padding:14px;min-height:0}
  .modal.side .media img,.modal.side .media svg{max-height:40vh;object-fit:contain}
  .modal.side .inner{width:100%}

  /* image height relative to the viewport so the band stays on screen */
  .node.hasimg .pic img{max-width:38vw;max-height:17vh}

  /* chevrons to the screen edges, close button top centre */
  .mnav-btn{position:fixed;top:80px}
  .mnav-btn.prev{left:4px}
  .mnav-btn.next{right:4px}
  .close{top:10px;right:auto;left:50%;transform:translateX(-50%);width:48px;height:48px;font-size:48px}
  .close:hover{transform:translateX(-50%) scale(1.1)}
}
