:root {
  --ink: #24211c;
  --muted: #857d6e;
  --paper: #f2ede2;
  --hud: #fffaf0;
  --sans: Manrope, Arial, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1a140f; color: var(--ink); font-family: var(--sans); font-synthesis: none; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; border-radius: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sr-only:focus-within { position: fixed; left: 16px; bottom: 16px; width: auto; height: auto; clip: auto; z-index: 30; display: flex; gap: 8px; }
.sr-only:focus-within button { font: 500 13px var(--sans); padding: 8px 12px; border-radius: 99px; border: 0; background: var(--hud); }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
/* holding a finger on the desk winds up a smack: no text selection, magnifier or callout
   on the way (reading the portfolio and the inspect panel stay selectable) */
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.reader, .panel { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }

.loader { position: fixed; inset: 0; display: grid; place-items: center; background: #1a140f; color: #cbbfa9; font: 500 12px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; z-index: 40; transition: opacity 1.2s ease, visibility 0s 1.2s; }
.ready .loader { opacity: 0; visibility: hidden; }

/* ---------- HUD ---------- */
.hud { position: fixed; z-index: 10; color: var(--hud); text-shadow: 0 1px 12px rgba(20, 12, 4, .45); transition: opacity .5s ease; }
.inspecting .hud, .reading .hud { opacity: 0; pointer-events: none; }
.top { top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: 22px 26px; pointer-events: none; }
.top a { pointer-events: auto; text-decoration: none; }
.name { font: 500 15px/1.3 var(--sans); display: flex; flex-direction: column; }
.name small { font-size: 12.5px; opacity: .72; font-weight: 400; }
.classic { font: 500 13px/1.3 var(--sans); opacity: .8; }
.classic:hover { opacity: 1; }
.hud-credits { position: fixed; right: 26px; bottom: 22px; font: 500 11px/1 var(--sans); opacity: .6; color: var(--hud); text-decoration: none; }
.hud-credits:hover { opacity: 1; }
.clock { left: 26px; top: 76px; display: flex; flex-direction: column; gap: 2px; pointer-events: none; }
#time { font: 500 22px/1 var(--mono); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
#mood { font: 500 11px/1.4 var(--mono); letter-spacing: .14em; text-transform: uppercase; opacity: .75; }
.hint { left: 50%; bottom: 22px; margin: 0; transform: translateX(-50%); font: 500 12.5px/1 var(--sans); opacity: .82; white-space: nowrap; transition: opacity .6s ease, transform .6s var(--ease); }
.hint.gone { opacity: 0; transform: translate(-50%, 6px); }

.tip { position: fixed; left: 0; top: 0; z-index: 20; pointer-events: none; padding: 6px 10px; border-radius: 99px; background: rgba(255, 250, 240, .92); color: var(--ink); font: 500 12px/1 var(--sans); white-space: nowrap; box-shadow: 0 6px 20px rgba(20, 12, 4, .18); opacity: 0; transition: opacity .18s ease; }
.tip.on { opacity: 1; }
.inspecting .tip, .reading .tip { opacity: 0; }

/* ---------- Inspect panel (loadout-style) ---------- */
.scrim { position: fixed; inset: 0; z-index: 14; pointer-events: none; opacity: 0; background: linear-gradient(to right, rgba(12, 8, 4, 0) 35%, rgba(12, 8, 4, .5) 70%, rgba(12, 8, 4, .62)); transition: opacity .8s ease; }
.inspecting .scrim { opacity: 1; }
.panel { position: fixed; z-index: 15; top: 50%; right: clamp(24px, 6vw, 96px); width: min(400px, 38vw); transform: translate(24px, -50%); opacity: 0; pointer-events: none; color: #f6f1e7; transition: opacity .45s ease, transform .7s var(--ease); }
.panel.on { opacity: 1; transform: translate(0, -50%); pointer-events: auto; }
.panel .kicker { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; font: 500 11px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: #d8cdb8; }
.panel .kicker span { padding: 4px 6px; border: 1px solid rgba(246, 241, 231, .35); color: #f6f1e7; }
.panel .draft { margin-left: auto; font-weight: 500; font-size: 9.5px; padding: 3px 6px; border: 1px dashed rgba(246, 241, 231, .45); color: #f3c98b; }
.panel h2 { margin: 0; font: 500 clamp(34px, 3.6vw, 52px)/1.04 var(--sans); letter-spacing: -.028em; text-wrap: balance; }
.panel .body { margin: 18px 0 26px; font: 400 15px/1.6 var(--sans); color: #e6ddcd; max-width: 36ch; }
.panel .list { margin-top: 20px; }
.panel .label { margin: 0 0 8px; font: 500 10.5px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: #bfb39e; }
.panel ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid rgba(246, 241, 231, .16); }
.panel li { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid rgba(246, 241, 231, .16); font: 500 14px/1.3 var(--sans); }
.panel li a { display: flex; justify-content: space-between; gap: 16px; width: 100%; text-decoration: none; }
.panel li a:hover span { text-decoration: underline; text-underline-offset: 3px; }
.panel li em { font: 500 11px/1.3 var(--mono); font-style: normal; color: #bfb39e; letter-spacing: .06em; white-space: nowrap; }
.panel .keys { margin-top: 28px; font: 500 11px/1 var(--mono); color: #bfb39e; letter-spacing: .06em; }
.panel .keys span { margin: 0 6px; }
.panel kbd { font: inherit; padding: 3px 5px; border: 1px solid rgba(246, 241, 231, .35); border-radius: 3px; color: #f6f1e7; margin-right: 4px; }
.panel .close { position: absolute; top: -48px; right: 0; width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(246, 241, 231, .35); background: transparent; color: #f6f1e7; font: 400 20px/1 var(--sans); cursor: pointer; }
.panel .close:hover { background: rgba(246, 241, 231, .12); }

@media (max-aspect-ratio: 1/1) {
  .scrim { background: linear-gradient(to top, rgba(12, 8, 4, .7), rgba(12, 8, 4, 0) 60%); }
  .panel { top: auto; bottom: 0; left: 0; right: 0; width: auto; padding: 24px 20px 28px; transform: translateY(24px); background: linear-gradient(to top, rgba(18, 12, 6, .7), rgba(18, 12, 6, 0)); }
  .panel.on { transform: none; }
  .panel h2 { font-size: 32px; }
  .panel .body { margin: 12px 0 10px; font-size: 14px; }
  .panel .list { margin-top: 12px; }
  .panel .list + .list, .panel .keys { display: none; }
  .panel .close { top: -44px; right: 20px; }
}

/* ---------- Reader: the book as a web page ---------- */
.reader { --crop: 0; position: fixed; inset: 0; z-index: 25; overflow-y: auto; overscroll-behavior: contain; background: var(--paper); opacity: 0; transition: opacity .6s ease; outline: none; }
.reader.on { opacity: 1; }
.back { position: fixed; top: 18px; right: 20px; z-index: 26; padding: 9px 14px; border: 1px solid rgba(36, 33, 28, .16); border-radius: 99px; background: rgba(242, 237, 226, .86); backdrop-filter: blur(8px); font: 500 13px/1 var(--sans); color: var(--ink); cursor: pointer; opacity: 0; pointer-events: none; transform: translateY(-6px); transition: opacity .4s ease .5s, transform .5s var(--ease) .5s; }
.reading .back { opacity: 1; pointer-events: auto; transform: none; }
.back:hover { background: #fff; }

.spread { display: grid; grid-template-columns: 1fr 1fr; min-height: 100%; }
.page { position: relative; container-type: inline-size; background-color: var(--paper); background-image: var(--grain); background-size: 160px, 100% 100%; }
.page.left { position: sticky; top: 0; height: 100vh; overflow: hidden; background-image: var(--grain), linear-gradient(to left, rgba(60, 45, 25, .16), rgba(60, 45, 25, .05) 3.5%, rgba(60, 45, 25, 0) 10%); }
.page.right { background-image: var(--grain), linear-gradient(to right, rgba(60, 45, 25, .16), rgba(60, 45, 25, .05) 3.5%, rgba(60, 45, 25, 0) 10%); background-attachment: local; }
.page.right { background-repeat: repeat, no-repeat; }

/* Absolutely placed first screen, in page units (1u = 1cqw). */
.first { position: relative; height: calc((135 - var(--crop)) * 1cqw); }
.page.right .first { height: calc((var(--end) - var(--crop)) * 1cqw); }
.u { position: absolute; margin: 0; left: calc(var(--x) * 1cqw); top: calc((var(--y) - var(--crop)) * 1cqw); font-size: calc(var(--s) * 1cqw); line-height: calc(var(--l) * 1cqw); letter-spacing: calc(var(--t) * 1em); font-weight: var(--wt); white-space: nowrap; text-decoration: none; color: var(--ink); }
.u.right { left: auto; right: calc((100 - var(--x)) * 1cqw); text-align: right; }
.u.muted { color: var(--muted); }
.u.italic { font-style: italic; }
.u.underline { text-decoration: underline; text-underline-offset: .22em; text-decoration-thickness: .06em; }
.f-sans { font-family: var(--sans); }
.f-serif { font-family: var(--serif); }
.f-mono { font-family: var(--mono); }
.u.rule { height: max(1px, .12cqw); width: calc(var(--w) * 1cqw); background: rgba(36, 33, 28, .14); }
img.u { width: calc(var(--w) * 1cqw); height: calc(var(--h) * 1cqw); border-radius: .8cqw; object-fit: cover; background: #ddd6c8; }
a.u:hover { color: var(--ink); text-decoration: underline; text-underline-offset: .22em; }

.flow { padding: 0 12cqw 10cqw; }
.entry { padding-top: 12cqw; }
.entry .kicker { margin: 0 0 1cqw; font: 600 1.8cqw/3cqw var(--sans); letter-spacing: .24em; color: var(--muted); }
.entry h2 { margin: 0; font: 400 7.5cqw/8.5cqw var(--serif); }
.entry .lede { margin: .5cqw 0 3cqw; font: italic 400 3.4cqw/4.4cqw var(--serif); color: var(--muted); }
.entry figure { margin: 0 0 3.5cqw; border-radius: .8cqw; overflow: hidden; background: #ddd6c8; }
.entry figure img { display: block; width: 100%; height: auto; }
.entry figure.app { padding: 6cqw; background: #e7e0d2; }
.entry figure.app img { border-radius: .8cqw; box-shadow: 0 1cqw 4cqw rgba(36, 33, 28, .15); }
.entry .body { margin: 0 0 1.4cqw; font: 400 2.7cqw/4.2cqw var(--sans); max-width: 70cqw; }
.entry .more { font: 500 2.2cqw/3.6cqw var(--sans); text-underline-offset: .22em; text-decoration-thickness: .06em; }
.entry.cont { padding-top: 2cqw; }
.meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2cqw; margin: 4cqw 0 2cqw; padding: 2.4cqw 0; border-block: 1px solid rgba(36, 33, 28, .14); }
.meta div { margin: 0; }
.meta dt { font: 600 1.6cqw/2.4cqw var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.meta dd { margin: .6cqw 0 0; font: 400 2.4cqw/3.4cqw var(--sans); }
.part { margin-top: 5cqw; }
.part h3 { display: flex; align-items: center; gap: 1.6cqw; margin: 0 0 1.4cqw; font: 400 4cqw/5cqw var(--serif); }
.part p { margin: 0; font: 400 2.7cqw/4.2cqw var(--sans); max-width: 70cqw; }
.draft { font: 500 1.4cqw/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; padding: .5cqw .8cqw; border: 1px dashed rgba(156, 79, 54, .6); color: #9c4f36; border-radius: .4cqw; }
.entry figure.placeholder { display: grid; place-items: center; aspect-ratio: 16 / 10; border: 1px dashed rgba(36, 33, 28, .25); background: rgba(36, 33, 28, .03); }
.entry figure.placeholder span { font: 500 1.8cqw/1.4 var(--mono); letter-spacing: .06em; color: var(--muted); }
.entry .grid { margin-top: 5cqw; }
.entry .more { display: inline-block; margin-top: 4cqw; }
.mini { margin-top: 5cqw; }
.mini h3 { margin: 0 0 1cqw; font: 400 4cqw/5cqw var(--serif); }
.mini h3 span { font: 600 1.6cqw/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin-left: 1.2cqw; vertical-align: middle; }
.mini p { margin: 0; font: 400 2.7cqw/4.2cqw var(--sans); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2cqw; }
.grid img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: .8cqw; display: block; background: #ddd6c8; }
.colophon { display: flex; gap: 4cqw; margin-top: 12cqw; padding-top: 3cqw; border-top: 1px solid rgba(36, 33, 28, .14); font: 500 2.2cqw/1 var(--sans); }
.colophon a { text-decoration: none; }
.credits { margin: 4cqw 0 0; font: 400 1.7cqw/2.8cqw var(--sans); color: var(--muted); }
.credits a { color: inherit; text-underline-offset: .2em; }
.colophon a:hover { text-decoration: underline; text-underline-offset: .22em; }

@media (max-width: 759px) {
  .spread { grid-template-columns: 1fr; }
  .page.left { position: relative; height: auto; background-image: var(--grain); }
  .page.right { background-image: var(--grain); }
  .back { top: auto; bottom: 16px; right: 16px; }
  .entry .body, .part p, .mini p { font-size: 3.6cqw; line-height: 5.4cqw; max-width: none; }
  .meta dd { font-size: 3cqw; line-height: 4.2cqw; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; transition-delay: 0s !important; }
}

@media (max-width: 600px) {
  .top { padding: 16px; }
  .clock { left: 16px; top: 64px; }
  .hint { bottom: 14px; width: calc(100% - 32px); white-space: normal; text-align: center; line-height: 1.4; }
}
