/* Two worlds: a dark particle field (Inter Tight) and a cream notebook (Georgia). */
:root {
  --night: #222124;
  --night-ink: #f0f2f0;
  --night-dim: rgba(240, 242, 240, 0.55);
  --paper: #fff8e7;
  --paper-box: #f1e6cf;
  --ink: #3a3226;
  --ink-head: #2b2419;
  --ink-soft: #8a7d68;
  --link: #1a4c96;
  --rule: #e3d6bb;
  --sans: "Inter Tight", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, Palatino, "Palatino Linotype", Times, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.6;
}
img { max-width: 100%; display: block; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* ---------- top bar (dark) ---------- */
.bar {
  background: var(--night);
  color: var(--night-ink);
  font-family: var(--sans);
  font-size: 15px;
  position: relative;
  overflow: hidden;
}
.bar canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.bar-inner {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 32px;
}
.bar a { color: var(--night-ink); }
.bar .home { font-size: 17px; }
.bar nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.bar nav a { color: var(--night-dim); transition: color .2s; }
.bar nav a:hover, .bar nav a[aria-current="page"] { color: var(--night-ink); text-decoration: none; }

/* ---------- notebook (cream) ---------- */
.notebook { max-width: 888px; margin: 0 auto; padding: 48px 24px 96px; }
.notebook h1 {
  font-weight: 400; font-size: 50px; line-height: 1.25; color: var(--ink-head);
  text-align: center; margin: 0 0 40px;
}
.notebook h2 { font-weight: 400; font-size: 40px; line-height: 1.25; color: var(--ink-head); margin: 64px 0 20px; }
.notebook h3 { font-weight: 400; font-size: 26px; line-height: 1.3; color: var(--ink-head); margin: 40px 0 12px; }
.notebook p { margin: 0 0 20px; }

.intro { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 32px; align-items: start; }
.side {
  background: var(--paper-box);
  padding: 8px 8px 12px;
  font-size: 13px;
  line-height: 1.5;
}
.side canvas { display: block; width: 100%; aspect-ratio: 1 / 1.05; background: var(--night); }
.side .lbl { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; font-weight: bold; margin: 12px 4px 2px; color: var(--ink-head); }
.side p { margin: 0 4px; font-size: 13px; }
.side hr { border: 0; border-top: 1px solid var(--rule); margin: 10px 4px; }

/* lists */
.items { list-style: none; margin: 0; padding: 0; }
.items li { margin: 0 0 18px; }
.items .t { color: var(--ink-head); }
.items .by { color: var(--ink-soft); }
.items .tags, .tags { display: block; font-size: 14px; color: var(--ink-soft); line-height: 1.5; margin-top: 2px; }

/* thumbnail grid */
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px 12px; }
.grid a { display: block; font-size: 13px; line-height: 1.35; }
.grid canvas { display: block; width: 100%; aspect-ratio: 4 / 3; background: var(--night); margin-bottom: 6px; }
.grid small { display: block; color: var(--ink-soft); font-size: 11px; margin-top: 2px; }

.frames { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.frames canvas { display: block; width: 100%; aspect-ratio: 4 / 5; background: var(--night); }

.note-box { background: var(--paper-box); padding: 16px 20px; font-size: 17px; }

/* subject index on subjects page */
.jump { font-size: 18px; text-align: center; margin-bottom: 8px; }
.how { list-style: none; padding: 0; margin: 0 0 8px; }
.how li { margin: 0 0 14px; }
.how .pair { display: block; font-size: 14px; color: var(--ink-soft); }

footer.foot {
  background: var(--night); color: var(--night-dim); font-family: var(--sans); font-size: 14px;
}
footer.foot .bar-inner { padding: 28px 24px; }

/* ---------- home hero (dark, scroll-driven) ---------- */
.hero { background: var(--night); color: var(--night-ink); font-family: var(--sans); height: 520vh; position: relative; }
.hero .stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero .top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
}
.step {
  position: absolute; left: 0; right: 0; bottom: 9vh; z-index: 2;
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease;
  pointer-events: none;
}
.step.on { opacity: 1; transform: none; pointer-events: auto; }
.step p { max-width: 640px; font-size: 28px; line-height: 1.17; margin: 0; color: var(--night-ink); }
.step p .dim { color: var(--night-dim); }
.step a { color: var(--night-ink); border-bottom: 1px solid var(--night-dim); }
.step a:hover { text-decoration: none; border-bottom-color: var(--night-ink); }
.scroll-hint { position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 2; font-size: 13px; color: var(--night-dim); transition: opacity .4s; }

