/* The designs: the list of cases to print, a page for each, and each one's guide.

   The site's own night, type and amber (style.css), and one new place: the studio. A
   design's page opens in it, on the warm grey its pictures were rendered against, so a
   black case can be seen. The model stands there, and scrolling takes it apart into a
   parts drawing: the list at its right is joined to each part by a line. Everything
   below the studio is the night page again, and quiet.

   A page is laid out for the board in html[data-board]. Anything with a data-board of its
   own shows only for that board. */

:root {
  --night: #0c0b0e;
  --ink: #f7f3ea;
  --dim: #d2cbbd;
  --line: rgba(255, 255, 255, 0.13);
  --accent: #ffa23a;
  --accent-ink: #1d1206;
  --plate: 'Michroma', 'Eurostile', 'Arial Black', sans-serif;
  --text: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --fill: rgba(255, 255, 255, 0.07);
  --bar: 3.5rem;
  --page: min(72rem, 100% - 2.5rem);
  --edge: max(1.25rem, (100% - 72rem) / 2);        /* the same, as a padding */
  /* the studio: the grey of the pictures' own backdrop, and ink for it */
  --studio: #d8d4d2;
  --studio-lit: #edeae7;
  --studio-deep: #b5afa9;
  --studio-ink: #19171c;
  --studio-dim: #4b464e;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--night); color-scheme: dark; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar) + 1rem); }
body { margin: 0; min-height: 100svh; color: var(--ink); font: 400 1rem/1.5 var(--text); }
a { color: inherit; text-underline-offset: 0.2em; }
a:hover { color: var(--accent); }
button, input { font: inherit; color: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; height: auto; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

html[data-board='pi4'] [data-board]:not([data-board='pi4']),
html[data-board='pi5'] [data-board]:not([data-board='pi5']) { display: none !important; }

/* ------------------------------------------------------------------ the bar */

.bar { position: fixed; inset: 0 0 auto; z-index: 10; height: var(--bar); display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 var(--edge);
  background: rgba(12, 11, 14, 0.84); -webkit-backdrop-filter: blur(16px) saturate(1.6); backdrop-filter: blur(16px) saturate(1.6);
  border-bottom: 1px solid var(--line); }
.bar-back { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.9375rem; text-decoration: none; white-space: nowrap; }
.bar-back svg { width: 0.7rem; height: 0.7rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* The choice of board: two radio buttons, drawn as one switch. Without JavaScript nothing
   could act on it, so it is not shown. */
.boards { display: flex; align-items: center; gap: 0.2rem; margin: 0; padding: 3px; border: 0; border-radius: 999px; background: var(--fill); min-width: 0; }
html:not(.js) .boards { display: none; }
.boards legend { float: left; padding: 0 0.6rem 0 0.75rem; font-size: 0.8125rem; color: var(--dim); }
.board { position: relative; cursor: pointer; }
.board input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.board > span { display: block; padding: 0.3rem 0.85rem; border-radius: 999px; font-size: 0.875rem; font-weight: 500; white-space: nowrap; }
.board small { font-size: 0.75rem; font-weight: 400; opacity: 0.8; }
.board:hover > span { background: rgba(255, 255, 255, 0.08); }
.board input:checked + span { background: var(--accent); color: var(--accent-ink); }
.board input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 40rem) {
  .boards legend, .board .long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .board > span { padding-inline: 0.7rem; }
}

/* ------------------------------------------------------------- a download */

.get { display: inline-flex; align-items: center; gap: 0.55rem; padding: 0.7rem 1.25rem; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 1rem; line-height: 1.2; text-decoration: none; }
.get:hover { color: var(--accent-ink); filter: brightness(1.07); }
.get svg { width: 1rem; height: 1rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; }
.bytes { font-size: 0.8125rem; color: var(--dim); white-space: nowrap; }
.sw { display: inline-block; width: 0.75rem; height: 0.75rem; flex: none; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(128, 128, 128, 0.55); }

/* --------------------------------------------------------------- the studio */

/* a design's page is wider than the rest, to give its model room */
.design-page { --page: min(82rem, 100% - 2.5rem); --edge: max(1.25rem, (100% - 82rem) / 2); }

.stage { position: relative; color: var(--studio-ink); background: var(--studio); }
.stage :focus-visible { outline-color: var(--studio-ink); }
.pin { position: relative; display: grid; gap: 1.5rem; padding: calc(var(--bar) + 2rem) var(--edge) 2.5rem;
  background: radial-gradient(120% 90% at 56% 34%, var(--studio-lit), var(--studio) 52%, var(--studio-deep) 100%);
  grid-template-columns: minmax(0, 24rem) minmax(0, 1fr); align-items: center; }
.still { grid-column: 2; grid-row: 1 / span 3; width: 100%; border-radius: 14px; }
.words { grid-column: 1; display: grid; gap: 1rem; align-content: center; }
.words h1 { font: 400 clamp(1.9rem, 3.3vw, 2.9rem)/1.12 var(--plate); letter-spacing: -0.01em; text-wrap: balance; }
.words .line { font-size: 1.125rem; line-height: 1.45; color: var(--studio-dim); max-width: 22rem; text-wrap: pretty; }
.words .fits { font-size: 0.9375rem; }
.stage .bytes { color: var(--studio-dim); }
#view, .leaders, .clear, .hint, .parts { display: none; }

/* With WebGL: the section is several screens tall and its picture stays put while they go
   by. The model is drawn over the whole of it, centred on .clear, the room left between
   the words and the list of parts. */
html.is-3d .stage { height: 360svh; }
html.is-3d .pin { position: sticky; top: 0; height: 100svh; min-height: 35rem; overflow: hidden;
  grid-template-columns: minmax(0, 22rem) minmax(0, 1fr) minmax(0, 14.5rem); grid-template-rows: minmax(0, 1fr); }
html.is-3d .still { display: none; }
html.is-3d #view { display: block; position: absolute; inset: 0; width: 100%; height: 100%; touch-action: pan-y; cursor: grab; outline-offset: -4px; }
html.is-3d.is-turning #view { cursor: grabbing; }
html.is-3d .leaders { display: block; position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
html.is-3d .clear { display: block; grid-column: 2; grid-row: 1; align-self: stretch; pointer-events: none; }
html.is-3d .words { grid-row: 1; position: relative; pointer-events: none; }
html.is-3d .words a { pointer-events: auto; }
html.is-3d .hint { display: block; position: absolute; left: 0; right: 0; bottom: 1.6rem; text-align: center; font-size: 0.875rem; color: var(--studio-dim); pointer-events: none; }

/* The list of parts. Each row is a button: pointing at it lights its part. */
html.is-3d .parts { display: grid; gap: 1px; grid-column: 3; grid-row: 1; align-self: center; position: relative; }
.part { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 0.55rem; width: 100%; padding: 0.3rem 0.5rem; border: 0; border-radius: 7px; background: none; text-align: left; cursor: pointer; color: inherit; }
.part-name { font-size: 0.875rem; font-weight: 500; line-height: 1.25; }
.part-n { margin-left: 0.4rem; font-weight: 400; color: var(--studio-dim); }
.part-n::before { content: '\00d7\2009'; }
.part-of { grid-column: 2; font-size: 0.75rem; line-height: 1.2; color: var(--studio-dim); }
.part.is-bought .sw { background: none; box-shadow: inset 0 0 0 1.5px var(--studio-dim); }
.part:hover, .part.is-on { background: rgba(25, 23, 28, 0.09); }
.leaders path { fill: none; stroke: rgba(25, 23, 28, 0.42); stroke-width: 1; vector-effect: non-scaling-stroke; }
.leaders circle { fill: var(--studio-ink); }
.leaders .is-on path { stroke: var(--studio-ink); stroke-width: 1.6; }

/* A board the design is not drawn for yet. */
.soon { grid-column: 1 / -1; justify-self: center; display: grid; gap: 0.9rem; max-width: 34rem; padding: 3rem 0 2rem; text-align: center; justify-items: center; }
.soon h2 { font: 400 clamp(1.3rem, 2.4vw, 1.8rem)/1.2 var(--plate); text-wrap: balance; }
.soon p { color: var(--studio-dim); text-wrap: pretty; }
html.is-soon .stage { height: auto; }
html.is-soon .pin { position: relative; height: auto; min-height: min(38rem, 100svh); grid-template-columns: 1fr; grid-template-rows: auto; align-content: center; }
html.is-soon :is(#view, .leaders, .clear, .hint, .still) { display: none; }
html.is-soon .words { justify-items: center; text-align: center; grid-column: 1; }

@media (max-width: 58rem) {
  .pin, html.is-3d .pin { grid-template-columns: minmax(0, 1fr); }
  .still { grid-column: 1; grid-row: auto; }
  html.is-3d .pin { grid-template-rows: auto minmax(0, 1fr) auto; padding-bottom: 3.6rem; gap: 0.5rem; }
  html.is-3d .words { gap: 0.55rem; }
  .words h1 { font-size: clamp(1.5rem, 6.4vw, 2.1rem); }
  .words .line { font-size: 1rem; max-width: none; }
  html.is-3d .words .fits { display: none; }
  html.is-3d .clear { grid-column: 1; grid-row: 2; }
  html.is-3d .leaders { display: none; }
  /* the list of parts is a row to swipe along the foot of the picture */
  html.is-3d .parts { grid-column: 1; grid-row: 3; grid-auto-flow: column; grid-auto-columns: max-content; gap: 0.35rem; overflow-x: auto; margin-inline: -1.25rem; padding: 0.25rem 1.25rem; scrollbar-width: none; }
  html.is-3d .parts::-webkit-scrollbar { display: none; }
  .part { padding: 0.35rem 0.7rem 0.35rem 0.55rem; border-radius: 999px; background: rgba(255, 255, 255, 0.4); }
  .part:hover, .part.is-on { background: rgba(255, 255, 255, 0.85); }
  .part-of { display: none; }
  html.is-3d .hint { bottom: 0.9rem; font-size: 0.8125rem; }
}

/* ------------------------------------------------------ below the studio */

.body { padding: 4.5rem 0 1rem; }
.sheet { width: var(--page); margin: 0 auto 5rem; }
.sheet > h2, .notes h2 { margin-bottom: 1.1rem; font: 400 1.0625rem/1.3 var(--plate); color: var(--accent); }
.aside { margin: -0.4rem 0 1.1rem; max-width: 46rem; font-size: 0.9375rem; color: var(--dim); }
table + .aside { margin-top: 1rem; }
.unprinted { margin: 0 0 1.25rem; max-width: 46rem; padding: 0.8rem 1rem; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; background: var(--fill); }

.about { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 2.5rem 4rem; align-items: start; }
.about-text { display: grid; gap: 1rem; font-size: 1.125rem; line-height: 1.55; max-width: 40rem; text-wrap: pretty; }
.about-text p + p { color: var(--dim); }
.more-link { color: var(--ink); font-weight: 500; }
.facts { display: grid; gap: 0; }
.facts > div { display: grid; grid-template-columns: 5.5rem 1fr; gap: 1rem; padding: 0.7rem 0; border-top: 1px solid var(--line); }
.facts > div:last-child { border-bottom: 1px solid var(--line); }
.facts dt { font-size: 0.875rem; color: var(--dim); }
.facts dd { font-size: 0.9375rem; }

.shots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem 1rem; }
.shots li:first-child { grid-column: span 2; grid-row: span 2; }
.shots a { display: grid; gap: 0.45rem; text-decoration: none; }
.shots img { display: block; width: 100%; border-radius: 10px; background: var(--studio); }
.shots li:first-child img { height: 100%; object-fit: cover; }
.shots li:first-child a { height: 100%; grid-template-rows: minmax(0, 1fr) auto; }
.shots span { font-size: 0.875rem; color: var(--dim); }
.shots a:hover span { color: var(--accent); }

table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
th, td { padding: 0.75rem 1rem 0.75rem 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); font-weight: 400; }
thead th { padding-bottom: 0.5rem; font-size: 0.8125rem; color: var(--dim); }
tbody th { font-weight: 500; white-space: nowrap; }
td { color: var(--dim); }
tfoot th, tfoot td { color: var(--ink); font-weight: 500; border-bottom: 0; }
.plates .sws { display: inline-flex; gap: 0.2rem; margin-right: 0.6rem; vertical-align: -0.05em; }
.plates td:nth-child(4), .plates td:nth-child(5) { white-space: nowrap; }
.plates .file { white-space: nowrap; padding-right: 0; }
.plates .file a, .singles a { color: var(--ink); font-weight: 500; }
.plates .file a:hover, .singles a:hover { color: var(--accent); }
.hardware .qty { width: 6rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.hardware tbody th { white-space: normal; }

.download { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 4rem; }
.download > h2, .download > .licence { grid-column: 1 / -1; }
.download-main { display: grid; gap: 1.4rem; align-content: start; }
.holds { display: grid; gap: 0.5rem; color: var(--dim); }
.holds li { padding-left: 1.1rem; position: relative; }
.holds li::before { content: ''; position: absolute; left: 0; top: 0.62em; width: 0.4rem; height: 0.4rem; border-radius: 50%; background: var(--accent); }
.download h3 { margin: 0 0 0.6rem; font: 500 0.875rem/1.3 var(--text); color: var(--dim); }
.singles li { display: grid; grid-template-columns: 1fr auto; gap: 0.1rem 1rem; padding: 0.6rem 0; border-top: 1px solid var(--line); }
.singles li:last-child { border-bottom: 1px solid var(--line); }
.singles .what { grid-column: 1 / -1; font-size: 0.8125rem; color: var(--dim); }
.licence { margin-top: 2rem; font-size: 0.9375rem; color: var(--dim); }

.strip { display: grid; grid-auto-flow: column; grid-auto-columns: 13.5rem; gap: 1rem; overflow-x: auto; padding-bottom: 0.75rem; scroll-snap-type: x proximity; }
.strip li { scroll-snap-align: start; }
.strip a { display: grid; gap: 0.5rem; text-decoration: none; font-size: 0.9375rem; }
.strip img { display: block; border-radius: 10px; background: var(--studio); }

.fine { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; width: var(--page); margin: 0 auto; padding: 1.5rem 0 2.5rem; border-top: 1px solid var(--line); font-size: 0.8125rem; color: var(--dim); }

@media (max-width: 58rem) {
  .body { padding-top: 3rem; }
  .sheet { margin-bottom: 3.75rem; }
  .about, .download { grid-template-columns: minmax(0, 1fr); }
  .download-singles { margin-top: 2rem; }
  .shots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* a table row becomes a block, each cell under its column's name */
  .plates thead { display: none; }
  .plates tr { display: grid; grid-template-columns: 5.5rem 1fr; gap: 0.3rem 1rem; padding: 0.9rem 0; border-bottom: 1px solid var(--line); }
  .plates th, .plates td { display: contents; }
  .plates tbody th, .plates tfoot th { display: block; grid-column: 1 / -1; padding: 0; border: 0; }
  .plates td[data-label]::before { content: attr(data-label); font-size: 0.8125rem; color: var(--dim); }
  .plates td:not([data-label]):empty { display: none; }
  .plates .file { display: block; grid-column: 1 / -1; padding: 0.2rem 0 0; border: 0; white-space: normal; }
  .hardware thead th:first-child, .hardware .qty { width: 3.25rem; }
}

/* A picture opened large (pictures.js). */
.lightbox { width: min(96vw, 94rem); max-width: none; max-height: none; height: 100dvh; margin: auto; padding: 3.5rem 0 1rem; border: 0; background: none; color: var(--ink); overflow: visible; }
.lightbox::backdrop { background: rgba(8, 7, 10, 0.92); }
.lightbox figure { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 0.75rem; height: 100%; justify-items: center; }
.lightbox img { max-width: 100%; max-height: 100%; width: auto; height: auto; min-height: 0; object-fit: contain; border-radius: 10px; }
.lightbox figcaption { font-size: 0.9375rem; color: var(--dim); }
.lightbox button { position: absolute; display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%; background: rgba(40, 37, 45, 0.9); cursor: pointer; }
.lightbox button:hover { background: var(--accent); color: var(--accent-ink); }
.lightbox svg { width: 0.9rem; height: 0.9rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.lightbox-close { top: 0.5rem; right: 0.5rem; }
.lightbox-step { top: 50%; translate: 0 -50%; }
.lightbox-step[data-step='-1'] { left: 0.5rem; }
.lightbox-step[data-step='1'] { right: 0.5rem; }

/* ------------------------------------------------------- the list of designs */

.shelf { width: var(--page); margin: 0 auto; padding: calc(var(--bar) + 4rem) 0 2rem; }
.shelf-head { display: grid; gap: 1.1rem; margin-bottom: 3.5rem; }
.shelf-head h1 { font: 400 clamp(2rem, 5vw, 3.6rem)/1.08 var(--plate); letter-spacing: -0.01em; text-wrap: balance; }
.lede { max-width: 40rem; font-size: 1.1875rem; line-height: 1.5; color: var(--dim); text-wrap: pretty; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr)); gap: 3rem 1.5rem; }
.card > a { display: grid; gap: 0.35rem; text-decoration: none; }
.card-pic { position: relative; display: block; margin-bottom: 0.6rem; border-radius: 12px; overflow: hidden; background: var(--studio); }
.card-pic img { display: block; width: 100%; }
.card-name { font: 400 1.0625rem/1.3 var(--plate); }
.card-line { font-size: 0.9375rem; color: var(--dim); text-wrap: pretty; }
.card > a:hover .card-line { color: var(--dim); }
.card-boards { display: flex; flex-wrap: wrap; gap: 0.4rem 0.9rem; margin-top: 0.7rem; font-size: 0.8125rem; }
.card-boards .has { padding: 0.1rem 0.6rem; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 999px; }
.card-boards .not { padding: 0.1rem 0; color: var(--dim); }
/* chosen a board this design is not drawn for: its picture stands back and says so */
.card-soon { position: absolute; inset: 0; display: grid; place-items: center; padding: 1rem; text-align: center; font: 400 0.9375rem/1.4 var(--plate); color: var(--ink); background: rgba(12, 11, 14, 0.72); }
html[data-board='pi4'] .card:not([data-ready~='pi4']) .card-pic img,
html[data-board='pi5'] .card:not([data-ready~='pi5']) .card-pic img { filter: saturate(0.25); }

.notes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem 3rem; margin-top: 5.5rem; padding-top: 2.5rem; border-top: 1px solid var(--line); }
.notes h2 { margin-bottom: 0.6rem; }
.notes p { font-size: 0.9375rem; color: var(--dim); text-wrap: pretty; }
@media (max-width: 58rem) {
  .shelf { padding-top: calc(var(--bar) + 2.5rem); }
  .shelf-head { margin-bottom: 2.5rem; }
  .notes { grid-template-columns: minmax(0, 1fr); margin-top: 4rem; }
}

/* ---------------------------------------------------------------- a guide */

.guide { width: min(46rem, 100% - 2.5rem); margin: 0 auto; padding: calc(var(--bar) + 2.5rem) 0 4rem; }
.guide-note { margin-bottom: 2rem; padding: 0.7rem 1rem; border-radius: 8px; background: var(--fill); font-size: 0.875rem; color: var(--dim); }
.guide article > * + * { margin-top: 1rem; }
.guide h1 { font: 400 1.6rem/1.2 var(--plate); text-wrap: balance; }
.guide h2 { margin-top: 3rem; font: 400 1.0625rem/1.3 var(--plate); color: var(--accent); }
.guide h3 { margin-top: 2rem; font: 700 1.0625rem/1.3 var(--text); }
.guide p, .guide li, .guide td { color: var(--dim); }
.guide strong { color: var(--ink); }
.guide ul, .guide ol { padding-left: 1.3rem; }
.guide ul { list-style: disc; }
.guide ol { list-style: decimal; }
.guide li + li { margin-top: 0.4rem; }
.guide li > ul, .guide li > ol { margin-top: 0.4rem; }
.guide img { display: block; border-radius: 10px; background: var(--studio); }
.guide table { display: block; overflow-x: auto; font-size: 0.875rem; }
.guide thead th { color: var(--ink); font-weight: 500; }
.guide td img, .guide th img { min-width: 12rem; }
.guide code, .guide pre { font: 400 0.875em/1.5 ui-monospace, 'SF Mono', Menlo, Consolas, monospace; color: var(--ink); }
.guide code { background: var(--fill); border-radius: 4px; padding: 0.1em 0.35em; overflow-wrap: anywhere; }
.guide pre { padding: 0.85rem 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--fill); overflow-x: auto; }
.guide pre code { background: none; padding: 0; overflow-wrap: normal; }

@media (prefers-reduced-motion: no-preference) {
  .get, .board > span, .part { transition: background-color 0.15s, filter 0.15s; }
}
@media (prefers-contrast: more) {
  :root { --dim: var(--ink); --line: rgba(255, 255, 255, 0.4); --studio-dim: var(--studio-ink); }
}
