/* ---------- Tokens ---------- */
:root {
  color-scheme: light;

  --ink: #111111;
  --ink-2: #27272a;
  --muted: #52525b;
  --line: #e4e4e7;
  --paper: #ffffff;
  --night: #141416;

  /* Brand gradient hues */
  --sky: #79bde5;
  --violet: #8e74b4;
  --coral: #ee6470;

  /* Shelf colours (cards) — full and soft versions of the brand hues */
  --tone-0: #79bde5;
  --tone-1: #e3d9f1;
  --tone-2: #ee6470;
  --tone-3: #cfe5f5;
  --tone-4: #a792cb;
  --tone-5: #f8cdd3;
  --tone-6: #b9dcf1;
  --tone-7: #f49aa3;

  --shape: #141416;

  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --body: "Figtree", ui-sans-serif, system-ui, sans-serif;

  --radius-card: 28px;
  --gutter: clamp(16px, 3vw, 40px);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
/* Line heights are whole grid cells, so every line of text can sit on the grid (js/grid.js shifts each
   block onto it). Each is the design ratio rounded to the nearest cell, at the element's own font size. */
/* Defined once; em resolves at each element that uses them. */
:root {
  --lh-0_88: max(var(--u), round(nearest, calc(0.88 * 1em), var(--u)));
  --lh-0_9: max(var(--u), round(nearest, calc(0.9 * 1em), var(--u)));
  --lh-0_95: max(var(--u), round(nearest, calc(0.95 * 1em), var(--u)));
  --lh-1: max(var(--u), round(nearest, calc(1 * 1em), var(--u)));
  --lh-1_05: max(var(--u), round(nearest, calc(1.05 * 1em), var(--u)));
  --lh-1_3: max(var(--u), round(nearest, calc(1.3 * 1em), var(--u)), round(up, 1.1em, var(--u)));
  --lh-1_45: max(var(--u), round(nearest, calc(1.45 * 1em), var(--u)), round(up, 1.1em, var(--u)));
  --lh-1_5: max(var(--u), round(nearest, calc(1.5 * 1em), var(--u)), round(up, 1.1em, var(--u)));
  --lh-1_55: max(var(--u), round(nearest, calc(1.55 * 1em), var(--u)), round(up, 1.1em, var(--u)));
}
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: var(--lh-1_5);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 6px; }

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip {
  position: absolute; left: 16px; top: -60px; z-index: 10;
  padding: 10px 16px; border-radius: 999px; background: var(--ink); color: #fff; text-decoration: none;
}
.skip:focus { top: 16px; }

/* The layout sits on the background grid: --u is one cell. The content width is a whole number of cells,
   made of --cols card columns of --col with one-cell gaps, so card edges and the page edges fall on lines. */
:root {
  --u: 24px; --cols: 1;
  --col: round(down, calc((100vw - 2 * var(--gutter) - (var(--cols) - 1) * var(--u)) / var(--cols)), var(--u));
  --W: calc(var(--cols) * var(--col) + (var(--cols) - 1) * var(--u));
}
@media (min-width: 640px) { :root { --cols: 2; } }
@media (min-width: 1000px) { :root { --cols: 3; } }
@media (min-width: 1320px) { :root { --cols: 4; --col: 288px; } }
.wrap { width: var(--W); max-width: 100%; margin: 0 auto; }

/* ---------- Top wash + header ---------- */
/* At least as tall as the window, so the grid (body::after) reaches the bottom on short pages, including
   the ones that hide the footer (the form, admin). Pages with a footer are already stretched by js/grid.js. */