/* ---------- connections page (dark) ---------- */
body.night { background: var(--night); color: var(--night-ink); font-family: var(--sans); font-size: 18px; }
.conn { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); max-width: 1320px; margin: 0 auto; }
.conn .map { position: sticky; top: 0; height: 100vh; height: 100svh; }
.conn .map canvas { width: 100%; height: 100%; display: block; }
.conn .text { padding: 22vh 48px 40vh 24px; }
.conn .lead { font-size: 28px; line-height: 1.17; margin: 0 0 28vh; max-width: 520px; }
.conn .lead .dim { color: var(--night-dim); }
.link-item { margin: 0 0 30vh; max-width: 480px; opacity: .35; transition: opacity .5s; }
.link-item.on { opacity: 1; }
.link-item .pair { font-size: 14px; color: var(--night-dim); margin: 0 0 10px; letter-spacing: .01em; }
.link-item .pair a { color: var(--night-ink); }
.link-item p { font-size: 26px; line-height: 1.2; margin: 0; }
.conn .end { font-size: 20px; color: var(--night-dim); max-width: 480px; }
.conn .end a { color: var(--night-ink); border-bottom: 1px solid var(--night-dim); }

@media (max-width: 860px) {
  body { font-size: 18px; }
  .notebook h1 { font-size: 38px; }
  .notebook h2 { font-size: 30px; margin-top: 48px; }
  .intro { grid-template-columns: 1fr; }
  .side { max-width: 260px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .frames { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .step { padding: 0 24px; }
  .step p { font-size: 20px; line-height: 1.2; }
  .bar { font-size: 14px; }
  .bar nav { gap: 2px 14px; }
  .conn { grid-template-columns: 1fr; }
  .conn .map { height: 52vh; height: 52svh; z-index: 1; background: var(--night); }
  .conn .text { padding: 8vh 24px 30vh; }
  .conn .lead { font-size: 22px; margin-bottom: 16vh; }
  .link-item { margin-bottom: 22vh; }
  .link-item p { font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) {
  .step, .link-item { transition: none; }
}

.bar.plain { background: transparent; }

/* WordPress admin bar (only shown when logged in) */
.admin-bar .hero .stage, .admin-bar .conn .map { top: var(--wp-admin--admin-bar--height, 32px); height: calc(100vh - var(--wp-admin--admin-bar--height, 32px)); }
.notebook article > * + * { margin-top: 0; }
.notebook img { height: auto; }

/* Keep the footer at the bottom of the window on short pages */
body { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }
body > main.notebook { flex: 1 0 auto; width: 100%; }
body > .conn { width: 100%; }

/* Modeling gallery: natural proportions, two columns (one on phones), click to enlarge */
.notebook.wide { max-width: 1200px; }
.gallery { columns: 2; column-gap: 12px; }
.gallery a { display: block; break-inside: avoid; margin-bottom: 12px; cursor: zoom-in; }
.gallery img { width: 100%; height: auto; display: block; }
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(20, 19, 22, .94); display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }

/* Videos */
.notebook .date { color: var(--ink-soft); font-size: 17px; margin: -4px 0 16px; }
.videos { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.videos video { display: block; max-width: 100%; max-height: 80vh; width: auto; height: auto; background: var(--night); }
@media (max-width: 860px) { .gallery { columns: 1; } }

/* Modeling agency */
.agency { display: grid; grid-template-columns: max-content 1fr; gap: 4px 20px; margin: 0 0 28px; font-size: 18px; }
.agency dt { color: var(--ink-soft); }
.agency dd { margin: 0; color: var(--ink-head); }

/* Books list */
.items.books li { margin: 0 0 6px; }

/* Connections: map only, filling the window below the header */
body.night .conn { display: block; max-width: none; flex: 1 0 auto; }
body.night .conn .map { position: relative; top: auto; height: calc(100vh - 64px); height: calc(100svh - 64px); min-height: 420px; }
@media (max-width: 860px) { body.night .conn .map { height: calc(100svh - 120px); } }

/* ---------- the door ---------- */
body.door { background: var(--night); color: var(--night-ink); font-family: var(--sans); }
#door { flex: 1 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; min-height: 100vh; min-height: 100svh; }
#door input, #door textarea {
  width: min(560px, 100%); background: transparent; border: 0; border-bottom: 1px solid rgba(240, 242, 240, 0.25);
  color: var(--night-ink); font: 400 22px/1.4 var(--sans); padding: 8px 2px; outline: none; caret-color: var(--night-ink); border-radius: 0;
}
#door input:focus, #door textarea:focus { border-bottom-color: rgba(240, 242, 240, 0.7); }
#door textarea { resize: vertical; font-size: 18px; }
#door ::placeholder { color: var(--night-dim); }
#ask { font-size: 18px; color: var(--night-dim); margin: 0; width: min(560px, 100%); }
#request { display: flex; flex-direction: column; gap: 12px; width: min(560px, 100%); }
#request[hidden] { display: none; }
#request button { align-self: flex-start; }
#msg { min-height: 1.4em; font-size: 15px; color: var(--night-dim); margin: 0; }
body.door button { font: 500 14px var(--sans); color: var(--night); background: var(--night-ink); border: 0; border-radius: 3px; padding: 8px 14px; cursor: pointer; }
body.door button:disabled { opacity: .5; }
body.door button.link { background: none; color: var(--night-dim); padding: 0; font-weight: 400; text-decoration: underline; text-underline-offset: 3px; }
body.door button.link:hover { color: var(--night-ink); }
body.door :focus-visible { outline: 2px solid var(--night-ink); outline-offset: 2px; }

/* inside */
#inside { flex: 1 0 auto; }
.in-bar { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; max-width: 760px; margin: 0 auto; padding: 22px 24px; font-size: 15px; color: var(--night-dim); }
.in-bar a { color: var(--night-ink); }
.in-main { max-width: 760px; margin: 0 auto; padding: 8px 24px 96px; display: flex; flex-direction: column; gap: 40px; }
.in-main h2 { font-weight: 400; font-size: 15px; letter-spacing: .06em; text-transform: uppercase; color: var(--night-dim); margin: 28px 0 12px; }
.in-main section > h2:first-child { margin-top: 0; }
.in-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; font-size: 16px; }
.in-list .note { color: var(--night-dim); margin: 4px 0 8px; white-space: pre-wrap; }
.quiet { color: var(--night-dim); }
.post { padding: 0 0 28px; margin: 0 0 28px; border-bottom: 1px solid rgba(240, 242, 240, 0.12); }
.post-date { font-size: 13px; color: var(--night-dim); margin-bottom: 8px; }
.post-body { font-size: 19px; line-height: 1.5; white-space: pre-wrap; }
.comments { list-style: none; padding: 0; margin: 16px 0 10px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.c-name { color: var(--night-dim); margin-right: 6px; }
.comment-form, .row-form { display: flex; gap: 8px; }
.comment-form input, .row-form input, #new-post textarea {
  flex: 1; min-width: 0; background: transparent; color: var(--night-ink); border: 1px solid rgba(240, 242, 240, 0.2); border-radius: 3px; padding: 8px 10px; font: 15px var(--sans);
}
#new-post { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
#new-post textarea { width: 100%; }
.thread { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 10px; font-size: 16px; white-space: pre-wrap; }
.thread li { max-width: 80%; padding: 8px 12px; border-radius: 6px; background: rgba(240, 242, 240, 0.06); }
.thread .from-a { align-self: flex-start; }
.thread .from-m { align-self: flex-end; background: rgba(240, 242, 240, 0.14); }
.m-date { display: block; font-size: 12px; color: var(--night-dim); margin-bottom: 2px; }

/* Books: cover grid */
.shelf { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 28px 18px; }
.shelf li { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 14px; line-height: 1.35; }
.shelf .cover { display: block; aspect-ratio: 2 / 3; max-width: 100%; background: var(--paper-box); overflow: hidden; box-shadow: 0 1px 2px rgba(43, 36, 25, .18); margin-bottom: 6px; }
.shelf .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shelf .cover-card { display: flex; align-items: flex-end; height: 100%; padding: 12px; background: var(--night); color: var(--night-ink); font: 500 15px/1.2 var(--sans); }
.shelf .t { color: var(--ink-head); }
.shelf .by { color: var(--ink-soft); font-size: 13px; }
@media (max-width: 520px) { .shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px 12px; } .shelf li { font-size: 13px; } }

