/* Dummy build: structure and content only. Visual design comes later. */

/* TRJN DaVinci, trial files: fine for local work, needs a web licence before going live. */
@font-face { font-family: "TRJN DaVinci"; src: url("fonts/TRJNDaVinci-Regular-Trial.otf") format("opentype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "TRJN DaVinci"; src: url("fonts/TRJNDaVinci-Italic-Trial.otf") format("opentype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "TRJN DaVinci"; src: url("fonts/TRJNDaVinci-Bold-Trial.otf") format("opentype"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  --bg: #f6f5f1;
  --ink: #141414;
  --muted: #77746c;
  --line: #d9d6cd;
  --fpo-bg: #ebe8df;
  --link: #0D00FF;
  --serif: "TRJN DaVinci", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* The shelves' 3D models sit in stages far wider than the models, to leave them room to turn, and
   near the right edge those reach past the window; they never widen the page. (On html, clip
   would become hidden, which still lets scripts scroll sideways.) Only the home page has them:
   on the project pages a clip would cut off the shadows that reach past the column. */
main.home { overflow-x: clip; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.5;
}

a { color: var(--link); }
/* Links that are whole cards, names or inline media keep the text colour. */
a.card, a.name, a.diorama, a.vidpic, .card h3 a { color: inherit; }

/* Nav */

.nav {
  display: flex;
  gap: 20px;
  align-items: baseline;
  padding: 20px 24px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nav .name { margin-right: auto; }
.nav a { text-decoration: none; color: var(--muted); }
.nav a.name, .nav a[aria-current="page"] { color: var(--ink); }

main { padding: 24px 24px 120px; max-width: 1200px; margin: 0 auto; }

.label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}

/* FPO placeholders */

.fpo {
  display: inline-block;
  vertical-align: middle;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.3;
  letter-spacing: 0;
  color: var(--muted);
  background: var(--fpo-bg);
  border: 1px dashed #a9a59a;
  border-radius: 8px;
  padding: 6px 9px;
  margin: 0 4px;
  max-width: 190px;
  text-decoration: none;
}
a.fpo { border-style: solid; color: var(--ink); }
a.fpo:hover { background: #dfdbd0; }

.todo { color: #a0522d; }

/* Home */

.home section { margin: 0 0 72px; }
.home p.big {
  font-size: clamp(1.4rem, 3.5vw, 3.3rem);
  line-height: 1.4;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: pretty;
}

/* Projects */

.group-title {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: normal;
  margin: 56px 0 8px;
}
.group-title:first-of-type { margin-top: 8px; }

.toolbar { display: flex; justify-content: flex-end; }
.toolbar button {
  font-family: var(--mono);
  font-size: 12px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--ink);
}

.row { border-top: 1px solid var(--line); }
.row:last-of-type { border-bottom: 1px solid var(--line); }

.row > summary, .row.line-only > .head {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  list-style: none;
}
.row > summary { cursor: pointer; }
.row > summary::-webkit-details-marker { display: none; }

.thumb {
  width: 96px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  background: var(--fpo-bg);
  border: 1px dashed #a9a59a;
  border-radius: 6px;
}

.row h3 { font-size: 1.25rem; font-weight: normal; margin: 0; }
.card h3 a { color: inherit; text-decoration: none; }
.row .meta { font-family: var(--mono); font-size: 12px; color: var(--muted); margin: 2px 0 4px; }
.row .one { margin: 0; font-style: italic; }
.row .size { font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.row[open] > summary .size::after { content: " ▲"; }
.row:not([open]) > summary .size::after { content: " ▼"; }

.body { padding: 4px 0 28px 112px; max-width: 900px; }
.body p { margin: 0 0 12px; font-size: 1.0625rem; }
.body ol { margin: 0 0 12px; padding-left: 20px; }
.body li { margin-bottom: 8px; }

.media { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin: 0 0 16px; }
.media .thumb { width: auto; height: 120px; }
.media.single { grid-template-columns: 1fr; }
.media.single .thumb { height: 280px; }

/* Writing */

.essay { max-width: 680px; }
.essay h1 { font-size: clamp(2rem, 5vw, 3.25rem); line-height: 1.1; font-weight: normal; margin: 0 0 32px; }
.essay p { font-size: 1.1875rem; margin: 0 0 20px; }
.beliefs { max-width: 680px; margin-top: 72px; border-top: 1px solid var(--line); padding-top: 24px; }
.beliefs dt { font-weight: bold; margin-top: 16px; }
.beliefs dd { margin: 2px 0 0; }

@media (max-width: 640px) {
  .nav, main { padding-left: 16px; padding-right: 16px; }
  .row > summary, .row.line-only > .head { grid-template-columns: 64px 1fr; }
  .row .size { display: none; }
  .thumb { width: 64px; height: 48px; }
  .body { padding-left: 0; }
}

/* Inline toys (home page, AI paragraph) */

.toy { display: inline-block; vertical-align: baseline; margin: 0 0.1em; }
.toy canvas { display: block; }

/* A plain page with one fixed background effect (html.fx-page, projects.html).
   bg-fx.js draws the effect named by data-fx on .bg-stage. */

html.fx-page {
  --ink: #fff;
  --muted: rgba(255, 255, 255, 0.72);
  --line: rgba(255, 255, 255, 0.35);
  background: #7f7876;
}
.fx-page body { background: transparent; }
.fx-page .bg-stage { position: fixed; inset: 0; z-index: -1; background: #7f7876; }
.fx-page .bg-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }

/* Snap-scrolling home (html.snap, index.html only).
   Each section is one "chunk". The background is a single fixed layer
   (.bg-stage) whose colour sections.js cross-fades as you scroll, so sections
   are transparent and nothing of the next background peeks in. A section is a
   little shorter than the viewport and its content is vertically centred. The
   next section's text shows in the gap below, blurred, and glides up to centre
   as it arrives (sections.js sets --shift and --blur from scroll position).
   Type is white. Put background effects inside .bg-stage. */

:root { --nav: 56px; --peek: 207px; }

html.snap {
  --ink: #fff;
  --muted: rgba(255, 255, 255, 0.72);
  --line: rgba(255, 255, 255, 0.35);
  background: #5e3f64;
  scroll-snap-type: y mandatory;
}
.snap body { background: transparent; }
.snap .bg-stage { position: fixed; inset: 0; z-index: -1; background: #5e3f64; }
.snap .bg-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
.snap .nav { position: fixed; top: 0; left: 0; right: 0; z-index: 10; padding-top: 18px; }
.snap main.home { max-width: none; margin: 0; padding: 0; }
.snap .home section {
  --pad-x: max(24px, calc((100vw - 1200px) / 2));
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 0;
  min-height: calc(100svh - var(--peek));
  padding: var(--nav) var(--pad-x) 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.snap .home section > * {
  transform: translateY(calc(var(--shift, 0) * -1px));
  filter: blur(calc(var(--blur, 0) * 1px));
  will-change: transform, filter;
}
.snap .fpo, .snap a.fpo { color: #141414; }
.snap .todo { color: var(--ink); opacity: 0.7; }

@media (max-width: 640px) {
  .snap .home section { --pad-x: 16px; }
}

/* Inline glyph toys: one row of fixed-width character cells (toys-glyphs.js). */

.glyph {
  display: inline-grid;
  grid-auto-flow: column;
  font-family: var(--mono);
  font-size: 0.5em;
  line-height: 1;
  vertical-align: 0.14em;
  margin: 0 0.3em;
}
.glyph span { display: block; text-align: center; white-space: pre; }

/* Inline 360 photo (toys-sphere.js): a WebGL window onto the inside of a sphere. */

.sphere {
  display: inline-block;
  position: relative;
  width: 3em;
  height: 1em;
  vertical-align: -0.2em;
  margin: 0 0.12em;
  border-radius: 999px;
  overflow: hidden;
  background: var(--fpo-bg);
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.sphere { transition: transform 0.35s cubic-bezier(.2, .8, .2, 1); z-index: 1; }
.sphere:hover, .sphere.dragging { transform: scale(2); z-index: 5; }
.sphere.dragging { cursor: grabbing; }
.sphere canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sphere::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14), inset 0 3px 10px rgba(0, 0, 0, 0.2);
  pointer-events: none;
}
.sphere:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* Inline pictures in the large text. Each sits in a short inline box so it
   never pushes the lines apart, and the image hangs from that box. The PNGs
   carry their own shadow padding, so the box width is the visible part. */

.pic { display: inline-block; position: relative; height: 0.7em; margin: 0 0.12em; }
.pic img { position: absolute; left: 0; display: block; }
.pic-meta  { width: 1.45em; margin-left: 0.2em; }
.pic-meta img  { height: 1.45em; bottom: -0.6em; }
.pic-quest { width: 1.8em; }
.pic-quest img { height: 1.9em; bottom: -0.65em; }
/* 3D model over a .pic (model3d.js). The stage is centred on the picture
   and bigger than it, so the model has room to turn. The picture stays until
   the model has loaded. */
.model3d-stage {
  position: absolute;
  left: 50%; bottom: 0.33em;
  width: 2.6em; height: 2.6em;
  margin-left: -1.3em; margin-bottom: -1.3em;
  transform-origin: 50% 50%;
  transition: transform 0.35s cubic-bezier(.2, .8, .2, 1);
  cursor: grab;
  touch-action: none;
  z-index: 1;
  /* Over the picture until hovered, so the pointer reaches it. */
}
.model3d-stage canvas { width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 0.3s; }
.model3d.loaded .model3d-stage canvas { opacity: 1; }
.model3d.loaded > img { visibility: hidden; }
.model3d-stage:hover, .model3d-stage.dragging { transform: scale(2.6); z-index: 5; }
.model3d-stage.dragging { cursor: grabbing; }
.pic-glasses { width: 1.8em; margin-left: 0.3em; }
.pic-holo  { width: 1em; margin-left: 0.2em; }
.pic-holo img  { height: 1em; bottom: -0.17em; }

/* Photo diorama (VR Memories). Sizes are in em so it scales with the text.
   Inline, it hangs from a short box like the .pic images; on hover it grows
   so there's room to peer around. */

.diorama { display: inline-block; position: relative; vertical-align: baseline; perspective: 8em; }
.diorama-card {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  background: #fff;
  border-radius: 0.09em;
  box-shadow: 0 0.05em 0.12em rgba(0, 0, 0, 0.12), 0 0.25em 0.6em rgba(0, 0, 0, 0.14);
  transform-style: preserve-3d;
}
.diorama-window {
  position: absolute;
  left: 4%; right: 4%; top: 4.5%; bottom: 17%;
  overflow: hidden;
  border-radius: 0.04em;
  background: #222;
}
.diorama-window img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  will-change: transform;
  user-select: none;
}
.diorama-bar {
  position: absolute;
  left: 4%; right: 4%; bottom: 0; height: 17%;
  display: flex;
  align-items: center;
  gap: 1.5%;
}
.diorama-bar i { width: 5%; aspect-ratio: 1; border-radius: 50%; display: block; }
.diorama-bar i.r1 { background: #1877f2; }
.diorama-bar i.r2 { background: #f7b928; margin-left: -2.5%; }
.diorama-bar i.r3 { background: #f33e58; margin-left: -2.5%; }
.diorama-bar b { height: 14%; width: 22%; border-radius: 1em; background: #d8d8d8; display: block; margin-left: 1.5%; }
.diorama-bar b.right { margin-left: auto; width: 18%; }

/* Inline placement in the large text */
.diorama.inline { width: 1.875em; height: 1.575em; margin: -0.9em 0.15em -0.225em; vertical-align: -0.225em; transition: transform 0.35s cubic-bezier(.2, .8, .2, 1); z-index: 1; }
.diorama.inline:hover { transform: scale(3.4); z-index: 5; }

/* Bare: no photo-post frame, just the scene in a rounded window (Workrooms). */
.diorama.bare .diorama-card { background: transparent; border-radius: 0.12em; }
.diorama.bare .diorama-window { inset: 0; border-radius: 0.12em; }
.diorama.inline.bare { width: 2.25em; height: 1.27em; margin: -0.68em 0.15em -0.225em; }
.diorama.inline.bare.video { width: 2.3em; }
.diorama.video .diorama-window { background: #000; }

/* Fill: the scene covers its box edge to edge, no card or frame (diorama.js). */
.diorama.fill { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; overflow: hidden; perspective: none; }
.diorama.fill .diorama-card { background: none; box-shadow: none; border-radius: inherit; }
.diorama.fill .diorama-window { inset: 0; border-radius: inherit; }
.diorama.fill canvas { object-fit: cover; }

/* Inline looping video in the large text (loopvid.js). Sits in the line like a .diorama.inline: the
   outer box holds the perspective and scales up on hover, the card inside tilts and pans toward the pointer. */
.vidpic {
  display: inline-block; position: relative; vertical-align: -0.2em; perspective: 8em;
  width: 1.8em; height: 1.305em; margin: -0.85em 0.15em -0.2em;
  transition: transform 0.35s cubic-bezier(.2, .8, .2, 1); z-index: 1;
}
.vidpic:hover { transform: scale(3); z-index: 5; }
.vidpic-card {
  display: block; position: absolute; inset: 0; overflow: hidden; background: #000;
  border-radius: 0.12em; box-shadow: 0 0.04em 0.2em rgba(0, 0, 0, 0.35);
  transform-style: preserve-3d;
}
/* App icon variant: a squircle PNG with its own edges. It lifts and tilts further on hover. */
.vidpic.icon { width: 1.5em; height: 1.5em; margin: -0.95em 0.2em -0.2em; vertical-align: -0.2em; }
.vidpic.icon:hover { transform: scale(2); }
.vidpic.icon .vidpic-card { overflow: visible; background: none; border-radius: 0; box-shadow: none; }
.vidpic.icon img { display: block; width: 100%; height: 100%; filter: drop-shadow(0 0.03em 0.06em rgba(0, 0, 0, 0.35)); transition: filter 0.35s; }
.vidpic.icon:hover img { filter: drop-shadow(0 0.18em 0.2em rgba(0, 0, 0, 0.4)); }
.vidpic video { display: block; width: 100%; height: 100%; object-fit: cover; will-change: transform; }

/* Looper controls toy (toy-looper.js): a 604 x 195 card scaled into a 3.6em slot by --s. */
.looper-toy {
  display: inline-block; position: relative; vertical-align: -0.15em;
  width: 3.6em; height: 1.163em; margin: -0.75em 0.15em -0.15em;
  transition: transform 0.35s cubic-bezier(.2, .8, .2, 1); z-index: 1;
  }
.looper-toy:hover, .looper-toy.dragging { transform: translateX(var(--tx, 0px)) scale(2.4); z-index: 5; }
.lt-scale { font: 16px/1 -apple-system, "SF Pro Text", "Helvetica Neue", Arial, sans-serif; position: absolute; left: 0; top: 0; width: 604px; height: 195px; transform: scale(var(--s, 0.3)); transform-origin: 0 0; perspective: 900px; }
.lt-card {
  position: absolute; inset: 0; border-radius: 28px; background: #151516; transform-style: preserve-3d;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35); transition: transform 0.12s ease-out; color: #fff;
}
.lt-panel {
  position: absolute; top: 10px; height: 175px; border-radius: 22px; transform-style: preserve-3d; transform: translateZ(8px);
  background: linear-gradient(#2e2e30, #262628); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07), 0 4px 10px rgba(0, 0, 0, 0.35);
}
.lt-rate { left: 12px; width: 278px; }
.lt-pitch { left: 302px; width: 290px; }
.lt-label { position: absolute; left: 18px; top: 18px; font-size: 14px; font-weight: 700; letter-spacing: 0.12em; color: #8d8d92; }
.lt-num { position: absolute; left: 16px; top: 38px; display: flex; align-items: baseline; transform: translateZ(14px); }
.lt-num b { font-size: 56px; font-weight: 300; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.lt-num i { font-style: normal; font-size: 18px; color: #c9c9cd; margin-left: 4px; }
.lt-ruler { position: absolute; left: 0; top: 88px; width: 278px; height: 80px; cursor: ew-resize; touch-action: none; outline: none; transform-style: preserve-3d; }
.lt-ruler svg, .lt-dial svg { display: block; overflow: visible; }
.lt-marker { transform-box: fill-box; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5)); }
.lt-dial { position: absolute; top: 30px; width: 120px; height: 64px; cursor: ew-resize; touch-action: none; outline: none; }
.lt-dial line:last-of-type { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5)); }
.lt-read { position: absolute; top: 80px; width: 140px; text-align: center; font-size: 30px; font-weight: 300; transform: translateZ(14px); pointer-events: none; }
.lt-cap { position: absolute; top: 122px; width: 140px; text-align: center; font-size: 14px; font-weight: 700; letter-spacing: 0.12em; color: #8d8d92; pointer-events: none; }
.lt-ruler:focus-visible, .lt-dial:focus-visible { outline: 2px solid #4a8bd6; outline-offset: 2px; border-radius: 6px; }

/* Fill variant: the model fills its card's media box and grows past the frame on hover. The canvas is
   padded (140%, keep FILL_PAD in model3d.js in step) so the grown model isn't clipped; the box takes the pointer. */
.model3d.fill { position: absolute; inset: 0; display: block; height: auto; margin: 0; }
.model3d.fill .model3d-stage { left: calc(-20% + 5px); top: -20%; bottom: auto; width: 140%; height: 140%; margin: 0; pointer-events: none; }
.model3d.fill:hover .model3d-stage, .model3d.fill .model3d-stage.dragging { transform: scale(1.39); z-index: 5; }   /* keep FILL_HOVER in step */
.model3d.fill { cursor: grab; touch-action: none; z-index: 1; }
.model3d.fill:hover { z-index: 5; }
