/* ─────────────────────────────────────────────────────────────────────
   Project pages, second edition: a large title, a two-sentence statement and
   a row of facts; the opening picture full width; then chapters with the
   text on the left (it stays while its pictures pass) and the pictures on the
   right; the other projects of the crate and a large next project to finish.
   Pages that open out of the sand (body.sand) keep the sand behind them.
   ───────────────────────────────────────────────────────────────────── */
:root {
  --bg: #f6f3ee; --ink: #1c1a17; --ink2: #57524b; --muted: #8f897f; --line: rgba(28, 26, 23, 0.12);
  --accent: #b4532f; --pad: clamp(20px, 5vw, 72px); --r: 10px;
  --sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.62 var(--sans); -webkit-font-smoothing: antialiased; }
body.sand { --bg: transparent; --ink: #1f1a12; --ink2: #43392b; --muted: #6c5d48; --line: rgba(80, 56, 24, 0.2); --accent: #8f3a1c; background: #d0bd9f; }
/* on the sand (rail.css lays the sand under the whole page), every picture lies there as a print */
body.sand .shots figure > img, body.sand .shots figure > video, body.sand .shots figure > a > img, body.sand .p-hero img, body.sand .p-hero video {
  box-shadow: 0 1px 2px rgba(60, 40, 15, 0.2), 0 18px 32px -20px rgba(60, 40, 15, 0.55);
}
body.sand .p-crate img { box-shadow: 0 1px 2px rgba(60, 40, 15, 0.2); }
body.has-rail .p-head h1 { margin-top: 84px; }
img, video { display: block; width: 100%; height: auto; border-radius: var(--r); }
/* every picture sits in a white frame with faint grey dots behind it */
.shots figure > img, .shots figure > video, .shots figure > a > img, .p-hero img, .p-hero video {
  padding: 12px; border-radius: 8px;
  background: #fff radial-gradient(circle, rgba(0, 0, 0, 0.09) 1px, transparent 1.4px) 0 0 / 11px 11px;
  box-shadow: 0 0 0 1px rgba(28, 26, 23, 0.06);
}
.p-hero img, .p-hero video { padding: clamp(12px, 2vw, 24px); }
/* the rail's small capitals become plain bold labels on these pages */
body.has-rail .cs-label, body.has-rail .cs-rail-next small { font: 600 12.5px/1.4 var(--sans); letter-spacing: 0; text-transform: none; }
body.has-rail .cs-brand span { font: 500 11.5px/1.4 var(--sans); letter-spacing: 0; text-transform: none; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent); color: #fff; }

.p-wrap { max-width: 1440px; margin: 0 auto; padding: 0 var(--pad); }
.p-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 22px var(--pad); max-width: 1440px; margin: 0 auto; font-size: 13.5px; }
.p-top a { text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.p-top a:hover { color: var(--accent); }
.cs-status { display: inline-flex; gap: 6px; align-items: center; padding: 5px 11px 5px 10px; border-radius: 999px; font: 500 11.5px/1 var(--sans); }
.cs-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.cs-status.is-done { color: #b4532f; background: #fbe6d6; box-shadow: inset 0 0 0 1px rgba(180, 83, 47, 0.22); }
.cs-status.is-wip { color: #2f5fb3; background: #e3ecfa; box-shadow: inset 0 0 0 1px rgba(47, 95, 179, 0.22); }

.p-head h1 { font-size: clamp(34px, 4.2vw, 58px); line-height: 1.02; letter-spacing: -0.035em; font-weight: 700; margin: 56px 0 0; }
.p-statement { max-width: 46ch; font-size: clamp(16px, 1.25vw, 18px); line-height: 1.5; letter-spacing: -0.005em; margin: 18px 0 0; }
.p-facts { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 24px; margin: 40px 0 0; padding: 0; }
.p-facts div { border-top: 1px solid var(--line); padding-top: 12px; }
.p-facts dt { font: 600 13px/1.4 var(--sans); color: var(--muted); margin-bottom: 6px; }
.p-facts dd { margin: 0; font-size: 15px; line-height: 1.5; }
.p-facts dd a { text-underline-offset: 3px; }
.p-hero { margin: 40px 0 0; position: relative; }
.p-hero > a { display: block; text-decoration: none; }

.p-ch { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 5vw, 80px); padding: 112px 0 0; align-items: start; }
.p-ch .say { position: sticky; top: 36px; }
.p-ch.solo { grid-template-columns: minmax(0, 1fr); }
.p-ch.solo .say { position: static; max-width: 760px; }
.p-k { font: 600 13px/1.4 var(--sans); color: var(--accent); }
.p-ch h2 { font-size: clamp(19px, 1.55vw, 23px); line-height: 1.28; letter-spacing: -0.015em; font-weight: 650; margin: 8px 0 14px; }
.p-ch h3.p-sub { font-size: 15px; font-weight: 600; letter-spacing: -0.005em; color: var(--ink); margin: 22px 0 6px; }
.p-ch p { color: var(--ink2); margin: 0 0 14px; max-width: 50ch; }
.p-ch.solo p { max-width: 64ch; }
.p-ch.wide .shots { margin-top: 18px; max-width: 1040px; }
.shots { display: grid; gap: 18px; }
.shots.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.shots.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.shots.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.shots figure { margin: 0; min-width: 0; }
.shots figcaption { font-size: 13px; line-height: 1.45; color: var(--muted); margin-top: 8px; }
.shots figure > a { display: block; }
[data-zoom] { cursor: zoom-in; }
.code { margin: 0; padding: 18px 20px; overflow-x: auto; border-radius: var(--r); background: #141216; color: #e6dfe4; font: 500 12.5px/1.6 var(--mono); }
.code code { font: inherit; white-space: pre; }

.p-crate { margin: 140px 0 0; border-top: 1px solid var(--line); padding-top: 22px; }
.p-crate p { font: 600 13px/1.4 var(--sans); color: var(--muted); margin: 0 0 14px; }
.p-crate ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.p-crate a { display: block; text-decoration: none; font-size: 13.5px; color: var(--ink2); }
.p-crate img { aspect-ratio: 16 / 9; object-fit: cover; border-radius: 7px; margin-bottom: 7px; opacity: 0.88; transition: opacity 0.2s; }
.p-crate a:hover img { opacity: 1; }
.p-crate a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.p-crate a[aria-current="page"] img { opacity: 1; box-shadow: 0 0 0 2px var(--ink); }
.p-next { margin: 64px 0 0; border-top: 1px solid var(--line); padding: 26px 0 96px; display: flex; justify-content: space-between; align-items: end; gap: 24px; text-decoration: none; color: inherit; }
.p-next small { font: 600 13px/1.4 var(--sans); color: var(--muted); }
.p-next strong { display: block; font-size: clamp(28px, 3.4vw, 46px); font-weight: 700; letter-spacing: -0.035em; line-height: 1; margin-top: 10px; transition: color 0.2s; }
.p-next:hover strong { color: var(--accent); }
.p-next img { width: 22%; flex: none; }
.p-foot { border-top: 1px solid var(--line); padding: 20px var(--pad) 36px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 20px; font-size: 13px; color: var(--muted); max-width: 1440px; margin: 0 auto; }
.p-foot nav { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.p-foot a { text-decoration: none; }
.p-foot a:hover { color: var(--ink); }

/* the lightbox (case.js) */
.cs-lb { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 48px 20px; background: rgba(20, 18, 15, 0.9); opacity: 0; visibility: hidden; transition: opacity 0.15s, visibility 0.15s; }
.cs-lb.on { opacity: 1; visibility: visible; }
.cs-lb img { max-width: min(1400px, 100%); max-height: calc(100vh - 110px); width: auto; height: auto; border-radius: 6px; }
.cs-lb p { position: absolute; left: 0; right: 0; bottom: 14px; margin: 0; text-align: center; font-size: 13px; color: rgba(255, 255, 255, 0.75); }
.cs-lb button { position: absolute; border: 0; background: none; color: #fff; font-size: 22px; line-height: 1; padding: 12px; cursor: pointer; opacity: 0.75; }
.cs-lb button:hover { opacity: 1; }
.cs-lb .x { top: 8px; right: 10px; }
.cs-lb .prev { left: 8px; top: 50%; transform: translateY(-50%); }
.cs-lb .next { right: 8px; top: 50%; transform: translateY(-50%); }

@media (max-width: 860px) {
  .p-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .p-ch { grid-template-columns: minmax(0, 1fr); padding-top: 80px; }
  .p-ch .say { position: static; }
  .shots.three, .shots.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* .stack: wide pictures one per row, so a third one is not left alone beside a gap */
  .shots.stack { grid-template-columns: minmax(0, 1fr); }
  .p-next img { display: none; }
}
@media (max-width: 520px) { .shots.two { grid-template-columns: minmax(0, 1fr); } }
.p-frame { border-radius: 8px; overflow: hidden; box-shadow: 0 0 0 1px rgba(28, 26, 23, 0.08); }
.p-frame iframe { display: block; width: 100%; aspect-ratio: 16 / 10; border: 0; }
.p-hero > figure { margin: 0; }
/* .shots.bento: pictures on a 12-column grid, each as wide as its class says (s4 to s8; s12 by default), so a tall
   picture and a wide one can share a row at sizes that keep both readable; one per row on a phone */
.shots.bento { grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: start; gap: 28px 22px; }
.shots.bento > figure { grid-column: span 12; }
.shots.bento > .s4 { grid-column: span 4; }
.shots.bento > .s5 { grid-column: span 5; }
.shots.bento > .s6 { grid-column: span 6; }
.shots.bento > .s7 { grid-column: span 7; }
.shots.bento > .s8 { grid-column: span 8; }
@media (max-width: 860px) { .shots.bento > figure { grid-column: span 12; } }
