/* Western United Civil Group
   Hi-vis: each page opens on one black and white photo, every other photo is
   in color. Hitachi-close safety orange is the only added color. One grade,
   one orange rule and one caption style make phone photos from different jobs
   read as one set.

   This file is a small design system. Read STYLES.md before changing how
   anything looks. Raw values live only in the tokens layer; everything below
   it is built from those tokens, and tools/css_audit.py check enforces that.

   Layers, lowest first. A later layer wins regardless of specificity, so a
   utility beats a component without !important:
     reset       removes browser defaults
     tokens      every color, size, space and width (custom properties only)
     base        element defaults
     layout      page width, sections, surfaces, grids and lists
     components  one block per kind of thing, with its variants
     utilities   single purpose helpers used in markup */

@layer reset, tokens, base, layout, components, utilities;

/* ------------------------------------------------------------------ fonts */

/* Hosted in /fonts (latin subset, SIL Open Font License, see fonts/OFL.txt).
   Every page preloads the display face, so headlines draw in it on first paint
   instead of re-wrapping when it arrives. */
@font-face {
  /* css-check: allow @font-face names the face here; a var() is not valid in this descriptor */
  font-family: "Sofia Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/sofia-sans.woff2") format("woff2");
}

@font-face {
  /* css-check: allow @font-face names the face here; a var() is not valid in this descriptor */
  font-family: "Sofia Sans Extra Condensed";
  font-style: normal;
  font-weight: 800 900;
  font-display: swap;
  src: url("/fonts/sofia-sans-extra-condensed.woff2") format("woff2");
}

@font-face {
  /* css-check: allow @font-face names the face here; a var() is not valid in this descriptor */
  font-family: "Sofia Sans Semi Condensed";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/sofia-sans-semi-condensed.woff2") format("woff2");
}

/* ------------------------------------------------------------------ reset */

@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  * {
    margin: 0;
  }

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

  img,
  picture,
  video,
  svg {
    display: block;
    max-width: 100%;
  }

  button,
  input,
  select,
  textarea {
    font: inherit;
    color: inherit;
  }

  /* Every heading's size and weight comes from this system, never the browser */
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    font-size: inherit;
    font-weight: inherit;
  }

  /* No list on this site is prose, so none keeps bullets */
  ul,
  ol {
    padding: 0;
    list-style: none;
  }
}

/* ----------------------------------------------------------------- tokens */

@layer tokens {
  :root {
    /* Color. Black, white and one orange, with greys between. */
    --color-dark: #0f1113; /* header, footer, dark sections; text on orange */
    --color-ink: #1b1e21; /* body text, heavy rules, dark buttons */
    --color-white: #ffffff; /* page background; text on dark */
    --color-paper: #f2f1ee; /* alternate section background */
    --color-muted: #6b6f73; /* secondary text on light */
    --color-line: #dcdad5; /* hairlines on light */
    --color-accent: #f2561d; /* close to Hitachi orange, sampled from the loader paint */
    --color-steel: #c9cdd1; /* vest reflective stripe */
    --color-steel-light: #dfe2e5; /* the gap between the stripe's bands */
    --color-on-dark-soft: #e4e4e4; /* lede text over photos */
    --color-on-dark-muted: #c8c8c8; /* body text on dark */
    --color-on-dark-subtle: #a9a9a9; /* footer text, notes on dark */
    --color-on-dark-faint: #7d7d7d; /* fine print */
    --color-line-on-dark: #333333; /* hairlines on dark */
    --color-line-on-dark-strong: #444444; /* chip borders on dark */
    --scrim: linear-gradient(transparent 40%, rgba(10, 10, 10, 0.75));
    --shadow-menu: 0 12px 30px rgba(0, 0, 0, 0.35);

    /* Muted text that follows its surface; .on-black swaps it */
    --muted: var(--color-muted);

    /* Type */
    --font-body: "Sofia Sans", system-ui, sans-serif;
    --font-display: "Sofia Sans Extra Condensed", sans-serif;
    --font-label: "Sofia Sans Semi Condensed", sans-serif;

    --text-xs: 13px;
    --text-sm: 15px;
    --text-base: 17px;
    --text-lg: 18px;
    --text-xl: 20px;
    --text-2xl: 24px;
    --text-3xl: 40px;
    --text-4xl: 44px;
    --text-5xl: 48px;
    --text-6xl: 52px;
    --text-7xl: 56px;
    --text-8xl: 64px;
    /* Fluid display sizes, by role */
    /* Home title: one line from 901px up. The name is about 10.1 times its
       font size wide; 10.5 leaves room for the scrollbar. */
    --text-hero: calc((min(100vw, var(--width-page)) - 2 * var(--gutter)) / 10.5);
    /* Home title on phones: two words a line (a pair is about 5.8 times
       its font size wide), capped so tablets don't outgrow desktop much. */
    --text-hero-phone: min(calc((100vw - 2 * var(--gutter)) / 6.1), 112px);
    --text-title: clamp(72px, 12vw, 190px);
    --text-pagehead: clamp(64px, 9vw, 140px);
    --text-section: clamp(52px, 6.4vw, 96px);
    --text-scope: clamp(56px, 7vw, 104px);
    --text-contact: clamp(48px, 7vw, 104px);
    --text-figure: clamp(72px, 8vw, 120px);
    --text-job: clamp(44px, 4.8vw, 72px);
    --text-card: clamp(36px, 11vw, 44px); /* card titles on phones: a long word must fit a 320px screen */

    --leading-display: 0.88;
    --leading-snug: 0.95;
    --leading-normal: 1.6;
    --leading-relaxed: 1.8;
    --tracking-display: 0.005em;
    --tracking-label: 0.14em;

    /* Spacing: --space-N is N x 4px, as in Tailwind; N-5 means N and a half */
    --space-1: 4px;
    --space-1-5: 6px;
    --space-2: 8px;
    --space-2-5: 10px;
    --space-3: 12px;
    --space-3-5: 14px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 28px;
    --space-8: 32px;
    --space-9: 36px;
    --space-10: 40px;
    --space-12: 48px;
    --space-14: 56px;
    --space-16: 64px;
    --space-18: 72px;
    --space-22: 88px;
    --space-24: 96px;
    --space-28: 112px;

    /* Rules and borders */
    --border-hair: 1px; /* hairlines */
    --border-rule: 2px; /* heavy rules between blocks, link underlines */
    --border-mark: 3px; /* focus ring, current page underline */
    --border-accent: 4px; /* orange edge on notes and lists */
    --border-photo: 6px; /* the orange rule on color photos */
    --border-heavy: 8px; /* the job posting's orange edge */

    /* Stacking */
    --z-raised: 2; /* text over a photo */
    --z-header: 10; /* the sticky header, above everything on the page but the skip link */
    --z-menu: 20;
    --z-skip: 50;

    /* Widths */
    --header-height: 64px; /* the sticky header; links to a section stop this far below the top */
    --width-page: 1240px;
    --gutter: 24px;
    --measure-xs: 360px;
    --measure-sm: 480px;
    --measure-md: 520px;
    --measure-lg: 560px;

    /* The one breakpoint is 900px: at or below it the site is the phone
       layout. Custom properties cannot be used inside @media, so it is
       written out in each query and listed in .css-check.json. */
  }

  @media (max-width: 900px) {
    :root {
      --gutter: 20px;
    }
  }
}

/* ------------------------------------------------------------------- base */

