:root {
  --bg: #fff;
  --ink: #1b1a18;
  --muted: #837d73;
  --line: #ddd7cc;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --font-index: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-y: scroll; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 300 1rem/1.6 var(--font); -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0.5rem; background: var(--ink); color: var(--bg); padding: 0.5rem 0.75rem; z-index: 100; }
.skip:focus { left: 0.5rem; }

/* Header + footer */
.site-header { display: flex; justify-content: space-between; align-items: baseline; padding: 1.5rem var(--gutter); }
.brand { font-weight: 400; text-decoration: none; letter-spacing: 0.01em; font-size: 0.95rem; }
.site-nav { display: flex; gap: 1.5rem; font-size: 0.95rem; }
.site-nav a { text-decoration: none; color: var(--muted); }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); }
.site-footer { padding: 2rem var(--gutter); color: var(--muted); font-size: 0.875rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* Home: three options, nothing else until one is chosen */
.home { padding: clamp(3rem, 14vh, 8rem) var(--gutter) 4rem; min-height: 115vh; }  /* taller than the screen, so the scrollbar is there from the start */
.choose { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem clamp(1.25rem, 4vw, 3rem); }
.choose button { font-weight: 300; font-size: clamp(1.25rem, 2.6vw, 1.75rem); letter-spacing: 0; line-height: 1.3; color: var(--muted); transition: color 0.15s; }
.choose button:hover, .choose button[aria-pressed="true"] { color: var(--ink); }
.choose button[aria-pressed="true"] { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.4em; }
.work[hidden] { display: none; }
.empty { color: var(--muted); margin: 0; text-align: center; }
.work { margin-top: clamp(2.5rem, 8vh, 5rem); }

/* Project name index: small, quiet; hovering a name hazes the other projects' photos */
.index { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: 0; align-items: center; }
.index[hidden] { display: none; }
.index li { display: contents; }
.index a { justify-self: end; text-align: right; font-family: var(--font-index); font-weight: 400; font-size: 0.78rem; letter-spacing: 0.02em; line-height: 1.75; color: var(--muted); text-decoration: none; transition: color 0.15s; }
.index a:hover, .index a:focus-visible, .index a.on { color: var(--ink); }
.index .bat { padding-left: 1rem; }
.index .bat, .bat-link { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #e8590c; white-space: nowrap; justify-self: start; transition: opacity 0.15s; }
.project-head .meta a.bat-link { font-size: inherit; font-weight: 600; letter-spacing: 0; text-transform: none; color: #e8590c; }
.project-head .meta .bat-link { font-size: inherit; font-weight: 600; letter-spacing: 0; text-transform: none; }
@media (max-width: 36rem) {
  .index { display: block; text-align: right; }
  .index li { display: block; margin-bottom: 0.4rem; }
  .index a { display: inline; }
  .index .bat { display: block; text-align: right; padding-left: 0; }
}

.follow { position: fixed; left: 0; top: 0; width: clamp(220px, 24vw, 340px); pointer-events: none; z-index: 50; opacity: 0; transform: scale(0.95); transition: opacity 0.18s ease, transform 0.18s ease; will-change: transform; }
.follow.on { opacity: 1; }
.follow img { width: 100%; height: auto; box-shadow: 0 10px 30px rgb(0 0 0 / 0.15); }
@media (hover: none) { .follow { display: none; } }

/* Masonry grid: columns are built in JS so every column starts at the same top edge */
.grid { display: flex; gap: 0.5rem; align-items: flex-start; margin-top: clamp(1.25rem, 3vh, 2rem); }
.grid .col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.tile { position: relative; display: block; background: #e6e1d7; text-decoration: none; overflow: hidden; transition: opacity 0.2s; }
.tile.dim { opacity: 0.25; }
.tile img { width: 100%; height: auto; transition: filter 0.2s; }
.tile .cap { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 1rem; color: #fff; font-size: 1.1rem; opacity: 0; transition: opacity 0.2s; }
.tile:hover img, .tile:focus-visible img { filter: brightness(0.55); }
.tile:hover .cap, .tile:focus-visible .cap { opacity: 1; }
@media (hover: none) { .tile .cap { opacity: 1; background: linear-gradient(transparent 60%, rgb(0 0 0 / 0.45)); align-items: end; justify-items: start; font-size: 1rem; } }

/* Project page */
.project-head { padding: 1rem var(--gutter) 1.5rem; }
.project-head h1 { margin: 0; font-weight: 300; font-size: clamp(1.5rem, 3.5vw, 2.25rem); letter-spacing: -0.01em; line-height: 1.2; }
.project-head .meta { margin: 0.5rem 0 0; color: var(--muted); }
.project-head .meta a { color: inherit; }
.project-head .note { margin: 0.25rem 0 0; max-width: 40rem; }
.mosaic { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0 var(--gutter); }
.mosaic .mcol { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.bat-cta { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; margin-top: 1.5rem; padding: clamp(1.1rem, 3vw, 1.75rem) clamp(1.25rem, 4vw, 2.5rem); background: #e8590c; color: #fff; text-decoration: none; border-radius: 0.25rem; transition: background 0.15s, transform 0.15s; }
.bat-cta span { display: flex; flex-direction: column; font-size: clamp(0.8rem, 1.6vw, 1rem); letter-spacing: 0.06em; text-transform: uppercase; }
.bat-cta strong { font-size: clamp(1.6rem, 5vw, 3rem); font-weight: 400; letter-spacing: -0.01em; line-height: 1.1; text-transform: none; }
.bat-cta i { flex: none; font-style: normal; font-size: clamp(0.9rem, 2vw, 1.15rem); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1; padding: 0.9em 1.4em; background: #fff; color: #e8590c; border-radius: 999px; white-space: nowrap; }
.bat-cta:hover, .bat-cta:focus-visible { background: #c94a08; }
.bat-cta i { transition: background 0.15s, color 0.15s; }
.bat-cta:hover i, .bat-cta:focus-visible i { background: #1b1a17; color: #fff; }
.frame { overflow: hidden; display: block; width: 100%; padding: 0; border: 0; background: #e6e1d7; cursor: zoom-in; line-height: 0; }
.frame img { display: block; width: 100%; height: auto; }
.frame:hover img, .frame:focus-visible img { filter: brightness(0.85); }
.next { display: block; padding: clamp(2rem, 6vh, 4rem) var(--gutter); font-size: clamp(1.25rem, 3vw, 1.75rem); font-weight: 300; text-decoration: none; }
.next small { display: block; color: var(--muted); font-size: 0.875rem; letter-spacing: 0; }
.next:hover span { text-decoration: underline; text-underline-offset: 0.2em; }
.back { display: inline-block; padding: 0 var(--gutter); color: var(--muted); text-decoration: none; }
.back:hover { color: var(--ink); }

/* Lightbox (native <dialog>: Esc and focus trap for free) */
dialog.lb { border: 0; padding: 0; max-width: none; max-height: none; width: 100vw; height: 100dvh; background: rgb(18 17 15 / 0.96); color: #f3f0ea; }
dialog.lb::backdrop { background: transparent; }
.lb-inner { height: 100%; display: grid; grid-template-rows: auto 1fr auto; }
.lb-top, .lb-bottom { display: flex; justify-content: space-between; align-items: center; padding: 1rem var(--gutter); gap: 1rem; }
.lb-stage { position: relative; min-height: 0; display: grid; place-items: center; padding: 0 clamp(3rem, 8vw, 6rem); }
.lb-stage img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.lb button { padding: 0.5rem 0.75rem; opacity: 0.8; }
.lb button:hover { opacity: 1; }
.lb .arrow { position: absolute; top: 50%; transform: translateY(-50%); font-size: 2rem; padding: 1rem; }
.lb .arrow.prev { left: 0; }
.lb .arrow.next { right: 0; }
.lb-caption { color: #bdb7ab; font-size: 0.875rem; min-height: 1.4em; }
.lb :focus-visible { outline-color: #f3f0ea; }

/* About */
.about { padding: clamp(2rem, 8vh, 5rem) var(--gutter) 4rem; max-width: 52rem; }
.about h1 { font-weight: 300; font-size: clamp(1.5rem, 3.5vw, 2.25rem); letter-spacing: -0.01em; margin: 0 0 2rem; line-height: 1.2; }
.about p { font-size: 1.05rem; max-width: 36rem; }
.about dl { display: grid; grid-template-columns: 8rem 1fr; gap: 1rem 2rem; margin: 3rem 0 0; padding-top: 2rem; border-top: 1px solid var(--line); }
@media (max-width: 36rem) { .about dl { grid-template-columns: 1fr; gap: 0.25rem; } .about dd { margin-bottom: 1rem; } }
.about dt { color: var(--muted); }
.about dd { margin: 0; }
.about ul { list-style: none; margin: 0; padding: 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
  .follow { transform: none; }
}

/* Photo settle: fade in and ease down from a slight zoom */
img.settle { opacity: 0; transform: scale(1.06); transition: opacity 0.9s ease, transform 1.6s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.2s; }
img.settle.in { opacity: 1; transform: none; }

/* Landing wheel: big, and while it is showing the page is locked so scrolling spins it instead (wheel.js) */
.wheel { width: min(94vw, 44rem, calc((100svh - 14rem) / 0.95)); min-width: min(94vw, 18rem); margin: clamp(1rem, 4vh, 3rem) auto 0; }
.wheel[hidden] { display: none; }
.wheel canvas { display: block; width: 100%; aspect-ratio: 1 / 0.95; }
/* the page is exactly 1px taller than the screen, so it can scroll 1px; wheel.js stops swipes and wheel turns from moving it further */
html.wheel-lock { overflow-y: scroll; overscroll-behavior: none; }
html.wheel-lock body { height: calc(100svh + 1px); overflow: hidden; }

/* About: locked page (same lock as the landing wheel). Text in a sidebar, point-cloud engine beside it; scrolling revs the engine. */
.about-page .site-footer { padding: 0.9rem var(--gutter); }
.about.about-lock { max-width: none; padding: 0.5rem var(--gutter) 0; min-height: 0; display: grid; grid-template-columns: minmax(17rem, 25rem) minmax(0, 1fr); gap: 0 clamp(1.5rem, 4vw, 4rem); }
.about-side { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 0 0.5rem 1rem 0; }
.about-side h1 { margin-bottom: 1.25rem; }
.about-side p { font-size: 1rem; margin: 0 0 0.8em; }
.about-side dl { grid-template-columns: 5.5rem 1fr; gap: 0.75rem 1rem; margin-top: 1.5rem; padding-top: 1.25rem; }
html:root .eng.about-eng { --eng-fg: var(--ink); --eng-bg: var(--bg); --eng-muted: var(--muted); --eng-line: var(--line); --eng-accent: #e8590c; --eng-sans: var(--font); --eng-mono: var(--font-index); min-height: 0; display: flex; flex-direction: column; }
.about-eng .eng-stage { flex: 1; aspect-ratio: auto; max-height: none; min-height: 0; }
.about-eng .eng-tabs { padding-block: 0.75rem 0.25rem; }
.about-eng .eng-tabs button b { font-weight: 300; font-size: clamp(1rem, 1.6vw, 1.25rem); }
.about-eng .eng-read b { font-weight: 300; }
.about-eng .eng-rpm { font-weight: 300; }
@media (max-width: 860px) {
  .about.about-lock { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 48%) minmax(0, 1fr); gap: 0.75rem 0; }
  .about-eng { order: -1; }
  .about-eng .eng-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .about-eng .eng-tabs button, .about-eng .eng-tabs .cycle { flex: none; margin-left: 0; }
  .about-eng .eng-hint { display: none; }
  .about-eng .eng-read b { font-size: 1.05rem; }
  .about-eng .eng-read { max-width: 62%; }
  .about-eng .eng-rpm { font-size: 1.75rem; }
  .about-eng .eng-bar { width: 6.5rem; }
}
