/* ==========================================================================
   willbullins.com — Bench
   Brand tokens live in the first block. When the brand guideline is done,
   most changes should only touch these variables.
   ========================================================================== */

:root {
  /* Color: light */
  --bg: #F4F3F0;
  --text: #1A1A1A;
  --muted: #5A5955;
  --line: #D6D4CE;
  --accent: #2747C8;
  --on-accent: #FFFFFF;
  --placeholder: #E4E2DC;
  --placeholder-ink: #55544F;

  /* Type */
  --font-sans: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --step-0: 1.0625rem;                       /* body, 17px */
  --step-intro: clamp(1.5rem, 3.2vw, 2.4rem);
  --step-h1: clamp(2.2rem, 5vw, 3.6rem);

  /* Space and shape */
  --gutter: 24px;
  --max: 1240px;
  --radius: 0;

  /* Motion */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --reveal-distance: 28px;
  --reveal-time: 900ms;
  --reveal-stagger: 90ms;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111111;
    --text: #EDEDEA;
    --muted: #A3A29C;
    --line: #2E2E2C;
    --accent: #8EA2FF;
    --on-accent: #111111;
    --placeholder: #1E1E1D;
    --placeholder-ink: #9B9A94;
  }
}

/* Base ------------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--step-0)/1.55 var(--font-sans);
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: 4px; }
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.mono { font-family: var(--font-mono); font-size: 0.8125rem; letter-spacing: 0; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

.skip {
  position: absolute; left: 12px; top: -100px; z-index: 20;
  background: var(--text); color: var(--bg); padding: 12px 16px;
}
.skip:focus { top: 12px; }

/* Header ---------------------------------------------------------------- */

.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
  gap: 8px 16px; padding: 12px 0;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color 200ms;
}
.is-scrolled .site-header { border-bottom-color: var(--line); }
.site-name {
  display: inline-flex; align-items: center; min-height: 44px;
  font-weight: 700; font-size: 1.25rem; letter-spacing: -0.01em; text-decoration: none;
}
.site-header ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.site-header nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; text-decoration: none;
}
.site-header nav a:hover,
.site-header nav a[aria-current] { text-decoration: underline; text-decoration-thickness: 2px; }

/* Intro + filters ------------------------------------------------------- */

.intro {
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end;
  padding: 48px 0 28px; border-bottom: 1px solid var(--line);
}
.intro-text {
  margin: 0; font-size: var(--step-intro); font-weight: 400; line-height: 1.2;
  letter-spacing: -0.015em; max-width: 26ch;
}
.filters { display: flex; justify-self: start; border: 1px solid var(--text); }
.filters[hidden] { display: none; }
.filters button {
  font: inherit; font-size: 0.9375rem; background: none; color: var(--text);
  border: 0; min-height: 44px; padding: 0 16px; cursor: pointer;
}
.filters button + button { border-left: 1px solid var(--text); }
.filters button[aria-pressed="true"] { background: var(--text); color: var(--bg); }

/* Bench grid ------------------------------------------------------------ */

.bench {
  list-style: none; margin: 0; padding: 32px 0 64px;
  display: grid; grid-template-columns: repeat(12, 1fr); grid-auto-flow: row dense;
  gap: 48px var(--gutter); align-items: start;
}
.bench-item { grid-column: span 4; }
.bench-item.size-wide { grid-column: span 8; }
.bench-item.size-w7 { grid-column: span 7; }
.bench-item.size-w6 { grid-column: span 6; }
.bench-item.size-w5 { grid-column: span 5; }
.bench-item[hidden] { display: none; }
/* While a filter is on, cards go even so the grid has no holes. */
.bench.is-filtered .shot { aspect-ratio: 4 / 3; }
@media (min-width: 861px) {
  .bench.is-filtered .bench-item { grid-column: span 4; }
}

.shot {
  position: relative; overflow: hidden; margin: 0;
  display: grid; place-items: center; aspect-ratio: 4 / 3;
  background-color: var(--placeholder); color: var(--placeholder-ink);
  background-image: repeating-linear-gradient(135deg, transparent 0 14px, rgb(127 127 127 / .08) 14px 15px);
  border-radius: var(--radius);
}
.shot img { width: 100%; height: 100%; object-fit: cover; }
.shot-label { padding: 12px; text-align: center; }
.size-wide .shot, .size-w7 .shot { aspect-ratio: 16 / 9; }
.size-tall .shot { aspect-ratio: 3 / 4; }