body { position: relative; min-height: 100vh; min-height: 100dvh; }
.wash {
  position: absolute; inset: 0 0 auto; height: 720px; z-index: -1; pointer-events: none;
  background:
    radial-gradient(45% 420px at 8% 0%, #dce9f7 0%, rgb(220 233 247 / 0) 100%),
    radial-gradient(40% 380px at 70% 0%, #f6dde3 0%, rgb(246 221 227 / 0) 100%),
    radial-gradient(40% 420px at 100% 10%, #e6ddf2 0%, rgb(230 221 242 / 0) 100%),
    var(--paper);
  background-repeat: no-repeat;
}
/* A faint line grid over the whole page, above the wash and behind everything else. */
body::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(to right, rgb(17 17 17 / .045) 1px, transparent 1px),
    linear-gradient(to bottom, rgb(17 17 17 / .045) 1px, transparent 1px);
  background-size: var(--u) var(--u);
  /* A line on the content's left edge. (50% here means half of the width left over after one tile.) */
  background-position: calc(50% + var(--u) / 2 - var(--W) / 2) 0;
  /* Fades in below the header, so the lines don't run through the logo and the name. */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, transparent 120px, #000 264px);
  mask-image: linear-gradient(to bottom, transparent 0, transparent 120px, #000 264px);
}

.top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 16px; padding-block: 24px; /* 24 + 48px button + 24 = four cells */
}
.wordmark {
  display: inline-flex; align-items: center; gap: 10px;
  /* 600: its stems match the ring's stroke on the finished mark (800 overpowered it) */
  font-family: var(--display); font-weight: 600; font-size: 22px; letter-spacing: -0.02em;
  text-decoration: none;
}

/* ---------- Brand mark, in outline mode ----------
   Blue outlines with anchor points, as if the mark were selected in a design tool. */
/* Finished, the mark is solid and exactly as tall as the lettering beside it (baseline to ascender:
   0.751em, measured from the font). While it's being built (js/logo.js, class is-building) it's the larger
   blue outline with anchor points; then it shrinks and fills in, done. Sizes in em follow the 22px name. */
.brand-mark {
  /* Sits on the text's baseline, then a little lower (0.068em) to centre it optically on the lowercase:
     the word's mass is its x-height, so a mark spanning baseline to ascender looks high. */
  position: relative; top: 0.1335em; width: 0.5564em; height: 0.8836em; margin-right: -0.27em; align-self: baseline;
  overflow: visible; color: var(--ink); flex: none;
  transition: width .45s cubic-bezier(.5,0,.2,1), height .45s cubic-bezier(.5,0,.2,1), top .45s cubic-bezier(.5,0,.2,1), margin .45s cubic-bezier(.5,0,.2,1);
}
.brand-mark.is-building { width: 21px; height: 34px; top: -1px; margin-right: 0; } /* centred on the lettering */
.brand-mark .bm-fill { fill: currentColor; transition: opacity .3s ease; } /* fills as it shrinks */
.brand-mark .bm-outline { opacity: 0; transition: opacity .2s ease; }
.brand-mark.is-building .bm-fill { opacity: 0; transition-delay: 0s; }
.brand-mark.is-building .bm-outline { opacity: 1; }
/* Finishing, step 1: fill in while still full size (step 2, the shrink, follows in js/logo.js) */
.brand-mark.is-building.is-filled .bm-fill { opacity: 1; transition-delay: 0s; }
.brand-mark.is-building.is-filled .bm-outline { opacity: 0; }
/* The name is blue while it's being made too, and turns black as the mark fills in: letter by letter,
   left to right, in quick succession (--i is each letter's position, set in js/logo.js). */
.wm-ch { transition: color .25s ease calc(var(--i, 0) * 30ms); }
.brand-mark.is-building:not(.is-filled) ~ span .wm-ch { color: var(--sel); }
.brand-mark .bm-outline circle { fill: none; stroke: var(--sel); stroke-width: 1; vector-effect: non-scaling-stroke; }
.brand-mark .bm-anchor { fill: #fff; stroke: var(--sel); stroke-width: 1; vector-effect: non-scaling-stroke; }
/* While the logo builds itself (js/logo.js): bezier handles pulled out from each anchor */
.brand-mark .bm-handle { stroke: var(--sel); stroke-width: 1; vector-effect: non-scaling-stroke; }
.brand-mark .bm-knob { fill: var(--sel); }
/* The name being typed (js/logo.js): letters hidden until typed (they keep their space), and a text cursor. */
.wordmark > span { position: relative; }
.wordmark > span.is-typing .wm-ch:not(.is-shown) { visibility: hidden; }
.wm-caret {
  position: absolute; left: -1px; top: 50%; width: 2px; height: 1.05em; margin-top: -0.55em; border-radius: 1px;
  background: var(--sel); pointer-events: none;
}
.wm-caret.is-blinking { animation: wm-blink .45s steps(1) infinite; }
@keyframes wm-blink { 50% { opacity: 0; } }
.top-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; }
.top-actions .btn-ghost { height: 48px; }

/* Search button: touch screens only (with a keyboard, you just start typing). */
.search-btn {
  display: none; place-items: center; width: 48px; height: 48px; border: 0; border-radius: 50%;
  background: #fff; color: var(--ink); cursor: pointer; box-shadow: 0 6px 24px rgb(60 40 90 / 0.10);
}
@media (hover: none) { .search-btn { display: grid; } }

/* ---------- Full-screen search (js/search.js) ---------- */
html.search-open { overflow: hidden; }
.search-layer {
  position: fixed; inset: 0; z-index: 70; overflow-y: auto;
  background:
    radial-gradient(45% 420px at 8% 0%, #dce9f7 0%, rgb(220 233 247 / 0) 100%),
    radial-gradient(40% 380px at 70% 0%, #f6dde3 0%, rgb(246 221 227 / 0) 100%),
    rgb(255 255 255 / 0.97);
  backdrop-filter: blur(6px);
}
.search-inner { display: flex; flex-direction: column; gap: 24px; padding-top: clamp(32px, 8vh, 96px); padding-bottom: 64px; max-width: min(960px, var(--W)); }
.search-bar {
  display: flex; align-items: center; gap: 16px; padding-bottom: 16px; border-bottom: 2px solid var(--ink); color: var(--ink);
}
.search-bar > svg { flex: none; width: 36px; height: 36px; }
.search-input {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--ink);
  font-family: var(--display); font-weight: 800; font-size: clamp(40px, 7vw, 88px); line-height: 1; letter-spacing: -0.04em;
}
.search-input::placeholder { color: rgb(17 17 17 / 0.25); }
.search-close { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--ink); background: #fff; color: var(--ink); cursor: pointer; }
.search-close:hover { background: var(--hover-fill); }
.search-results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.search-row {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 16px;
  padding: 12px 14px; border-radius: 16px; cursor: pointer;
}
.search-row[aria-selected="true"] { background: #fff; box-shadow: 0 0 0 2px var(--ink); }
.search-swatch { width: 44px; height: 44px; border-radius: 12px; background: var(--tone); }
.search-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.search-name { font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: -0.02em; }
.search-desc { font-size: 15px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-meta { font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.search-empty { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; padding: 24px 14px; font-family: var(--display); font-weight: 700; font-size: 24px; }
.search-empty a { font-family: var(--body); font-size: 16px; font-weight: 500; text-underline-offset: 4px; }
.search-hint { margin: 0; font-size: 13px; color: var(--muted); }
@media (hover: none) { .search-hint { display: none; } }
@media (max-width: 640px) { .search-meta { display: none; } .search-row { grid-template-columns: 36px minmax(0, 1fr); } .search-swatch { width: 36px; height: 36px; } }

.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 22px; /* buttons are two cells tall */
  border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 15px; white-space: nowrap;
  transition: background-color .15s ease, color .15s ease;
}
.btn-dark { background: var(--ink); color: #fff; }
.btn-light { background: #fff; color: var(--night); }

/* ---------- Intro ---------- */
.intro { padding-block: 48px; display: flex; flex-direction: column; gap: var(--u); } /* rows snap to the grid (js/grid.js), which leaves the space */
.intro h1 {
  margin: 0; font-family: var(--display); font-weight: 800;
  font-size: clamp(64px, 10.5vw, 132px); line-height: var(--lh-0_88); letter-spacing: -0.05em;
}
.intro-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 24px; }
.lede { margin: 0; font-size: clamp(16px, 1.4vw, 18px); line-height: var(--lh-1_45); color: var(--ink-2); max-width: 520px; }

.segmented { display: flex; flex-wrap: wrap; gap: 8px; }
.segmented button {
  height: 48px; padding: 0 18px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--ink); background: var(--paper); font-size: 14px; font-weight: 500;
}
.segmented button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* ---------- Featured ---------- */
.featured {
  position: relative; overflow: hidden; isolation: isolate;
  margin-bottom: 48px; padding: 48px;
  border-radius: 32px; background: var(--tone, var(--coral)); color: var(--ink); /* the tool's own colour, same as its card and page */
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr));
  gap: 40px; align-items: center;
  container: featured / inline-size; /* the shape below follows the card's own layout, not the window's */
}
/* The tool's own shape, big, in the corner behind the media (js/shelf.js featuredShape). */
.featured-shape { position: absolute; z-index: -1; right: -48px; top: -72px; width: 400px; height: 400px; pointer-events: none; }
/* Stacked layout: tuck the shape behind the media frame, away from the text. The card stacks when two
   360px columns and the 40px gap no longer fit (760px of content), whatever the window's width, so this asks
   the card rather than the window. (A window query missed windows a little wider than 860px, where a card
   is already stacked and the shape covered the text.) */
@container featured (width < 760px) {
  .featured-shape { top: auto; bottom: -110px; right: -110px; width: 320px; height: 320px; }
}
/* One cell above the text: the grid nudges the title's baseline up (js/grid.js), which otherwise leaves it
   almost touching the card's top edge. */
.featured-text { display: flex; flex-direction: column; align-items: flex-start; gap: 22px; padding-top: var(--u); }
.sticker {
  display: inline-block; transform: rotate(-4deg);
  padding: 8px 16px; border-radius: 999px; background: #fff;
  font-family: var(--display); font-weight: 800; font-size: 16px; letter-spacing: -0.01em;
}
.featured h2 a { text-decoration: none; }
.featured h2 a:hover { text-decoration: underline; text-decoration-thickness: 4px; text-underline-offset: 8px; }
.featured h2 {
  margin: 0; font-family: var(--display); font-weight: 800;
  font-size: clamp(56px, 7vw, 88px); line-height: var(--lh-0_9); letter-spacing: -0.05em;
}
.featured-blurb { margin: 0; font-size: 18px; line-height: var(--lh-1_45); max-width: 460px; }
.quote {
  margin: 0; display: flex; gap: 14px; align-items: flex-start; max-width: 480px;
}
.avatar {
  flex: none; width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; background: var(--ink); color: #fff; font-weight: 600; font-size: 15px;
}
.quote blockquote {
  margin: 0; font-family: var(--display); font-weight: 500; font-size: 20px; line-height: var(--lh-1_3); letter-spacing: -0.01em;
}
.quote figcaption { margin-top: 0; font-size: 14px; font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
.btn-lg { height: 48px; padding: 0 26px; font-size: 16px; }
.text-link { font-size: 16px; font-weight: 500; text-underline-offset: 4px; }

.media {
  position: relative; border-radius: 20px; overflow: hidden; background: #fff;
  box-shadow: 0 24px 60px rgb(17 17 17 / 0.25);
}
.media-frame {
  position: relative; aspect-ratio: 16 / 9; display: grid; place-items: center;
  background-color: #fafafa;
  background-image: radial-gradient(circle, #d6d6da 1.2px, transparent 1.6px);
  background-size: 20px 20px;
}
.media-frame video, .media-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.media-empty { font-size: 14px; font-weight: 500; color: var(--muted); }
.media-toggle {
  position: absolute; right: 14px; bottom: 14px; z-index: 1;
  width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: rgb(17 17 17 / 0.8); color: #fff;
  opacity: 0; transition: opacity .2s ease;
}
/* Shown while pointing at the video, or when tabbed to; always shown on touch screens (no hover there). */
.media-frame:hover .media-toggle, .media-toggle:focus-visible { opacity: 1; }
@media (hover: none) { .media-toggle { opacity: 1; } }

/* ---------- Grid + cards ---------- */
.status { margin: 0; min-height: 0; font-size: 15px; color: var(--muted); }
.status:not(:empty) { padding: 8px 0 24px; }

.group + .group { margin-top: 72px; }
.group-title {
  display: flex; align-items: baseline; gap: 12px; margin: 0; padding-bottom: 16px;
  font-family: var(--display); font-weight: 800; font-size: clamp(28px, 3vw, 40px); letter-spacing: -0.03em;
}
.group-title small { font-family: var(--body); font-weight: 500; font-size: 14px; letter-spacing: 0; color: var(--muted); }

.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: var(--u);
}
.card {
  position: relative; height: 100%; min-height: 360px;
  display: flex; flex-direction: column; gap: var(--u); padding: var(--u);
  border-radius: var(--radius-card); background: var(--tone, var(--tone-0)); color: var(--ink);
  text-decoration: none;
  transition: transform .2s ease;
}
.card:hover { transform: translateY(-4px); }
.card-link { text-decoration: none; }
/* The whole card opens the tool (js/canvas.js); the name link is what keyboards and screen readers use. */
.card, .featured { cursor: pointer; }
.featured video { cursor: auto; }
.card-link:focus-visible { outline: none; }
.card:has(.card-link:focus-visible) { outline: 3px solid var(--ink); outline-offset: 3px; }
.card-open {
  position: absolute; top: 24px; right: 24px; z-index: 1;
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  background: rgb(255 255 255 / 0.7); color: var(--ink); text-decoration: none;
  opacity: 0; transform: scale(.9); transition: opacity .15s ease, transform .15s ease, background-color .15s ease;
}
.card:hover .card-open, .card-open:focus-visible { opacity: 1; transform: none; }
.card-open:hover { background: #fff; }
@media (hover: none) { .card-open { opacity: 1; transform: none; } }
.card-art { height: 144px; margin-bottom: var(--u); display: grid; place-items: center; } /* an extra cell of air above the name */
/* Locked to the display cut so the name is the same shape at 30px and 120px and scales without ghosting. */
.morph-name { display: inline-block; line-height: 0.95em; /* proportional on purpose: the name scales between card and page, so its box must keep the same shape (js/morph.js) */ letter-spacing: -0.045em; font-variation-settings: "opsz" 96; }
.card-name {
  margin: 0;
  font-family: var(--display); font-weight: 800; font-size: 30px; line-height: var(--lh-1); letter-spacing: -0.03em;
}
.card-desc { margin: 0; flex: 1; font-size: 15px; line-height: var(--lh-1_45); }
.card-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding-top: 14px; border-top: 1px solid rgb(17 17 17 / 0.25); font-size: 13px; font-weight: 500;
}
/* One pill size everywhere, so tags move between card and page without resizing. */
.pill {
  display: inline-flex; align-items: center; flex: none; height: 28px; padding: 0 12px; box-sizing: border-box;
  border-radius: 999px; border: 1px solid var(--ink); font-size: 13px; font-weight: 500; line-height: 1; white-space: nowrap;
}
.pill-type { background: var(--ink); color: #fff; } /* the type is filled; the job it helps with stays outlined */
/* On the card, tags share one row with the maker: the ones that fit show, the rest wrap out of sight. */
.card-foot .by { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-foot .pills { flex: 1 1 0; min-width: 0; height: 28px; overflow: hidden; justify-content: flex-end; }

/* Fifty shapes (js/shapes.js), one per tool, one solid colour. Vector paths (js/canvas.js) so they can be edited with the pen tool. */
.shape { display: block; overflow: visible; color: var(--shape); transform: rotate(var(--shape-rot, 0deg)); }
.shape-path { fill: currentColor; }
/* A card's shape drawing itself in (js/canvas.js buildIn): blue outline + anchor points, then the fill. */
.shape.is-unbuilt { visibility: hidden; }
.shape.is-building .shape-path { fill-opacity: 0; stroke: var(--sel); stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.shape-build .pen-anchor { fill: #fff; stroke: var(--sel); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.shape-build .pen-line { stroke: var(--sel); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.shape-build .pen-handle { fill: var(--sel); }

/* ---------- Canvas touches (js/canvas.js) ---------- */
:root { --sel: #0d99ff; --redline: #f24822; }
/* Only the shape itself takes the pointer (for the pen tool); the empty art area clicks through to the card. */
.card-art { position: relative; z-index: 1; pointer-events: none; }
.card-art .shape-path { pointer-events: visiblePainted; cursor: default; }

.pen { pointer-events: none; opacity: 0; transition: opacity .15s ease .2s; }

/* 3. Pen points when pointing at the shape (and while dragging) */
.shape:hover .pen, .shape.is-editing .pen { opacity: 1; transition-delay: 0s; }
.pen-line { stroke: var(--sel); stroke-width: 1; vector-effect: non-scaling-stroke; }
.pen-handle { fill: #fff; stroke: var(--sel); stroke-width: 1; vector-effect: non-scaling-stroke; }
.pen-anchor { fill: #fff; stroke: var(--sel); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.pen-hit { fill: transparent; pointer-events: all; cursor: grab; }
.shape.is-editing .pen-hit { cursor: grabbing; }

/* 2. Hold Option/Alt to measure */
.measure-layer { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.m-box { position: absolute; outline: 1px solid var(--redline); }
.m-box.m-dashed { outline-style: dashed; outline-color: rgb(242 72 34 / 0.6); }
.m-line { position: absolute; background: var(--redline); }
.m-line.m-h { height: 1px; }
.m-line.m-v { width: 1px; }
.m-label {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  padding: 2px 5px; border-radius: 3px; background: var(--redline); color: #fff;
  font: 600 11px/1.2 var(--body); font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* 4. Live type in the headline */
.live-type .lt-word { white-space: nowrap; }
.live-type .lt { font-variation-settings: "wght" 800, "wdth" 100, "opsz" 96; }

/* None of it during page transitions, or on touch screens */
html:active-view-transition .pen, html:active-view-transition .measure-layer { display: none; }
@media (hover: none) { .pen, .measure-layer { display: none; } .card-art { pointer-events: none; } .card-art .shape-path { pointer-events: none; } }

.empty {
  padding: 64px 24px; border-radius: var(--radius-card); background: #f6f6f7; text-align: center;
}
.empty p { margin: 0 0 16px; font-family: var(--display); font-weight: 700; font-size: 28px; letter-spacing: -0.02em; }
.empty button {
  height: 48px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--ink); background: #fff; cursor: pointer; font-weight: 500;
}

/* ---------- Makers band ---------- */
.makers {
  position: relative; isolation: isolate;
  padding: 72px var(--gutter) 144px; text-align: center;
}
/* Floating squares: drift up the sides, fade in at the bottom and out before the top. The middle third
   (where the count, grid and chips sit) is masked out so nothing ever passes behind the text. */
.makers-float {
  position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  /* Two masks, intersected: clear in the middle (left-right), and fading out over the top 40% (bottom-top)
     so squares dissolve before the section's edge instead of being cut off by it. */
  -webkit-mask-image:
    linear-gradient(to right, #000 0%, #000 15%, transparent 22%, transparent 78%, #000 85%, #000 100%),
    linear-gradient(to top, #000 0%, #000 60%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, #000 0%, #000 15%, transparent 22%, transparent 78%, #000 85%, #000 100%),
    linear-gradient(to top, #000 0%, #000 60%, transparent 100%);
  mask-composite: intersect;
}
.makers-float span {
  position: absolute; bottom: -40px; left: var(--x); margin-left: calc(var(--s) / -2); width: var(--s); aspect-ratio: 1; border-radius: 28%;
  background: var(--c); opacity: 0;
  animation: makers-drift var(--d) linear var(--delay) infinite;
}
@keyframes makers-drift {
  0%   { translate: 0 0; rotate: var(--r0, 0deg); opacity: 0; }
  15%  { opacity: .75; }
  70%  { opacity: .75; }
  100% { translate: 0 -640px; rotate: var(--r); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .makers-float span { animation: none; opacity: .5; bottom: auto; top: calc(var(--s) * 9); }
}
/* Below this width the chips reach the sides, so there's no room left for the squares. */
@media (max-width: 1000px) { .makers-float { display: none; } }

/* Contribution grid: one square per tool, in the tool's card colour (--tone-N). */
/* Squares flow centred, up to 16 per row. */
/* One square per grid cell, a cell apart, so every square sits exactly between lines.
   js/grid.js moves the whole block sideways onto the nearest line after centring it. */
.contrib {
  display: flex; flex-wrap: wrap; gap: var(--u); justify-content: flex-start;
  width: fit-content; max-width: calc(16 * var(--u) * 2 - var(--u)); margin: 48px auto 0;
}
.cell-wrap { display: contents; }
.cell {
  position: relative; display: grid; place-items: center; width: var(--u); height: var(--u); border-radius: 6px;
  background: var(--c, transparent); text-decoration: none;
  box-shadow: inset 0 0 0 1px rgb(17 17 17 / 0.08);
  transition: transform .15s ease, opacity .2s ease, filter .2s ease;
}
a.cell:hover, a.cell:focus-visible { transform: scale(1.15); z-index: 2; }
.cell-add { box-shadow: inset 0 0 0 1.5px var(--ink); color: var(--ink); font: 600 16px/1 var(--body); }
.cell-add:hover { background: var(--hover-fill); }
/* Label above the square on hover / focus */
a.cell::after {
  content: attr(data-label); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  padding: 5px 8px; border-radius: 6px; background: var(--ink); color: #fff; white-space: nowrap;
  font: 500 12px/1.2 var(--body); pointer-events: none; opacity: 0; transition: opacity .12s ease;
}
a.cell:hover::after, a.cell:focus-visible::after { opacity: 1; }
/* If the pointer is on another square than the keyboard focus, only the pointed-at label shows. */
.contrib:has(a.cell:hover) a.cell:focus-visible:not(:hover)::after { opacity: 0; }
/* Pointing at a maker lights up their squares */
/* The others fade almost away and lose their colour, so even the palest lit square stands out. */
.contrib.is-focused .cell[data-maker]:not(.is-lit) { opacity: .08; filter: grayscale(1); }
.legend a { gap: 8px; }
.legend .chip-count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.legend a:hover .chip-count { color: inherit; }
@media (max-width: 760px) { .contrib { max-width: calc(8 * var(--u) * 2 - var(--u)); } }
.makers h2 { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; font-weight: inherit; }
.makers-count {
  font-family: var(--display); font-weight: 800; font-size: clamp(72px, 10vw, 128px); line-height: var(--lh-0_9); letter-spacing: -0.05em;
}
.makers-count .lt[hidden] { display: none; }
.makers-sub { font-family: var(--body); font-weight: 500; font-size: clamp(20px, 2.2vw, 28px); letter-spacing: 0; }
.chips { list-style: none; margin: 48px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chips a {
  display: inline-flex; align-items: center; text-decoration: none;
  height: 48px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--ink);
  background: #fff; cursor: pointer; font-size: 14px; font-weight: 500;
}
.chips a:hover { background: var(--hover-fill); }

/* ---------- Footer ---------- */
.foot { background: var(--night); color: #fff; padding: 48px 0; }
.foot-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 24px; }
.foot-line { margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(28px, 3vw, 36px); line-height: var(--lh-1_05); letter-spacing: -0.03em; }
.foot :focus-visible { outline-color: #fff; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .card:hover { transform: none; }
}

/* ---------- Views ---------- */
#app:focus { outline: none; }
.view h1:focus { outline: none; }
.view-home .makers { margin-top: 120px; }
.view-tool, .view-maker, .notfound { padding-bottom: 72px; }

.back {
  display: inline-flex; align-items: center; gap: 8px; height: 48px; margin: 0 0 24px;
  font-size: 15px; font-weight: 500; text-decoration: none;
}
.back:hover { text-decoration: underline; text-underline-offset: 4px; }

/* Tool page */
.tool-hero {
  position: relative; overflow: hidden;
  /* The content section has one fixed width on every tool (up to 624px of content + the same padding on both
     sides, so the gap before the video matches the margin on the left); the video takes the rest. */
  --hero-pad: clamp(24px, 5vw, 56px);
  display: grid; grid-template-columns: min(calc(624px + 2 * var(--hero-pad)), 56%) minmax(0, 1fr); align-items: stretch;
  border-radius: 36px; background: var(--tone, var(--tone-0));
}
.tool-hero-text { display: flex; flex-direction: column; align-items: flex-start; gap: 22px; padding: var(--hero-pad); min-width: 0; }
.tool-hero h1 { overflow-wrap: break-word; max-width: 100%; }
.tool-hero h1 {
  margin: 0; font-family: var(--display); font-weight: 800;
  font-size: clamp(56px, 7.5vw, 104px); line-height: var(--lh-0_88); letter-spacing: -0.05em;
}
@media (max-width: 860px) { .tool-hero { grid-template-columns: minmax(0, 1fr); } .tool-hero-art { aspect-ratio: 16 / 9; } }
.tool-desc { margin: 0; font-size: clamp(18px, 1.6vw, 20px); line-height: var(--lh-1_3); font-weight: 500; max-width: 100%; }
.tool-about { margin: 0; font-size: 17px; line-height: var(--lh-1_5); max-width: 100%; }
/* Same anatomy as the card's foot, so it morphs piece for piece */
.tool-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 24px;
  width: 100%; padding-top: 16px; border-top: 1px solid rgb(17 17 17 / 0.25); font-size: 15px; font-weight: 500;
}
.tool-foot a { text-underline-offset: 3px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
/* The video (or screenshot) fills the hero's whole right side, top to bottom, cropped to that shape;
   the hero's rounded corners clip it. */
.tool-hero-art { position: relative; min-width: 0; min-height: 320px; }
.tool-hero-art > .media, .tool-hero-art > .shot { position: absolute; inset: 0; border-radius: 0; box-shadow: none; aspect-ratio: auto; }
.tool-hero-art .media-frame { position: absolute; inset: 0; aspect-ratio: auto; }
.shot {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden; display: grid; place-items: center;
  border-radius: 20px; background: rgb(255 255 255 / 0.55); box-shadow: 0 24px 60px rgb(17 17 17 / 0.2);
}
.shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.tool-quote { margin: 48px 0 0; }
.tool-quote .quote { max-width: 720px; }
/* Divider lines only inside cards, where the page grid doesn't show; outside them the grid does the job. */
.featured .quote { padding-top: var(--u); border-top: 1px solid rgb(17 17 17 / 0.3); }
.tool-quote blockquote { font-size: 32px; } /* 32px on 48px lines (two cells); smaller sizes would sit loose on the grid */
.view-tool .group { margin-top: 72px; }
.view-maker .grid { margin-top: 48px; } /* closer under the maker's tool count */

/* Maker page */
.maker-hero { display: flex; flex-wrap: wrap; align-items: center; gap: 28px; padding: 24px 0 0; }
.maker-hero h1 {
  margin: 0; font-family: var(--display); font-weight: 800;
  font-size: clamp(56px, 9vw, 120px); line-height: var(--lh-0_9); letter-spacing: -0.05em;
}
.maker-hero .lede { margin-top: var(--u); } /* a grid row of air below the name */

/* Not found */
.notfound { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; padding-top: 48px; }
.notfound h1 { margin: 0; font-family: var(--display); font-weight: 800; font-size: clamp(56px, 9vw, 112px); line-height: var(--lh-0_9); letter-spacing: -0.05em; }

/* ---------- Page transitions ----------
   Browsers with View Transitions morph a tool's card into its page (js/morph.js); others just swap. */
:root { --m-dur: .55s; --m-ease: cubic-bezier(.2, .8, .2, 1); }
::view-transition-group(*) { animation-duration: var(--m-dur); animation-timing-function: var(--m-ease); }

/* The rest of the page steps aside quickly, then the new page settles in behind the morph. */
::view-transition-old(root) { animation: 160ms ease-out both m-fade-out; }
::view-transition-new(root) { animation: 320ms ease-out 200ms both m-fade-in; }

/* Pieces with no partner on the other side fade instead of popping: leaving ones go first,
   arriving ones settle in once the shared pieces have nearly landed. */
::view-transition-old(*):only-child { animation: calc(var(--m-dur) * .3) ease-out both m-fade-out; }
::view-transition-new(*):only-child { animation: calc(var(--m-dur) * .45) ease-out calc(var(--m-dur) * .55) both m-fade-in; }

/* The one-liner rewraps between sizes, so hand it off instead of overlapping two layouts. */
::view-transition-old(m-desc) { animation: calc(var(--m-dur) * .35) ease-out both m-fade-out; }
::view-transition-new(m-desc) { animation: calc(var(--m-dur) * .5) ease-out calc(var(--m-dur) * .35) both m-fade-in; }

/* The panel crops the pieces nested inside it (view-transition-group: contain, set in morph.js), like
   overflow: hidden, so nothing shows outside it mid-flight. Its radius follows the panel's (morph.js). */
::view-transition-group-children(m-box) { overflow: clip; }

/* The container. Its colour + radius tween on the image pair (morph.js) and clip what's inside.
   Its snapshots hold every piece that has no partner. They scale with the container (keeping their
   proportions), so the card's own extras fade out in place and the page's extras fade in where they land. */
::view-transition-image-pair(m-box) { overflow: hidden; }
::view-transition-old(m-box) { animation: calc(var(--m-dur) * .3) ease-out both m-fade-out; }
::view-transition-new(m-box) { animation: calc(var(--m-dur) * .45) ease-out calc(var(--m-dur) * .55) both m-fade-in; }

/* The header, when held still between pages (main.js): no fade, no movement. */
::view-transition-group(site-header) { animation: none; }
::view-transition-old(site-header) { animation: none; opacity: 0; }
::view-transition-new(site-header) { animation: none; }
/* If the new page lands scrolled down after all, the old header just fades out like the rest. */
::view-transition-old(site-header):only-child { opacity: 1; animation: 160ms ease-out both m-fade-out; }

/* Layering while pieces travel: the title and shape stay on top, small controls pass beneath them. */
::view-transition-group(m-open), ::view-transition-group(m-howto) { z-index: 2; }
::view-transition-group(m-name), ::view-transition-group(m-shape) { z-index: 3; }

/* The name scales as one line of type instead of stretching. */
::view-transition-old(m-name), ::view-transition-new(m-name) { height: 100%; width: auto; }
/* The featured card's video frame (wide) becomes the hero's right side (tall): crop, don't stretch. */
::view-transition-image-pair(m-media) { overflow: hidden; }
::view-transition-old(m-media), ::view-transition-new(m-media) { width: 100%; height: 100%; object-fit: cover; }

@keyframes m-fade-out { to { opacity: 0; } }
@keyframes m-fade-in { from { opacity: 0; } }

/* =========================================================
   Forms (submit + admin)
   ========================================================= */
.view-submit, .view-admin { padding-bottom: 96px; }
/* Narrow pages (forms, sign-in, messages): a narrow column on the left, lined up with the logo.
   The page itself keeps the full .wrap width, so its left edge matches the header's. */
.view-narrow > * { max-width: 960px; }
.view-login > * { max-width: 480px; }
.submit-intro { padding: 8px 0 40px; display: flex; flex-direction: column; gap: 16px; max-width: 760px; }
.submit-intro h1, .admin-login h1, .admin-head h1 {
  margin: 0; font-family: var(--display); font-weight: 800;
  font-size: clamp(56px, 9vw, 112px); line-height: var(--lh-0_9); letter-spacing: -0.05em;
}
.admin-head h1 { font-size: clamp(44px, 6vw, 72px); }

.form { display: flex; flex-direction: column; gap: 20px; max-width: 960px; }
.form-section {
  margin: 0; padding: clamp(20px, 3vw, 36px); border: 0; border-radius: var(--radius-card);
  background: #f6f6f7; min-width: 0;
}
.form-section-tinted { background: var(--tone-1); }
.form-section legend, .legend-like {
  float: left; width: 100%; display: flex; align-items: center; gap: 12px; margin: 0 0 24px; padding: 0;
  font-family: var(--display); font-weight: 800; font-size: 28px; letter-spacing: -0.03em;
}
.form-section legend + * { clear: both; }
.step {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--ink); color: #fff; font-family: var(--body); font-size: 15px; font-weight: 600; letter-spacing: 0;
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 24px; }
.span-2 { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }

.field { display: flex; flex-direction: column; gap: 0; min-width: 0; } /* label, hint, input, counter: consecutive grid rows */
/* Side-by-side fields share rows (label · hint · input · counter · error) through subgrid, so their inputs
   line up even when one has a longer hint, or none. */
.form-grid > .field, .feature-block > .field {
  display: grid; grid-row: span 5; grid-template-rows: subgrid; row-gap: 0; align-content: start;
}
/* Subgrid rows would otherwise inherit the grid's 24px row gap between label and input; space the fields
   with a margin instead, so label, hint and input stay 6px apart. */
.form-grid, .feature-block { row-gap: 0; }
.form-grid > *, .feature-block > * { margin-bottom: 48px; } /* two cells: labels sit in the space above their row */
.form-grid > :is(:last-child, :nth-last-child(2):not(.span-2)), .feature-block > :is(:last-child, :nth-last-child(2)) { margin-bottom: 0; }
.form-grid > .field > .field-label, .feature-block > .field > .field-label { grid-row: 1; }
.form-grid > .field > .field-hint, .feature-block > .field > .field-hint { grid-row: 2; }
.form-grid > .field > :is(input, select, textarea, div), .feature-block > .field > :is(input, select, textarea, div) { grid-row: 3; }
.form-grid > .field > .counter, .feature-block > .field > .counter { grid-row: 4; justify-self: end; }
.form-grid > .field > .field-error, .feature-block > .field > .field-error { grid-row: 5; }
.field-label { font-weight: 600; font-size: 15px; }
.optional { font-weight: 400; color: var(--muted); }
.field-hint { margin: 0; font-size: 14px; line-height: var(--lh-1_45); color: var(--muted); }
.field input:not([type=checkbox]):not([type=file]), .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: 14px; /* 11 + 24 + 11 + borders = 48, two cells */
  border: 1px solid #d4d4d8; background: #fff; color: var(--ink); font: inherit; font-size: 16px;
}
.field textarea { resize: vertical; line-height: 1.5; }
.field input[readonly]:not([type=checkbox]):not([type=file]) { background: #f4f4f5; color: var(--ink-2); cursor: default; }
.field select { appearance: none; padding-right: 40px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 3px solid var(--ink); outline-offset: 1px; border-color: var(--ink); }
.field.has-error input:not([type=checkbox]), .field.has-error select, .field.has-error textarea, .field.has-error .file-zone { border-color: #b4232f; }
.field-error { margin: 0; font-size: 14px; font-weight: 500; color: #b4232f; }
.counter { margin: 0; align-self: flex-end; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.counter-near { color: #b4232f; font-weight: 600; }

.check { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.check input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--ink); cursor: pointer; }
.check > span { display: flex; flex-direction: column; gap: 4px; }
.check-small { align-items: center; font-size: 14px; margin-top: 8px; }
.check-small input { width: 18px; height: 18px; margin: 0; }

/* The drop zone is the shape uploads must be (16:9), with the size written in it. */
.file-field { display: flex; flex-direction: column; gap: 8px; }
.file-zone {
  position: relative; aspect-ratio: 16 / 9; width: 100%; max-width: 576px; overflow: hidden;
  border-radius: 14px; border: 1.5px dashed #a1a1aa; background: #fff;
}
.file-zone.is-over { border-color: var(--ink); background: var(--tone-3); }
.file-zone.has-file { border-style: solid; border-color: #d4d4d8; background: #e4e4e7; }
.file-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2; }
.file-zone:has(.file-input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 2px; }
.file-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 16px; }
.file-zone.has-file .file-empty { display: none; }
.file-spec { font-family: var(--display); font-weight: 800; font-size: clamp(18px, 2vw, 24px); letter-spacing: -0.02em; }
.file-cta { display: inline-flex; align-items: center; height: 48px; padding: 0 16px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 600; }
.file-or { font-size: 14px; color: var(--muted); }
.file-replace {
  position: absolute; right: 12px; bottom: 12px; z-index: 1; display: none; align-items: center; height: 32px; padding: 0 12px;
  border-radius: 999px; background: rgb(17 17 17 / .8); color: #fff; font-size: 13px; font-weight: 600;
}
.file-zone.has-file .file-replace { display: inline-flex; }
.file-zone.has-file:hover .file-replace { background: var(--ink); }
/* Previews are letterboxed, not cropped, so a file in the wrong shape shows bars. */
.file-preview { position: absolute; inset: 0; }
.file-preview img, .file-preview video { width: 100%; height: 100%; object-fit: contain; display: block; }
.file-name { margin: 0; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.file-name:empty { display: none; }

.section-hint { margin: -12px 0 24px; clear: both; }
.feature-block { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.feature-block .video-length { grid-column: 1; margin-top: -16px; color: #8a4b00; font-weight: 500; }
@media (max-width: 720px) { .feature-block { grid-template-columns: minmax(0, 1fr); } }

.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; padding-top: 8px; }
.form-actions-sticky {
  position: sticky; bottom: 0; z-index: 2; margin: 0 calc(-1 * var(--gutter)); padding: 16px var(--gutter);
  background: rgb(255 255 255 / 0.92); backdrop-filter: blur(8px);
}
.btn[disabled], .btn-small[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
button.btn { border: 0; cursor: pointer; }
.form-error { margin: 0; flex-basis: 100%; padding: 12px 16px; border-radius: 12px; background: #fde8ea; color: #8c1823; font-weight: 500; }
.flash { margin: 0; font-weight: 500; }
.flash:empty { display: none; }

.progress { display: flex; align-items: center; gap: 12px; min-width: 240px; flex: 1; }
.progress[hidden] { display: none; }
.progress-track { flex: 1; height: 8px; border-radius: 999px; background: #e4e4e7; overflow: hidden; }
.progress-fill { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--sky), var(--violet), var(--coral)); transition: width .2s ease; }
.progress-label { font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }

.success {
  display: flex; flex-direction: column; align-items: flex-start; gap: 20px; max-width: 760px;
  padding: clamp(28px, 5vw, 56px); border-radius: 36px; background: var(--tone-3);
}
.success h2 { margin: 0; font-family: var(--display); font-weight: 800; font-size: clamp(36px, 5vw, 56px); line-height: var(--lh-1); letter-spacing: -0.04em; }
.success h2:focus { outline: none; }
.success-mark { display: grid; place-items: center; width: 72px; height: 72px; margin-bottom: var(--u); border-radius: 50%; background: var(--ink); color: #fff; } /* 3 cells, a cell of air before the title */

/* =========================================================
   Admin
   ========================================================= */
.eyebrow { margin: 0 0 8px; font-size: 13px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.admin-login { max-width: 480px; padding: 24px 0 48px; display: flex; flex-direction: column; gap: 24px; }
.admin-login .form-error { flex-basis: auto; }
.admin-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; padding: 8px 0 8px; }
.admin-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-lede { margin: 24px 0 28px; max-width: 760px; color: var(--muted); font-size: 16px; } /* a cell below the title's letters */
.btn-ghost { background: transparent; border: 1px solid var(--ink) !important; color: var(--ink); height: 48px; }
.btn-danger { background: #fff; color: #8c1823; border: 1px solid #b4232f !important; height: 48px; }
.btn-danger:hover { background: #fdecee; }

.admin-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.segmented .count { margin-left: 8px; font-size: 12px; font-variant-numeric: tabular-nums; opacity: .7; }

.table-wrap { position: relative; overflow-x: auto; border-radius: var(--radius-card); background: #f6f6f7; }
.admin-table { width: 100%; min-width: 860px; border-collapse: collapse; font-size: 15px; }
.admin-table th { padding: 16px 20px; text-align: left; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.admin-table td { padding: 16px 20px; border-top: 1px solid #e4e4e7; vertical-align: top; }
.admin-table tbody tr:hover { background: #fff; }
.row-title { display: block; font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: -0.02em; text-decoration: none; }
.row-title:hover { text-decoration: underline; }
.row-sub { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); }
.nowrap { white-space: nowrap; }
.row-actions { display: flex; justify-content: flex-end; gap: 8px; white-space: nowrap; }
.btn-small {
  display: inline-flex; align-items: center; height: 48px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--ink); background: #fff; color: var(--ink); font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn-small:hover:not([disabled]) { background: var(--hover-fill); }
.btn-small-dark { background: var(--ink); color: #fff; }
.state { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.state-pending { background: #fff1d6; color: #7a4a00; }
.state-published { background: #dff3e7; color: #1d6b3d; }
.state-hidden { background: #ececef; color: #52525b; }
.featured-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.featured-flag { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: #8c1823; }

.maker-note { margin: 0; white-space: pre-line; font-size: 16px; line-height: var(--lh-1_55); }
.danger-zone { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; max-width: 960px; margin-top: 40px; padding: 20px 24px; border-radius: 20px; border: 1px solid #f3c2c7; }
.danger-zone p { margin: 0; color: var(--muted); font-size: 14px; }

/* Admin and form pages don't need the brand wash competing with inputs */
body[data-route^="admin"] .wash { opacity: .5; }
body[data-route="submit"] .foot, body[data-route^="admin"] .foot { display: none; }

/* ---------- Animated icons (vendored from lucide-animated, see js/icons.js) ----------
   Each Motion animation is ported 1:1 to keyframes. They play while the link or button holding
   the icon is hovered or keyboard-focused. */
.ia * { transform-box: fill-box; transform-origin: center; }
.ia-arrow-up-right g { transform-origin: top right; }
.ia-arrow-left .ia-line { transform-origin: right center; }
.ia-check path, .ia-x path { stroke-dasharray: 1; }

@media (prefers-reduced-motion: no-preference) {
  :is(a, button):is(:hover, :focus-visible) .ia-arrow-up-right g { animation: ia-arrow-up-right .5s ease-in-out; }
  :is(a, button):is(:hover, :focus-visible) .ia-arrow-left .ia-head { animation: ia-arrow-left-head .4s ease-in-out; }
  :is(a, button):is(:hover, :focus-visible) .ia-arrow-left .ia-line { animation: ia-arrow-left-line .4s ease-in-out; }
  :is(a, button):is(:hover, :focus-visible) .ia-play polygon { animation: ia-play .5s ease-in-out; }
  :is(a, button):is(:hover, :focus-visible) .ia-pause .ia-l { animation: ia-pause-l .5s ease-in-out; }
  :is(a, button):is(:hover, :focus-visible) .ia-pause .ia-r { animation: ia-pause-r .5s ease-in-out; }
  :is(a, button):is(:hover, :focus-visible) svg.ia-search { animation: ia-search 1s ease-in-out; }
  :is(a, button):is(:hover, :focus-visible) .ia-x path { animation: ia-draw .3s ease-in-out backwards; }
  :is(a, button):is(:hover, :focus-visible) .ia-x .ia-2 { animation-delay: .2s; }
  :is(a, button):is(:hover, :focus-visible) .ia-check path,
  .success-mark .ia-check path { animation: ia-check .4s ease-in-out backwards; }
  .success-mark .ia-check path { animation-delay: .25s; }
}

@keyframes ia-arrow-up-right { 50% { transform: translate(-4px, 4px) scale(.85); } }
@keyframes ia-arrow-left-head { 50% { transform: translateX(3px); } }
@keyframes ia-arrow-left-line { 50% { transform: scaleX(.643); } } /* M19 12H5 → M19 12H10 */
@keyframes ia-play { 20% { transform: translateX(-1px) rotate(-10deg); } 50% { transform: translateX(2px); } }
@keyframes ia-pause-l { 20% { transform: translateY(2px); } 50%, 100% { transform: none; } }
@keyframes ia-pause-r { 0%, 20% { transform: none; } 50% { transform: translateY(2px); } }
@keyframes ia-search { 0% { translate: 0 0; } 33.3% { translate: 0 -4px; } 66.6% { translate: -3px 0; } }
@keyframes ia-draw { from { stroke-dashoffset: 1; opacity: 0; } 33% { opacity: 1; } to { stroke-dashoffset: 0; } }
@keyframes ia-check { from { stroke-dashoffset: 1; opacity: 0; transform: scale(.5); } 25% { opacity: 1; } to { stroke-dashoffset: 0; transform: none; } }

/* ---------- Button hover: a subtle fill, never movement ---------- */
:root { --hover-fill: #ececee; }
.btn-dark:hover, .btn-small-dark:hover:not([disabled]) { background: #2e2e33; color: #fff; }
.btn-light:hover, .search-btn:hover { background: var(--hover-fill); }
.btn-ghost:hover { background: rgb(17 17 17 / .06); }
.segmented button:not([aria-pressed="true"]):hover { background: var(--hover-fill); }
.segmented button, .search-btn, .search-close, .chips a, .btn-small, .cell-add { transition: background-color .15s ease, color .15s ease, opacity .15s ease; }

/* ---------- Admin: shape picker ---------- */
.form-section.shape-field { display: block; }
.shape-field .field-hint { margin-bottom: 16px; }
.shape-field .field-error { margin-top: 12px; }
.shape-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 8px; }
.shape-pick {
  position: relative; display: block; aspect-ratio: 1;
  border-radius: 14px; background: #fff; cursor: pointer; transition: background-color .15s ease;
}
.shape-pick input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: inherit; }
.shape-pick .shape { position: absolute; inset: 16px; width: calc(100% - 32px); height: calc(100% - 32px); pointer-events: none; }
.shape-pick:hover { background: var(--hover-fill); }
.shape-pick:has(input:checked) { background: var(--tone); box-shadow: inset 0 0 0 2px var(--ink); }
.shape-pick:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 2px; }
.shape-pick.is-taken { cursor: not-allowed; background: transparent; box-shadow: inset 0 0 0 1px #e2e2e5; }
.shape-pick.is-taken .shape { color: #d4d4d8; }

/* ---------- Featured carousel (more than one featured tool) ---------- */
.carousel { margin-bottom: 48px; }
.carousel-track {
  display: flex; gap: var(--u); overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: 32px;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel .featured { flex: 0 0 100%; margin: 0; scroll-snap-align: start; }
.carousel-controls { display: flex; align-items: center; justify-content: space-between; gap: var(--u); margin-top: var(--u); }
.carousel-dots { display: flex; align-items: center; }
/* 24px hit targets, small marks: the current one stretches into a bar. */
.carousel { --carousel-delay: 7s; }
.carousel-dot { position: relative; display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; transition: width .25s ease; }
.carousel-dot::before { content: ""; width: 8px; height: 8px; border-radius: 4px; background: rgb(17 17 17 / .25); transition: width .25s ease, background-color .25s ease; }
.carousel-dot[aria-current="true"] { width: 48px; }
.carousel-dot[aria-current="true"]::before { width: 32px; background: var(--ink); }
/* Autoplay: the current dot is a timer. Its bar empties, then fills over --carousel-delay; when it's full
   the carousel moves on (js/shelf.js). It only waits while off screen or in a hidden tab. */
.carousel.is-auto .carousel-dot[aria-current="true"]::before { background: rgb(17 17 17 / .25); }
.carousel.is-auto .carousel-dot[aria-current="true"]::after {
  content: ""; position: absolute; left: 8px; top: 8px; width: 8px; height: 8px; border-radius: 4px; background: var(--ink);
  animation: carousel-progress var(--carousel-delay) linear forwards;
}
.carousel.is-auto.is-paused .carousel-dot[aria-current="true"]::after { animation-play-state: paused; }
/* Grows in width (not scale), so its ends stay round: it starts as a dot and fills into the pill. */
@keyframes carousel-progress { from { width: 8px; } to { width: 32px; } }
.carousel-dot:hover::before { background: rgb(17 17 17 / .5); }
.carousel-dot[aria-current="true"]:hover::before { background: var(--ink); }
.carousel-arrows { display: flex; gap: 12px; }
.carousel-btn {
  display: grid; place-items: center; width: 48px; height: 48px; padding: 0; border-radius: 50%;
  border: 1px solid var(--ink); background: #fff; color: var(--ink); cursor: pointer; transition: background-color .15s ease;
}
.carousel-btn:hover { background: var(--hover-fill); }
.carousel-btn.is-next svg { scale: -1 1; }

/* Text links: no underline at rest, underlined on hover (and keyboard focus) — the action links, the maker's
   name on the tool page, the quote's byline and the search's "Add yours". */
:is(.text-link, .tool-foot a, .quote figcaption a, .search-empty a) { text-decoration: none; }
:is(.text-link, .tool-foot a, .quote figcaption a, .search-empty a):is(:hover, :focus-visible) { text-decoration: underline; }

/* The button row sits at the bottom of the card (the expanded tool card, the featured card and each
   carousel slide): the text column fills the card's height and the row takes the space left above it. */
.featured { align-items: stretch; }
/* When the text makes the card taller than the media, the media stays at the top instead of floating in the middle. */
.featured > .media { align-self: start; }
:is(.tool-hero-text, .featured-text) > .actions { margin-top: auto; }

/* "We kept what you'd filled in. Start over" above a restored form */
.draft-note { margin: 0 0 var(--u); font-size: 15px; color: var(--ink-2); }
.draft-note button { padding: 0; border: 0; background: none; color: var(--ink); cursor: pointer; font: inherit; font-weight: 500; }

/* Cards waiting to rise in as they come into view (js/morph.js riseIn) */
.is-waiting { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .is-waiting { opacity: 1; } }

/* =========================================================
   Ideas board (js/ideas.js) + admin ideas
   ========================================================= */
.view-ideas { padding-bottom: 96px; }
.ideas-account { margin: 0 0 24px; font-size: 15px; color: var(--ink-2); }
.ideas-account .text-link { padding: 0; border: 0; background: none; cursor: pointer; }
.ideas-signin {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 24px;
  padding: clamp(20px, 3vw, 36px); border-radius: var(--radius-card); background: var(--tone-3);
}
.ideas-signin > p:first-child { margin: 0; font-family: var(--display); font-weight: 800; font-size: 24px; letter-spacing: -0.02em; }
.ideas-post { margin-bottom: 32px; }
.ideas-post > .legend-like + * { clear: both; }
.ideas-post .form-actions { padding-top: 24px; }
.ideas-post .form-error { flex-basis: auto; }
.ideas-toolbar .ideas-count { margin: 0 auto 0 0; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ideas-toolbar .segmented { order: -1; }

/* Sized in whole grid cells (--u, 24px) so js/grid.js can keep every line on the background grid. */
.ideas-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--u); }
.idea {
  display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: var(--u); align-items: start;
  padding: var(--u); border-radius: var(--radius-card); background: #f6f6f7;
}
.idea-body { min-width: 0; display: flex; flex-direction: column; }
.idea-title { margin: 0; font-family: var(--display); font-weight: 800; font-size: clamp(20px, 2.2vw, 24px); line-height: var(--lh-1_05); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.idea-details { margin: 0; color: var(--ink-2); line-height: var(--lh-1_5); overflow-wrap: anywhere; white-space: pre-line; }
.idea-meta { margin: 0; font-size: 13px; line-height: var(--lh-1_5); color: var(--muted); }

/* The vote button: arrow + count, filled once you've voted. 64px is a comfortable touch target. */
.vote {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  width: 64px; height: calc(3 * var(--u)); border-radius: 18px; border: 1px solid var(--ink); background: #fff; color: var(--ink);
  cursor: pointer; font-weight: 600; font-variant-numeric: tabular-nums;
  transition: background-color .15s ease, color .15s ease, transform .15s ease;
}
.vote-count { font-size: 18px; line-height: 1; }
.vote:hover:not([disabled]) { background: var(--hover-fill); }
.vote[aria-pressed="true"] { background: var(--ink); color: #fff; }
.vote[aria-pressed="true"]:hover:not([disabled]) { background: #2e2e33; }
.vote:active { transform: scale(.96); }
.vote[disabled] { cursor: progress; }
@media (prefers-reduced-motion: reduce) { .vote { transition: none; } .vote:active { transform: none; } }
@media (max-width: 520px) { .idea { grid-template-columns: 56px minmax(0, 1fr); gap: 16px; } .vote { width: 56px; } }

/* Admin: Tools / Ideas switch, voters */
.seg-link {
  display: inline-flex; align-items: center; height: 48px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--ink); background: var(--paper); font-size: 14px; font-weight: 500; text-decoration: none;
}
.seg-link[aria-current="page"] { background: var(--ink); color: #fff; }
.seg-link:not([aria-current="page"]):hover { background: var(--hover-fill); }
.vote-total { display: block; font-family: var(--display); font-size: 22px; }
.voters-btn { padding: 0; border: 0; background: none; cursor: pointer; font-size: 13px; }
.voter-list { list-style: none; margin: 4px 0 0; padding: 0; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.voter-list .row-sub { margin-top: 0; }


/* ---------- Sign-in return page (login.html) ---------- */
.login-page { display: grid; place-items: center; }
.login-box { display: flex; flex-direction: column; align-items: center; gap: 24px; padding: 24px 16px; text-align: center; }
.login-status { margin: 0; font-family: var(--display); font-weight: 700; font-size: 28px; line-height: var(--lh-1_3, 1.3); letter-spacing: -0.02em; }
.login-error { color: #b42318; }
.login-box [hidden] { display: none; }