/* Music: album covers, hover to play */
.songs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 30px 18px; }
.song { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 14px; line-height: 1.35; }
.song .art { position: relative; display: block; width: 100%; aspect-ratio: 1; max-width: 100%; padding: 0; border: 0; margin: 0 0 8px; background: var(--night); cursor: pointer; overflow: hidden; box-shadow: 0 1px 2px rgba(43, 36, 25, .2); }
.song .art:disabled { cursor: default; }
.song .art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .4s, filter .3s; }
.song.has-art .art img { opacity: 1; }
.song .art-fallback { position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 12px; color: var(--night-ink); font: 500 15px/1.2 var(--sans); text-align: start; }
.song.has-art .art-fallback { visibility: hidden; }
.song .play { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(34, 33, 36, .72); opacity: 0; transition: opacity .2s; }
.song .play::before { content: ""; position: absolute; left: 18px; top: 14px; border-style: solid; border-width: 9px 0 9px 14px; border-color: transparent transparent transparent #f0f2f0; }
.song.playing .play::before { left: 16px; top: 15px; width: 4px; height: 16px; border: 0; background: #f0f2f0; box-shadow: 9px 0 0 #f0f2f0; }
.song .art:not(:disabled):hover .play, .song .art:focus-visible .play, .song.tap .play, .song.playing .play { opacity: 1; }
.song.playing .art img { filter: saturate(1.1); }
.song .progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: #f0f2f0; transform: scaleX(0); transform-origin: left; transition: transform .25s linear; }
.song .t { color: var(--ink-head); }
.song .by { color: var(--ink-soft); font-size: 13px; }
.song .links { font-size: 12px; color: var(--ink-soft); }
.song .art:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
@media (max-width: 520px) { .songs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 12px; } }
@media (prefers-reduced-motion: reduce) { .song .art img, .song .play, .song .progress { transition: none; } }