@layer base {
  /* Links to a section (#utilities) land below the sticky header, not under it */
  html {
    scroll-padding-top: var(--header-height);
  }

  body {
    font: 400 var(--text-base) / var(--leading-normal) var(--font-body);
    color: var(--color-ink);
    background: var(--color-white);
  }

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

  p a,
  li a,
  dd a {
    text-decoration: underline;
    text-decoration-color: var(--color-accent);
    text-decoration-thickness: var(--border-rule);
    text-underline-offset: 3px;
  }

  /* A photo's crop can be set per image with style="--focus: center 40%" */
  img {
    object-position: var(--focus, 50% 50%);
  }

  /* Every photo is a <picture> (AVIF with a JPEG fallback). The wrapper takes no box of its
     own, so the <img> stays the grid or flex item and components style the img as before.
     The page head is the exception: .pagehead picture fills the head. */
  picture {
    display: contents;
  }

  /* A <source> only lists files. Without this, Chrome gives it an empty box, which takes a
     grid cell once the picture is display: contents and pushes the photo to the next cell. */
  picture source {
    display: none;
  }

  :focus-visible {
    outline: var(--border-mark) solid var(--color-accent);
    outline-offset: 3px;
  }
}

/* ----------------------------------------------------------------- layout */

@layer layout {
  /* Page width column */
  .wrap {
    max-width: var(--width-page);
    margin: 0 auto;
    padding-left: var(--gutter);
    padding-right: var(--gutter);
  }

  /* Sections: vertical padding in three sizes */
  .sect {
    padding-top: var(--space-24);
    padding-bottom: var(--space-24);
  }

  .sect--md {
    padding-top: var(--space-18);
    padding-bottom: var(--space-18);
  }

  .sect--sm {
    padding-top: var(--space-14);
    padding-bottom: var(--space-14);
  }

  @media (max-width: 900px) {
    .sect {
      padding-top: var(--space-16);
      padding-bottom: var(--space-16);
    }

    .sect--md {
      padding-top: var(--space-14);
      padding-bottom: var(--space-14);
    }

    .sect--sm {
      padding-top: var(--space-10);
      padding-bottom: var(--space-10);
    }
  }

  /* Surfaces */
  .on-paper {
    background: var(--color-paper);
  }

  .on-black {
    background: var(--color-dark);
    color: var(--color-white);
    --muted: var(--color-on-dark-muted);
  }

  .on-accent {
    background: var(--color-accent);
    color: var(--color-dark);
  }

  /* Two columns that stack on phones. Vary with --split-cols and --split-gap. */
  .split {
    display: grid;
    grid-template-columns: var(--split-cols, 1fr 1fr);
    gap: var(--split-gap, var(--space-14));
    align-items: center;
  }

  .split--top {
    align-items: start;
  }

  .split--flush {
    --split-gap: 0;
    align-items: stretch;
  }

  @media (max-width: 900px) {
    .split {
      grid-template-columns: 1fr;
    }
  }

  /* Equal columns that stack on phones. Vary with --cols, --cols-sm,
     --cols-gap, --cols-gap-sm, or --cols-template for unequal columns. */
  .cols {
    display: grid;
    grid-template-columns: var(--cols-template, repeat(var(--cols, 4), 1fr));
    gap: var(--cols-gap, var(--space-8));
  }

  @media (max-width: 900px) {
    .cols {
      grid-template-columns: repeat(var(--cols-sm, 1), 1fr);
      gap: var(--cols-gap-sm, var(--space-7));
    }
  }

  /* The 12 column grid for photo layouts; two columns on phones.
     Children place themselves with grid-column. */
  .columns {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--space-3);
  }

  @media (max-width: 900px) {
    .columns {
      grid-template-columns: 1fr 1fr;
      gap: var(--space-2-5);
    }
  }

  /* A row of items that wraps */
  .cluster {
    display: flex;
    flex-wrap: wrap;
    gap: var(--cluster-gap, var(--space-3));
  }

  /* A list with hairlines between items. Vary with --ruled-pad and --ruled-gap. */
  .ruled {
    border-top: var(--border-hair) solid var(--color-line);
  }

  .ruled > li {
    display: grid;
    gap: var(--ruled-gap, var(--space-4));
    padding: var(--ruled-pad, var(--space-4)) 0;
    border-bottom: var(--border-hair) solid var(--color-line);
  }

  /* Blocks separated by heavy rules, with a closing rule after the last */
  .ruled-block {
    border-top: var(--border-rule) solid var(--color-ink);
  }

  .ruled-block:last-of-type {
    border-bottom: var(--border-rule) solid var(--color-ink);
  }
}

/* ------------------------------------------------------------- components */

