/* Layout: drawing-sheet column on the left, a single voxel model on the right that re-forms per sheet as you scroll. */
:root {
  --bg: #E8E9E4;      /* cool plaster */
  --paper: #F3F4F0;
  --ink: #1A1D1C;
  --muted: #5B625E;
  --line: #C3C7BF;
  --accent: #2E45B8;  /* drafting cobalt */
  --veil: rgba(232,233,228,.86);
  --f-display: "Syne", "Helvetica Neue", Arial, sans-serif;
  --f-body: "Source Serif 4", Georgia, "Times New Roman", serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --col: min(600px, 50vw);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101312; --paper: #171B19; --ink: #E3E6E0; --muted: #98A09B;
    --line: #2B312E; --accent: #8C9CFF; --veil: rgba(16,19,18,.86); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101312; --paper: #171B19; --ink: #E3E6E0; --muted: #98A09B;
  --line: #2B312E; --accent: #8C9CFF; --veil: rgba(16,19,18,.86); color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--f-body); font-size: 18px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
::selection { background: var(--accent); color: var(--paper); }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* 3D stage */
#stage { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
#stage canvas { display: block; width: 100%; height: 100%; }

/* Header */
.top {
  position: fixed; inset: 0 0 auto; z-index: 20;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 14px); padding-bottom: 14px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: linear-gradient(var(--bg) 40%, transparent);
}
.brand { font-family: var(--f-display); font-weight: 700; font-size: 15px; letter-spacing: .02em; text-decoration: none; display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 18px; height: 18px; border: 1.5px solid var(--ink); position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 4px 4px auto auto; width: 6px; height: 6px; background: var(--accent); }
.nav { display: flex; gap: 22px; font-family: var(--f-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.nav a { text-decoration: none; color: var(--muted); padding: 4px 0; border-bottom: 1px solid transparent; }
.nav a:hover, .nav a[aria-current="true"] { color: var(--ink); border-bottom-color: var(--accent); }

/* Main column */
main { position: relative; z-index: 1; }
.wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.inner { max-width: var(--col); margin-left: clamp(0px, 5vw, 80px); }

.hero { padding-block: 22vh 12vh; }
.eyebrow { font-family: var(--f-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.eyebrow b { font-weight: 500; color: var(--accent); }
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(44px, 7vw, 96px); line-height: .95; font-weight: 800; margin-top: 24px; }
h1 em { font-family: var(--f-body); font-style: italic; font-weight: 400; color: var(--accent); letter-spacing: -.02em; }
.lede { font-size: clamp(19px, 1.6vw, 22px); max-width: 34em; margin-top: 28px; color: var(--ink); }
.scrollcue { margin-top: 48px; font-family: var(--f-mono); font-size: 12px; color: var(--muted); display: flex; gap: 12px; align-items: center; }
.scrollcue span { width: 1px; height: 40px; background: var(--line); position: relative; overflow: hidden; }
.scrollcue span::after { content: ""; position: absolute; left: 0; top: -40%; width: 1px; height: 40%; background: var(--accent); animation: cue 2.4s ease-in-out infinite; }
@keyframes cue { to { top: 100%; } }
@media (prefers-reduced-motion: reduce) { .scrollcue span::after { animation: none; top: 30%; } }

/* Sheets */
.sheet { min-height: 100vh; display: flex; align-items: center; padding-block: 12vh; border-top: 1px solid var(--line); }
.sheet-head { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; align-items: baseline; font-family: var(--f-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.sheet-no { color: var(--accent); font-weight: 500; }
.sheet-rule { grid-column: 1 / -1; height: 1px; background: var(--ink); margin-top: 6px; position: relative; }
.sheet-rule::before, .sheet-rule::after { content: ""; position: absolute; top: -4px; width: 1px; height: 9px; background: var(--ink); }
.sheet-rule::before { left: 0; } .sheet-rule::after { right: 0; }
.sheet h2 { font-size: clamp(34px, 4.6vw, 64px); line-height: 1; font-weight: 700; margin-top: 28px; }
.sheet p { max-width: 34em; margin: 22px 0 0; }
.specs { margin-top: 32px; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); border: 1px solid var(--line); background: var(--veil); }
.specs div { padding: 12px 14px; border-left: 1px solid var(--line); min-width: 0; }
.specs div:first-child { border-left: 0; }
.specs dt { font-family: var(--f-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.specs dd { margin: 4px 0 0; font-family: var(--f-display); font-weight: 600; font-size: 15px; line-height: 1.3; }
.reads { margin-top: 28px; display: grid; gap: 0; }
.reads a { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); text-decoration: none; font-family: var(--f-display); font-weight: 600; font-size: 17px; }
.reads a:last-child { border-bottom: 1px solid var(--line); }
.reads a span:last-child { font-family: var(--f-mono); font-weight: 400; font-size: 12px; color: var(--muted); white-space: nowrap; }
.reads a:hover span:first-child { color: var(--accent); }

/* Journal */
.journal { padding-block: 16vh 10vh; border-top: 1px solid var(--line); }
.journal .inner { max-width: min(880px, 62vw); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.filters button {
  font: 500 12px/1 var(--f-mono); text-transform: uppercase; letter-spacing: .08em;
  padding: 10px 14px; border: 1px solid var(--line); background: var(--veil); color: var(--muted); cursor: pointer;
}
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.filters button:hover { color: var(--ink); border-color: var(--ink); }
.filters button[aria-pressed="true"]:hover { color: var(--bg); }
.list { margin-top: 28px; border-top: 1.5px solid var(--ink); }
.entry { display: grid; grid-template-columns: 92px minmax(0,1fr) 120px; gap: 20px; padding: 22px 0; border-bottom: 1px solid var(--line); background: var(--veil); }
.entry .ref { font-family: var(--f-mono); font-size: 12px; color: var(--accent); padding-top: 4px; }
.entry h3 { font-size: 22px; font-weight: 700; line-height: 1.2; }
.entry p { margin: 8px 0 0; font-size: 16.5px; color: var(--muted); max-width: 40em; }
.entry .meta { font-family: var(--f-mono); font-size: 11.5px; color: var(--muted); text-align: right; padding-top: 4px; line-height: 1.7; }
.entry .tag { display: inline-block; border: 1px solid var(--line); padding: 1px 6px; text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; }
.entry .tag.draft { border-color: var(--accent); color: var(--accent); }

footer { position: relative; z-index: 1; border-top: 1px solid var(--line); padding-block: 40px 140px; font-family: var(--f-mono); font-size: 12px; color: var(--muted); background: var(--bg); }
footer .inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; max-width: none; margin-right: clamp(0px, 5vw, 80px); }

/* Title block */
.titleblock {
  position: fixed; z-index: 15; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: grid; grid-template-columns: auto auto auto; border: 1.5px solid var(--ink); background: var(--paper);
  font-family: var(--f-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
}
.titleblock div { padding: 8px 12px; border-left: 1px solid var(--line); min-width: 0; }
.titleblock div:first-child { border-left: 0; }
.titleblock small { display: block; font-size: 9.5px; color: var(--muted); }
.titleblock strong { font-weight: 500; font-variant-numeric: tabular-nums; }
#tb-sheet { color: var(--accent); }

.no-webgl #stage { display: none; }

@media (max-width: 860px) {
  :root { --col: 100%; }
  body { font-size: 17px; }
  .nav { display: none; }
  .inner { margin-left: 0; }
  .journal .inner { max-width: 100%; }
  #stage { opacity: .55; }
  .sheet .inner { background: var(--veil); padding: 20px; margin-inline: -4px; }
  .hero { padding-block: 16vh 8vh; }
  .specs { grid-template-columns: minmax(0,1fr); }
  .specs div { border-left: 0; border-top: 1px solid var(--line); }
  .specs div:first-child { border-top: 0; }
  .entry { grid-template-columns: minmax(0,1fr); gap: 6px; padding-inline: 12px; }
  .entry .meta { text-align: left; }
  .titleblock { left: max(16px, env(safe-area-inset-left, 0px)); grid-template-columns: auto 1fr auto; }
}

/* Root padding for phone safe areas (the artifact viewer added this automatically) */
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
body { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }
