/* Bussola: the stylesheet every page of bussola.company loads (the home page adds home.css).
   The site is drawn as a nautical chart: paper, ink, one old-style serif, and a neatline round every page.
   Layers, from weakest to strongest. Colours are tokens that follow the theme through light-dark(): the system's, or
   the one pinned with the header's switch (data-theme on <html>, set by theme.js and by the inline script in <head>).
   A browser without light-dark() gets the light theme in plain hex, and no switch.
   Everything newer than Baseline "widely available" is an enhancement: the page reads and works without it. */

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

/* EB Garamond (SIL Open Font License, assets/fonts/OFL-eb-garamond.txt), for every word of the site: the roman with
   its weight axis from 400 to 600, the italic as one static cut at 400. Both cut down to Latin-1 and the punctuation
   the site uses, without hinting (36 KB and 20 KB; README, "The hero"). Its figures are old-style: where numbers must
   line up or stand tall, ask for lining-nums. */
@font-face {
  font-family: "EB Garamond";
  src: url("/assets/fonts/eb-garamond-roman.fcaa816d7a.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("/assets/fonts/eb-garamond-italic.1b67f6a17f.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
/* Mea Culpa (SIL Open Font License, assets/fonts/OFL-mea-culpa.txt), a copperplate script with swash capitals, for
   the home page's title, its three verbs and the compass's ribbon: cut down to Latin-1, without hinting (25 KB),
   preloaded by the home page. */
@font-face {
  font-family: "Mea Culpa";
  src: url("/assets/fonts/mea-culpa.e6e3cef59f.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
/* Georgia, resized to EB Garamond's measurements, so the text doesn't jump when the font arrives. */
@font-face {
  font-family: "EB Garamond Fallback";
  src: local("Georgia");
  size-adjust: 84.84%;
  ascent-override: 118.70%;
  descent-override: 35.13%;
  line-gap-override: 0%;
}

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  * { margin: 0; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body { min-block-size: 100svh; line-height: 1.5; -webkit-font-smoothing: antialiased; }
  img, svg, video { display: block; max-inline-size: 100%; }
  input, button, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
  p, h1, h2, h3, li, dt, dd { overflow-wrap: break-word; }
  :where(ul, ol)[role="list"] { list-style: none; padding: 0; }
  fieldset { border: 0; padding: 0; min-inline-size: 0; }
  legend { padding: 0; }
  [hidden] { display: none !important; }
}

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

    /* The chart: its paper, the lighter paper of what lies on it, sepia ink. */
    --paper: light-dark(#f4ece3, oklch(0.195 0.012 55));
    --paper-hi: light-dark(#fbf6ef, oklch(0.255 0.016 55));
    --ink: light-dark(#332218, oklch(0.935 0.014 78));
    --ink-2: light-dark(#5f4a3d, oklch(0.8 0.022 70));
    --brand: light-dark(#704328, oklch(0.785 0.085 66));
    --brand-hover: light-dark(#5d341e, oklch(0.85 0.08 70));
    --on-brand: light-dark(#fdfaf4, oklch(0.2 0.015 55));
    /* The three colours a portolan chart is drawn in besides its ink: the red of the needle and the quarter-winds,
       the green of the half-winds and the sea, the gold of boxwood and brass. */
    --needle: light-dark(#c15735, oklch(0.7 0.13 40));
    --green: light-dark(#3f7a4f, oklch(0.76 0.09 150));
    --gold: light-dark(#b98545, oklch(0.86 0.075 78));
    /* The ribbon's folded tails, a step deeper than the ribbon (var(--brand)) in either theme. */
    --fold: light-dark(#5d341e, oklch(0.66 0.085 60));
    --error: light-dark(oklch(0.49 0.17 29), oklch(0.74 0.14 29));
    --ok: light-dark(oklch(0.47 0.1 150), oklch(0.78 0.12 150));

    --line: color-mix(in oklab, var(--ink) 18%, transparent);
    --line-strong: color-mix(in oklab, var(--ink) 35%, transparent);
    --frame: color-mix(in oklab, var(--ink) 60%, transparent);
    --field-border: color-mix(in oklab, var(--ink) 60%, var(--paper-hi));
    --field-bg: light-dark(#fffdf9, oklch(0.225 0.014 55));
    --focus: var(--needle);
    --shadow: 0 1px 2px oklch(0.3 0.04 50 / 0.08), 0 14px 30px -16px oklch(0.3 0.04 50 / 0.3);

    --font-serif: "EB Garamond", "EB Garamond Fallback", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
    --font-script: "Mea Culpa", "Snell Roundhand", "Apple Chancery", cursive;

    /* Garamond is small on its body (its x-height is 40 % of the size): the text starts at 19 px. */
    --step--1: 1.0625rem;
    --step-0: 1.1875rem;
    --step-1: 1.4rem;
    --step-2: clamp(1.6rem, 1.4rem + 1vw, 2rem);
    --step-3: clamp(2.4rem, 1.7rem + 2.6vw, 3.75rem);
    --step-4: clamp(2.75rem, 1.8rem + 4.4vw, 4.5rem);

    --wrap: 72.5rem; /* the column, its gutters included */
    --gutter: clamp(1.75rem, 5vw, 3.5rem);
    --radius-s: 0.375rem;
    --header-h: 4.5rem; /* the header's padding above and its 44 px row */

    /* A damped spring from 0 to 1 (overshoot 37 %), sampled for linear(): the needle finding north. */
    --spring: linear(0, 0.069 2.5%, 0.246 5%, 0.487 7.5%, 0.745 10%, 0.984 12.5%, 1.175 15%, 1.304 17.5%, 1.365 20%, 1.366 22.5%, 1.318 25%, 1.238 27.5%, 1.143 30%, 1.049 32.5%, 0.968 35%, 0.908 37.5%, 0.872 40%, 0.861 42.5%, 0.871 45%, 0.896 47.5%, 0.929 50%, 0.965 52.5%, 0.998 55%, 1.024 57.5%, 1.042 60%, 1.051 62.5%, 1.051 65%, 1.044 67.5%, 1.033 70%, 1.02 72.5%, 1.007 75%, 0.995 77.5%, 0.987 80%, 0.982 82.5%, 0.981 85%, 0.982 87.5%, 0.986 90%, 0.99 92.5%, 0.995 95%, 1 97.5%, 1);
    --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  @media (width >= 60rem) {
    :root { --step-0: 1.25rem; --header-h: 5rem; }
  }

  @media (prefers-contrast: more) {
    :root {
      --ink-2: var(--ink);
      --line: color-mix(in oklab, var(--ink) 45%, transparent);
      --line-strong: color-mix(in oklab, var(--ink) 70%, transparent);
      --frame: var(--ink);
      --field-border: var(--ink);
    }
  }

  /* A theme pinned with the switch: light-dark() follows color-scheme, so this is all it takes. */
  @supports (color: light-dark(#000, #fff)) {
    :root[data-theme="light"] { color-scheme: light; }
    :root[data-theme="dark"] { color-scheme: dark; }
  }

  @supports not (color: light-dark(#000, #fff)) {
    :root {
      color-scheme: light;
      --paper: #f4ece3; --paper-hi: #fbf6ef;
      --ink: #332218; --ink-2: #5f4a3d;
      --brand: #704328; --brand-hover: #5d341e; --on-brand: #fdfaf4;
      --needle: #c15735; --green: #3f7a4f; --gold: #b98545; --fold: #5d341e;
      --error: #ac281e; --ok: #296a3b;
      --line: rgb(51 34 24 / 0.18); --line-strong: rgb(51 34 24 / 0.35); --frame: rgb(51 34 24 / 0.6);
      --field-border: #836f63; --field-bg: #fffdf9;
    }
  }
}

@layer base {
  html {
    scroll-padding-block-start: 1rem;
    scrollbar-gutter: stable;
    hanging-punctuation: first last;
    background: var(--paper);
  }
  body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: var(--step-0);
    font-kerning: normal;
  }
  h1, h2, h3 {
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: -0.015em;
    text-wrap: balance;
  }
  p, li, dd { text-wrap: pretty; }
  /* Links are ink, told apart by their line: never by colour alone. */
  a {
    color: var(--ink);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.25em;
    &:hover { color: var(--brand); text-decoration-thickness: 2px; }
  }
  :focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
  ::selection { background: color-mix(in oklab, var(--gold) 40%, transparent); }
  strong { font-weight: 600; }
  /* Only what someone may want to copy can be selected: words, not drawings, buttons or the page's furniture. */
  svg, img, button, .button, .brand, .site-nav, .lang-menu, .chip, .skip-link, .site-footer__links {
    -webkit-user-select: none;
    user-select: none;
  }

  @media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
  }
}

@layer layout {
  .wrap { max-inline-size: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
  main:focus { outline: none; }

  /* The sheet of the chart: everything on a page but the skip link. It is what the neatline, the route and the ship
     are placed against, and it clips what runs off its edges (the rhumb lines go on for thousands of pixels). The
     footer stays at its foot on a short page. */
  .page {
    position: relative;
    display: flex;
    flex-direction: column;
    min-block-size: 100svh;
    overflow: hidden; /* for a browser without clip */
    overflow: clip;
    > main { flex: 1 0 auto; }
  }
  /* The neatline, as round a nautical chart: two fine rules and, between them, the scale's alternating bars. */
  .sheet {
    position: absolute;
    inset: 0.5rem;
    z-index: 3;
    border: 1px solid var(--frame);
    pointer-events: none;
    @media (width >= 60rem) { inset: 0.75rem; }
    &::before {
      content: "";
      position: absolute;
      inset: 0;
      background:
        repeating-linear-gradient(90deg, var(--frame) 0 2.5rem, transparent 2.5rem 5rem) top / 100% 5px no-repeat,
        repeating-linear-gradient(90deg, transparent 0 2.5rem, var(--frame) 2.5rem 5rem) bottom / 100% 5px no-repeat,
        repeating-linear-gradient(180deg, transparent 0 2.5rem, var(--frame) 2.5rem 5rem) left / 5px 100% no-repeat,
        repeating-linear-gradient(180deg, var(--frame) 0 2.5rem, transparent 2.5rem 5rem) right / 5px 100% no-repeat;
    }
    &::after {
      content: "";
      position: absolute;
      inset: 5px;
      border: 1px solid var(--frame);
    }
  }
}

@layer components {
  /* ── Skip link ─────────────────────────────────────────────── */
  .skip-link {
    position: absolute;
    inset-inline-start: 1.5rem;
    inset-block-start: 1.25rem;
    z-index: 100;
    padding: 0.6rem 1.1rem 0.7rem;
    border-radius: var(--radius-s);
    background: var(--ink);
    color: var(--paper);
    font-weight: 600;
    text-decoration: none;
    translate: 0 -300%;
    &:hover { color: var(--paper); }
    &:focus { translate: 0 0; }
  }

  /* ── Icons ─────────────────────────────────────────────────── */
  .icon {
    inline-size: 1.25rem;
    block-size: 1.25rem;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  /* A filled drawing (the translate mark on the language button): ink, no line. */
  .icon--filled { fill: currentColor; stroke: none; }

  /* ── The compass mark ──────────────────────────────────────── */
  .mark__disc, .mark__pivot { fill: var(--brand); }
  .mark__ticks { fill: none; stroke: var(--on-brand); stroke-opacity: 0.5; stroke-width: 3; stroke-linecap: round; }
  .mark__north { fill: var(--on-brand); }
  .mark__south { fill: var(--on-brand); fill-opacity: 0.4; }
  .mark__needle { transform-box: view-box; transform-origin: 32px 32px; }

  /* ── Header ────────────────────────────────────────────────── */
  /* Printed at the head of the sheet: it scrolls away with the page. */
  .site-header {
    position: relative;
    z-index: 2;
    container: header / inline-size;
    view-transition-name: site-header;
  }
  .site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-block-start: calc(var(--header-h) - 2.75rem);
  }

  .brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    min-block-size: 2.75rem;
    color: var(--ink);
    text-decoration: none;
    &:hover { color: var(--ink); }
  }
  .brand__mark { inline-size: 2.25rem; block-size: 2.25rem; flex: none; }
  .brand__name { font-size: 1.6rem; font-weight: 600; line-height: 1; }
  .brand--small .brand__mark { inline-size: 1.9rem; block-size: 1.9rem; }
  .brand--small .brand__name { font-size: 1.4rem; }

  /* In the header the brand gives way before anything else. Where the row is too short for the mark and the name
     (a phone, with the language menu on), the name wraps under the mark, below the row, where it is clipped away:
     only the mark is left, and the link keeps its name for a screen reader. Nothing to measure again when a word
     changes or a language is added (README, "The header on a phone"). */
  .site-header .brand {
    flex: 0 1 auto;
    flex-wrap: wrap;
    align-content: flex-start;
    row-gap: 1rem; /* far enough down to be clipped whole */
    block-size: 2.75rem;
    min-inline-size: 2.25rem;
    padding-block: 0.25rem; /* leaves the mark's own height: one line of it */
    margin-inline-end: 0.375rem; /* the name never comes closer than this to the buttons */
    overflow: hidden; /* for a browser without clip */
    overflow: clip;
  }

  .site-nav { display: flex; flex: none; align-items: center; gap: 0.75rem; }

  /* The language button and the light/dark switch: round, fine-ruled, 44 px. */
  .lang-button, .theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-block-size: 2.75rem;
    min-inline-size: 2.75rem;
    padding: 0 0.85rem 0.05rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: none;
    color: var(--ink);
    font-size: 1.0625rem;
    font-weight: 600;
    font-variant-numeric: lining-nums;
    letter-spacing: 0.03em;
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.15s;
    &:focus-visible { border-radius: 999px; }
    /* Only where there's a real pointer: after a tap, a touch screen keeps :hover, and the switch would look held. */
    @media (hover: hover) {
      &:hover { border-color: var(--ink); }
    }
    .icon { inline-size: 1.1rem; block-size: 1.1rem; }
  }
  .theme-toggle {
    padding: 0;
    .icon { inline-size: 1.3rem; block-size: 1.3rem; }
  }
  /* The switch shows the theme the page is in: the sun in light, the moon in dark. */
  .theme-toggle__moon { display: none; }
  :root[data-theme="dark"] .theme-toggle {
    .theme-toggle__sun { display: none; }
    .theme-toggle__moon { display: block; }
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle {
      .theme-toggle__sun { display: none; }
      .theme-toggle__moon { display: block; }
    }
  }
  /* No switch where it can't work: without JavaScript, or without light-dark() (forced colours: at the end). */
  @media (scripting: none) {
    .theme-toggle { display: none; }
  }
  @supports not (color: light-dark(#000, #fff)) {
    .theme-toggle { display: none; }
  }

  /* The language menu: a popover under its button where anchor positioning exists, elsewhere dropping from the
     header's right edge (placed from the top of the page, since the header scrolls with it). Without popovers the
     button and the menu go, and the footer's links remain. */
  .lang-menu {
    position: absolute;
    inset: calc(var(--header-h) + 0.375rem) max(var(--gutter), (100% - var(--wrap)) / 2 + var(--gutter)) auto auto;
    margin: 0;
    min-inline-size: 13rem;
    padding: 0.375rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-s);
    background: var(--paper-hi);
    color: var(--ink);
    box-shadow: var(--shadow);
  }
  /* Right-aligned under the button, at least 1rem from the screen's left edge; where there's no room for that (a
     narrow screen), centred under it (--lang-centred, at the end of the file). */
  @supports (position-anchor: --lang) {
    .lang-button { anchor-name: --lang; }
    .lang-menu {
      position-anchor: --lang;
      position-area: bottom span-left;
      position-try-fallbacks: --lang-centred, flip-inline;
      inset: auto;
      margin: 0.375rem 0 0 1rem;
    }
  }
  @supports selector(:popover-open) {
    .lang-button:has(+ .lang-menu:popover-open) { border-color: var(--ink); }
  }
  @supports not selector(:popover-open) {
    .lang-button, .lang-menu { display: none; }
  }
  .lang-menu__list { display: grid; gap: 0.125rem; }
  /* Each language: its round flag (decorative: the name says it), its name, and a check on the current one. */
  .lang-menu__link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-block-size: 2.75rem;
    padding: 0.4rem 0.75rem 0.5rem 0.85rem;
    border-radius: 0.25rem;
    color: var(--ink);
    font-size: 1.125rem;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    &:hover { color: var(--ink); }
    @media (hover: hover) {
      &:hover { background: color-mix(in oklab, var(--ink) 8%, transparent); }
    }
    &:focus-visible { outline-offset: -3px; }
    &[aria-current] { color: var(--brand); font-weight: 600; }
    > span { flex: 1; }
    .icon { inline-size: 1.1rem; block-size: 1.1rem; margin-inline-start: 0.3rem; stroke-width: 2.2; }
  }
  .lang-menu__flag { inline-size: 1.25rem; block-size: 1.25rem; flex: none; border-radius: 50%; }

  .site-nav .button { white-space: nowrap; } /* a two-line button looks broken: better a little tighter */

  /* Narrower headers: the language code goes (the translate mark stays: "IT" alone reads as a service), then the
     gaps close, sooner where the language button takes its share of the row. These thresholds only decide how soon
     the brand's name gets its room back (measured with the longest words, in every language; README, "The header on
     a phone"): where there is none, the name goes by itself (.site-header .brand). */
  @container header (width < 28rem) {
    .lang-button { padding: 0; }
    .lang-button__code { display: none; }
  }
  @container header (width < 26rem) {
    .site-header__inner:has(.lang-button) {
      gap: 0.5rem;
      .site-nav { gap: 0.5rem; }
      .brand { column-gap: 0.45rem; }
      .button--small { padding-inline: 0.9rem; }
    }
  }
  @container header (width < 22.5rem) {
    .site-header__inner {
      gap: 0.5rem;
      .site-nav { gap: 0.5rem; }
      .brand { column-gap: 0.45rem; }
      .button--small { padding-inline: 0.9rem; }
    }
  }

  /* ── Buttons ───────────────────────────────────────────────── */
  /* Squared, as a stamp on the chart. */
  .button {
    --button-bg: transparent;
    --button-fg: var(--ink);
    --button-border: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-block-size: 3rem;
    padding: 0.5rem 1.5rem 0.6rem;
    border: 1px solid var(--button-border);
    border-radius: var(--radius-s);
    background: var(--button-bg);
    color: var(--button-fg);
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.1;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
    &:hover { color: var(--button-fg); text-decoration-thickness: 1px; }
  }
  .button--primary {
    --button-bg: var(--brand);
    --button-fg: var(--on-brand);
    &:hover { --button-bg: var(--brand-hover); }
  }
  .button--quiet {
    --button-border: var(--line-strong);
    &:hover { --button-border: var(--ink); }
  }
  /* A link among buttons: as tall as they are, a line under its words. */
  .button--link {
    padding: 0;
    border: 0;
    border-radius: 2px;
    font-weight: 500;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.25em;
    &:hover { --button-fg: var(--brand); text-decoration-thickness: 2px; }
  }
  .button--small { min-block-size: 2.75rem; padding-inline: 1.15rem; font-size: 1.15rem; }
  .button--large { min-block-size: 3.5rem; padding-inline: 2.25rem; font-size: 1.5rem; }
}

@layer pages {
  /* ── Footer ────────────────────────────────────────────────── */
  .site-footer {
    position: relative;
    z-index: 1;
    color: var(--ink-2);
    font-size: 1.125rem;
  }
  /* Three blocks side by side where there's room: the brand, the pages (and the other languages under them), the
     line about cookies. A fine rule above, as wide as the text. */
  .site-footer__inner {
    position: relative;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
    gap: 1.25rem 3rem;
    align-items: start;
    padding-block: 2.25rem 3.25rem;
    &::before {
      content: "";
      position: absolute;
      inset: 0 var(--gutter) auto;
      border-block-start: 1px solid color-mix(in oklab, var(--ink) 30%, transparent);
    }
  }
  .site-footer__brand { display: grid; gap: 0.15rem; justify-items: start; }
  :is(.site-footer__nav, .site-footer__langs) ul { display: flex; flex-wrap: wrap; gap: 0 1.75rem; }
  :is(.site-footer__nav, .site-footer__langs) a {
    display: inline-flex;
    align-items: center;
    min-block-size: 2.75rem;
    color: var(--ink);
    &:hover { color: var(--brand); }
    &[aria-current="page"] { text-decoration-thickness: 2px; }
  }
  /* Each language with its round flag, as in the header's menu (decorative: the name is written next to it). */
  .site-footer__langs a { gap: 0.5rem; }
  .site-footer__flag { inline-size: 1.25rem; block-size: 1.25rem; flex: none; border-radius: 50%; }
  .site-footer__legal { display: grid; gap: 0.5rem; padding-block-start: 0.5rem; }
  /* The shield before "no tracking cookies". */
  .site-footer__note .icon {
    display: inline-block;
    inline-size: 1.15rem;
    block-size: 1.15rem;
    margin-inline-end: 0.35rem;
    vertical-align: -0.2em;
    color: var(--brand);
  }

  /* ── Contact page ──────────────────────────────────────────── */
  .contact {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-areas: "intro" "panel" "next";
    gap: clamp(2rem, 1.5rem + 3vw, 3.5rem);
    padding-block: clamp(2.5rem, 1.5rem + 4vw, 5rem) clamp(3.5rem, 3rem + 4vw, 6.5rem);
    @media (width >= 60rem) {
      grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
      grid-template-areas: "intro panel" "next panel";
      grid-template-rows: auto 1fr;
      column-gap: clamp(3rem, 6vw, 5rem);
      align-items: start;
    }
  }
  .contact__intro { grid-area: intro; }
  .contact__panel { grid-area: panel; }
  .contact__next { grid-area: next; }
  .contact__title { font-size: var(--step-4); line-height: 1.02; letter-spacing: -0.02em; }
  .contact__lead { margin-block-start: 1.1rem; max-inline-size: 32rem; color: var(--ink-2); font-size: var(--step-1); line-height: 1.4; }
  .contact__email { margin-block-start: 0.75rem; max-inline-size: 32rem; color: var(--ink-2); }
  .contact__next-title { font-size: 1.5rem; font-weight: 600; line-height: 1.2; letter-spacing: 0; }
  /* What happens next, in order: each step under a tall figure, as the four points of the home page sit under their
     letters. */
  .steps {
    display: grid;
    gap: 1.1rem;
    margin-block-start: 1.25rem;
    counter-reset: step;
    & li {
      display: grid;
      grid-template-columns: 2.5rem minmax(0, 1fr);
      column-gap: 0.75rem;
      align-items: start;
      color: var(--ink-2);
      counter-increment: step;
    }
    & li::before {
      content: counter(step);
      color: var(--brand);
      font-size: 2.75rem;
      font-weight: 500;
      font-variant-numeric: lining-nums;
      line-height: 0.9;
      text-align: center;
    }
  }

  /* The form: a lighter sheet laid on the chart. Errors show in text and in the border, never in colour alone. */
  .form, .form-success {
    padding: clamp(1.5rem, 1rem + 2.2vw, 2.75rem);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-s);
    background: var(--paper-hi);
  }
  .form { display: grid; gap: 1.5rem; }
  .form__title { font-size: var(--step-2); }
  .field { display: grid; gap: 0.4rem; }
  .field__label { font-weight: 600; }
  .field__optional { color: var(--ink-2); font-weight: 400; font-style: italic; }
  .field__hint { color: var(--ink-2); font-size: var(--step--1); }
  .field__error {
    color: var(--error);
    font-size: var(--step--1);
    font-weight: 600;
    &:empty { display: none; }
  }
  .field__input {
    inline-size: 100%;
    min-block-size: 3rem;
    padding: 0.55rem 0.9rem 0.65rem;
    border: 1.5px solid var(--field-border);
    border-radius: var(--radius-s);
    background: var(--field-bg);
    color: var(--ink);
    font-size: max(1em, 16px);
    font-variant-numeric: lining-nums;
    line-height: 1.4;
    transition: border-color 0.15s;
    &:hover { border-color: var(--ink); }
    &:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--ink); border-radius: var(--radius-s); }
    &:user-invalid { border-color: var(--error); }
    &[aria-invalid="true"] { border-color: var(--error); border-width: 2px; }
  }
  .field__input--area {
    min-block-size: 9.5rem;
    max-block-size: 32rem;
    resize: vertical;
    field-sizing: content;
  }
  .field:has([aria-invalid="true"]) {
    padding-inline-start: 0.9rem;
    border-inline-start: 3px solid var(--error);
  }

  .chips__list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-block-start: 0.2rem; }
  .chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-block-size: 2.75rem;
    padding: 0.4rem 0.95rem 0.5rem;
    border: 1.5px solid var(--field-border);
    border-radius: var(--radius-s);
    background: var(--field-bg);
    font-size: 1.125rem;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
    &:hover { border-color: var(--ink); }
    &:has(:checked) { border-color: var(--brand); background: var(--brand); color: var(--on-brand); }
    &:has(:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
  }
  .chip__input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
  .chip__check { display: none; inline-size: 1rem; block-size: 1rem; stroke-width: 2.4; }
  .chip:has(:checked) .chip__check { display: block; }

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

  /* Always in the page (a live region must exist before it speaks); empty, it gives back the gap it would add. */
  .form__alert {
    color: var(--error);
    font-weight: 600;
    &:empty { margin-block-end: -1.5rem; }
    &:not(:empty) {
      padding: 0.8rem 1rem 0.9rem;
      border: 1.5px solid color-mix(in oklab, var(--error) 45%, transparent);
      border-radius: var(--radius-s);
      background: color-mix(in oklab, var(--error) 8%, var(--paper-hi));
    }
  }
  .form__submit { inline-size: 100%; }
  .form.is-busy .form__submit {
    cursor: progress;
    &::after {
      content: "";
      inline-size: 1.1rem;
      block-size: 1.1rem;
      border: 2px solid currentColor;
      border-inline-end-color: transparent;
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
    }
  }
  .form__privacy, .form__noscript { color: var(--ink-2); font-size: var(--step--1); }
  .form__noscript { color: var(--ink); font-weight: 600; }

  .shield-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-block-size: 2.75rem;
    padding: 0.25rem 0.1rem;
    border: 0;
    background: none;
    color: var(--ink);
    font-size: var(--step--1);
    font-weight: 600;
    text-decoration: underline dotted;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.25em;
    cursor: pointer;
    anchor-name: --shield;
    &:hover { color: var(--brand); }
    .icon { inline-size: 1.15rem; block-size: 1.15rem; color: var(--brand); }
  }
  .toggletip {
    max-inline-size: min(24rem, calc(100vw - 2rem));
    padding: 1.1rem 1.25rem 1rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-s);
    background: var(--paper-hi);
    color: var(--ink);
    box-shadow: var(--shadow);
    font-size: var(--step--1);
  }
  .toggletip__title { font-weight: 600; }
  .toggletip__text { margin-block: 0.4rem 0.75rem; color: var(--ink-2); }
  /* Above its button where anchor positioning exists, starting at the button and shrinking to the space left before
     the screen's edge (or below it, if there's no room above); elsewhere it sits in the middle of the screen. */
  @supports (position-anchor: --shield) {
    .toggletip {
      position-anchor: --shield;
      position-area: top span-right;
      position-try-fallbacks: flip-block;
      inset: auto;
      margin: 0 1rem 0.5rem 0;
    }
  }
  @supports selector(:popover-open) {
    .toggletip {
      opacity: 0;
      translate: 0 0.4rem;
      transition: opacity 0.18s, translate 0.18s var(--ease-out), overlay 0.18s allow-discrete, display 0.18s allow-discrete;
      &:popover-open { opacity: 1; translate: 0 0; }
    }
    @starting-style {
      .toggletip:popover-open { opacity: 0; translate: 0 0.4rem; }
    }
  }

  .form-success {
    display: grid;
    justify-items: start;
    gap: 0.9rem;
    &:focus:not(:focus-visible) { outline: none; }
  }
  .form-success__icon { inline-size: 3rem; block-size: 3rem; color: var(--ok); stroke-width: 1.8; }
  .form-success__title { font-size: var(--step-2); }
  .form-success__text { color: var(--ink-2); }
  .form-success__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.75rem; margin-block-start: 0.5rem; }

  /* ── Privacy page ──────────────────────────────────────────── */
  .prose {
    position: relative;
    z-index: 1;
    padding-block: clamp(2.5rem, 1.5rem + 4vw, 5rem) clamp(3.5rem, 3rem + 4vw, 6.5rem);
    & > * { max-inline-size: 40rem; }
    & h2 { margin-block: 2.5rem 0.6rem; font-size: var(--step-2); }
    & p + p, & p + ul { margin-block-start: 0.9rem; }
    & ul { display: grid; gap: 0.6rem; padding-inline-start: 1.25rem; }
    & li::marker { color: var(--brand); }
  }
  .prose__title { font-size: var(--step-4); line-height: 1.02; letter-spacing: -0.02em; }
  .prose__updated { margin-block: 0.9rem 1rem; color: var(--ink-2); font-style: italic; }
  /* The switch "count my visits or not" (stats.js shows it; hidden without JavaScript, where nothing is counted). */
  .stats-choice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
    margin-block-start: 1.25rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-s);
    background: var(--paper-hi);
  }
  .stats-choice__status { flex: 1 1 16rem; font-weight: 600; }
  .stats-choice__noscript { margin-block-start: 1rem; color: var(--ink-2); }

  /* ── 404 ───────────────────────────────────────────────────── */
  .not-found {
    position: relative;
    z-index: 1;
    display: grid;
    justify-items: start;
    gap: 1.1rem;
    padding-block: clamp(3.5rem, 3rem + 6vw, 8rem);
  }
  .not-found__mark { inline-size: 4.5rem; block-size: 4.5rem; }
  .not-found__title { font-size: var(--step-4); font-weight: 500; line-height: 1.02; letter-spacing: -0.02em; }
  .not-found__title--small { font-size: var(--step-2); }
  /* The same words in the other languages: side by side where there's room. */
  .not-found__others {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
    gap: 1.5rem 3rem;
    justify-self: stretch;
    max-inline-size: 48rem;
    margin-block-start: 2rem;
    padding-block-start: 1.5rem;
    border-block-start: 1px solid color-mix(in oklab, var(--ink) 30%, transparent);
    color: var(--ink-2);
  }
  .not-found__other { display: grid; gap: 0.6rem; align-content: start; }
}

@layer utilities {
  .visually-hidden {
    position: absolute !important;
    inline-size: 1px !important;
    block-size: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }
}

/* ── Motion: only for those who haven't asked for less ─────── */
@media (prefers-reduced-motion: no-preference) {
  /* Cross-document view transitions between pages (Chrome, Edge, Safari): the header stays put, the rest fades. */
  @view-transition { navigation: auto; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.25s; }

  /* The language menu slides down a touch as it opens. */
  @supports selector(:popover-open) {
    .lang-menu {
      opacity: 0;
      translate: 0 -0.3rem;
      transition: opacity 0.16s, translate 0.16s var(--ease-out), overlay 0.16s allow-discrete, display 0.16s allow-discrete;
      &:popover-open { opacity: 1; translate: 0 0; }
    }
    @starting-style {
      .lang-menu:popover-open { opacity: 0; translate: 0 -0.3rem; }
    }
  }

  /* The logo's needle gives a little swing on hover. */
  .brand:hover .mark__needle { animation: needle-wiggle 0.9s var(--ease-out); }
  @keyframes needle-wiggle { 25% { rotate: 22deg; } 50% { rotate: -12deg; } 75% { rotate: 5deg; } }

  /* 404: the needle hunts for north twice, then gives up at an odd angle (under five seconds in all). */
  .not-found__mark .mark__needle { animation: needle-lost 2.2s ease-in-out 2 both; }
  @keyframes needle-lost { 30% { rotate: 150deg; } 55% { rotate: 95deg; } 80% { rotate: 215deg; } to { rotate: 200deg; } }
}

@keyframes spin { to { rotate: 1turn; } }

/* The language menu's second place (components: .lang-menu), centred under its button. */
@position-try --lang-centred {
  position-area: bottom;
  margin: 0.375rem 0 0;
}
@media (prefers-reduced-motion: reduce) {
  .form.is-busy .form__submit::after { animation-duration: 2.4s; }
}

@media (forced-colors: active) {
  .theme-toggle { display: none; } /* the system's colours win anyway: the switch would change nothing */
  .chip:has(:checked) { forced-color-adjust: none; background: Highlight; color: HighlightText; border-color: Highlight; }
  .mark__disc, .mark__pivot { fill: CanvasText; }
  .mark__north, .mark__south { fill: Canvas; }
  .mark__ticks { stroke: Canvas; }
  .button { border-color: ButtonText; }
  .button--link { border: 0; }
  .sheet::before { display: none; } /* the scale's bars are a background: the two rules stay */
}

@media print {
  :root { color-scheme: light; } /* paper is light, whatever the screen's theme: every light-dark() follows */
  .site-header, .skip-link, .sheet, .form__shield, .site-footer__links { display: none !important; }
  html, body { background: #fff; color: #000; }
  .page { display: block; min-block-size: 0; overflow: visible; }
  * { animation: none !important; }
}