@layer components {
  /* Skip link */
  .skip {
    position: absolute;
    left: var(--space-3);
    top: -60px;
    z-index: var(--z-skip);
  }

  .skip:focus {
    top: var(--space-3);
  }

  /* Button */
  .btn {
    display: inline-block;
    background: var(--color-accent);
    color: var(--color-dark);
    font-weight: 700;
    padding: var(--space-3-5) var(--space-6);
  }

  .btn--dark {
    background: var(--color-ink);
    color: var(--color-white);
  }

  .btn--ghost {
    background: transparent;
    color: inherit;
    box-shadow: inset 0 0 0 var(--border-rule) currentColor;
  }

  .btn--sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
  }

  /* A <button class="btn"> loses the browser's border, like a link button */
  button.btn {
    border: 0;
    cursor: pointer;
  }

  button.btn:disabled {
    opacity: 0.5; /* a state, not a length */
    cursor: not-allowed;
  }

  .btn[aria-current="page"] {
    box-shadow: inset 0 calc(-1 * var(--border-mark)) 0 var(--color-dark);
  }

  /* Display type */
  .cond {
    font-family: var(--font-display);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: var(--tracking-display);
    line-height: var(--leading-display);
  }

  /* Label: small caps line above a heading */
  .tag {
    font-family: var(--font-label);
    font-weight: 600;
    font-size: var(--text-xs);
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    color: var(--color-accent);
  }

  .tag--chip {
    display: inline-block;
    background: var(--color-accent);
    color: var(--color-dark);
    padding: var(--space-1-5) var(--space-2-5);
  }

  /* Big orange number: 01, 02, 03 */
  .n {
    font-size: var(--text-8xl);
    color: var(--color-accent);
  }

  /* Lede paragraph */
  .lede {
    font-size: var(--text-xl);
    max-width: var(--measure-sm);
  }

  /* Header */
  /* Stays at the top of the screen as the page scrolls */
  .site-head {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    background: var(--color-dark);
    color: var(--color-white);
  }

  .site-head .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
  }

  .brand {
    display: flex;
    align-items: center;
    gap: var(--space-2-5);
    font-size: var(--text-2xl);
  }

  .brand img {
    width: 36px;
    height: 36px;
  }

  .site-nav {
    display: flex;
    align-items: center;
    gap: var(--space-7);
    font-weight: 500;
    font-size: var(--text-sm);
  }

  .site-nav a[aria-current="page"]:not(.btn) {
    box-shadow: inset 0 calc(-1 * var(--border-mark)) 0 var(--color-accent);
    padding-bottom: var(--space-1);
  }

  .menu {
    display: none;
    position: relative;
  }

  .menu summary {
    display: block;
    list-style: none;
    cursor: pointer;
  }

  .menu summary::-webkit-details-marker {
    display: none;
  }

  .menu .sheet {
    position: absolute;
    right: 0;
    top: calc(100% + var(--space-2));
    z-index: var(--z-menu);
    background: var(--color-white);
    color: var(--color-ink);
    min-width: 220px;
    box-shadow: var(--shadow-menu);
    padding: var(--space-1-5);
    display: flex;
    flex-direction: column;
    border-top: var(--border-accent) solid var(--color-accent);
  }

  .menu .sheet a {
    padding: var(--space-3) var(--space-3-5);
    font-weight: 700;
  }

  .menu .sheet a[aria-current="page"] {
    color: var(--color-accent);
  }

  @media (max-width: 900px) {
    .site-nav {
      display: none;
    }

    .menu {
      display: block;
    }
  }

  /* Page head: a black and white photo with the title over it.
     .pagehead--hero is the taller home page version. */
  .pagehead {
    position: relative;
    height: min(62vh, 560px);
    min-height: 400px;
    background: var(--color-dark);
    overflow: hidden;
  }

  .pagehead--hero {
    height: min(86vh, 820px);
    min-height: 520px;
  }

  .pagehead picture {
    display: block;
    height: 100%;
  }

  .pagehead img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: var(--focus, center 55%);
  }

  .pagehead::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--scrim);
  }

  .pagehead .copy {
    position: absolute;
    z-index: var(--z-raised);
    left: 0;
    right: 0;
    bottom: var(--space-12);
    color: var(--color-white);
  }

  .pagehead h1 {
    font-size: var(--text-pagehead);
  }

  .pagehead--hero h1 {
    font-size: var(--text-hero);
  }

  /* Each word pair stays together, so a wrap falls between the pairs */
  .pagehead--hero h1 span {
    white-space: nowrap;
  }

  .pagehead p {
    font-size: var(--text-xl);
    max-width: var(--measure-lg);
    margin-top: var(--space-4);
    color: var(--color-on-dark-soft);
  }

  @media (max-width: 900px) {
    .pagehead {
      height: 56vh;
      min-height: 380px;
    }

    .pagehead--hero {
      height: 78vh;
      min-height: 500px;
    }

    .pagehead--hero h1 {
      font-size: var(--text-hero-phone);
    }

    .pagehead .copy {
      bottom: var(--space-7);
    }

    .pagehead p {
      font-size: var(--text-lg);
    }
  }

  /* Section head: heading left, intro right */
  .sect-head {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-10);
    /* The intro's last line sits on the heading's last baseline, not the bottom of its line box */
    align-items: last baseline;
    margin-bottom: var(--space-10);
  }

  .sect-head p {
    color: var(--muted);
    font-size: var(--text-xl);
    max-width: var(--measure-md);
  }

  @media (max-width: 900px) {
    .sect-head {
      grid-template-columns: 1fr;
      gap: var(--space-3);
      margin-bottom: var(--space-6);
    }
  }

  /* Home: dirt, utilities, road */
  .row {
    display: grid;
    grid-template-columns: 90px 1fr 1.4fr;
    gap: var(--space-8);
    align-items: center;
    padding: var(--space-7) 0;
  }

  .row h3 {
    font-size: var(--text-7xl);
  }

  .row h3 a:hover {
    color: var(--color-accent);
  }

  .row p {
    color: var(--muted);
    margin-top: var(--space-2);
    max-width: var(--measure-xs);
  }

  .row img {
    aspect-ratio: 21/9;
    object-fit: cover;
    width: 100%;
  }

  .row img.col {
    border-bottom: var(--border-photo) solid var(--color-accent);
  }

  @media (max-width: 900px) {
    .row {
      grid-template-columns: 52px 1fr;
      gap: var(--space-1-5) var(--space-3-5);
      padding: var(--space-6) 0;
    }

    .row .n {
      font-size: var(--text-4xl);
      grid-row: span 2;
      align-self: start;
    }

    .row h3 {
      font-size: var(--text-4xl);
    }

    .row img {
      grid-column: 2;
      aspect-ratio: 16/9;
      margin-top: var(--space-3);
    }
  }

  /* Home: photo essay on .columns */
  .essay .sect-head {
    margin-bottom: var(--space-9);
  }

  .essay figure {
    position: relative;
  }

  .essay figure img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .g1 {
    grid-column: span 7;
  }

  .g1 img {
    aspect-ratio: 16/10;
  }

  .g2 {
    grid-column: span 5;
  }

  .g2 img {
    aspect-ratio: 4/5;
  }

  .g3,
  .g4,
  .g5 {
    grid-column: span 4;
  }

  .g3 img,
  .g4 img,
  .g5 img {
    aspect-ratio: 1/1;
  }

  @media (max-width: 900px) {
    .g1,
    .g2,
    .g5 {
      grid-column: span 2;
    }

    .g2 img {
      aspect-ratio: 4/3;
    }

    .g3,
    .g4 {
      grid-column: span 1;
    }

    .g5 img {
      aspect-ratio: 16/9;
    }
  }

  /* Caption tag: black chip, orange number or kind */
  .cap {
    position: absolute;
    left: 0;
    bottom: 0;
    background: var(--color-dark);
    color: var(--color-white);
    padding: var(--space-2) var(--space-3-5);
    font-weight: 500;
    font-size: var(--text-sm);
  }

  .cap b {
    color: var(--color-accent);
    margin-right: var(--space-2-5);
  }

  @media (max-width: 900px) {
    .cap {
      font-size: var(--text-sm);
      padding: var(--space-1-5) var(--space-2-5);
    }
  }

  /* Home: figures band */
  .figs .cols {
    --cols-sm: 2;
    --cols-gap: var(--space-6);
    --cols-gap-sm: var(--space-5);
  }

  .figs b {
    display: block;
    font-size: var(--text-figure);
  }

  .figs span {
    display: block;
    font-size: var(--text-xl);
    font-weight: 700;
  }

  /* Home: crew */
  .crew .copy {
    padding: var(--space-22) var(--space-14) var(--space-22)
      max(var(--gutter), calc(50vw - var(--width-page) / 2 + var(--gutter)));
  }

  .crew p {
    color: var(--muted);
    margin: var(--space-4) 0 var(--space-7);
    max-width: var(--measure-sm);
  }

  .crew .photo {
    position: relative;
    min-height: 420px;
  }

  .crew .photo img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .crew .photo img.col {
    border-left: var(--border-photo) solid var(--color-accent);
  }

  @media (max-width: 900px) {
    .crew .copy {
      padding: var(--space-14) var(--gutter);
    }

    .crew .photo {
      min-height: 300px;
    }

    .crew .photo img.col {
      border-left: 0;
      border-top: var(--border-photo) solid var(--color-accent);
    }
  }

  /* Chips: outlined labels on dark, in a wrapping row */
  .chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .chips > * {
    border: var(--border-hair) solid var(--color-line-on-dark-strong);
    padding: var(--space-1-5) var(--space-3);
    font-weight: 500;
  }

  /* Open position note */
  .open {
    border-left: var(--border-accent) solid var(--color-accent);
    padding: var(--space-1-5) 0 var(--space-1-5) var(--space-4);
  }

  .open b {
    display: block;
    font-size: var(--text-xl);
  }

  .open span {
    color: var(--color-on-dark-subtle);
    font-size: var(--text-sm);
  }

  /* Home: shop and estimating, on .split--flush */
  .duo {
    border-bottom: var(--border-hair) solid var(--color-line);
  }

  .duo > div {
    padding: var(--space-18) var(--space-14);
  }

  .duo > div:first-child {
    border-right: var(--border-hair) solid var(--color-line);
  }

  .duo h3 {
    font-size: var(--text-7xl);
    margin: var(--space-2-5) 0 var(--space-3-5);
  }

  .duo p {
    color: var(--muted);
    max-width: 440px;
    margin-bottom: var(--space-6);
  }

  @media (max-width: 900px) {
    .duo > div {
      padding: var(--space-12) var(--gutter);
    }

    .duo > div:first-child {
      border-right: 0;
      border-bottom: var(--border-hair) solid var(--color-line);
    }

    .duo h3 {
      font-size: var(--text-4xl);
    }
  }

  /* Client list */
  .clients {
    color: var(--muted);
  }

  .clients p {
    font-size: var(--text-lg);
    line-height: var(--leading-relaxed);
  }

  .clients b {
    color: var(--color-ink);
    font-weight: 700;
  }

  /* What we do: one block per kind of work, on .split */
  .scope {
    --split-cols: 1.15fr 1fr;
    padding: var(--space-18) 0;
    scroll-margin-top: var(--space-6);
  }

  .scope .pics {
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
    aspect-ratio: 6/5;
  }

  .scope .pics img {
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: cover;
  }

  /* the lead photo: the first <picture>'s img, which is the grid item */
  .scope .pics > :first-child img {
    grid-row: span 2;
    border-bottom: var(--border-photo) solid var(--color-accent);
  }

  .scope h2 {
    font-size: var(--text-scope);
    margin: var(--space-1-5) 0 var(--space-4);
  }

  @media (max-width: 900px) {
    .scope {
      --split-gap: var(--space-7);
      padding: var(--space-12) 0;
    }
  }

  /* Term and description list, on .ruled */
  .items {
    --ruled-pad: var(--space-3-5);
  }

  .items > li {
    grid-template-columns: 180px 1fr;
  }

  .items span {
    color: var(--muted);
  }

  @media (max-width: 900px) {
    .items > li {
      grid-template-columns: 1fr;
      --ruled-gap: var(--space-1);
    }
  }

  /* What we do: equipment */
  .iron img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    border-left: var(--border-photo) solid var(--color-accent);
  }

  .iron p {
    color: var(--muted);
    max-width: var(--measure-sm);
    margin: var(--space-4) 0 var(--space-7);
  }

  @media (max-width: 900px) {
    .iron img {
      border-left: 0;
      border-top: var(--border-photo) solid var(--color-accent);
    }
  }

  /* What we do: who we work for, on .cols */
  .reach {
    --cols: 3;
    --cols-gap: var(--space-10);
  }

  .reach h3 {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-2-5);
  }

  .reach p {
    color: var(--muted);
    max-width: var(--measure-xs);
  }

  /* Closing band on inner pages */
  .band .wrap {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: var(--space-8);
    flex-wrap: wrap;
  }

  .band p {
    font-size: var(--text-xl);
    max-width: var(--measure-md);
    margin-top: var(--space-3-5);
  }

  /* Work: one block per job, on .columns. Kind of work in the tag, no names. */
  .job {
    padding: var(--space-16) 0;
  }

  .job .main {
    grid-column: 1 / span 8;
    grid-row: 1 / span 2;
    position: relative;
  }

  .job .side {
    grid-column: 9 / span 4;
    position: relative;
  }

  .job .text {
    grid-column: 9 / span 4;
    align-self: end;
    padding: var(--space-6) 0 0 var(--space-3);
  }

  .job--flip .main {
    grid-column: 5 / span 8;
  }

  .job--flip .side,
  .job--flip .text {
    grid-column: 1 / span 4;
  }

  .job--flip .text {
    padding: var(--space-6) var(--space-3) 0 0;
  }

  .job img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .job .main img {
    aspect-ratio: 4/3;
    border-bottom: var(--border-photo) solid var(--color-accent);
  }

  .job .side img {
    aspect-ratio: 4/3;
  }

  .job h2 {
    font-size: var(--text-job);
    margin: var(--space-2-5) 0 var(--space-3-5);
  }

  .job p {
    color: var(--muted);
  }

  @media (max-width: 900px) {
    .job {
      padding: var(--space-10) 0;
    }

    .job .main,
    .job--flip .main {
      grid-column: 1 / span 2;
      grid-row: auto;
    }

    .job .side,
    .job--flip .side {
      grid-column: 1 / span 2;
    }

    .job .side img {
      aspect-ratio: 16/9;
    }

    .job .text,
    .job--flip .text {
      grid-column: 1 / span 2;
      grid-row: 1;
      padding: 0 0 var(--space-3);
    }
  }

  /* Careers: reasons, on .cols. Six reasons, so two even rows of three */
  .why {
    --cols: 3;
  }

  .why li {
    border-top: var(--border-accent) solid var(--color-accent);
    padding-top: var(--space-4);
  }

  .why b {
    display: block;
    font-size: var(--text-xl);
    margin-bottom: var(--space-1-5);
  }

  .why span {
    color: var(--muted);
  }

  /* Careers: numbered career steps, on .cols */
  .ladder {
    --cols-gap: 0;
    --cols-gap-sm: var(--space-8);
    counter-reset: step;
  }

  .ladder li {
    counter-increment: step;
    border-left: var(--border-hair) solid var(--color-line-on-dark);
    padding: 0 var(--space-7) var(--space-2);
  }

  .ladder li:first-child {
    border-left: 0;
    padding-left: 0;
  }

  .ladder li::before {
    content: counter(step);
    display: block;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: var(--text-8xl);
    line-height: var(--leading-display);
    color: var(--color-accent);
    margin-bottom: var(--space-3);
  }

  .ladder h3 {
    font-size: var(--text-4xl);
    margin-bottom: var(--space-2-5);
  }

  .ladder p {
    color: var(--muted);
  }

  @media (max-width: 900px) {
    .ladder li,
    .ladder li:first-child {
      border-left: 0;
      border-top: var(--border-hair) solid var(--color-line-on-dark);
      padding: var(--space-6) 0 0;
    }

    .ladder li:first-child {
      border-top: 0;
      padding-top: 0;
    }
  }

  /* Careers: open job, on .split */
  .jobs-open img {
    width: 100%;
    aspect-ratio: 4/5;
    object-fit: cover;
  }

  .posting {
    border: var(--border-rule) solid var(--color-ink);
    border-left: var(--border-heavy) solid var(--color-accent);
    padding: var(--space-8);
  }

  .posting h3 {
    font-size: var(--text-6xl);
    margin: var(--space-2-5) 0 var(--space-3);
  }

  .posting p {
    color: var(--muted);
    margin-bottom: var(--space-6);
  }

  @media (max-width: 900px) {
    .posting {
      padding: var(--space-6);
    }

    .posting h3 {
      font-size: var(--text-card);
    }
  }

  /* Careers: numbered steps to apply, on .ruled */
  .how {
    --ruled-pad: var(--space-5);
    counter-reset: how;
    max-width: 760px;
  }

  .how > li {
    counter-increment: how;
    grid-template-columns: 64px 1fr;
    font-size: var(--text-xl);
  }

  .how li::before {
    content: counter(how);
    font-family: var(--font-display);
    font-weight: 900;
    font-size: var(--text-4xl);
    line-height: var(--leading-display);
    color: var(--color-accent);
  }

  .how small {
    display: block;
    color: var(--muted);
    font-size: var(--text-sm);
    margin-top: var(--space-1);
  }

  /* Fab shop: the page opens on a hi-vis vest */
  .vest {
    position: relative;
    overflow: hidden;
    padding: var(--space-28) 0 var(--space-24);
  }

  .vest::before,
  .vest::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 34px;
    background: repeating-linear-gradient(
      90deg,
      var(--color-steel) 0 6px,
      var(--color-steel-light) 6px 7px
    );
  }

  .vest::before {
    top: 40px;
  }

  .vest::after {
    bottom: 40px;
  }

  .vest h1 {
    font-size: var(--text-title);
    max-width: 1000px;
  }

  .vest p {
    font-size: var(--text-xl);
    max-width: var(--measure-lg);
    margin: var(--space-6) 0 var(--space-7);
  }

  @media (max-width: 900px) {
    .vest {
      padding: var(--space-24) 0 var(--space-22);
    }

    .vest::before,
    .vest::after {
      height: 24px;
    }

    .vest::before {
      top: 32px;
    }

    .vest::after {
      bottom: 32px;
    }
  }

  /* Fab shop: what we build, on .cols */
  .makes {
    --cols-gap: 0;
    --cols-gap-sm: 0;
    border-top: var(--border-rule) solid var(--color-ink);
    border-bottom: var(--border-rule) solid var(--color-ink);
  }

  .makes li {
    padding: var(--space-7) var(--space-6) var(--space-8);
    border-left: var(--border-hair) solid var(--color-line);
  }

  .makes li:first-child {
    border-left: 0;
    padding-left: 0;
  }

  .makes h3 {
    font-size: var(--text-4xl);
    margin-bottom: var(--space-2-5);
  }

  .makes p {
    color: var(--muted);
  }

  @media (max-width: 900px) {
    .makes li,
    .makes li:first-child {
      border-left: 0;
      border-top: var(--border-hair) solid var(--color-line);
      padding: var(--space-6) 0 var(--space-6);
    }

    .makes li:first-child {
      border-top: 0;
    }
  }

  /* Contact block: big phone and email lines with details, on .split */
  .reachus {
    --split-cols: 1.2fr 1fr;
  }

  .reachus dl {
    display: grid;
    gap: var(--space-7);
  }

  .reachus dt {
    color: var(--muted);
    font-weight: 700;
    margin-bottom: var(--space-1);
  }

  .reachus dd {
    overflow-wrap: anywhere;
  }

  .bigline {
    display: block;
    font-family: var(--font-display);
    font-weight: 900;
    line-height: var(--leading-snug);
    font-size: var(--text-contact);
  }

  .bigline:hover {
    color: var(--color-accent);
  }

  /* What to send, on .ruled */
  .checklist > li {
    grid-template-columns: 22px 1fr;
    gap: var(--space-3-5);
    font-size: var(--text-lg);
  }

  .checklist li::before {
    content: "";
    width: 14px;
    height: 14px;
    margin-top: var(--space-1-5);
    background: var(--color-accent);
  }

  .checklist small {
    display: block;
    color: var(--muted);
    font-size: var(--text-sm);
  }

  .checklist + p {
    margin-top: var(--space-5);
    color: var(--muted);
  }

  /* Not found */
  .lost {
    min-height: 60vh;
    display: flex;
    align-items: center;
    padding: var(--space-24) 0;
  }

  /* Full page column, so the message lines up with the header's logo
     instead of shrinking to its widest line and centering. */
  .lost > .wrap {
    flex: 1;
  }

  .lost h1 {
    font-size: var(--text-title);
  }

  .lost p {
    font-size: var(--text-xl);
    color: var(--muted);
    margin: var(--space-4) 0 var(--space-7);
    max-width: var(--measure-md);
  }

  /* Employee sign-in: a label, then the password field and button side by
     side at one height (same padding and line height; the field's border is
     an inset shadow so it adds no height). */
  .gate {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    max-width: var(--measure-md);
  }

  .gate label {
    flex-basis: 100%;
    font-weight: 700;
  }

  /* The field itself is an .input, the site's one field look */
  .gate input {
    flex: 1 1 0;
    min-width: 0;
  }

  .gate button {
    border: 0;
    cursor: pointer;
  }

  /* Shown by the Worker after a wrong password (worker/index.js) */
  .lost .sign-in-error {
    color: var(--color-ink);
    font-size: var(--text-base);
    font-weight: 700;
    border-left: var(--border-accent) solid var(--color-accent);
    padding-left: var(--space-3);
    margin: 0 0 var(--space-5);
  }

  /* ------------------------------------------------------------ forms */

  /* The one field look: a white field with a hairline in the muted grey
     (over 3:1 on white, so it still reads as a field), darkening to ink
     under the pointer and on focus. On input, select and textarea. */
  .input {
    display: block;
    width: 100%;
    padding: var(--space-3-5) var(--space-4);
    background: var(--color-white);
    color: var(--color-ink);
    border: 0;
    border-radius: 0;
    box-shadow: inset 0 0 0 var(--border-hair) var(--color-muted);
    font-size: var(--text-base); /* 16px or more, so phones don't zoom in on focus */
    line-height: var(--leading-normal);
  }

  .input:hover,
  .input:focus {
    box-shadow: inset 0 0 0 var(--border-hair) var(--color-ink);
  }

  .input::placeholder {
    color: var(--color-muted);
  }

  /* What can't be changed looks set, not broken */
  .input:disabled {
    background: var(--color-paper);
    color: var(--muted);
    box-shadow: inset 0 0 0 var(--border-hair) var(--color-line);
    cursor: not-allowed;
  }

  textarea.input {
    resize: vertical;
    min-height: var(--space-28);
  }

  /* A date field is as tall as a text field in Safari, which draws it shorter */
  input.input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
    min-height: calc(var(--text-base) * var(--leading-normal) + 2 * var(--space-3-5));
  }

  /* A select with the native chrome off and a drawn arrow */
  .select {
    display: block;
    position: relative;
  }

  .select .input {
    -webkit-appearance: none;
    appearance: none;
    padding-right: var(--space-12);
    cursor: pointer;
  }

  .select::after {
    content: "";
    position: absolute;
    right: var(--space-4);
    top: 50%;
    width: var(--space-2-5);
    height: var(--space-2-5);
    border-right: var(--border-rule) solid var(--color-ink);
    border-bottom: var(--border-rule) solid var(--color-ink);
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
  }

  /* A file field: its button drawn like a ghost button on a hairline */
  .input-file {
    max-width: 100%;
    font-size: var(--text-sm);
  }

  .input-file::file-selector-button {
    font: inherit;
    font-weight: 700;
    color: var(--color-ink);
    background: var(--color-white);
    border: 0;
    box-shadow: inset 0 0 0 var(--border-hair) var(--color-muted);
    padding: var(--space-3) var(--space-5);
    margin-right: var(--space-4);
    cursor: pointer;
  }

  /* One question: bold label, an optional hint, the field, an error line.
     In .fields the four sit on a subgrid, so fields in a row line up even
     when one label wraps or has a hint. */
  .field {
    min-width: 0;
  }

  .field-label {
    display: block;
    font-weight: 700;
    margin-bottom: var(--space-2);
  }

  .field-opt {
    font-weight: 400;
    font-size: var(--text-sm);
    color: var(--muted);
  }

  .field-hint {
    color: var(--muted);
    font-size: var(--text-sm);
    margin: calc(-1 * var(--space-1)) 0 var(--space-2);
  }

  /* An answer that needs fixing: the sign-in's error line, under the field */
  .field-error {
    font-weight: 700;
    border-left: var(--border-accent) solid var(--color-accent);
    padding-left: var(--space-3);
    margin-top: var(--space-2);
  }

  /* Questions in rows: twelve columns on a computer; a question takes a
     share of the row by its width (.field--half and so on), the whole row
     by default. One column on a phone. */
  .fields {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--space-4);
  }

  /* The space under each question is its own padding: a row gap would also
     open up between a question's label, hint and field, which share the
     grid's rows. */
  .fields > .field {
    grid-column: span 12;
    display: grid;
    grid-row: span 4;
    grid-template-rows: subgrid;
    padding-bottom: var(--space-6);
    align-content: start;
  }

  .fields > .field--quarter {
    grid-column: span 3;
  }

  .fields > .field--third {
    grid-column: span 4;
  }

  .fields > .field--half {
    grid-column: span 6;
  }

  .fields > .field--two-thirds {
    grid-column: span 8;
  }

  .fields > .field--three-quarters {
    grid-column: span 9;
  }

  .fields > .field > .field-label {
    grid-row: 1;
    align-self: end;
  }

  .fields > .field > .field-hint {
    grid-row: 2;
  }

  .fields > .field > .field-control {
    grid-row: 3;
  }

  .fields > .field > .field-error {
    grid-row: 4;
    align-self: start;
  }

  /* A follow-up waiting for its answer; beats the display set above and in the phone layout */
  .fields > .field[hidden] {
    display: none;
  }

  @media (max-width: 900px) {
    .fields {
      grid-template-columns: minmax(0, 1fr);
    }

    /* Later than the width rules, so it wins over them */
    .fields > .field {
      display: block;
      grid-column: 1;
    }
  }

  /* Yes and No, short pick lists and the equipment list: boxes to tap.
     A picked one turns the site's orange with dark text, like its buttons. */
  .choices {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .choice {
    position: relative;
    cursor: pointer;
  }

  .choice input {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
  }

  .choice span {
    display: block;
    min-width: var(--space-22);
    text-align: center;
    padding: var(--space-3) var(--space-6);
    font-weight: 700;
    background: var(--color-white);
    box-shadow: inset 0 0 0 var(--border-hair) var(--color-muted);
  }

  .choice:hover span {
    box-shadow: inset 0 0 0 var(--border-hair) var(--color-ink);
  }

  .choice--chip span {
    min-width: 0;
    padding: var(--space-2-5) var(--space-4);
    font-weight: 600;
  }

  .choice input:checked + span {
    background: var(--color-accent);
    color: var(--color-dark);
    box-shadow: none;
  }

  .choice input:focus-visible + span {
    outline: var(--border-mark) solid var(--color-accent);
    outline-offset: var(--border-mark);
  }

  /* A single box to tick, beside its words (the certification) */
  .tick {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-3);
    align-items: start;
    font-weight: 700;
    cursor: pointer;
  }

  .tick input {
    width: var(--space-6);
    height: var(--space-6);
    margin: 0;
    accent-color: var(--color-ink);
  }

  .tick:has(input:disabled) {
    color: var(--muted);
    cursor: not-allowed;
  }

  /* A plain text button: Remove */
  .textbtn {
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: var(--border-rule);
    text-decoration-color: var(--color-accent);
    text-underline-offset: var(--border-mark);
    cursor: pointer;
  }

  /* An ink underline, for an action that shouldn't look like the orange
     ones (Delete) */
  .textbtn--ink {
    text-decoration-color: var(--color-ink);
  }

  /* A message about the whole form: what needs fixing before Send */
  .form-error {
    font-weight: 700;
    font-size: var(--text-lg);
    border-left: var(--border-accent) solid var(--color-accent);
    padding-left: var(--space-3);
  }

  /* A note at the top of a form, on an orange edge: answers brought back */
  .form-note {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3) var(--space-6);
    background: var(--color-white);
    border-left: var(--border-accent) solid var(--color-accent);
    padding: var(--space-4) var(--space-5);
  }

  .form-note p {
    flex: 1 1 var(--measure-xs);
  }

  /* Good news gets the ink edge; orange is for what needs fixing */
  .form-note--ok {
    border-left-color: var(--color-ink);
  }

  .form-note ul {
    flex-basis: 100%;
    display: grid;
    gap: var(--space-1);
  }

  .form-note[hidden],
  .form-error[hidden] {
    display: none;
  }

  /* A field bots fill in and people never see */
  .trap {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  /* ------------------------------------------------- the job application */

  /* The page sits on .on-paper, so the white fields stand out without
     heavy outlines. A sticky list of sections beside the form, ticked off
     as each is done; a progress strip under the header on a phone. */
  .apply {
    display: grid;
    /* The list takes its longest name, up to a narrow column; 760px is one
       column of questions, as .how */
    grid-template-columns: fit-content(var(--measure-xs)) minmax(0, 760px);
    gap: var(--space-16);
    align-items: start;
  }

  /* The heading spans both columns, above the list and the form */
  .apply-head {
    grid-column: 1 / -1;
    max-width: 760px;
  }

  .apply-head h1 {
    font-size: var(--text-section);
  }

  .apply-head .form-note {
    margin-top: var(--space-8);
  }

  .apply-sec {
    border-top: var(--border-rule) solid var(--color-ink);
    padding: var(--space-10) 0 var(--space-12);
    scroll-margin-top: calc(var(--header-height) + var(--space-4));
  }

  .apply-sec h2 {
    font-size: var(--text-5xl);
  }

  .apply-sec-intro {
    color: var(--muted);
    margin-top: var(--space-2);
    max-width: var(--measure-lg);
  }

  /* The first copy of the questions (every section has at least one) */
  .apply-sec > div:first-of-type {
    margin-top: var(--space-6);
  }

  /* One copy of a repeating section: one reference, one past job */
  .apply-copy + .apply-copy,
  .apply-copy + .btn {
    margin-top: var(--space-8);
  }

  .apply-copy[hidden],
  .apply-sec .btn[hidden] {
    display: none;
  }

  .apply-copy-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: var(--border-hair) solid var(--color-line);
    padding-bottom: var(--space-2);
    margin-bottom: var(--space-5);
  }

  .apply-copy-head h3 {
    font-size: var(--text-lg);
    font-weight: 700;
  }

  .apply-send {
    display: grid;
    justify-items: start;
    gap: var(--space-4);
    border-top: var(--border-rule) solid var(--color-ink);
    padding-top: var(--space-8);
  }

  .apply-send .btn {
    border: 0;
    cursor: pointer;
    font-size: var(--text-lg);
  }

  .apply-send-note {
    color: var(--muted);
    font-size: var(--text-sm);
    max-width: var(--measure-md);
  }

  /* The editor's Preview: an orange bar across the top, above the page */
  .apply-preview {
    background: var(--color-accent);
    color: var(--color-dark);
    padding-top: var(--space-3);
    padding-bottom: var(--space-3);
  }

  .apply-list {
    position: sticky;
    top: calc(var(--header-height) + var(--space-8));
  }

  .apply-list ol {
    list-style: none;
    padding: 0;
    border-top: var(--border-rule) solid var(--color-ink);
  }

  .apply-list li {
    border-bottom: var(--border-hair) solid var(--color-line);
  }

  .apply-list a {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    text-decoration: none;
    color: var(--muted);
    font-weight: 600;
  }

  .apply-list a[aria-current] {
    color: var(--color-ink);
    font-weight: 700;
  }

  /* The tick box: empty, then orange with a dark tick when the section is done */
  .apply-list i {
    flex: none;
    position: relative;
    width: var(--space-5);
    height: var(--space-5);
    box-shadow: inset 0 0 0 var(--border-rule) currentColor;
  }

  .apply-list .is-done i {
    background: var(--color-accent);
    box-shadow: none;
  }

  .apply-list .is-done i::after {
    content: "";
    position: absolute;
    left: var(--space-1-5);
    top: var(--space-1);
    width: var(--space-1-5);
    height: var(--space-2-5);
    border-right: var(--border-rule) solid var(--color-dark);
    border-bottom: var(--border-rule) solid var(--color-dark);
    transform: rotate(45deg);
  }

  .apply-count {
    margin-top: var(--space-4);
    font-size: var(--text-sm);
    color: var(--muted);
  }

  .apply-strip {
    display: none;
  }

  /* After Send */
  .apply-done h1 {
    font-size: var(--text-title);
  }

  @media (max-width: 900px) {
    .apply {
      grid-template-columns: minmax(0, 1fr);
      gap: 0;
    }

    .apply-head h1 {
      font-size: var(--text-6xl);
    }

    .apply-sec {
      padding: var(--space-8) 0 var(--space-10);
      scroll-margin-top: calc(var(--header-height) + var(--space-18));
    }

    .apply-sec h2 {
      font-size: var(--text-3xl);
    }

    .apply-list {
      top: var(--header-height);
      z-index: var(--z-raised);
      background: var(--color-paper);
      margin: 0 calc(-1 * var(--gutter));
      padding: var(--space-3) var(--gutter);
      border-bottom: var(--border-hair) solid var(--color-line);
    }

    .apply-list nav {
      display: none;
    }

    .apply-strip {
      display: block;
    }

    .apply-strip p {
      display: flex;
      justify-content: space-between;
      font-weight: 700;
      margin-bottom: var(--space-2);
    }

    .apply-strip p span + span {
      font-weight: 400;
      font-size: var(--text-sm);
      color: var(--muted);
    }

    .apply-strip div {
      display: grid;
      grid-auto-flow: column;
      grid-auto-columns: minmax(0, 1fr);
      gap: var(--space-1);
    }

    .apply-strip a {
      height: var(--space-2);
      background: var(--color-line);
    }

    .apply-strip a.is-done {
      background: var(--color-accent);
    }

    .apply-strip a[aria-current] {
      box-shadow: inset 0 calc(-1 * var(--border-rule)) 0 var(--color-ink);
    }
  }

  /* ------------------------------------------------ the question editor */

  /* HR's page for changing the application's questions (plan 09,
     /careers/apply/edit/): the sections and their questions on the left,
     the picked one's settings in a pane on the right. On a phone the
     settings take the screen, with a way back. On .on-paper. */

  /* The publish bar sticks under the site's header, so Publish is in reach */
  .qe-bar {
    position: sticky;
    top: var(--header-height);
    z-index: var(--z-raised);
    background: var(--color-white);
    border-bottom: var(--border-hair) solid var(--color-line);
  }

  .qe-bar-in {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-6);
    padding-top: var(--space-2-5);
    padding-bottom: var(--space-2-5);
  }

  .qe-who,
  .qe-changes {
    font-size: var(--text-sm);
  }

  .qe-who {
    color: var(--muted);
  }

  .qe-signout {
    margin-left: var(--space-3);
  }

  .qe-changes {
    margin-left: auto;
  }

  .qe-changes.is-dirty {
    color: var(--color-ink);
    font-weight: 700;
  }

  .qe-actions {
    --cluster-gap: var(--space-2);
  }

  /* On a phone, who's signed in moves from the bar to the page head, to keep
     the sticky bar short */
  .qe-who--head {
    display: none;
  }

  .qe-head h1 {
    font-size: var(--text-section);
    line-height: var(--leading-display);
  }

  /* The two panes */
  .qe {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: var(--space-10);
    align-items: start;
  }

  .qe[hidden] {
    display: none;
  }

  /* A section in the list: its number and name, its buttons, its small
     print, and its questions */
  .qe-sec {
    border-top: var(--border-rule) solid var(--color-ink);
    padding: var(--space-6) 0 var(--space-8);
  }

  .qe-sec-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-4);
  }

  .qe-sec-head h2 {
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
    margin-right: auto;
    font-size: var(--text-4xl);
    line-height: var(--leading-display);
  }

  .qe-sec-n {
    color: var(--color-accent);
  }

  .qe-sec.is-open > .qe-sec-head,
  .qe-sec.has-error > .qe-sec-head {
    background: var(--color-white);
    padding-left: var(--space-4);
    padding-right: var(--space-4);
    box-shadow: inset var(--border-accent) 0 0 var(--color-ink);
  }

  .qe-sec.has-error > .qe-sec-head {
    box-shadow: inset var(--border-accent) 0 0 var(--color-accent);
  }

  .qe-sec-note {
    margin-top: var(--space-2);
    max-width: var(--measure-lg);
    color: var(--muted);
    font-size: var(--text-sm);
  }

  .qe-sec-list {
    margin-top: var(--space-4);
    border-top: var(--border-hair) solid var(--color-line);
  }

  /* One question's line: its words, its follow-up rule, its kind of
     answer; pressing it opens its settings */
  .qe-q {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    border-bottom: var(--border-hair) solid var(--color-line);
  }

  .qe-q-main {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: var(--space-1);
    padding: var(--space-3) 0;
    background: none;
    border: 0;
    color: inherit;
    text-align: left;
    cursor: pointer;
  }

  .qe-q-label {
    font-weight: 700;
  }

  .qe-q-main:hover .qe-q-label {
    text-decoration: underline;
    text-decoration-thickness: var(--border-rule);
    text-decoration-color: var(--color-accent);
    text-underline-offset: var(--border-mark);
  }

  .qe-q-follow {
    font-size: var(--text-sm);
  }

  .qe-q-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-4);
    color: var(--muted);
    font-size: var(--text-sm);
  }

  .qe-q-lock {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
  }

  /* A follow-up hangs off the question it follows */
  .qe-q--follow {
    padding-left: var(--space-5);
  }

  .qe-q--follow > .qe-q-main {
    border-left: var(--border-accent) solid var(--color-line);
    padding-left: var(--space-3);
  }

  /* The open question, and one that stops a publish */
  .qe-q.is-open,
  .qe-q.has-error {
    background: var(--color-white);
    padding-left: var(--space-4);
    padding-right: var(--space-4);
    box-shadow: inset var(--border-accent) 0 0 var(--color-ink);
  }

  .qe-q.has-error {
    box-shadow: inset var(--border-accent) 0 0 var(--color-accent);
  }

  /* The padlock beside what can't be deleted */
  .qe-lock {
    width: var(--space-3-5);
    height: var(--space-3-5);
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6; /* a drawn line, not a length */
  }

  /* Move up and move down */
  .qe-move {
    display: flex;
    gap: var(--space-1);
    flex-shrink: 0;
  }

  /* A square button with a drawn icon, big enough for a thumb */
  .iconbtn {
    display: grid;
    place-items: center;
    width: var(--space-10);
    height: var(--space-10);
    padding: 0;
    background: var(--color-white);
    border: 0;
    box-shadow: inset 0 0 0 var(--border-hair) var(--color-line);
    color: var(--color-ink);
    cursor: pointer;
  }

  .iconbtn:hover {
    box-shadow: inset 0 0 0 var(--border-hair) var(--color-ink);
  }

  .iconbtn:disabled {
    color: var(--color-line);
    box-shadow: inset 0 0 0 var(--border-hair) var(--color-line);
    cursor: default;
  }

  .iconbtn svg {
    width: var(--space-4);
    height: var(--space-4);
    fill: none;
    stroke: currentColor;
    stroke-width: 2; /* a drawn line, not a length */
  }

  /* The settings pane: sticks beside the list and scrolls on its own;
     scrolling inside it never runs on into the page */
  .qe-pane {
    position: sticky;
    top: calc(var(--header-height) + var(--space-18));
    max-height: calc(100vh - var(--header-height) - var(--space-24));
    overflow: auto;
    overscroll-behavior: contain;
    background: var(--color-white);
    box-shadow: inset var(--border-accent) 0 0 var(--color-ink);
    padding: var(--space-6) var(--space-6) var(--space-2) var(--space-7);
  }

  .qe-pane-body {
    display: grid;
    gap: var(--space-5);
    padding-bottom: var(--space-5);
  }

  .qe-pane-body[hidden],
  .qe-pane-empty[hidden] {
    display: none;
  }

  .qe-pane-back {
    display: none;
    margin-bottom: var(--space-5);
  }

  /* The picked question's words, or the section's name, as the pane's
     title: they read as a heading; under the pointer a hairline and the text
     cursor say they can be changed, and a click edits them in place, like a
     document's title. A text area, so long questions wrap. */
  .qe-title {
    display: block;
    width: 100%;
    padding: var(--space-1-5) var(--space-2);
    resize: none;
    overflow: hidden;
    background: transparent;
    border: 0;
    box-shadow: inset 0 0 0 var(--border-hair) transparent;
    color: var(--color-ink);
    font-size: var(--text-2xl);
    font-weight: 700;
    line-height: var(--leading-snug);
    cursor: text;
  }

  .qe-title:hover {
    box-shadow: inset 0 0 0 var(--border-hair) var(--color-muted);
  }

  .qe-title:focus {
    background: var(--color-white);
    box-shadow: inset 0 0 0 var(--border-hair) var(--color-ink);
  }

  .qe-title::placeholder {
    color: var(--muted);
  }

  /* No pointer on a phone or tablet, so a faint line under it always shows
     it can be changed */
  @media (hover: none) {
    .qe-title {
      box-shadow: inset 0 calc(-1 * var(--border-hair)) 0 var(--color-line);
    }
  }

  /* Two settings side by side: a follow-up's question and answer, a
     repeating section's two numbers */
  .qe-pair {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: var(--space-3) var(--space-4);
  }

  .qe-pair[hidden] {
    display: none;
  }

  /* A pick question's choices, each with Remove */
  .qe-choices {
    display: grid;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
  }

  .qe-choices:empty {
    display: none;
  }

  .qe-choice {
    display: flex;
    align-items: center;
    gap: var(--space-4);
  }

  .qe-choice .input {
    flex: 1;
  }

  /* Settings HR rarely needs, tucked away */
  .qe-more summary {
    font-size: var(--text-sm);
    font-weight: 700;
    cursor: pointer;
  }

  .qe-more-body {
    display: grid;
    gap: var(--space-5);
    margin-top: var(--space-4);
  }

  .qe-foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3) var(--space-5);
    border-top: var(--border-hair) solid var(--color-line);
    padding-top: var(--space-4);
  }

  .qe-locked {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--muted);
    font-size: var(--text-sm);
  }

  /* Earlier versions: the last 20, newest first */
  .qe-versions {
    margin-top: var(--space-10);
    border-top: var(--border-rule) solid var(--color-ink);
    padding-top: var(--space-5);
  }

  .qe-versions summary {
    font-size: var(--text-lg);
    font-weight: 700;
    cursor: pointer;
  }

  .qe-versions summary span {
    color: var(--muted);
    font-size: var(--text-sm);
    font-weight: 400;
  }

  .qe-versions li {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: baseline;
    gap: var(--space-1) var(--space-4);
    padding: var(--space-2-5) 0;
    border-bottom: var(--border-hair) solid var(--color-line);
    font-size: var(--text-sm);
  }

  .qe-v-n,
  .qe-v-live {
    font-weight: 700;
  }

  .qe-v-who {
    color: var(--muted);
  }

  @media (max-width: 900px) {
    .qe-bar .qe-who {
      display: none;
    }

    .qe-who--head {
      display: block;
    }

    .qe-changes {
      flex: 1;
      margin-left: 0;
    }

    .qe {
      grid-template-columns: minmax(0, 1fr);
    }

    .qe-sec-head h2 {
      flex-basis: 100%;
    }

    .qe-sec-head .qe-move {
      margin-left: auto;
    }

    /* The picked question's settings take the screen */
    .qe-pane {
      display: none;
      position: static;
      max-height: none;
    }

    .qe.is-editing .qe-list {
      display: none;
    }

    .qe.is-editing .qe-pane {
      display: block;
    }

    .qe-pane-back {
      display: inline;
    }

    .qe-pane-empty {
      display: none;
    }

    .qe-pair {
      grid-template-columns: minmax(0, 1fr);
    }

    .qe-versions li {
      grid-template-columns: minmax(0, 1fr) auto;
    }

    .qe-v-when,
    .qe-v-who {
      grid-row: 2;
    }

    .qe-v-who {
      text-align: right;
    }
  }

  /* Footer */
  .site-foot {
    background: var(--color-dark);
    color: var(--color-on-dark-subtle);
    font-size: var(--text-sm);
    padding: var(--space-14) 0 var(--space-7);
  }

  .site-foot .cols {
    /* Link columns take their content's width and share the leftover space evenly, so the gaps between them match */
    --cols-template: minmax(0, var(--measure-xs)) auto auto auto;
    justify-content: space-between;
    padding-bottom: var(--space-10);
    border-bottom: var(--border-hair) solid var(--color-line-on-dark);
  }

  .site-foot .brand {
    gap: var(--space-3-5);
    color: var(--color-white);
    margin-bottom: var(--space-3-5);
  }

  .site-foot .brand img {
    width: 72px;
    height: 72px;
  }

  .site-foot h2 {
    color: var(--color-white);
    font-size: var(--text-sm);
    font-weight: 700;
    margin-bottom: var(--space-2-5);
  }

  .site-foot li {
    margin-bottom: var(--space-1-5);
  }

  .site-foot a {
    text-decoration: none;
  }

  .site-foot a:hover {
    color: var(--color-white);
  }

  .site-foot .fine {
    padding-top: var(--space-5);
    font-size: var(--text-xs);
    color: var(--color-on-dark-faint);
  }
}

/* -------------------------------------------------------------- utilities */

@layer utilities {
  /* Photo grades */
  .bw {
    filter: grayscale(1) contrast(1.18) brightness(1.02);
  }

  /* Color photos: one gentle grade so phone shots from different days match */
  .col {
    filter: saturate(0.94) contrast(1.06);
  }

  /* Section heading size */
  .h2 {
    font-size: var(--text-section);
  }


  .text-5xl {
    font-size: var(--text-5xl);
  }

  .text-muted {
    color: var(--muted);
  }

  .measure-md {
    max-width: var(--measure-md);
  }

  /* Spacing between elements, from the spacing scale */
  .mt-4 {
    margin-top: var(--space-4);
  }


  .mt-6 {
    margin-top: var(--space-6);
  }

  .mt-7 {
    margin-top: var(--space-7);
  }

  .mt-8 {
    margin-top: var(--space-8);
  }

  .mt-10 {
    margin-top: var(--space-10);
  }

  .mb-4 {
    margin-bottom: var(--space-4);
  }


  .mb-7 {
    margin-bottom: var(--space-7);
  }

  .pt-12 {
    padding-top: var(--space-12);
  }

  .pb-16 {
    padding-bottom: var(--space-16);
  }
}
