/* Layout: one tall white room. A spiral of works turns at the centre (Explore). Choosing a work grows the Entry around it;
   choosing a fragment inside brings it forward to inspect. Index is the plain map of everything. Content sits low, air above. */
/* Single deliberate look (BLAKK MATTER paper wall), so no dark variant. */
:root{
  --paper:#FAFAF9; --chalk:#FFFFFF; --limestone:#E9E5DE; --seafoam:#D2E0D8;
  --rain:#BFC7CA; --ash:#6B6E6B; --ink:#17171A; --body:#3A3B3F; --hair:rgba(23,23,26,.08);
  --sans:"Liberation Sans","Arimo",Arial,sans-serif;
  --mark:"Archivo Narrow","Liberation Sans Narrow","Arial Narrow",sans-serif;
  --ease:cubic-bezier(.16,1,.3,1);
  /* TIME is musical: one beat; every duration a whole-number interval of it */
  --beat:800ms; --octave-up:400ms; --fourth:600ms; --fifth:1200ms; --octave:1600ms;
  --fade:var(--beat); --fade-slow:var(--fifth);
  --reader-idle:.14;   /* decision 3: the reader at idle in Explore */
  /* TYPE is musical: every size an interval from the 13px body; the name alone is golden */
  --t-body:13px; --t-meta:10.4px; --t-lede:14.625px; --t-display:29.25px; --t-mark:21.034px;
  /* SPACE is golden: 8 x Fibonacci */
  --f1:8px; --f2:16px; --f3:24px; --f5:40px; --f8:64px; --f13:104px;
  --edge:clamp(0px, calc(7.2vw - 16px), 88px);
  color-scheme:light;
}
html,body{height:100%;background:var(--paper);color:var(--ink)}
body{font-family:var(--sans);-webkit-font-smoothing:antialiased;overflow:hidden}
*{box-sizing:border-box}
[hidden]{display:none!important}
button{font:inherit;color:inherit;text-transform:inherit;letter-spacing:inherit;background:none;border:0;padding:0;cursor:pointer;text-align:inherit}
button:focus-visible,a:focus-visible,.item:focus-visible{outline:1px solid var(--ink);outline-offset:5px}
.m{font-family:var(--sans);text-transform:uppercase;letter-spacing:.14em;font-size:var(--t-meta);line-height:1.4}
.ash{color:var(--ash)} .ink{color:var(--ink)}
.u{text-decoration:underline;text-underline-offset:6px;text-decoration-thickness:1px}
.lnk{min-height:44px;display:inline-flex;align-items:center}
.lnk:hover{color:var(--ink)}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* ---------- the room ---------- */
.world{position:fixed;inset:0;overflow:hidden;transition:opacity var(--fade-slow) var(--ease)}
.grain{position:fixed;inset:0;pointer-events:none;z-index:60;
  background-image:radial-gradient(rgba(23,23,26,.045) .5px,transparent .6px);background-size:3px 3px}
.holo{position:absolute;left:50%;top:52%;width:940px;height:600px;margin:-300px 0 0 -470px;transform-origin:50% 50%;border-radius:50%;filter:blur(46px);
  transition:opacity var(--fade-slow) var(--ease);pointer-events:none;
  background:
   radial-gradient(40% 50% at 30% 40%,rgba(231,218,239,.95),rgba(231,218,239,0) 70%),
   radial-gradient(40% 50% at 70% 45%,rgba(215,229,221,.95),rgba(215,229,221,0) 70%),
   radial-gradient(40% 45% at 50% 70%,rgba(243,227,211,.9),rgba(243,227,211,0) 70%),
   radial-gradient(35% 40% at 55% 25%,rgba(220,231,242,.95),rgba(220,231,242,0) 70%);
  animation:breathe 12.8s ease-in-out infinite alternate}
