/*
  Razvan Mocanu, personal site
  One stylesheet in cascade layers. No framework, no preprocessor, no build step.

  Design language
  - Tokens below are the only source of colour, type, space, radius and depth.
  - Five text sizes (xs, sm, base, lead, h3) and three display sizes (h2, h1, stat).
  - One card anatomy: head (title + quiet meta), hairline, body, optional foot.
  - One icon tile, one hairline, one gradient band. Colour marks meaning, never decoration.
  - Light and dark themes come from light-dark(); a data-theme attribute overrides the system.
*/

@layer reset, tokens, base, components, sections, motion, print;

/* ------------------------------------------------------------------ reset */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  [hidden] { display: none !important; } /* hidden means hidden, whatever display a component sets */
  body, h1, h2, h3, p, figure, blockquote, ol, ul, pre { margin: 0; }
  ol, ul { padding: 0; list-style: none; }
  svg { display: block; flex: none; }
  button { font: inherit; color: inherit; }
}

/* ----------------------------------------------------------------- tokens */
@layer tokens {
  :root {
    color-scheme: light dark;

    /* brand */
    --amber: #ffc35c;
    --orange: #ff7a3d;
    --pink: #ff4f81;
    --violet: #9b6bff;
    --accent-grad: linear-gradient(90deg, var(--orange), var(--pink));

    /* surfaces */
    --bg: light-dark(#f7f7f5, #171716);
    --surface: light-dark(#ffffff, #242422);
    --surface-hover: light-dark(#f1f0ec, #2b2b29);
    --line: light-dark(#e6e6e2, rgb(255 255 255 / 0.1));
    --line-soft: light-dark(#efeeea, rgb(255 255 255 / 0.065));
    --header-glass: light-dark(rgb(247 247 245 / 0.8), rgb(23 23 22 / 0.72));

    /* text (every pair measured at 4.5:1 or better on --bg and --surface) */
    --ink: light-dark(#22221f, #ecece9);
    --ink-2: light-dark(#4a4a45, #bcbcb6);
    --muted: light-dark(#65655f, #9b9b94);
    --accent-ink: light-dark(#c2410c, #ff9d6e);

    /* status */
    --ok: light-dark(#18a957, #3fcf8e);
    --ok-ink: light-dark(#0f7b3f, #5fe0a3);
    --wait: light-dark(#b07d00, #e3a92b);
    --pending: light-dark(#d4d4ce, rgb(255 255 255 / 0.2));

    /* hero band: bright by day, ember by night so light text still reads */
    --band-a: light-dark(#ffc35c, #93491a);
    --band-b: light-dark(#ff7a3d, #9a3a1e);
    --band-c: light-dark(#ff4f81, #8f2350);
    --band-d: light-dark(#9b6bff, #4d2f9e);
    --band-base: light-dark(#ff9a4d, #7a3518);

    /* type */
    --sans: "Geist", "Geist fallback", system-ui, sans-serif;
    --code-bg: light-dark(#22221f, #0d0d0c);
    --mono: "Geist Mono", "Geist Mono fallback", ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
    --fs-xs: 13px;
    --fs-sm: 15px;
    --fs-base: 16px;
    --fs-lead: clamp(17px, 0.3vw + 14px, 18px);
    --fs-h3: 18px;
    --fs-h2: clamp(28px, 1.8vw + 15px, 38px);
    --fs-h1: clamp(40px, 4.2vw + 10px, 64px);
    --fs-stat: clamp(32px, 1vw + 22px, 40px);
    --fs-finale: clamp(36px, 2.8vw + 16px, 56px);

    /* space, on a 4px grid */
    --s-1: 4px;
    --s-2: 8px;
    --s-3: 12px;
    --s-4: 16px;
    --s-5: 24px;
    --s-6: 32px;
    --s-7: 48px;
    --s-8: 64px;
    --section: clamp(80px, 7vw + 20px, 124px);

    /* shape and depth */
    --r-sm: 6px;
    --r: 8px;
    --r-lg: 10px;
    --ring: 0 0 0 1px light-dark(rgb(34 34 31 / 0.07), rgb(255 255 255 / 0.1));
    --shadow: var(--ring),
      0 1px 2px light-dark(rgb(34 34 31 / 0.04), rgb(0 0 0 / 0.3)),
      0 6px 12px -6px light-dark(rgb(34 34 31 / 0.06), rgb(0 0 0 / 0.3)),
      0 28px 48px -24px light-dark(rgb(34 34 31 / 0.2), rgb(0 0 0 / 0.55));
    --shadow-lift: 0 0 0 1px light-dark(rgb(34 34 31 / 0.09), rgb(255 255 255 / 0.12)),
      0 2px 4px light-dark(rgb(34 34 31 / 0.05), rgb(0 0 0 / 0.3)),
      0 10px 20px -8px light-dark(rgb(34 34 31 / 0.1), rgb(0 0 0 / 0.35)),
      0 36px 60px -28px light-dark(rgb(34 34 31 / 0.26), rgb(0 0 0 / 0.6));
    --shadow-sm: 0 0 0 1px light-dark(rgb(34 34 31 / 0.08), rgb(255 255 255 / 0.1)),
      0 1px 2px light-dark(rgb(34 34 31 / 0.06), rgb(0 0 0 / 0.3)),
      0 6px 12px -6px light-dark(rgb(34 34 31 / 0.14), rgb(0 0 0 / 0.4));

    /* layout and motion */
    --wrap: 1160px;
    --gutter: 32px;
    --head: 72px;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);

    @media (max-width: 640px) {
      --gutter: 20px;
      --head: 64px;
    }
  }

  :root[data-theme="light"] { color-scheme: light; }
  :root[data-theme="dark"] { color-scheme: dark; }

  /* Geist and Geist Mono, served from this site (SIL Open Font License, see /fonts) */
  @font-face {
    font-family: "Geist";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("/fonts/geist-latin-wght-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
  }
  @font-face {
    font-family: "Geist";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("/fonts/geist-latin-ext-wght-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
  }
  @font-face {
    font-family: "Geist Mono";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("/fonts/geist-mono-latin-wght-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
  }
  @font-face {
    font-family: "Geist Mono";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("/fonts/geist-mono-latin-ext-wght-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
  }

  /* Arial and Courier New sized to Geist's measured widths at each weight, so the swap moves nothing */
  @font-face {
    font-family: "Geist fallback";
    font-weight: 100 450;
    src: local("Arial");
    size-adjust: 101.8%;
    ascent-override: 98.7%;
    descent-override: 29.0%;
    line-gap-override: 0%;
  }
  @font-face {
    font-family: "Geist fallback";
    font-weight: 451 550;
    src: local("Arial");
    size-adjust: 104.1%;
    ascent-override: 96.5%;
    descent-override: 28.3%;
    line-gap-override: 0%;
  }
  @font-face {
    font-family: "Geist fallback";
    font-weight: 551 650;
    src: local("Arial Bold"), local("Arial-BoldMT");
    size-adjust: 99.2%;
    ascent-override: 101.3%;
    descent-override: 29.7%;
    line-gap-override: 0%;
  }
  @font-face {
    font-family: "Geist fallback";
    font-weight: 651 900;
    src: local("Arial Bold"), local("Arial-BoldMT");
    size-adjust: 101.3%;
    ascent-override: 99.2%;
    descent-override: 29.1%;
    line-gap-override: 0%;
  }
  @font-face {
    font-family: "Geist Mono fallback";
    font-weight: 100 900;
    src: local("Courier New"), local("CourierNewPSMT");
    size-adjust: 100.0%;
    ascent-override: 100.5%;
    descent-override: 29.5%;
    line-gap-override: 0%;
  }
}

/* ------------------------------------------------------------------- base */
@layer base {
  html {
    scroll-padding-top: calc(var(--head) + var(--s-4));
    -webkit-text-size-adjust: 100%;
  }

  body {
    background: var(--bg);
    color: var(--ink);
    font: var(--fs-base) / 1.6 var(--sans);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: clip;
  }

  h1, h2, h3 { text-wrap: balance; }
  p { text-wrap: pretty; }
  a { color: inherit; }
  b, strong { font-weight: 600; }

  :focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 3px;
    border-radius: var(--r-sm);
  }

  ::selection { background: color-mix(in oklch, var(--orange) 32%, transparent); }

  .wrap {
    max-inline-size: var(--wrap);
    margin-inline: auto;
    padding-inline: var(--gutter);
  }

  .skip-link {
    position: absolute;
    inset-inline-start: var(--s-3);
    top: -200px;
    z-index: 100;
    padding: var(--s-2) var(--s-3);
    border-radius: var(--r);
    background: var(--surface);
    box-shadow: var(--shadow);
    font-size: var(--fs-sm);
    font-weight: 600;

    &:focus { top: var(--s-3); }
  }

  .print-only { display: none; }
}

/* ------------------------------------------------------------- components */
@layer components {
  /* gradient band: the one expressive surface, reused by hero and contact */
  .band {
    position: absolute;
    inset-inline: 0;
    overflow: hidden;
    transform: skewY(-8deg);
    /* the content is centred, so pivot the slant with it: past 1280px wide the slope crosses the
       text where it does at 1280, instead of climbing into it as the screen widens */
    transform-origin: max(0px, 50% - 640px) 0;
    pointer-events: none;

    &::before {
      content: "";
      position: absolute;
      inset: -25%;
      background:
        radial-gradient(38% 55% at 14% 42%, var(--band-a) 0, transparent 70%),
        radial-gradient(42% 60% at 42% 28%, var(--band-b) 0, transparent 70%),
        radial-gradient(40% 55% at 70% 46%, var(--band-c) 0, transparent 70%),
        radial-gradient(34% 50% at 92% 22%, var(--band-d) 0, transparent 70%),
        var(--band-base);
    }
  }

  /* buttons */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-2);
    block-size: 46px;
    padding-inline: 20px;
    border: 0;
    border-radius: var(--r);
    background: light-dark(#22221f, #ecece9);
    color: light-dark(#ffffff, #171716);
    font-size: var(--fs-sm);
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.005em;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    box-shadow:
      inset 0 1px 0 rgb(255 255 255 / 0.14),
      0 1px 2px rgb(34 34 31 / 0.24),
      0 4px 10px -4px rgb(34 34 31 / 0.3);
    transition: background-color 0.15s, translate 0.15s var(--ease);

    &:hover { background: light-dark(#3a3a36, #ffffff); }
    &:active { translate: 0 1px; }
  }

  .btn-ghost {
    background: light-dark(rgb(255 255 255 / 0.42), rgb(255 255 255 / 0.07));
    color: var(--ink);
    box-shadow: inset 0 0 0 1px light-dark(rgb(34 34 31 / 0.16), rgb(255 255 255 / 0.22));
    backdrop-filter: blur(8px);

    &:hover { background: light-dark(rgb(255 255 255 / 0.72), rgb(255 255 255 / 0.14)); }
  }

  .btn-sm {
    block-size: 36px;
    padding-inline: 14px;
  }

  .text-btn {
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent-ink);
    font-size: var(--fs-xs);
    font-weight: 600;
    cursor: pointer;

    &:hover { text-decoration: underline; text-underline-offset: 3px; }
  }

  /* icon tile: pipeline steps, the award, carousel and header controls */
  .tile {
    display: grid;
    place-items: center;
    flex: none;
    inline-size: 40px;
    block-size: 40px;
    border: 0;
    border-radius: var(--r);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    color: var(--ink);

    & svg {
      inline-size: 20px;
      block-size: 20px;
      fill: none;
      stroke: currentColor;
      stroke-width: 1.7;
      stroke-linecap: round;
      stroke-linejoin: round;
    }
  }

  button.tile {
    cursor: pointer;
    transition: background-color 0.15s, translate 0.15s var(--ease), opacity 0.2s;

    &:hover { background: var(--surface-hover); }
    &:active { translate: 0 1px; }
    &:disabled { opacity: 0.4; cursor: default; translate: none; }
  }

  .tile-quiet {
    background: transparent;
    box-shadow: none;

    &:hover { background: color-mix(in oklch, var(--ink) 7%, transparent); }
  }

  /* card anatomy */
  .card {
    position: relative;
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
  }

  .card-head {
    display: flex;
    align-items: baseline;
    gap: var(--s-3);
    padding-block-end: var(--s-4);
    border-block-end: 1px solid var(--line-soft);
  }

  .card-title {
    font-size: var(--fs-sm);
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.4;
  }

  .card-meta {
    margin-inline-start: auto;
    font-size: var(--fs-xs);
    color: var(--muted);
  }

  .card-head .text-btn { margin-inline-start: auto; }

  .card-foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--s-2) var(--s-4);
    margin-block-start: var(--s-5);
    padding-block-start: var(--s-4);
    border-block-start: 1px solid var(--line-soft);
    font-size: var(--fs-xs);
    color: var(--ink-2);

    & b { color: var(--ink); }
  }

  /* section heading block */
  .eyebrow {
    margin-block-end: var(--s-3);
    color: var(--accent-ink);
    font-size: var(--fs-sm);
    font-weight: 600;
    letter-spacing: -0.005em;
  }

  .section-title {
    margin-block-end: var(--s-4);
    font-size: var(--fs-h2);
    font-weight: 600;
    line-height: 1.12;
    letter-spacing: -0.03em;
  }

  .lede {
    max-inline-size: 35rem;
    color: var(--ink-2);
    font-size: var(--fs-lead);
    line-height: 1.6;
  }

  /* Lex: one card under Iris, what it is and where to see it */
  .lex {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--s-5);
    margin-block-start: var(--s-8);
    padding: var(--s-5) var(--s-6);

    & .lex-head {
      display: flex;
      align-items: baseline;
      gap: var(--s-3);
      margin-block-end: var(--s-1);

      & b { font-size: var(--fs-h3); font-weight: 600; letter-spacing: -0.01em; }
      & span { font-size: var(--fs-xs); color: var(--muted); }
    }

    & .lex-body > p:last-child {
      max-inline-size: 44rem;
      color: var(--ink-2);
      font-size: var(--fs-sm);
      line-height: 1.6;
    }

    & .lex-link {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      color: var(--ink);
      font-size: var(--fs-sm);
      font-weight: 600;
      text-decoration: none;
      text-underline-offset: 3px;
      white-space: nowrap;

      &:hover { text-decoration: underline; }
    }

    & svg {
      inline-size: 12px;
      block-size: 12px;
      fill: none;
      stroke: var(--muted);
      stroke-width: 2.2;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    @media (max-width: 640px) {
      grid-template-columns: minmax(0, 1fr);
      align-items: start;
      gap: var(--s-4);
      margin-block-start: var(--s-7);
      padding: var(--s-5);
    }
  }

  /* items: impact figures, principles and skills share one anatomy */
  .items {
    display: grid;
    grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
    gap: var(--s-7) var(--s-6);

    @media (max-width: 1060px) { --cols: 2 !important; }
    @media (max-width: 640px) { --cols: 1 !important; }
  }

  .item {
    position: relative;
    padding-block-start: var(--s-5);
    border-block-start: 1px solid var(--line);

    & p { color: var(--ink-2); }
    & .stat { color: var(--ink); }
  }

  .item-title {
    margin-block-end: var(--s-2);
    font-size: var(--fs-h3);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.02em;
  }

  .items-quiet .item-title {
    font-size: var(--fs-sm);
    letter-spacing: -0.005em;
  }

  .items-quiet p { font-size: var(--fs-sm); line-height: 1.65; }

  .item-meta {
    margin-block-start: var(--s-3);
    color: var(--ink-2);
    font-size: var(--fs-xs);
  }

  .stat {
    margin-block-end: var(--s-4);
    color: var(--ink);
    font-size: var(--fs-stat);
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
  }

  /* point list beside an illustration */
  /* each point opens with its own bold lead-in, so it needs no bullet */
  .points {
    display: grid;
    gap: var(--s-4);
    margin-block-start: var(--s-6);

    & li { color: var(--ink-2); }
    & b { color: var(--ink); }
  }
}

/* --------------------------------------------------------------- sections */
@layer sections {
  /* header */
  .site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    block-size: var(--head);
    transition: background-color 0.3s, box-shadow 0.3s, backdrop-filter 0.3s;

    &[data-stuck] {
      background: var(--header-glass);
      backdrop-filter: saturate(180%) blur(14px);
      box-shadow: 0 1px 0 var(--line);
    }

    & .wrap {
      display: flex;
      align-items: center;
      gap: var(--s-2);
      block-size: 100%;
    }
  }

  /* wordmark: "raz." that opens into the full name on hover, focus and first load */
  .brand {
    display: inline-flex;
    align-items: center;
    margin-inline-end: var(--s-4);
    color: var(--ink);
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.055em;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
  }

  /* the front sweep, in the ink: the brand dot keeps the only colour */
  .brand-mark {
    flex: none;
    inline-size: auto;
    block-size: 1.7em;
    margin-inline-end: 0.3em;
  }

  .brand-rest {
    display: inline-grid;
    grid-template-columns: 0fr;

    & > span {
      overflow: hidden;
      white-space: pre;
      opacity: 0;
    }
  }

  /* phones have no room beside the header buttons, so the mark stays "raz." there */
  @media (min-width: 641px) {
    .brand:is(:hover, :focus-visible, .is-open) .brand-rest,
    :root:has(.nickname:hover) .brand-rest {
      grid-template-columns: 1fr;
      & > span { opacity: 1; }
    }
  }

  .brand-dot {
    display: inline-block;
    inline-size: 0.27em;
    block-size: 0.27em;
    margin-inline-start: 0.07em;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--amber), var(--orange) 45%, var(--pink));
  }

  /* over the gradient band the dot would vanish into it, so it takes the ink until the header turns solid */
  .site-header .brand-dot {
    position: relative;
    background: currentColor;

    &::after {
      content: "";
      position: absolute;
      inset: 0;
      border-radius: inherit;
      background: linear-gradient(135deg, var(--amber), var(--orange) 45%, var(--pink));
      opacity: 0;
      transition: opacity 0.3s;
    }
  }

  .site-header[data-stuck] .brand-dot::after { opacity: 1; }

  /* with the menu open, the header's dot takes the menu's ember too, so the two logos match */
  html:has(.drawer:popover-open) .site-header .brand-dot::after { opacity: 1; }

  .site-nav {
    position: relative;
    display: flex;
    gap: var(--s-1);

    & a {
      padding: var(--s-2) 10px;
      border-radius: var(--r-sm);
      color: var(--ink);
      font-size: var(--fs-sm);
      font-weight: 500;
      text-decoration: none;
      transition: background-color 0.15s;

      &:hover { background: color-mix(in oklch, var(--ink) 6%, transparent); }
    }
  }

  .nav-indicator {
    position: absolute;
    inset-inline-start: 0;
    bottom: -2px;
    inline-size: 0;
    block-size: 2px;
    border-radius: 1px;
    background: var(--ink);
    opacity: 0;
    pointer-events: none;
  }

  /* the nav sits right, beside the call to action, so the wordmark has room to open */
  .site-nav { margin-inline-start: auto; }

  .header-actions {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    margin-inline-start: var(--s-5);
  }

  .menu-toggle { display: none; }

  @media (max-width: 860px) {
    .menu-toggle { display: grid; }
    .header-actions { margin-inline-start: auto; }
    .site-nav { display: none; }
  }

  @media (max-width: 640px) {
    .brand { margin-inline-end: 0; }
    .header-actions .btn-sm { padding-inline: var(--s-3); }
  }

  /* the drawer: a popover, so the browser handles light dismiss, Escape and the top layer */
  /* the menu takes the whole screen, so its mark stands in for the header's rather than beside it */
  .drawer {
    inset: 0;
    inline-size: 100%;
    max-inline-size: none;
    block-size: 100dvh;
    max-block-size: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: var(--bg);
    color: var(--ink);
    overflow: auto;
    overscroll-behavior: contain;

    &::backdrop { background: light-dark(rgb(23 23 22 / 0.42), rgb(0 0 0 / 0.5)); }
  }

  .drawer-inner {
    display: flex;
    flex-direction: column;
    min-block-size: 100%;
    padding: 0 var(--gutter) max(var(--s-6), env(safe-area-inset-bottom));
  }

  .drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    block-size: var(--head);
  }

  .drawer-mark {
    display: inline-flex;
    align-items: center;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.055em;
    line-height: 1;
  }

  .drawer-nav {
    display: grid;
    margin-block-start: var(--s-4);
    border-block-start: 1px solid var(--line-soft);

    & a {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding-block: var(--s-4);
      border-block-end: 1px solid var(--line-soft);
      color: var(--ink);
      font-size: 22px;
      font-weight: 600;
      letter-spacing: -0.02em;
      text-decoration: none;

      & span { display: inline-flex; align-items: center; gap: var(--s-3); }

      & svg {
        inline-size: 22px;
        block-size: 22px;
        fill: none;
        stroke: var(--accent-ink);
        stroke-width: 1.7;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      /* the section you're reading carries the brand dot */
      &[aria-current]::after {
        content: "";
        inline-size: 8px;
        block-size: 8px;
        border-radius: 50%;
        background: linear-gradient(135deg, var(--amber), var(--orange) 45%, var(--pink));
      }
    }
  }

  .drawer-foot {
    display: grid;
    gap: var(--s-5);
    margin-block-start: auto;
    padding-block-start: var(--s-7);

    & .btn { justify-content: center; }
  }

  html:has(.drawer:popover-open) { overflow: hidden; }

  /* browsers without popovers: the same drawer, opened by a class */
  @supports not selector(:popover-open) {
    .drawer { position: fixed; z-index: 100; display: none; }
    .drawer.is-open { display: block; }
  }

  /* hero */
  /* the band sits inside its hero, behind the text; it starts above the header either way */
  .band-hero { top: calc(-170px - var(--head)); z-index: -1; block-size: 800px; }

  /* a plain page, such as /uses: the band runs from under the header to just past the hero,
     so it ends below the title at every width instead of at a fixed height */
  .page-hero > .band-page {
    top: calc(-170px - var(--head));
    bottom: -16px;
    z-index: -1;
    block-size: auto;
  }

  .page-hero {
    position: relative;
    z-index: 1;

    & .wrap { padding-block: clamp(40px, 4vw + 12px, 72px) var(--s-7); }

    /* the band sits behind the label, so it takes the ink colour to stay readable */
    & .eyebrow { color: var(--ink); }

    & h1 {
      margin-block-end: var(--s-5);
      font-size: var(--fs-h1);
      font-weight: 600;
      line-height: 1.02;
      letter-spacing: -0.045em;
    }
  }

  .page-hero .updated {
    margin-block-start: var(--s-3);
    color: var(--ink-2);
    font-size: var(--fs-xs);
  }

  /* /uses: written as a few short paragraphs, the tools marked as if with a highlighter */
  .uses {
    padding-block: var(--s-7) var(--section);

    & p {
      max-inline-size: 34em;
      color: var(--ink-2);
      font-size: clamp(18px, 0.5vw + 14px, 21px);
      line-height: 1.7;
      text-wrap: pretty;

      & + p { margin-block-start: var(--s-6); }
    }

    & .run-in { color: var(--ink); font-weight: 600; }

    & b {
      padding-inline: 0.12em;
      margin-inline: -0.12em;
      color: var(--ink);
      font-weight: 500;
      background: linear-gradient(
        transparent 50%,
        light-dark(color-mix(in oklch, var(--orange) 45%, transparent), color-mix(in oklch, var(--orange) 40%, transparent)) 50% 94%,
        transparent 94%
      );
      white-space: nowrap;
      box-decoration-break: clone;
      -webkit-box-decoration-break: clone;
    }

    & code { color: var(--ink); font-family: var(--mono); font-size: 0.86em; }
  }
  .lede a { color: var(--ink); text-underline-offset: 3px; }

  .hero {
    position: relative;
    z-index: 1;

    & .wrap {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 470px;
      gap: var(--s-7);
      min-block-size: 580px;
      padding-block-start: clamp(40px, 4vw + 12px, 72px);
    }

    /* the text column: the headline sizes itself from its width */
    & .wrap > div:first-child { container-type: inline-size; }

    & h1 {
      margin-block-end: var(--s-5);
      /* each line is set by hand, so cap the size where the longest, 9.2em wide, still fits */
      font-size: min(64px, 100cqi / 9.2); /* the largest size, or the column's width */
      font-weight: 600;
      line-height: 1.02;
      letter-spacing: -0.045em;
    }

    /* the headline's lines are set by hand to within 1.5% of each other, and justified to the
       longest, so the headline is a block with straight edges */
    & .line { display: block; text-align: justify; text-align-last: justify; }
  }

  /* the headline and the intro as one block, as wide as the headline: the intro takes no width
     of its own and fills what the headline sets */
  .hero-copy { inline-size: fit-content; }

  .hero-sub {
    contain: inline-size;
    margin-block-end: var(--s-6);
    font-size: var(--fs-lead);
    line-height: 1.55;

    /* a block with both edges straight, the headline's width. Phones keep a ragged right, since
       four or five words a line would leave holes */
    @media (min-width: 641px) { text-align: justify; }
  }

  /* phones: the headline and intro scale with the screen, keeping their size on a 390px phone
     (38px and 17px in a 350px column), so they break into the same lines on every phone: the
     headline's three, and the intro's eight */
  @media (max-width: 480px) {
    .hero h1 { font-size: calc(100cqi / 9.2); }
    .hero-sub { font-size: max(14px, calc((100vw - 2 * var(--gutter)) * 17 / 350)); }
  }

  .nickname { font-weight: 700; }

  .actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s-3);
  }

  /* beside the headline: the policy file, the number nobody else can claim, and the award
     pressed on like a stamp */
  .stack {
    position: relative;
    block-size: 470px;
    margin-block-start: var(--s-1);
  }

  .code {
    position: absolute;
    inset-inline-start: 30px;
    top: 0;
    z-index: 1;
    inline-size: 420px;
    overflow: hidden;
    border-radius: var(--r-lg);
    background: var(--code-bg);
    color: #ecece9;
    box-shadow:
      0 0 0 1px light-dark(rgb(34 34 31 / 0.5), rgb(255 255 255 / 0.1)),
      0 28px 48px -18px light-dark(rgb(34 34 31 / 0.45), rgb(0 0 0 / 0.6));

    & .card-head { padding: var(--s-3) 18px; border-color: rgb(255 255 255 / 0.08); }
    & .card-title { font-size: var(--fs-xs); font-weight: 500; color: #d4d4ce; }

    & pre {
      padding: var(--s-4) 20px 20px;
      font: 13px / 1.85 var(--mono);
      white-space: pre;
    }

    & .k { color: #ffb38a; }
    & .v { color: #ffd98a; }
    & .c { color: #9b9b94; }
    & .code-line { display: block; min-block-size: 1.85em; }
  }

  .stat-card {
    position: absolute;
    inset-inline-end: 0;
    top: 262px;
    z-index: 2;
    inline-size: 260px;
    padding: 20px 22px;

    & .stat { margin-block-end: var(--s-2); }
    & p:not(.stat) { color: var(--ink-2); font-size: var(--fs-sm); line-height: 1.5; }
  }

  /* a rubber stamp, not a card: ink outline, a ruled inner border, no shadow, set at an angle */
  .stamp {
    position: absolute;
    inset-inline-start: 4px;
    top: 338px;
    z-index: 3;
    display: grid;
    justify-items: center;
    padding: 10px 16px 9px;
    border: 2px solid currentColor;
    border-radius: 6px;
    outline: 1px solid currentColor;
    outline-offset: -6px;
    background: var(--bg);
    color: var(--accent-ink);
    line-height: 1.1;
    text-align: center;
    text-transform: uppercase;
    rotate: -7deg;

    & b { font-size: 15px; font-weight: 700; letter-spacing: 0.08em; }
    & span { font: 600 22px / 1.1 var(--mono); letter-spacing: 0.12em; }
    & small { font-size: 10px; font-weight: 600; letter-spacing: 0.14em; }
  }

  @media (max-width: 1060px) {
    .hero .wrap { grid-template-columns: 1fr; min-block-size: 0; }
    /* one column: the cards follow the link, and the band ends with the hero, with room for its
       slant to clear them before the next section. Phones drop the cards */
    .hero { padding-block-end: var(--s-8); }
    .hero > .band-hero { bottom: 0; block-size: auto; }
    .stack { inline-size: min(100%, 470px); margin-block-start: var(--s-6); }
  }

  @media (max-width: 640px) {
    .actions .btn { flex: 1 1 auto; }
    .stack { display: none; }
  }

  /* clients */
  /* where I've led: a ledger of engagements, coloured by when they happened */
  .clients {
    position: relative;
    z-index: 1;
    padding-block-start: var(--s-7);
  }

  .ledger-label {
    margin-block-end: var(--s-4);
    color: var(--accent-ink);
    font-size: var(--fs-sm);
    font-weight: 600;
    letter-spacing: -0.005em;
  }

  .ledger {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    border-block-end: 1px solid var(--line);

    @media (max-width: 1060px) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    @media (max-width: 640px) { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    & li {
      position: relative;
      display: grid;
      align-content: start;
      gap: var(--s-1);
      padding: var(--s-4) var(--s-4) var(--s-5);
      border-block-start: 1px solid var(--line);
      border-inline-start: 1px solid var(--line);

      /* on hover the cell's top edge takes its colour */
      &::before {
        content: "";
        position: absolute;
        inset-inline: -1px 0;
        top: -1px;
        block-size: 2px;
        background: var(--c, var(--orange));
        scale: 0 1;
        transform-origin: left;
      }

      &:hover::before { scale: 1 1; }
    }
  }

  .ledger-name {
    color: var(--ink);
    font-size: var(--fs-base);
    font-weight: 600;
    letter-spacing: -0.015em;
  }

  .ledger-years {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 12px;

    &::before {
      content: "";
      inline-size: 6px;
      block-size: 6px;
      border-radius: 50%;
      background: var(--c, var(--orange));
    }
  }

  .ledger-role {
    margin-block-start: var(--s-2);
    color: var(--ink-2);
    font-size: var(--fs-xs);
    line-height: 1.45;
  }

  /* sections */
  .section { padding-block-start: var(--section); }
  .section > .wrap > .section-head + * { margin-block-start: var(--s-7); }

  .split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: var(--s-8);

    &.reverse > :first-child { order: 2; }

    /* the illustration stays in view while the points are read */
    & > figure {
      position: sticky;
      top: calc(var(--head) + var(--s-6));
      margin-block-start: var(--s-1);
    }

    @media (max-width: 1060px) {
      grid-template-columns: 1fr;
      gap: var(--s-7);
      &.reverse > :first-child { order: 0; }
      & > figure { position: static; }
    }
  }

  /* agent run */
  .run { padding: var(--s-5) var(--s-5) var(--s-2); }

  .step {
    display: grid;
    grid-template-columns: 20px 1fr auto;
    align-items: center;
    gap: var(--s-3);
    min-block-size: 50px;
    padding-block: var(--s-2);
    font-size: var(--fs-sm);

    & + .step { border-block-start: 1px solid var(--line-soft); }
  }

  .step-icon {
    display: grid;
    place-items: center;
    inline-size: 18px;
    block-size: 18px;
    border: 2px solid var(--ok);
    border-radius: 50%;
    color: var(--ok);

    & svg { inline-size: 10px; block-size: 10px; fill: none; stroke: currentColor; stroke-width: 2; }
  }

  .step-meta {
    color: var(--muted);
    font-size: var(--fs-xs);
    text-align: end;
  }

  .step.is-waiting .step-icon {
    border-color: var(--wait);

    &::after {
      content: "";
      inline-size: 6px;
      block-size: 6px;
      border-radius: 50%;
      background: var(--wait);
    }
  }

  .approve {
    padding: 6px 10px;
    border: 0;
    border-radius: var(--r-sm);
    background: light-dark(#fff6dc, rgb(227 169 43 / 0.12));
    box-shadow: inset 0 0 0 1px light-dark(#e9c46a, rgb(227 169 43 / 0.5));
    color: light-dark(#5a3d00, #ffd58a);
    font-size: var(--fs-xs);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, translate 0.15s var(--ease);

    &:hover { background: light-dark(#ffedb8, rgb(227 169 43 / 0.2)); }
    &:active { translate: 0 1px; }
  }

  .approved { color: var(--ok-ink); font-weight: 600; }

  /* release pipeline */
  .pipe {
    padding: var(--s-5);
    container-type: inline-size;
  }

  .lane-wrap { position: relative; margin-block-start: var(--s-5); }

  .lane {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;

    &::before {
      content: "";
      position: absolute;
      inset-inline: 12.5%;
      top: 19px;
      block-size: 2px;
      border-radius: 1px;
      background: linear-gradient(90deg, var(--amber), var(--orange), var(--pink), var(--violet));
    }
  }

  .node {
    color: var(--ink-2);
    font-size: var(--fs-xs);
    line-height: 1.45;
    text-align: center;

    & .tile { position: relative; z-index: 2; margin: 0 auto var(--s-3); }
    & b { display: block; margin-block-end: 2px; color: var(--ink); font-size: var(--fs-sm); }
  }

  .token {
    position: absolute;
    top: 14px;
    inset-inline-start: 12.5%;
    z-index: 1;
    inline-size: 12px;
    block-size: 12px;
    margin-inline-start: -6px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 0 3px var(--orange), 0 0 18px 4px rgb(255 122 61 / 0.55);
    opacity: 0;
    pointer-events: none;
  }

  /* narrow cards: the same track, run vertically */
  @container (max-width: 420px) {
    .lane {
      grid-template-columns: 1fr;
      row-gap: var(--s-4);

      &::before {
        inset-inline: 19px auto;
        top: 20px;
        bottom: 20px;
        inline-size: 2px;
        block-size: auto;
        background: linear-gradient(180deg, var(--amber), var(--orange), var(--pink), var(--violet));
      }
    }

    .node {
      display: grid;
      grid-template-columns: 40px 1fr;
      column-gap: var(--s-4);
      align-items: center;
      text-align: start;

      & .tile { grid-row: 1 / span 2; margin: 0; }
      & b { align-self: end; margin: 0; }
    }

    .token { inset-inline-start: 20px; }
  }

  /* impact */
  .impact { --cols: 4; }
  .impact .item > p:not(.stat, .stat-label, .item-meta) { font-size: var(--fs-sm); line-height: 1.55; }

  /* the label says what the big number measures, so it sits tight under it */
  .impact .stat { margin-block-end: var(--s-2); }
  .impact .stat-label {
    margin-block-end: var(--s-3);
    color: var(--ink);
    font-size: var(--fs-sm);
    font-weight: 600;
    line-height: 1.35;
  }

  /* career */
  .career { padding: var(--s-5) var(--s-6) var(--s-5); }

  .chart {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    block-size: 180px;
    margin-block-start: var(--s-6);
    touch-action: pan-y;
    cursor: crosshair;

    & i {
      flex: 1;
      min-inline-size: 0;
      min-block-size: 3px;
      border-radius: 2px 2px 0 0;
      transition: opacity 0.15s;
    }

    & i.is-gap { background: var(--line); }
    &.is-scrubbing i { opacity: 0.32; }
    &.is-scrubbing i.is-on { opacity: 1; }

    &:focus-visible { outline-offset: 8px; border-radius: var(--r); }
  }

  .axis {
    position: relative;
    block-size: 20px;
    margin-block-start: var(--s-3);
    color: var(--ink-2);
    font-size: var(--fs-xs);
    font-variant-numeric: tabular-nums;

    & span { position: absolute; top: 0; translate: -50% 0; white-space: nowrap; }
    & span:first-child { translate: 0; }
    & span:last-child { translate: -100% 0; }
  }

  .readout {
    min-block-size: 26px;
    margin-block-start: var(--s-4);
    color: var(--ink-2);
    font-size: var(--fs-sm);

    & b { color: var(--ink); }
  }

  .roles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--s-7);
    margin-block-start: var(--s-5);
    border-block-start: 1px solid var(--line);

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

  .role {
    display: grid;
    grid-template-columns: 112px 1fr;
    gap: var(--s-3);
    padding-block: 14px;
    border-block-end: 1px solid var(--line-soft);
    font-size: var(--fs-sm);
    line-height: 1.45;

    @media (max-width: 640px) { grid-template-columns: 96px 1fr; }
  }

  .role-years {
    padding-block-start: 2px;
    color: var(--muted);
    font-size: var(--fs-xs);
    font-variant-numeric: tabular-nums;
  }

  .role-company { color: var(--ink-2); }

  @media (max-width: 640px) {
    .career { padding: var(--s-5) var(--s-4) var(--s-4); }
  }

  /* recommendations */
  .carousel-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--s-5);

    @media (max-width: 640px) { flex-direction: column; align-items: stretch; gap: var(--s-5); }
  }

  .carousel-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--s-2);
    flex: none;
  }

  .carousel-position {
    min-inline-size: 4.6em;
    margin-inline-end: var(--s-2);
    color: var(--muted);
    font-size: var(--fs-sm);
    font-variant-numeric: tabular-nums;
    text-align: end;
  }

  .track {
    --edge: max(var(--gutter), calc((100% - var(--wrap)) / 2 + var(--gutter)));
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: min(560px, calc(100% - 2 * var(--gutter)));
    gap: var(--s-5);
    margin-block-start: var(--s-6);
    padding: var(--s-2) var(--edge) var(--s-7);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--edge);
    scrollbar-width: none;

    &::-webkit-scrollbar { display: none; }
    &:focus-visible { outline-offset: -2px; border-radius: 0; }
    &.is-dragging { scroll-snap-type: none; cursor: grabbing; user-select: none; }

    @media (pointer: fine) { cursor: grab; }
    @media (max-width: 640px) { gap: var(--s-3); margin-block-start: var(--s-4); }
  }

  .quote {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: var(--s-6) var(--s-6) var(--s-5);
    scroll-snap-align: start;
    container-type: inline-size;

    & blockquote { flex: 1; }

    & figcaption {
      display: flex;
      align-items: center;
      gap: var(--s-3);
      margin-block-start: var(--s-6);
      padding-block-start: var(--s-5);
      border-block-start: 1px solid var(--line-soft);
    }

    @media (max-width: 640px) {
      padding: var(--s-5) var(--s-5) var(--s-4);
    }
  }

  .quote-pull {
    font-size: var(--fs-h3);
    font-weight: 600;
    line-height: 1.42;
    letter-spacing: -0.018em;
    text-indent: -0.42em;

    @supports (hanging-punctuation: first) { text-indent: 0; hanging-punctuation: first; }
  }

  .quote-more {
    margin-block-start: var(--s-4);
    color: var(--ink-2);
    font-size: var(--fs-sm);
    line-height: 1.65;
  }

  /* a bar in the career colour of when they wrote it, as on the career chart */
  .quote-who {
    min-inline-size: 0;
    padding-inline-start: var(--s-3);
    border-inline-start: 3px solid var(--c, var(--orange));
    line-height: 1.4;

    & a {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      color: var(--ink);
      font-size: var(--fs-sm);
      font-weight: 600;
      text-decoration: none;
      text-underline-offset: 3px;

      &:hover { text-decoration: underline; }
    }

    & svg {
      inline-size: 12px;
      block-size: 12px;
      fill: none;
      stroke: var(--muted);
      stroke-width: 2.2;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    & span { display: block; color: var(--muted); font-size: var(--fs-xs); }
    & .quote-relation { color: var(--ink-2); }
  }

  .carousel-progress {
    block-size: 2px;
    overflow: hidden;
    border-radius: 1px;
    background: var(--line);

    & i {
      display: block;
      block-size: 100%;
      background: linear-gradient(90deg, var(--violet), var(--pink), var(--orange), var(--amber));
      transform-origin: left;
      scale: 0.08 1;
    }
  }

  /* approach */
  .principles { --cols: 3; }
  /* the skills read as a CV list, so they only print; on screen the three ideas stand alone */
  .skills { --cols: 4; margin-block-start: var(--s-8); @media screen { display: none; } }

  /* contact */
  .contact {
    position: relative;
    margin-block-start: var(--section);
    padding-block: clamp(120px, 10vw + 40px, 170px) clamp(130px, 10vw + 50px, 180px);

    & .band { top: 80px; block-size: 540px; }
    /* the heading sizes itself from this column, so its hand-set lines never wrap */
    & .wrap { position: relative; z-index: 1; container-type: inline-size; }

    /* wider screens: the footer tucks up under the band's low left corner. The band slopes up to
       the right, where the footer's icons sit, and the tagline and copyright clear it */
    @media (min-width: 641px) {
      min-block-size: 570px;
      padding-block-end: var(--s-7);
    }

    /* phones: the band grows to give the particle word its own room above the heading. A
       "Get in touch" link lands with "hello" just under the header, which keeps both buttons,
       CV included, on screen with the browser's bars showing */
    @media (max-width: 640px) {
      padding-block-start: 250px;
      scroll-margin-top: -50px;
      /* the band ends just above the footer's icons however long the copy runs */
      & .band { bottom: 24px; block-size: auto; }
    }

    /* each line is set by hand to within 1% of the others, and justified to the longest, so the
       heading is a block with straight edges. It sizes itself from the column, the longest line
       being under 9.1em, so the lines never wrap */
    & .section-title {
      display: grid;
      inline-size: fit-content;
      font-size: min(var(--fs-finale), 100cqi / 9.1);
      line-height: 1.04;
      letter-spacing: -0.045em;

      /* on phones it fills the column, as the hero's headline does, so the heading and the
         buttons under it meet both edges. The longest line is 8.78em */
      @media (max-width: 480px) { font-size: calc(100cqi / 8.8); }

      & span { text-align: justify; text-align-last: justify; }
    }

    /* the heading and its buttons as one block as wide as the heading's longest line. The two
       buttons split that width evenly, and stack full width when they no longer fit side by side */
    & .contact-copy { inline-size: fit-content; }
    & .actions { margin-block-start: var(--s-6); contain: inline-size; } /* the heading alone sets the width */
    & .actions .btn { flex: 1 1 0; min-inline-size: max-content; }
  }

  /* footer: where else to find me, on the right under Contact, then under a rule the tagline
     and the copyright as one block. The header stays pinned, so its mark is already on screen */
  .site-footer {
    padding-block: 0 var(--s-7);
    color: var(--muted);
    font-size: var(--fs-xs);

    & .wrap { display: grid; gap: var(--s-5); }

    & .sign { display: grid; justify-self: end; margin-block-start: -20px; }

    /* the tagline over the copyright, both justified to the wider line's width so the pair
       reads as one block with shared edges */
    & .colophon {
      display: grid;
      gap: var(--s-1);
      inline-size: fit-content;

      /* at the tagline's size the copyright is within a few pixels of it, so the stretch hides */
      & p { font-size: var(--fs-sm); text-align: justify; text-align-last: justify; }
    }

    /* the one line of personality on the page, so it gets the ink and the accent */
    & .aside {
      color: var(--muted);
      font-size: var(--fs-sm);

      & b { color: var(--ink); font-weight: 600; }
      & i { color: var(--accent-ink); font-style: normal; font-weight: 500; }
    }
  }

  /* the icons sit on the block's edges rather than their hover tiles */
  .social {
    display: flex;
    justify-content: space-between;
    gap: var(--s-1);
    margin-inline: -10px;

    & .tile { color: var(--ink-2); transition: background-color 0.15s, color 0.15s; }
    & .tile:hover { color: var(--ink); }
    & .logo { inline-size: 18px; block-size: 18px; fill: currentColor; stroke: none; }
  }

  .footer-legal {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--s-2) var(--s-4);
    padding-block-start: var(--s-5);
    border-block-start: 1px solid var(--line);

    & .footer-link { margin-inline-start: auto; }
    & a { color: inherit; text-underline-offset: 3px; }
    & a:hover { color: var(--ink); }
  }

  .visually-hidden {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  /* theme: a pull cord hanging from the "Get in touch" button, like a light switch.
     main.js swings it with a small rope simulation; without motion it simply hangs straight */
  .hang {
    position: relative;
    display: inline-flex;
  }

  .cord {
    position: absolute;
    top: 100%;
    left: calc(100% - 16px); /* off-centre, towards the button's right end */
    z-index: 1;
    inline-size: 36px;
    block-size: 60px;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink);
    cursor: grab;
    touch-action: none;
    translate: -50% 0;
    /* only the rope and the bead catch the pointer, wherever they have swung to */
    pointer-events: none;

    &.is-dragging { cursor: grabbing; }

    & svg {
      display: block;
      inline-size: 100%;
      block-size: 100%;
      overflow: visible;
    }

    /* the tip says what a pull will do */
    &::after {
      content: attr(data-tip);
      position: absolute;
      top: calc(100% + 8px);
      left: 50%;
      padding: 4px 8px;
      border-radius: var(--r-sm);
      background: var(--ink);
      color: var(--bg);
      font-size: 12px;
      font-weight: 500;
      white-space: nowrap;
      opacity: 0;
      translate: -50% -3px;
      pointer-events: none;
    }

    /* hover only where there is a real pointer: on a phone a tap leaves :hover stuck on,
       so a touch shows the tip for a moment instead (main.js adds .show-tip) */
    &:is(:focus-visible, .show-tip):not(.is-dragging)::after { opacity: 1; translate: -50% 0; }
    @media (hover: hover) and (pointer: fine) {
      &:hover:not(.is-dragging)::after { opacity: 1; translate: -50% 0; }
    }
    &:focus-visible { outline: none; }
    &:focus-visible .bead-ring { opacity: 1; }
  }

  .cord-line {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.55;
  }

  /* the pull is the brand dot, stretched: ink over the band, the gradient once the header turns solid */
  .bead-ink { fill: currentColor; }
  .bead-glow { fill: url(#cord-glow); opacity: 0; transition: opacity 0.3s; }
  .site-header[data-stuck] .bead-glow { opacity: 1; }
  .bead-ring { fill: none; stroke: var(--accent-ink); stroke-width: 2; opacity: 0; }
  .cord-hit { fill: none; stroke: transparent; stroke-width: 24; stroke-linecap: butt; pointer-events: stroke; }
  .cord-bead { pointer-events: all; }
  /* a fingertip-sized catch (44px) around the bead, drawn as nothing */
  .bead-hit { fill: transparent; }

  /* windows high contrast: shadows vanish, so draw real edges */
  @media (forced-colors: active) {
    .card, .tile, .btn, .site-nav { border: 1px solid CanvasText; }
    .band { display: none; }
  }

  @media (prefers-contrast: more) {
    :root { --line: light-dark(#bcbcb5, rgb(255 255 255 / 0.3)); --line-soft: var(--line); }
  }
}

/* ----------------------------------------------------------------- motion */
@layer motion {
  @media (prefers-reduced-motion: no-preference) {
    .cord::after { transition: opacity 0.3s, translate 0.2s var(--ease); }

    html { scroll-behavior: smooth; }

    .band::before { animation: band-drift 22s ease-in-out infinite alternate; }

    /* particle field: drawn by main.js into each band, counter-skewed so its pixels sit square */
    .field {
      position: absolute;
      inset-inline: 0;
      inset-block-start: -15vw;
      inline-size: 100%;
      block-size: calc(100% + 15vw);
      transform: skewY(8deg);
      transform-origin: 0 0;
      color: light-dark(var(--ink), #fff6ec); /* read by the canvas: navy on the light band, warm white on the dark one */
      opacity: 0;
      transition: opacity 1.2s var(--ease);

      &.is-live { opacity: 1; }
    }

    /* behind the headline the current steps back so the words stay crisp */
    .band-hero .field {
      mask-image: linear-gradient(100deg, rgb(0 0 0 / 0.45) 0%, rgb(0 0 0 / 0.45) 38%, #000 62%);
    }

    /* cards catch a soft light where the pointer is */
    @media (hover: hover) and (pointer: fine) {
      .card {
        isolation: isolate;

        &::after {
          content: "";
          position: absolute;
          inset: 0;
          z-index: -1;
          border-radius: inherit;
          background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%),
            color-mix(in oklch, var(--orange) 9%, transparent), transparent 70%);
          opacity: 0;
          transition: opacity 0.4s;
          pointer-events: none;
        }

        &:hover::after { opacity: 1; }
      }
    }

    .nav-indicator {
      transition: translate 0.45s var(--ease), inline-size 0.45s var(--ease), opacity 0.2s;
    }

    .brand-rest { transition: grid-template-columns 0.6s var(--ease); }
    .ledger li::before { transition: scale 0.45s var(--ease); }


    /* the menu only fades: its logo and close button sit exactly over the header's, so they
       must not move. The links and the button below them slide in on their own. */
    .drawer {
      opacity: 0;
      transition: opacity 0.3s, overlay 0.4s allow-discrete, display 0.4s allow-discrete;

      &:popover-open {
        opacity: 1;
        @starting-style { opacity: 0; }
      }

      & :is(.drawer-nav, .drawer-foot) { transition: translate 0.4s var(--ease); }

      &:popover-open :is(.drawer-nav, .drawer-foot) {
        translate: 0;
        @starting-style { translate: 0 -12px; }
      }

      &::backdrop {
        opacity: 0;
        transition: opacity 0.35s, overlay 0.45s allow-discrete, display 0.45s allow-discrete;
      }

      &:popover-open::backdrop {
        opacity: 1;
        @starting-style { opacity: 0; }
      }
    }
    .brand-rest > span { transition: opacity 0.35s 0.05s; }

    /* hero entrance: .js is set in the head before first paint, .ready when it may play */
    .js {
      & .hero .line { overflow: hidden; padding-block-end: 0.06em; margin-block-end: -0.06em; }
      & .hero .line > span { display: block; translate: 0 108%; }
      & .hero-sub, & .hero .actions { opacity: 0; translate: 0 14px; }
      & .code { opacity: 0; translate: 48px 24px; rotate: 2.5deg; }
      & .code-line { opacity: 0; translate: -4px 0; }
      & .stat-card { opacity: 0; translate: 24px 36px; }
      & .stamp { opacity: 0; scale: 1.5; }
      /* the cards fade in turn without moving: sliding the cards dragged the scroll snap with
         them, and sliding the row pushed it past the screen edge, widening the page on phones */
      & .recommendations:not(.is-in) .quote { opacity: 0; }
      /* if main.js never runs, the cards still show */
      &:not(.enhanced) .recommendations .quote { animation: show-anyway 0s 3s forwards; }
    }

    .ready {
      & .hero .line > span { translate: 0; transition: translate 1s var(--ease); }
      & .hero .line:nth-child(2) > span { transition-delay: 0.08s; }
      & .hero .line:nth-child(3) > span { transition-delay: 0.16s; }
      & .hero-sub { opacity: 1; translate: 0; transition: opacity 0.8s 0.35s, translate 0.8s 0.35s var(--ease); }
      & .hero .actions { opacity: 1; translate: 0; transition: opacity 0.8s 0.45s, translate 0.8s 0.45s var(--ease); }
      & .code { opacity: 1; translate: 0; rotate: 0deg; transition: opacity 0.7s 0.3s, translate 1.1s 0.3s var(--ease), rotate 1.1s 0.3s var(--ease); }
      & .stat-card { opacity: 1; translate: 0; transition: opacity 0.7s 0.75s, translate 1s 0.75s var(--ease); }
      /* the stamp comes down last and fast, as if pressed on */
      & .stamp { opacity: 1; scale: 1; transition: opacity 0.15s 1.5s, scale 0.25s 1.5s cubic-bezier(0.5, 0, 0.75, 0); }

      /* the policy file types itself in, one line every 90ms */
      & .code-line { opacity: 1; translate: 0; transition: opacity 0.25s var(--line-delay), translate 0.25s var(--ease) var(--line-delay); }
      & .code-line:nth-child(1) { --line-delay: 0.65s; }
      & .code-line:nth-child(2) { --line-delay: 0.74s; }
      & .code-line:nth-child(3) { --line-delay: 0.83s; }
      & .code-line:nth-child(4) { --line-delay: 0.92s; }
      & .code-line:nth-child(5) { --line-delay: 1.01s; }
      & .code-line:nth-child(6) { --line-delay: 1.10s; }
      & .code-line:nth-child(7) { --line-delay: 1.19s; }
      & .code-line:nth-child(8) { --line-delay: 1.28s; }
      & .code-line:nth-child(9) { --line-delay: 1.37s; }

    }

    .stack {
      transform: perspective(1400px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
      transform-style: preserve-3d;
      transition: transform 0.6s var(--ease);
    }

    /* everything below waits for main.js, which adds .enhanced */
    .enhanced {
      & .step { color: var(--muted); transition: color 0.35s; }
      & .step .step-icon { border-color: var(--pending); transition: border-color 0.3s; }
      & .step.is-running, & .step.is-done, & .step.is-waiting { color: var(--ink); }
      & .step.is-running .step-icon { border-color: var(--orange); border-inline-end-color: transparent; animation: spin 0.7s linear infinite; }
      & .step.is-done .step-icon { border-color: var(--ok); }
      & .step.is-waiting .step-icon { border-color: var(--wait); }
      & .step .step-icon path { stroke-dasharray: 12; stroke-dashoffset: 12; transition: stroke-dashoffset 0.4s var(--ease); }
      & .step.is-done .step-icon path { stroke-dashoffset: 0; }
      & .step .step-meta { opacity: 0; translate: -6px 0; transition: opacity 0.3s, translate 0.4s var(--ease); }
      & .step.is-done .step-meta, & .step.is-waiting .step-meta { opacity: 1; translate: 0; }
      & .step.is-waiting .approve { animation: ask 2.2s ease-in-out infinite; }
      & .step.is-new { animation: row-in 0.5s var(--ease) both; }

      & .node .tile { transition: translate 0.35s var(--ease), box-shadow 0.35s, color 0.35s; }
      & .node.is-lit .tile { translate: 0 -4px; color: var(--accent-ink); box-shadow: 0 0 0 3px rgb(255 122 61 / 0.28), var(--shadow-sm); }

      & .chart:not(.is-grown) i { scale: 1 0; }
      & .chart i { transform-origin: bottom; }
      & .chart.is-grown i { transition: scale 0.7s var(--ease) var(--delay, 0ms), opacity 0.15s; }

      & .quote { transition: box-shadow 0.3s var(--ease), opacity 0.7s var(--ease); }
      & .recommendations.is-in .quote { transition-delay: var(--delay, 0ms); }

      & .carousel-progress i { transition: scale 0.25s var(--ease); }
    }

    @media (hover: hover) {
      /* the shadow deepens but the card stays put: lifting it moved its edge away from the
         pointer, so near the edge it flicked in and out of hover every frame */
      .quote:hover { box-shadow: var(--shadow-lift); }
    }

    /* theme switch: a circle grows from the toggle */
    ::view-transition-old(root),
    ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
    ::view-transition-new(root) { animation: theme-reveal 0.6s var(--ease); }
  }

  @keyframes band-drift { to { translate: -5% 3%; rotate: 5deg; scale: 1.05; } }
  @keyframes spin { to { rotate: 360deg; } }
  @keyframes row-in { from { opacity: 0; translate: 0 -6px; } }
  @keyframes ask {
    0%, 100% { box-shadow: inset 0 0 0 1px light-dark(#e9c46a, rgb(227 169 43 / 0.5)), 0 0 0 0 rgb(227 169 43 / 0.4); }
    60% { box-shadow: inset 0 0 0 1px light-dark(#e9c46a, rgb(227 169 43 / 0.5)), 0 0 0 6px rgb(227 169 43 / 0); }
  }
  @keyframes show-anyway { to { opacity: 1; translate: none; } }

  @keyframes theme-reveal {
    from { clip-path: circle(0 at var(--reveal-x, 50%) var(--reveal-y, 0)); }
    to { clip-path: circle(150vmax at var(--reveal-x, 50%) var(--reveal-y, 0)); }
  }
}

/* ------------------------------------------------------------------ print */
@layer print {
  @media print {
    @page { size: A4; margin: 14mm; }

    :root { color-scheme: light; }
    body { background: #ffffff; font-size: 10pt; line-height: 1.45; }

    .band, .stack, .site-nav, .header-actions, .actions, .clients, .run, .pipe,
    .chart, .axis, .readout, .carousel-controls, .carousel-progress, .site-footer, .no-print { display: none !important; }

    .site-header { position: static; block-size: auto; background: none !important; box-shadow: none !important; }
    .wrap { max-inline-size: none; padding: 0; }
    .brand { color: #000000; font-size: 20pt; }
    .brand-rest { grid-template-columns: 1fr; }
    .brand-rest > span { opacity: 1; }

    .hero .wrap { display: block; min-block-size: 0; padding-block-start: 4pt; }
    .hero h1 { margin-block: 4pt; font-size: 15pt; letter-spacing: -0.02em; }
    .hero .line { display: inline; }
    .hero-sub { max-inline-size: none; margin-block-end: 4pt; color: #222222; font-size: 10pt; }
    .print-only { display: block; }

    .section { padding-block-start: 12pt; }
    .section > .wrap > .section-head + * { margin-block-start: 4pt; }
    .split { display: block; }
    .eyebrow { margin-block-end: 2pt; color: #000000; font-size: 9pt; }
    .section-title { margin-block-end: 4pt; font-size: 13pt; letter-spacing: -0.01em; }
    .lede { max-inline-size: none; font-size: 10pt; }
    .points { gap: 3pt; margin-block-start: 4pt; }
    .points li, .item p, .role, .role * { font-size: 10pt; }

    .items { display: block; }
    .item { margin-block-end: 4pt; padding: 0; border: 0; }
    .item-title, .items-quiet .item-title { margin-block: 6pt 2pt; font-size: 10.5pt; }
    .stat { display: inline; margin-inline-end: 6pt; font-size: 11pt; }
    .impact .item > p { display: inline; }
    .impact .stat-label { font-weight: 600; &::after { content: ": "; } }
    .impact .item-meta { display: block; margin: 0; }

    .card { box-shadow: none; }
    .lex-link svg { display: none; }
    .lex { display: block; margin-block-start: 6pt; padding: 0; }
    .lex-head b { font-size: 10.5pt; }
    .lex-body > p:last-child, .lex-link { font-size: 10pt; }
    .career { padding: 0; }
    .career .card-head { display: none; }
    .roles { display: block; margin: 0; border: 0; }
    .role { padding-block: 3pt; break-inside: avoid; }

    .carousel-head { display: block; }
    .track { display: block; margin-block-start: 4pt; padding: 0; overflow: visible; }
    .quote { padding: 0 0 6pt; border-radius: 0; box-shadow: none; break-inside: avoid; opacity: 1 !important; translate: none !important; }
    .quote-more, .quote-who svg { display: none; }
    .quote-pull { font-size: 10pt; font-weight: 500; text-indent: 0; }
    .quote figcaption { display: block; margin: 0; padding: 0; border: 0; }
    .quote-who { padding: 0; border: 0; }
    .quote-who a, .quote-who span { display: inline; font-size: 9pt; }
    .quote-who span::before { content: ", "; }

    .contact { margin-block-start: 12pt; padding: 0; }
    .contact .section-title { max-inline-size: none; font-size: 13pt; }
  }
}