.card { display: block; text-decoration: none; }
.label {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 16px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--text);
}
.label h2 { margin: 0; font-size: 1.125rem; font-weight: 500; line-height: 1.3; }
.label .meta { color: var(--muted); padding-top: 3px; }
.label p { grid-column: 1 / -1; margin: 0; color: var(--muted); }
.card:hover h2 { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
.is-live { color: var(--accent) !important; }

/* Project page ---------------------------------------------------------- */

.crumb { margin: 32px 0 0; }
.crumb a { display: inline-flex; align-items: center; min-height: 44px; }
.project-head {
  display: grid; grid-template-columns: 1fr minmax(240px, 340px); gap: 16px 48px;
  padding: 8px 0 32px; align-items: end;
}
.project-head h1 {
  grid-column: 1 / -1; margin: 0;
  font-size: var(--step-h1); font-weight: 500; line-height: 1.05; letter-spacing: -0.02em;
}
.project-summary { margin: 0; font-size: 1.375rem; line-height: 1.35; max-width: 36ch; }
.project-meta { margin: 0; display: grid; gap: 0; border-top: 1px solid var(--text); }
.project-meta div {
  display: grid; grid-template-columns: 96px 1fr; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.project-meta dt { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--muted); padding-top: 3px; }
.project-meta dd { margin: 0; overflow-wrap: anywhere; }
.project-meta dd a { display: inline-flex; align-items: center; min-height: 44px; margin: -12px 0; }
.project-shot { aspect-ratio: 16 / 9; margin-bottom: 56px; }

.prose { max-width: 68ch; }
.prose h1 { font-size: var(--step-h1); font-weight: 500; line-height: 1.05; letter-spacing: -0.02em; margin: 48px 0 24px; }
.prose h2 { font-size: 1.375rem; font-weight: 500; margin: 2.2em 0 0.5em; }
.prose p, .prose li { line-height: 1.65; }
.prose a { text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
.page { padding-bottom: 64px; }
.standalone { display: inline-flex; align-items: center; min-height: 44px; }
.about-photo { aspect-ratio: 4 / 5; max-width: 420px; margin: 0 0 32px; }

.updates ol { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--text); }
.updates li { display: grid; grid-template-columns: 110px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.updates .mono { color: var(--muted); padding-top: 4px; }

.pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--gutter);
  margin: 72px 0 64px; border-top: 1px solid var(--text);
}
.pager a { display: grid; gap: 4px; padding: 16px 0; min-height: 44px; text-decoration: none; font-size: 1.125rem; }
.pager a:hover { text-decoration: underline; text-decoration-color: var(--accent); }
.pager .mono { color: var(--muted); }
.pager .next { text-align: right; }

/* Footer + signup ------------------------------------------------------- */

.site-footer {
  display: grid; grid-template-columns: 1fr 1fr; gap: 32px;
  border-top: 1px solid var(--line); padding: 40px 0 48px;
}
.site-footer h2 { font-size: 0.9375rem; font-weight: 500; color: var(--muted); margin: 0 0 8px; }
.site-footer p { margin: 0; max-width: 46ch; }
.site-footer p a { display: inline-flex; align-items: center; min-height: 44px; }
.colophon { grid-column: 1 / -1; color: var(--muted); }
.signup label { display: block; margin-bottom: 4px; }
.signup-row { display: flex; flex-wrap: wrap; gap: 8px; }
.signup input {
  flex: 1 1 220px; font: inherit; min-height: 44px; padding: 0 12px;
  background: transparent; color: var(--text); border: 1px solid var(--text); border-radius: var(--radius);
}
.signup button {
  font: inherit; min-height: 44px; padding: 0 20px; cursor: pointer;
  background: var(--text); color: var(--bg); border: 0; border-radius: var(--radius);
}
.signup button:hover { background: var(--accent); color: var(--on-accent); }
.hp { position: absolute; left: -9999px; }

/* Scroll reveal ---------------------------------------------------------
   Only when JS is running and the visitor hasn't asked for reduced motion.
   Without JS, or with reduced motion, everything is simply visible.        */

@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(var(--reveal-distance));
    transition:
      opacity calc(var(--reveal-time) * .8) ease-out,
      transform var(--reveal-time) var(--ease-out);
    transition-delay: calc(var(--i, 0) * var(--reveal-stagger));
  }
  .js .reveal.is-in,
  .js .reveal:focus-within,
  .js .reveal:focus-visible { opacity: 1; transform: none; }

  /* Images settle from a slight zoom as they arrive. */
  .js .card.reveal .shot > *,
  .js .project-shot.reveal > * {
    transform: scale(1.06);
    transition: transform 1400ms var(--ease-out);
    transition-delay: calc(var(--i, 0) * var(--reveal-stagger));
  }
  .js .card.reveal.is-in .shot > *,
  .js .project-shot.reveal.is-in > * { transform: none; }

  .card .shot img { transition: transform 600ms var(--ease-out); }
  .card:hover .shot img { transform: scale(1.03); }
}

/* Small screens --------------------------------------------------------- */

@media (max-width: 860px) {
  .bench-item, .bench-item[class*="size-"] { grid-column: span 6; }
  .intro { grid-template-columns: 1fr; }
  .project-head { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  :root { --gutter: 16px; }
  .bench { grid-template-columns: 1fr; gap: 40px; }
  .bench-item, .bench-item[class*="size-"] { grid-column: auto; }
  .size-tall .shot { aspect-ratio: 4 / 3; }
  .site-footer { grid-template-columns: 1fr; }
  .site-header { position: static; }
  .site-header nav a { padding: 0 10px; }
  .updates li { grid-template-columns: 1fr; gap: 2px; }
}