@keyframes breathe{from{transform:scale(calc(var(--hs,1) * 1)) rotate(0deg)}to{transform:scale(calc(var(--hs,1) * 1.06)) rotate(8deg)}}
.stagebox{position:absolute;left:50%;top:50%;width:1440px;height:900px;margin:-450px 0 0 -720px;transform-origin:50% 50%}
.spiralwrap{position:absolute;inset:0}
.scene{position:absolute;left:720px;top:392px;width:0;height:0;perspective:1700px}
.helix{position:absolute;left:0;top:0;transform-style:preserve-3d;transform:rotateX(-8deg)}
.item{position:absolute;cursor:pointer;will-change:transform,opacity,filter}
.item svg,.sup svg,.thumb svg,.preview svg{display:block;width:100%;height:100%}
.item .shade{position:absolute;inset:0;box-shadow:0 30px 50px -36px rgba(40,55,70,.45);pointer-events:none}
/* Prompt 1 scene: the body carries the Entry and inspect fades over the spin; the hovered work sharpens over its
   animation (!important outranks it); while an Entry is open only the flying work takes the pointer */
.item .body{position:absolute;inset:0}
.item.focus{opacity:var(--hover-op)!important;filter:none!important}
.helix.holding .item:not(.flying){pointer-events:none}
.band{position:absolute;left:0;top:0;transform-style:preserve-3d;pointer-events:none;transition:opacity var(--fade-slow) var(--ease)}
.rail{position:absolute;border-radius:50%;border:1px solid rgba(120,135,140,.38)}
.tag{position:absolute;left:-40px;top:-8px;width:80px;height:16px;display:flex;align-items:center;justify-content:center;
  font-family:var(--sans);font-size:var(--t-meta);letter-spacing:.14em;text-transform:uppercase;white-space:nowrap;color:var(--ash);
  backface-visibility:hidden;-webkit-backface-visibility:hidden;transition:color var(--octave-up) var(--ease)}
.tag.on{color:var(--ink)}

/* view states */
body[data-view="entry"] .holo{opacity:0}
body[data-view="index"] .holo,body[data-view="info"] .holo,body[data-view="shop"] .holo{opacity:.4}
body[data-view="index"] .world,body[data-view="info"] .world,body[data-view="shop"] .world{pointer-events:none}
/* in an Entry the empty room reads as the way back; the words and controls stay put */
body[data-view="entry"] .world{cursor:zoom-out}
body[data-view="entry"] .item{cursor:default}
body[data-view="entry"] .item.flying{cursor:zoom-in}
/* the anchor inspected (/media/0): the room is lifted over the dimmed fragments, so the anchor comes forward above them */
body.anchor-detail .world{z-index:21}
body.anchor-detail .item.flying{cursor:zoom-out}
body[data-view="entry"] .reader > *{pointer-events:auto;width:fit-content;max-width:100%}
/* one world (bible §6): Index, Info and Shop are frosted panels over the still-living spiral; the veil is Paper at
   --veil (1 − 1/φ³, set from harmonic.ts) with a --f2 backdrop blur; the spiral keeps turning behind it at a quarter */
.veil{position:fixed;inset:0;z-index:25;opacity:0;pointer-events:none;transition:opacity var(--fade-slow) var(--ease);
  background:color-mix(in srgb, var(--paper) calc(var(--veil) * 100%), transparent);
  -webkit-backdrop-filter:blur(var(--f2));backdrop-filter:blur(var(--f2))}
body[data-view="index"] .veil,body[data-view="info"] .veil,body[data-view="shop"] .veil{opacity:1;pointer-events:auto}

/* ---------- the Entry: fragments that grow out of the work ---------- */
.supports{position:fixed;inset:0;pointer-events:none;z-index:20}
.sup{position:absolute;pointer-events:auto;cursor:pointer;opacity:0;
  transition:left var(--octave) var(--ease),top var(--octave) var(--ease),width var(--octave) var(--ease),height var(--octave) var(--ease),opacity var(--fifth) var(--ease);
  box-shadow:0 30px 50px -36px rgba(40,55,70,.45)}
.sup.near{transition-delay:0ms!important}

/* ---------- Index: the plain map ---------- */
.page{position:fixed;inset:0;z-index:30;overflow-y:auto;opacity:0;pointer-events:none;transition:opacity var(--fade-slow) var(--ease);
  padding-left:max(16px, env(safe-area-inset-left, 0px));padding-right:max(16px, env(safe-area-inset-right, 0px));
  padding-block:calc(env(safe-area-inset-top, 0px) + var(--f13)) calc(env(safe-area-inset-bottom, 0px) + var(--f8))}
