/* Bussola: the home page's own stylesheet, on top of site.css (its layers, its tokens).
   The page is one nautical chart. At its head, the compass rose with its rhumb lines running across the sheet; under
   it the compass taken apart, one part for each thing the studio does (the Tavola); then the four cardinal points
   beside a small rose, the clients as a ship's log beside their sea serpent, and where the route ends, an X with a
   treasure chest under it. On wide screens a dashed route runs through all of it, and a ship sails it as the page
   scrolls (compass.js plots both).
   The drawings come from compass.mjs; here they get their colours, their places and their motion. */

@layer pages {
  /* Words that are part of a drawing or an instrument, not of the text: never selected. */
  .hero__title, .readout, .compass-quote, .part__name, .points__letter {
    -webkit-user-select: none;
    user-select: none;
  }

  /* ── The route's stops ─────────────────────────────────────── */
  /* Points the route passes through (compass.js reads where each one is), set where no text can be: under the
     compass, at each part's pivot, in the gap between two columns, beside a drawing. Wide screens only. Placed with
     top and left on purpose: this is geometry, not text. */
  .way { position: absolute; display: none; inline-size: 1px; block-size: 1px; pointer-events: none; }
  .way--top { top: 0; left: 50%; }
  .way--bottom { top: 100%; left: 50%; }
  .way--foot { top: calc(100% + 3.75rem); left: 50%; }
  .way--west { top: 50%; left: -0.9rem; }
  .way--east { top: 46%; left: calc(100% + 0.75rem); }
  .way--centre { top: 50%; left: 50%; }
  .way--part { top: 45.4%; left: 50%; } /* a part's pivot: 118 of its drawing's 260 */
  .way--under { top: 106%; left: 50%; }

  /* The route and its ship: laid over the whole sheet (.page), under the text. */
  .route {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: none;
    inline-size: 100%;
    block-size: 100%;
    max-inline-size: none;
    overflow: visible;
    pointer-events: none;
  }
  .route__line { fill: none; stroke: var(--needle); stroke-width: 2; stroke-dasharray: 9 10; stroke-linecap: round; opacity: 0.75; }
  /* A point compass.js moves along the route; the ship is drawn round it. The point is a layer of its own, so the
     compositor moves it; the drawing rolls and turns about round the point (compass.js sets its rotate and scale). */
  .ship {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    display: none;
    inline-size: 0;
    block-size: 0;
    pointer-events: none;
    will-change: transform;
    & svg { position: absolute; left: -36px; top: -53px; inline-size: 72px; block-size: 64px; max-inline-size: none; overflow: visible; transform-origin: 36px 53px; }
  }
  .ship__hull { fill: var(--brand); stroke: var(--ink); stroke-width: 1.2; stroke-linejoin: round; }
  .ship__sail { fill: var(--paper-hi); stroke: var(--ink); stroke-width: 1.2; stroke-linejoin: round; }
  .ship__mast { fill: none; stroke: var(--ink); stroke-width: 1.4; stroke-linecap: round; }
  .ship__flag { fill: var(--needle); }
  .ship__wake { fill: none; stroke: var(--green); stroke-width: 1.3; stroke-linecap: round; }

  /* ── Hero ──────────────────────────────────────────────────── */
  .hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    align-items: center;
    padding-block: 1.5rem 3rem;
    reading-flow: grid-order; /* on a phone the compass comes first: the Tab key follows what is seen, where it can */
  }
  /* Above the chart's lines, which come from the compass beside it. */
  .hero__text { position: relative; z-index: 1; }

  /* The studio's name in Mea Culpa, on two lines. A wordmark: it can't be selected. Each line's box is padded so the
     swashes stay inside it (the writing-in only paints inside the box), and the padding is taken back with margins. */
  .hero__title {
    padding-block: 0.08em;
    color: var(--brand);
    font-family: var(--font-script);
    font-size: clamp(3.6rem, 2.2rem + 6.2vw, 6.75rem);
    font-weight: 400;
    line-height: 0.98;
    letter-spacing: 0;
  }
  .hero__line {
    display: block;
    inline-size: fit-content;
    padding: 0.16em 0.3em 0.34em;
    margin: -0.16em -0.3em -0.34em;
  }
  .hero__line + .hero__line { margin-inline-start: 0.42em; } /* "Company" steps in under "Bussola", as a signature does */
  .hero__sub { margin-block-start: 1.1rem; color: var(--ink-2); font-size: 1.35rem; font-style: italic; }
  .hero__tagline {
    margin-block-start: 1.75rem;
    font-size: clamp(2rem, 1.4rem + 2.2vw, 3rem);
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: -0.01em;
    text-wrap: balance;
  }
  .hero__lead { margin-block-start: 1.1rem; max-inline-size: 34rem; color: var(--ink-2); font-size: 1.3125rem; }
  .hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 2rem; margin-block-start: 2rem; }

  /* The compass: above the words on a phone (larger on a tablet), beside them on a wide screen. */
  .hero__art { position: relative; z-index: 0; order: -1; justify-self: center; inline-size: min(100%, clamp(20rem, 52vw, 27rem)); }
  .compass-box { position: relative; }

  /* The chart (compass.mjs, chart()): rhumb lines from the rose across the whole sheet, in the colours of a portolan
     (the winds in ink, the half-winds in green, the quarter-winds in red), fading with distance. The course is the
     line compass.js turns to the rhumb nearest the pointer. The small rose has a chart of its own. */
  .chart {
    position: absolute;
    inset: 0;
    z-index: -1;
    inline-size: 100%;
    block-size: 100%;
    max-inline-size: none;
    overflow: visible;
    pointer-events: none;
    & path { fill: none; stroke-width: 1; vector-effect: non-scaling-stroke; }
  }
  .chart__wind-from { stop-color: color-mix(in oklch, var(--ink) 16%, transparent); }
  .chart__half-from { stop-color: color-mix(in oklch, var(--green) 26%, transparent); }
  .chart__quarter-from { stop-color: color-mix(in oklch, var(--needle) 22%, transparent); }
  .chart__to { stop-color: transparent; }
  /* Each gradient has a stop in the middle. On a narrow screen, where the words take the whole width, it is clear:
     the lines die out close to their rose instead of running through every paragraph down the page. On a wide one it
     is what the fade would be there anyway (the --small one is the small rose's, nearer its centre). */
  .chart__mid { stop-opacity: 0; }
  .chart__course-from { stop-color: var(--needle); }
  .chart__course-to { stop-color: color-mix(in oklch, var(--needle) 0%, transparent); }
  .chart__course {
    opacity: 0;
    transform-box: view-box;
    transform-origin: 360px 360px;
    & path { stroke-width: 1.75; }
  }
  .is-steering .chart__course { opacity: 0.7; }

  /* The compass is a button: it unrolls the ribbon (compass.js). Artwork: no callout on a long press. */
  .compass {
    display: block;
    inline-size: 100%;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: inherit;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    &:focus-visible { outline-offset: 0.25rem; border-radius: 50%; }
  }

  /* The roses (compass.mjs draws them; here their colours). The two-tone points are dark on one flank: the cardinal
     ones in the brand's brown, the intercardinal in green, the half-winds in red. */
  .rose { display: block; inline-size: 100%; block-size: auto; aspect-ratio: 1; overflow: visible; }
  .rose__rhumbs { fill: none; stroke: color-mix(in oklch, var(--ink) 11%, transparent); stroke-width: 1; }
  .rose__ring { fill: none; stroke: color-mix(in oklch, var(--ink) 40%, transparent); stroke-width: 1.25; }
  .rose__ring--inner { stroke: color-mix(in oklch, var(--ink) 18%, transparent); }
  .compass[aria-expanded="true"] .rose__ring--inner { stroke: color-mix(in oklch, var(--needle) 60%, transparent); }
  .rose__ticks { fill: none; stroke: color-mix(in oklch, var(--ink) 44%, transparent); stroke-width: 1.25; }
  .rose__dark { fill: var(--brand); }
  .rose__dark--green { fill: var(--green); }
  .rose__dark--red { fill: var(--needle); }
  .rose__light { fill: var(--paper-hi); stroke: color-mix(in oklch, var(--brand) 60%, transparent); stroke-width: 1.25; stroke-linejoin: round; }
  .rose__letters text { fill: var(--ink); font-size: 30px; font-weight: 600; text-anchor: middle; dominant-baseline: central; }
  .rose--small .rose__letters text { font-size: 38px; }
  /* The eight winds' names, round the dial: only where the rose is big enough to read them. */
  .rose__winds text { display: none; fill: var(--ink-2); font-size: 21px; font-style: italic; letter-spacing: 1.5px; text-anchor: middle; }
  .rose__needle-n { fill: var(--needle); }
  .rose__needle-s { fill: var(--paper-hi); stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; }
  .rose__cap { fill: var(--brand); }
  .rose__pin { fill: var(--paper-hi); }
  .rose__ping { fill: none; stroke: var(--needle); stroke-width: 2; opacity: 0; }
  .rose__dial, .rose__needle, .rose__needle-turn, .rose__ping { transform-box: view-box; transform-origin: 360px 360px; }
  .rose--small :is(.rose__dial, .rose__needle-turn) { transform-origin: 320px 320px; }

  /* The ribbon the compass unrolls, across its lower half, with the studio's motto. Rolled up it's out of sight and
     out of the accessibility tree (visibility), so aria-expanded tells the truth. It never takes the pointer: the
     compass under it keeps the hover. */
  .compass-quote {
    position: absolute;
    inset-block-end: 14%;
    inset-inline-start: 50%;
    inline-size: max-content;
    max-inline-size: calc(100vw - 5rem);
    translate: -50% 0;
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
  }
  .compass[aria-expanded="true"] + .compass-quote { visibility: visible; opacity: 1; }
  .compass-quote__ribbon {
    position: relative;
    display: block;
    padding: 0.32em 0.9em 0.42em;
    background: var(--brand);
    color: var(--on-brand);
    box-shadow: inset 0 -0.5em 0.8em -0.6em oklch(0.15 0.03 45 / 0.35), 0 0.7em 1.2em -0.7em oklch(0.2 0.04 50 / 0.45);
    font-family: var(--font-script);
    font-size: clamp(1.625rem, 1.3rem + 1.1vw, 2.25rem);
    line-height: 1.12;
    text-align: center;
    text-wrap: balance;
    outline: 1px solid color-mix(in oklch, var(--on-brand) 38%, transparent); /* an engraved rule inside the edge */
    outline-offset: -0.24em;
    /* The two tails, folded back under the ribbon's ends and cut in a swallowtail; their inner part, under the
       ribbon's lower corners, is the fold. */
    &::before, &::after {
      content: "";
      position: absolute;
      z-index: -1;
      inset-block: 0.38em -0.38em;
      inline-size: 1.45em;
      background: var(--fold);
    }
    &::before {
      inset-inline-start: -1.05em;
      clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 0.42em 50%);
    }
    &::after {
      inset-inline-end: -1.05em;
      clip-path: polygon(0 0, 100% 0, calc(100% - 0.42em) 50%, 100% 100%, 0 100%);
    }
  }
  .compass-quote__apos { margin-inline: -0.09em -0.07em; }

  /* Under the compass, what it reads: a question while it rests, the course and its wind while it is steered. */
  .readout {
    min-block-size: 1.6em;
    margin-block-start: 0.35rem;
    color: var(--ink-2);
    font-size: 1.25rem;
    font-style: italic;
    font-variant-numeric: lining-nums tabular-nums;
    text-align: center;
  }

  /* ── Sections ──────────────────────────────────────────────── */
  .section { position: relative; z-index: 1; padding-block: 3.5rem; scroll-margin-top: 1rem; }
  /* Two columns on a wide screen, the first with a set share of the width: so the middle of the gap is known, and
     the route can run down it without ever crossing a word. */
  .split { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2.25rem; align-items: center; reading-flow: grid-order; }
  .head {
    & h2 { font-size: var(--step-3); font-weight: 500; line-height: 1.05; letter-spacing: -0.015em; }
    & p { margin-block-start: 0.4rem; color: var(--ink-2); font-size: 1.4rem; font-style: italic; }
  }

  /* ── What we do: the compass taken apart (the Tavola) ──────── */
  /* The parts lie on the chart, over the route: the ship passes under them. */
  .services { position: relative; z-index: 3; padding-block: 3rem 1rem; scroll-margin-top: 1rem; }
  .tavola { position: relative; margin-block-start: 1rem; }
  /* --sit: how far above the box's own place a part comes to rest when the compass is put together, as a share of
     the drawing's height. --name-x: where a part's name ends, measured from the drawing's right edge. */
  .tavola__row {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
    padding-block: 1.5rem;
    &:nth-child(1) { --sit: -4%; --name-x: 62%; }
    &:nth-child(2) { --sit: -1%; --name-x: 86%; }
    &:nth-child(3) { --name-x: 91.5%; }
  }
  .service__title {
    color: var(--brand);
    font-family: var(--font-script);
    font-size: clamp(3.4rem, 2.5rem + 3.4vw, 5.25rem);
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0;
  }
  .service__text { max-inline-size: 31rem; margin-block-start: 1rem; } /* room for the script's long tails ("gg") */
  /* Each point behind a small red lozenge, as the rose's own points. */
  .service__points {
    display: grid;
    gap: 0.4rem;
    margin-block-start: 1.1rem;
    & li { position: relative; padding-inline-start: 1.5rem; color: var(--ink-2); }
    & li::before {
      content: "";
      position: absolute;
      inset-inline-start: 0.2rem;
      inset-block-start: 0.58em;
      inline-size: 0.5rem;
      block-size: 0.5rem;
      rotate: 45deg;
      background: var(--needle);
    }
  }
  .service__note { max-inline-size: 31rem; margin-block-start: 1.25rem; color: var(--ink-2); font-style: italic; }
  .tavola__toggle { margin-block-start: 0.35rem; }

  .tavola__land { position: relative; order: -1; }
  .part { position: relative; inline-size: min(100%, 23rem); }
  .part__svg { position: relative; z-index: 1; display: block; inline-size: 100%; block-size: auto; overflow: visible; }
  .tavola__row:nth-child(1) .part__svg { z-index: 3; }
  .tavola__row:nth-child(2) .part__svg { z-index: 2; }
  .part__name { position: absolute; top: 0; left: 0; display: block; color: var(--ink-2); font-size: 1.15rem; font-style: italic; line-height: 1.25; }
  /* Put together: each part slides down the axis onto the box (--drop, from compass.js: how far below the row is the
     last one), and only the last name is left, now the whole instrument's. */
  .tavola.is-whole .part__svg { translate: 0 calc(var(--drop, 0px) + var(--sit, 0%)); }
  .tavola.is-whole .tavola__row:not(:last-child) .part__name { opacity: 0; }

  /* The parts' drawings. Laid flat, their lines keep one thickness whatever the squeeze. */
  .flat :is(path, circle, ellipse) { vector-effect: non-scaling-stroke; }
  .card-edge { fill: color-mix(in oklab, var(--ink) 34%, var(--paper)); stroke: var(--ink); stroke-width: 1.4; }
  .card-face { fill: var(--paper-hi); stroke: var(--ink); stroke-width: 1.4; }
  .box-wood { fill: color-mix(in oklab, var(--gold) 40%, var(--paper-hi)); stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; }
  .box-rim { fill: color-mix(in oklab, var(--gold) 22%, var(--paper-hi)); stroke: var(--ink); stroke-width: 1.5; }
  .box-well { fill: color-mix(in oklab, var(--gold) 62%, var(--paper)); stroke: var(--ink); stroke-width: 1.3; }
  .box-floor { fill: color-mix(in oklab, var(--gold) 30%, var(--paper-hi)); stroke: color-mix(in oklab, var(--ink) 60%, transparent); stroke-width: 1; }
  .box-groove { fill: none; stroke: color-mix(in oklab, var(--ink) 48%, transparent); stroke-width: 1.1; }
  .box-pin { fill: var(--ink); }
  .hatch { fill: none; stroke: color-mix(in oklab, var(--ink) 55%, transparent); stroke-width: 1.1; stroke-linecap: round; }
  .waves { fill: none; stroke: color-mix(in oklab, var(--green) 75%, transparent); stroke-width: 1.5; stroke-linecap: round; }

  /* ── How we work: four cardinal points ─────────────────────── */
  .points {
    display: grid;
    gap: 1.6rem;
    margin-block-start: 2.25rem;
    & li { display: grid; grid-template-columns: 3rem minmax(0, 1fr); column-gap: 1rem; align-items: start; }
    & h3 { font-size: 1.5rem; font-weight: 600; line-height: 1.2; letter-spacing: 0; }
    & p { max-inline-size: 32rem; margin-block-start: 0.25rem; color: var(--ink-2); }
  }
  /* The point's letter, tall beside its text; red while the small rose's needle points to it. */
  .points__letter { color: var(--brand); font-size: 3.5rem; font-weight: 500; line-height: 0.82; text-align: center; }
  .points li.is-aimed .points__letter { color: var(--needle); }
  .method__rose { position: relative; z-index: 0; order: -1; justify-self: center; inline-size: min(100%, 13rem); }

  /* ── Clients: a ship's log, and a stretch of open sea ──────── */
  .sea { position: relative; order: 2; display: grid; justify-items: center; gap: 0.25rem; }
  /* The sea serpent is a button: pressed, it dives and leaves bubbles (compass.js); pressed again, it's back. */
  .serpent {
    display: block;
    inline-size: min(100%, 17rem);
    padding: 0;
    border: 0;
    border-radius: 0.5rem;
    background: none;
    color: inherit;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
  }
  .serpent__svg { display: block; inline-size: 100%; block-size: auto; overflow: visible; }
  .serpent__skin { fill: color-mix(in oklab, var(--green) 26%, var(--paper)); stroke: var(--green); stroke-width: 1.8; stroke-linejoin: round; }
  .serpent__scales { fill: none; stroke: var(--green); stroke-width: 1.3; stroke-linecap: round; }
  .serpent__eye { fill: var(--ink); }
  .serpent__tongue { fill: none; stroke: var(--needle); stroke-width: 1.8; stroke-linecap: round; }
  .serpent__bubbles { fill: none; stroke: var(--green); stroke-width: 1.4; opacity: 0; }
  .serpent[aria-pressed="true"] .serpent__body { translate: 0 44px; opacity: 0; }
  .serpent[aria-pressed="true"] .serpent__bubbles { opacity: 1; }
  .serpent__say { min-block-size: 1.6em; color: var(--ink-2); font-size: 1.25rem; font-style: italic; text-align: center; }

  .clients__intro { max-inline-size: 34rem; margin-block-start: 1rem; color: var(--ink-2); }
  /* The log: who, and what was done for them. On a wide screen, a line of dots leads from one to the other. */
  .log {
    display: grid;
    gap: 1.4rem;
    margin-block-start: 2rem;
    & li { display: grid; gap: 0.15rem; }
  }
  .log__who { display: grid; }
  .log__name { font-size: 1.5rem; font-weight: 600; line-height: 1.2; letter-spacing: 0; }
  .log__sector { color: var(--ink-2); font-style: italic; }
  .log__dots { display: none; }

  /* ── Where the route ends: X marks the spot ────────────────── */
  .destination {
    position: relative;
    z-index: 1;
    padding-block: 3rem 4rem;
    scroll-margin-top: 1rem;
    & h2 {
      max-inline-size: 17em;
      font-size: clamp(2.2rem, 1.5rem + 2.6vw, 3.6rem);
      font-weight: 500;
      line-height: 1.06;
      letter-spacing: -0.015em;
    }
  }
  .destination__text p { margin-block-start: 1rem; color: var(--ink-2); font-size: 1.4rem; font-style: italic; }
  .destination__text .button { margin-block-start: 1.75rem; }
  /* The spot: the X and, under it, the line that shows once the chest is found. On a phone it closes the page. */
  .destination__spot { display: grid; justify-items: center; gap: 0.6rem; }

  /* The X is a button: it digs. One drawing, two states (compass.mjs, treasure()), told by aria-expanded: the X in
     its dashed ring, as a map marks the spot; then the chest that was under it, dug up, its lid thrown back. The ring
     stays: the spot is still the spot. compass.js digs once by itself, when the ship gets there (or, without a ship,
     when the X is in full view); after that the button undoes and redoes it. */
  .dig {
    position: relative;
    display: block;
    inline-size: 9rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: inherit;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    &:focus-visible { outline-offset: 0.25rem; border-radius: 50%; }
  }
  .treasure { display: block; inline-size: 100%; block-size: auto; overflow: visible; }
  /* The ring is filled with the sheet's own colour: the route and the chart's lines stop at its edge. */
  .treasure__ring { fill: var(--paper); stroke: var(--needle); stroke-width: 1.5; stroke-dasharray: 3 7; stroke-linecap: round; }
  .treasure__cross {
    fill: none;
    stroke: var(--needle);
    stroke-width: 9;
    stroke-linecap: round;
    transform-box: view-box;
    transform-origin: 70px 70px;
  }
  /* The chest, drawn like the boxwood case of the compass: ink lines, washes of gold, hatched shade. Its hollow is
     dark in both themes (the first value is for the browsers without light-dark(), which only have the light one);
     the glints are light itself, the same in both. */
  .chest__wood { fill: color-mix(in oklab, var(--gold) 40%, var(--paper-hi)); stroke: var(--ink); stroke-width: 1.4; stroke-linejoin: round; }
  .chest__inside { fill: #573823; fill: light-dark(#573823, oklch(0.15 0.012 55)); stroke: var(--ink); stroke-width: 1.3; stroke-linejoin: round; }
  .chest__groove { fill: none; stroke: color-mix(in oklab, var(--ink) 48%, transparent); stroke-width: 1; }
  .chest__band { fill: var(--brand); stroke: var(--ink); stroke-width: 1.1; stroke-linejoin: round; }
  .chest__plate { fill: var(--gold); stroke: var(--ink); stroke-width: 1.1; stroke-linejoin: round; }
  .chest__key { fill: var(--ink); }
  .chest__gold { fill: var(--gold); stroke: var(--ink); stroke-width: 1.2; stroke-linejoin: round; }
  .chest__coins { fill: none; stroke: color-mix(in oklab, var(--gold) 50%, black); stroke-width: 1; stroke-linecap: round; }
  .chest__glint { fill: #fbf6ef; stroke: var(--ink); stroke-width: 0.9; stroke-linejoin: round; transform-box: fill-box; transform-origin: center; }
  /* Buried: the chest is under the X, shut. */
  .chest { opacity: 0; translate: 0 16px; scale: 0.7; transform-box: view-box; transform-origin: 70px 102px; }
  .chest__lid, .chest__lid-in { transform-box: view-box; transform-origin: 70px 60px; } /* hinged on the back edge */
  .chest__lid-in { scale: 1 0; }
  .chest__glint { scale: 0; }
  /* Found. */
  .dig[aria-expanded="true"] {
    .treasure__cross { opacity: 0; scale: 0.6; }
    .chest { opacity: 1; translate: 0 0; scale: 1; }
    .chest__lid { scale: 1 0; }
    .chest__lid-in { scale: 1 1; }
    .chest__glint { scale: 1; }
  }
  .dig__find {
    color: var(--ink-2);
    font-size: 1.2rem;
    font-style: italic;
    line-height: 1.3;
    text-align: center;
    visibility: hidden;
    opacity: 0;
    & span { display: inline-block; } /* a sentence a line, where they don't fit side by side */
  }
  .dig[aria-expanded="true"] + .dig__find { visibility: visible; opacity: 1; }

  /* ── Wide screens: two columns, and the route between them ─── */
  @media (width >= 60rem) {
    .way, .route { display: block; }
    .has-route .ship { display: block; }

    .hero { grid-template-columns: minmax(0, 0.95fr) minmax(0, 1fr); gap: 3rem; min-block-size: 44rem; padding-block: 2rem 6rem; }
    /* Two lines, never three: where the column is a few pixels short (60 to 68 rem wide), "The Bussola" leans into
       the gap between the columns instead of breaking after "The". */
    .hero__line { white-space: nowrap; }
    /* The rose is the page's subject: it takes its column and the margin beside it, as far as the sheet's edge allows. */
    .hero__art { order: 0; justify-self: start; inline-size: min(40rem, 100% + max(0rem, (100vw - var(--wrap)) / 2 + 0.5rem)); }
    .rose__winds text { display: block; }
    .chart__mid { stop-opacity: 0.86; }
    .chart__mid--small { stop-opacity: 0.936; }

    .section { padding-block: 5.5rem; }
    .split { gap: 4rem; }
    .split--a { grid-template-columns: 62% minmax(0, 1fr); }
    .split--a > .way { left: calc(62% + 2rem); }
    .split--b { grid-template-columns: 27% minmax(0, 1fr); column-gap: 7rem; }
    .split--b > .way { left: calc(27% + 3rem); }

    /* The Tavola: the parts take the hero's own compass column, measured the same way, so the route drops from the
       rose through the three of them without a bend. Each heading sits level with its part, and a hairline runs from
       the heading to the axis, behind the drawing. --land repeats the column's width for what can't use a percentage:
       --cy is how far down a part its pivot is, --h3 the heading's size. */
    .services { padding-block: 5rem 2rem; }
    .tavola {
      --col2: calc((min(var(--wrap), 100vw) - 2 * var(--gutter) - 3rem) / 1.95);
      --land: min(40rem, var(--col2) + max(0rem, (100vw - var(--wrap)) / 2 + 0.5rem));
      --cy: calc(var(--land) * 0.2269);
      --h3: clamp(3.4rem, 2.5rem + 3.4vw, 5.25rem);
      margin-block-start: 0;
    }
    .tavola__row { grid-template-columns: minmax(0, 0.95fr) minmax(0, 1fr); gap: 3rem; align-items: start; padding-block: 0.75rem; }
    .tavola__land { order: 0; justify-self: start; inline-size: min(40rem, 100% + max(0rem, (100vw - var(--wrap)) / 2 + 0.5rem)); }
    .part { inline-size: 100%; }
    .part__name { top: auto; left: auto; right: var(--name-x); bottom: calc(54.6% + 0.25rem); white-space: nowrap; }
    .service { padding-block-start: calc(var(--cy) - 0.58 * var(--h3)); }
    .service__title {
      display: flex;
      align-items: flex-start;
      gap: 1rem;
      &::after {
        content: "";
        flex: 1 1 1.5rem;
        block-size: 1px;
        margin-block-start: 0.58em;
        margin-inline-end: calc(-3rem - var(--land) / 2);
        background: color-mix(in oklab, var(--ink) 55%, transparent);
      }
    }
    .tavola.is-whole .tavola__row:not(:last-child) .service__title::after { opacity: 0; }

    .method__rose { order: 0; inline-size: min(100%, 19rem); }
    .sea { order: 0; }

    .destination { padding-block: 5rem 7rem; }
    .destination__spot { justify-self: center; }
    .dig { inline-size: 13rem; }
    .dig__find { max-inline-size: 15rem; font-size: 1.25rem; }
  }
  /* The log's dotted lines: only where the column has reached its full width (a narrower one keeps who and what one
     under the other). Each runs on the name's own line, from the name to what was done; the client's trade sits
     under the name, the whole row wide. */
  @media (width >= 72.5rem) {
    .log { gap: 1.1rem; }
    .log li { grid-template-columns: auto minmax(1.5rem, 1fr) auto; gap: 0.1rem 0.75rem; align-items: baseline; }
    .log__who { display: contents; }
    .log__name { grid-area: 1 / 1; }
    .log__dots {
      display: block;
      grid-area: 1 / 2;
      border-block-end: 2px dotted color-mix(in oklab, var(--ink) 38%, transparent);
      translate: 0 -0.3em;
    }
    .log__what { grid-area: 1 / 3; max-inline-size: 27rem; font-size: 1.125rem; text-align: end; }
    .log__sector { grid-area: 2 / 1 / auto / -1; font-size: 1.125rem; }
  }
}

/* ── Motion: only for those who haven't asked for less ─────── */
@media (prefers-reduced-motion: no-preference) {
  /* The needle swings and settles on north when the page opens. The spring is linear() (site.css, --spring), and it
     is always given in a declaration of its own: a browser that doesn't know linear() drops that one line and keeps
     the motion, with a plain ease. */
  .rose__needle { animation: needle-settle 2.4s var(--ease-out) 0.25s both; animation-timing-function: var(--spring); }
  @keyframes needle-settle { from { rotate: 58deg; } to { rotate: 0deg; } }

  /* The title writes itself in, line after line: a soft edge sweeping left to right. */
  .hero__line {
    -webkit-mask: linear-gradient(90deg, #000 44%, transparent 56%) 100% 0 / 230% 100% no-repeat;
    mask: linear-gradient(90deg, #000 44%, transparent 56%) 100% 0 / 230% 100% no-repeat;
    animation: title-write 1.25s cubic-bezier(0.45, 0.05, 0.3, 1) 0.2s both;
  }
  .hero__line + .hero__line { animation-delay: 0.95s; }
  @keyframes title-write { to { -webkit-mask-position: 0 0; mask-position: 0 0; } }

  /* The ship turns about slowly when it starts to cross the page the other way: it narrows to its bow, then opens
     the other way round (compass.js mirrors it with scale). */
  .ship svg { transition: scale 0.8s cubic-bezier(0.45, 0, 0.3, 1); }

  /* The ribbon unrolls from its middle and rolls back up. */
  .compass-quote {
    clip-path: inset(-50% 50%);
    transition: clip-path 0.45s var(--ease-out), opacity 0.3s, visibility 0s linear 0.45s;
  }
  .compass[aria-expanded="true"] + .compass-quote {
    clip-path: inset(-50% -3em);
    transition: clip-path 0.75s var(--ease-out), opacity 0.2s, visibility 0s;
  }
  .rose__ring--inner { transition: stroke 0.4s; }
  .chart__course { transition: opacity 0.4s, rotate 0.35s var(--ease-out); }

  /* On a touch screen, where nothing hovers, a ring pulses twice round the compass once its needle has settled: it
     can be tapped. */
  @media (hover: none) {
    .rose__ping { animation: compass-ping 1.7s ease-out 2.9s 2; }
    @keyframes compass-ping { from { opacity: 0.6; scale: 0.96; } to { opacity: 0; scale: 1.14; } }
  }
  .compass:active .rose { scale: 0.985; }
  .compass .rose { transition: scale 0.15s; }

  /* As you scroll, the dial turns and the needle keeps pointing north, as on a real compass (compass.js does it
     where scroll timelines don't exist). */
  @supports (animation-timeline: scroll()) {
    .compass .rose__dial { animation: dial-turn linear both; animation-timeline: scroll(root block); animation-range: 0 90vh; }
    @keyframes dial-turn { to { rotate: -40deg; } }
  }

  /* The Tavola: the parts slide onto the box, the needle a moment after the rose; names and hairlines fade. */
  .part__svg { transition: translate 0.95s var(--ease-out); }
  .tavola__row:nth-child(1) .part__svg { transition-delay: 0.12s; }
  .part__name, .service__title::after { transition: opacity 0.3s; }

  .points__letter { transition: color 0.2s; }

  /* The serpent dives; its bubbles come up after it. */
  .serpent__body { transition: translate 0.5s var(--ease-out), opacity 0.35s; }
  .serpent__bubbles { transition: opacity 0.4s 0.2s; }

  /* The chest. Buried again, everything goes back quickly (these are the ways back). */
  .treasure__cross { transition: opacity 0.2s 0.1s, scale 0.25s var(--ease-out) 0.1s; }
  .chest { transition: opacity 0.2s, translate 0.25s ease-in, scale 0.25s ease-in; }
  .chest__lid, .chest__lid-in { transition: scale 0.1s; }
  .chest__glint { transition: scale 0.1s; }
  .dig__find { transition: opacity 0.2s, visibility 0s linear 0.2s; }
  /* Dug up: the X goes, the chest comes up out of the ground with a bounce, its lid flies open, the gold glints. */
  .dig[aria-expanded="true"] {
    .treasure__cross { transition: opacity 0.2s, scale 0.25s ease-in; }
    .chest { transition: opacity 0.2s 0.12s, translate 0.75s 0.12s, scale 0.75s 0.12s; transition-timing-function: ease, var(--spring), var(--spring); }
    .chest__lid { transition: scale 0.16s ease-in 0.62s; }
    .chest__lid-in { transition: scale 0.5s 0.78s; transition-timing-function: var(--spring); }
    .chest__glint { transition: scale 0.5s 1.05s; transition-timing-function: var(--spring); }
    .chest__glint:nth-child(2) { transition-delay: 1.17s; }
    .chest__glint:nth-child(3) { transition-delay: 1.29s; }
  }
  .dig[aria-expanded="true"] + .dig__find { transition: opacity 0.5s 1s, visibility 0s; }
}

/* ── Without JavaScript ────────────────────────────────────── */
/* No button can keep a state: the ribbon and the chest show while their button is pointed at or focused, the serpent
   dives the same way, and the button that puts the compass together goes (it would do nothing). */
@media (scripting: none) {
  .compass:is(:hover, :focus-visible) + .compass-quote { visibility: visible; opacity: 1; }
  .tavola__toggle { display: none; }
  .serpent:is(:hover, :focus-visible) .serpent__body { translate: 0 44px; opacity: 0; }
  .serpent:is(:hover, :focus-visible) .serpent__bubbles { opacity: 1; }
  .dig:is(:hover, :focus-visible) {
    .treasure__cross { opacity: 0; scale: 0.6; }
    .chest { opacity: 1; translate: 0 0; scale: 1; }
    .chest__lid { scale: 1 0; }
    .chest__lid-in { scale: 1 1; }
    .chest__glint { scale: 1; }
  }
  .dig:is(:hover, :focus-visible) + .dig__find { visibility: visible; opacity: 1; }
  @media (prefers-reduced-motion: no-preference) {
    .compass:is(:hover, :focus-visible) + .compass-quote { clip-path: inset(-50% -3em); transition: clip-path 0.75s var(--ease-out), opacity 0.2s, visibility 0s; }
  }
}

@media (forced-colors: active) {
  .compass-quote__ribbon { border: 1px solid CanvasText; }
  .treasure__ring { fill: Canvas; }
  .service__points li::before { forced-color-adjust: none; background: CanvasText; }
}

@media print {
  .route, .ship, .chart, .readout, .compass-quote, .tavola__toggle, .dig__find { display: none !important; }
  .hero__line { -webkit-mask: none; mask: none; }
}
