/* Shared base: tokens, typography, rows, links */
  /* Light is the base. Every text colour clears WCAG 2.1 AA (4.5:1),
     link underlines clear the 3:1 non-text minimum. */
  :root {
    --bg: #ffffff;
    --text: #171717;      /* 17.9:1 */
    --muted: #636363;     /*  6.0:1 */
    --faint: #757575;     /*  4.6:1 */
    --underline: #939393; /*  3.1:1 */
    --line: #e2e2e2;      /* decorative hairline */
    --hover: #000000;
  }

  /* follows the device unless the visitor chose light explicitly */
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --bg: #0a0a0a;
      --text: #ededed;      /* 16.9:1 */
      --muted: #8e8e8e;     /*  6.0:1 */
      --faint: #7a7a7a;     /*  4.6:1 */
      --underline: #5e5e5e; /*  3.1:1 */
      --line: #262626;
      --hover: #ffffff;
    }
  }

  /* the visitor chose dark explicitly */
  :root[data-theme="dark"] {
    --bg: #0a0a0a;
    --text: #ededed;
    --muted: #8e8e8e;
    --faint: #7a7a7a;
    --underline: #5e5e5e;
    --line: #262626;
    --hover: #ffffff;
  }

  * { box-sizing: border-box; }

  html { -webkit-text-size-adjust: 100%; }

  body {
    margin: 0;
    text-wrap: pretty;
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.6;
    font-weight: 400;
    letter-spacing: -0.011em;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  main {
    max-width: 664px;
    margin: 0 auto;
    padding: 128px 32px 160px;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  /* ---------- header ---------- */

  header h1 {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: -0.014em;
  }

  header .role {
    margin: 0;
    color: var(--muted);
  }

  header .intro {
    margin: 28px 0 0;
    color: var(--muted);
  }

  header .intro em {
    font-style: normal;
    color: var(--text);
  }

  /* ---------- sections ---------- */

  section {
    margin-top: 64px;
  }

  h2 {
    margin: 0 0 20px;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: -0.014em;
  }

  /* ---------- rows ---------- */

  .row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: baseline;
    gap: 16px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
  }

  .row:last-child {
    border-bottom: 1px solid var(--line);
  }

  .row .label {
    color: var(--text);
    transition: color 120ms ease;
  }

  .row .desc {
    display: block;
    color: var(--muted);
  }

  .row .result {
    display: block;
    margin-top: 3px;
    color: var(--text);
  }

  .row .meta {
    color: var(--faint);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  a.row .label {
    text-decoration: underline;
    text-decoration-color: var(--underline);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
  }

  a.row:hover .label {
    color: var(--hover);
    text-decoration-color: var(--muted);
  }

  /* ---------- today ---------- */

  .today {
    color: var(--muted);
    margin: 0;
  }

  .today.lead {
    color: var(--text);
    margin-bottom: 14px;
  }

  .today strong,
  .today em {
    font-weight: 400;
    font-style: normal;
    color: var(--text);
  }

  /* ---------- contact ---------- */

  .contact {
    margin-top: 64px;
    color: var(--muted);
  }

  .contact p {
    margin: 0 0 14px;
  }

  .links {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
  }

  .links a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text);
  }

  .links svg {
    height: 15px;
    width: auto;
    flex: none;
    fill: var(--faint);
    transition: fill 120ms ease;
  }

  .links span {
    text-decoration: underline;
    text-decoration-color: var(--underline);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: text-decoration-color 120ms ease;
  }

  .links a:hover { color: var(--hover); }
  .links a:hover svg { fill: var(--text); }
  .links a:hover span { text-decoration-color: var(--muted); }

  @media (max-width: 600px) {
    main { padding: 72px 20px 96px; }
    section { margin-top: 48px; }
    .row {
      grid-template-columns: 1fr;
      gap: 2px;
    }
    .row .meta { margin-top: 2px; }
  }

  /* ---------- language switch ---------- */

  .lang {
    position: fixed;
    top: 16px;
    right: 50px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0 8px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--faint);
    transition: color 120ms ease;
    -webkit-tap-highlight-color: transparent;
  }

  .lang:hover { color: var(--text); }

  .lang:focus-visible {
    outline: 1px solid var(--underline);
    outline-offset: 2px;
  }

  /* ---------- theme toggle ---------- */

  .theme {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  /* stroked outline icons: a filled sun reads as a gear at this size */
  .theme svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: var(--faint);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 120ms ease;
  }

  .theme:hover svg { stroke: var(--text); }

  .theme:focus-visible {
    outline: 1px solid var(--underline);
    outline-offset: 2px;
  }

  /* show the theme you would switch to */
  .icon-sun { display: none; }
  .icon-moon { display: block; }

  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .icon-sun { display: block; }
    :root:not([data-theme="light"]) .icon-moon { display: none; }
  }

  :root[data-theme="dark"] .icon-sun { display: block; }
  :root[data-theme="dark"] .icon-moon { display: none; }
  :root[data-theme="light"] .icon-sun { display: none; }
  :root[data-theme="light"] .icon-moon { display: block; }

  /* ---------- case pages ---------- */
  /* ---------- case page ---------- */

  .back {
    display: inline-block;
    margin-bottom: 44px;
    color: var(--muted);
  }

  .back:hover { color: var(--text); }

  .case-head h1 {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: -0.014em;
  }

  .case-head .meta-line {
    margin: 0;
    color: var(--muted);
  }

  .case-head .lede {
    margin: 28px 0 0;
    color: var(--muted);
  }

  .case-head .lede em {
    font-style: normal;
    color: var(--text);
  }

  /* media breaks out wider than the text column */

  .wide {
    width: min(96vw, 1000px);
    margin-left: 50%;
    transform: translateX(-50%);
  }

  figure {
    margin: 0 0 40px;
  }

  figure:last-child { margin-bottom: 0; }

  .frame {
    display: block;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
  }

  .frame img {
    display: block;
    width: 100%;
    height: auto;
  }

  /* long page canvases: tall cards in a grid, full length opens on click */

  .pages {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px 24px;
  }

  .pages figure { margin-bottom: 0; }

  .page-shot .frame {
    aspect-ratio: 1440 / 1800;
  }

  /* a shot that is already short keeps its own proportions */
  .page-shot.natural .frame {
    aspect-ratio: auto;
  }

  .page-shot.natural .frame img {
    height: auto;
  }

  .page-shot .frame img {
    height: 100%;
    object-fit: cover;
    object-position: top;
  }

  figcaption {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    margin-top: 10px;
    color: var(--muted);
  }

  figcaption .open {
    color: var(--faint);
    white-space: nowrap;
    transition: color 120ms ease;
  }

  figure a:hover ~ figcaption .open,
  figcaption a.open:hover { color: var(--text); }

  .grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }

  .grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
  }

  .grid-3 figure { margin-bottom: 0; }

  .grid figure { margin-bottom: 0; }

  /* flat artwork sits on a light panel so it never floats in dark mode */

  .art .frame {
    background: #fff;
    padding: 20px 24px;
  }

  .art .frame img { border-radius: 0; }

  .next {
    margin-top: 72px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
  }

  @media (max-width: 700px) {
    .wide { width: 100%; margin-left: 0; transform: none; }
    .grid, .pages, .grid-3 { grid-template-columns: 1fr; gap: 20px; }
    .page-shot .frame { aspect-ratio: 1440 / 1500; }
  }