.page.on{opacity:1;pointer-events:auto}
.ix{min-height:100%;padding-inline:var(--edge);display:grid;grid-template-columns:minmax(0,1fr) minmax(0,.618fr);gap:var(--f8);align-items:end}
.ixlist{list-style:none;margin:0;padding:0}
.irow{width:100%;display:grid;grid-template-columns:3.2em minmax(0,1fr) auto 7.5em;gap:var(--f3);align-items:center;min-height:44px}
.irow .t{font-size:var(--t-body);color:var(--ink)}
.irow:hover .t,.irow:focus-visible .t{text-decoration:underline;text-underline-offset:6px;text-decoration-thickness:1px}
.irow .st{text-align:right}
.preview{justify-self:end;align-self:end;width:100%;max-width:340px;aspect-ratio:4/5;opacity:0;transition:opacity var(--octave-up) var(--ease);box-shadow:0 30px 50px -36px rgba(40,55,70,.45)}
.preview.on{opacity:1}

/* ---------- the Shop room (bible §6, restored from V1): the works that can be bought float over the frosted spiral ---------- */
.shop{position:fixed;inset:0;z-index:30;opacity:0;pointer-events:none;transition:opacity var(--fade-slow) var(--ease)}
body[data-view="shop"] .shop{opacity:1;pointer-events:auto}
.shop .room{position:relative;width:100%}
.object{position:absolute;display:block;cursor:pointer}
.object .drift,.object .yaw,.object .lift{display:block}
.object .lift{transition:transform var(--octave-up) var(--ease)}
.object:hover .lift,.object:focus-visible .lift{transform:scale(var(--lift))}
.object .pic{display:block;width:100%;box-shadow:0 30px 50px -36px rgba(40,55,70,.45)}
.object .pic svg{display:block;width:100%;height:100%}
.object.gone .pic{filter:grayscale(var(--gone-gray));opacity:var(--gone-veil)}
.object.away{visibility:hidden}
.object .lab{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--f1);margin-top:var(--f2)}
.object .lab > :first-child{min-width:0}
.shopfoot,.shoplist{display:none}
body[data-view="shop"] .shopfoot,body[data-view="shop"] .shoplist{display:block}
body[data-view="shop"] .bot > #reader,body[data-view="shop"] .bot > #hint{display:none}

/* ---------- info ---------- */
.infopanel{position:fixed;z-index:35;left:max(16px, env(safe-area-inset-left, 0px));bottom:calc(env(safe-area-inset-bottom, 0px) + var(--f13));
  padding-inline:var(--edge);max-width:620px;opacity:0;pointer-events:none;transition:opacity var(--fade-slow) var(--ease),transform var(--fade-slow) var(--ease);transform:translateY(16px)}
.infopanel.on{opacity:1;pointer-events:auto;transform:none}
.body{font-size:var(--t-body);line-height:1.85;color:var(--body);max-width:34em;margin:0}
.infopanel .body{font-size:var(--t-lede);margin-top:var(--f3)}

/* ---------- the edges: name, navigation, reader ---------- */
.ui{position:fixed;inset:0;pointer-events:none;z-index:40;
  padding-left:max(16px, env(safe-area-inset-left, 0px));padding-right:max(16px, env(safe-area-inset-right, 0px));
  padding-block:calc(env(safe-area-inset-top, 0px) + 22px) calc(env(safe-area-inset-bottom, 0px) + 22px)}
.frame{position:relative;height:100%;padding-inline:var(--edge)}
.ui button,.ui a{pointer-events:auto}
.top{display:flex;justify-content:space-between;align-items:center;gap:24px;flex-wrap:wrap}
.mark{font-family:var(--mark);font-weight:700;font-size:var(--t-mark);letter-spacing:.01em;line-height:1;min-height:44px;display:inline-flex;align-items:center}
.nav{display:flex;gap:var(--f5);color:var(--ash);align-items:center}
.nav .on{color:var(--ink)}
.bot{position:absolute;left:var(--edge);right:var(--edge);bottom:0;display:flex;justify-content:space-between;align-items:flex-end;gap:24px}
.reader{transition:opacity var(--octave-up) var(--ease);max-width:min(480px,70vw)}
.reader.swap{opacity:0}
/* decision 3: after four idle beats in Explore the reader fades to near-silence over a fifth and returns on intent over an octave-up.
   It dims through filter, so the opacity swap and hidden-soft keep working unchanged. */
#reader{transition:opacity var(--fade) var(--ease),filter var(--octave-up) var(--ease)}
#reader.idle{filter:opacity(var(--reader-idle));transition:opacity var(--fade) var(--ease),filter var(--fifth) var(--ease)}
.reader .t{font-size:var(--t-lede);line-height:1.5;margin-top:var(--f2);color:var(--ink);text-wrap:balance}
.reader h2.t{font-weight:400;margin:var(--f2) 0 0}
.reader .t:focus{outline:none}
.reader .note{font-size:var(--t-body);line-height:1.85;color:var(--body);margin:var(--f1) 0 0}
.reader .acts{display:flex;gap:var(--f5);margin-top:var(--f2)}
/* buying is plain and still: no motion, no drift */
.rbuy{margin-top:var(--f3);transition:none}
.rbuy .row{display:flex;gap:var(--f1);align-items:center;flex-wrap:wrap;margin-top:var(--f1)}
.rbuy .price{margin-right:var(--f2)}
.size{min-width:56px;height:44px;padding:0 12px;border:1px solid rgba(23,23,26,.22)}
.size[aria-pressed="true"]{border-color:var(--ink);box-shadow:inset 0 0 0 1px var(--ink)}
.cta{height:44px;padding:0 var(--f5);background:var(--ink);color:var(--paper)}
.zoom{display:flex;gap:var(--f1);justify-content:flex-end;color:var(--ash);letter-spacing:.14em;text-transform:none}
.zoom button{min-width:44px;justify-content:center}
.zoom button[aria-pressed="true"]{color:var(--ink);text-decoration:underline;text-underline-offset:6px;text-decoration-thickness:1px}
.fade{transition:opacity var(--fade) var(--ease)}
.hidden-soft{opacity:0;pointer-events:none!important}
.hidden-soft *{pointer-events:none!important}
.bagpanel{position:fixed;z-index:45;top:var(--hdr,80px);right:calc(max(16px, env(safe-area-inset-right, 0px)) + var(--edge));width:min(320px,calc(100vw - 32px));
  background:color-mix(in srgb, var(--paper) calc(var(--veil) * 100%), transparent);-webkit-backdrop-filter:blur(var(--f2));backdrop-filter:blur(var(--f2));padding:var(--f3);box-shadow:0 30px 60px -40px rgba(40,55,70,.5)}
.bagpanel .line{display:flex;justify-content:space-between;gap:var(--f2);padding:var(--f1) 0}

/* short screens (a phone on its side): the reader keeps only what is needed and stays clear of the work */
body.short .reader .desc,body.short .reader .note{display:none}
body.short .reader{max-width:var(--rmax,320px)}
@media (max-width:760px){
  .mark{font-size:calc(var(--t-body) * 4 / 3)}   /* a fourth above the body, to share the line with the menu */
  .nav{gap:var(--f3)}
  .world{touch-action:none}
  .reader{max-width:100%}
  .reader .note{display:none}
  .bot{flex-direction:column;align-items:flex-start}
  #hint{position:fixed;top:var(--hdr,120px);left:calc(max(16px, env(safe-area-inset-left, 0px)) + var(--edge));right:calc(max(16px, env(safe-area-inset-right, 0px)) + var(--edge));text-align:left!important}
  #hint .zoom{justify-content:flex-start}
  #hint-t{transition:opacity var(--fifth) var(--ease)}
  #hint-t.gone{opacity:0}
  .page{top:var(--hdr,120px);padding-block:var(--f2) calc(env(safe-area-inset-bottom, 0px) + var(--f8))}
  .ix{grid-template-columns:minmax(0,1fr);align-items:start}
  .preview{display:none}
  .irow{grid-template-columns:2.6em minmax(0,1fr) auto;gap:var(--f2)}
  .irow .yr{display:none}
  .shop{top:var(--hdr,120px);bottom:var(--ftr,0px);overflow-y:auto;-webkit-overflow-scrolling:touch}
  .object .lab{flex-direction:column;gap:0}
  body[data-view="shop"] .bot{flex-direction:row;align-items:flex-end}
}
/* a phone on its side: the Shop is the same single scrolling column, between the header and the footer */
body.short .shop{top:var(--hdr,120px);bottom:var(--ftr,0px);overflow-y:auto;-webkit-overflow-scrolling:touch}
body.short .object .lab{flex-direction:column;gap:0}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation:none!important;transition-duration:1ms!important;transition-delay:0ms!important}
}
