/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: var(--space-3) var(--space-5);
  border-radius: 999px;
  text-decoration: none;            /* btn may be an <a> (e.g. mailto CTA) */
  font-weight: 500; letter-spacing: 0.02em;   /* Switzer Medium */
  text-transform: uppercase;
  transition: transform .15s ease, background .15s ease, color .15s ease;
}
.btn--primary {
  background: var(--color-accent); color: #fff;
}
.btn--primary:hover { transform: translateY(-1px); }
.btn--primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* Get in touch buttons: one block treatment shared by the open-inquiry CTA and
   the submit, so they read as the same control. Square edges, neon green in
   both themes, white letters set in the About copy's face and size - the
   section then carries a single type system. Uppercase comes from .btn. */
.contact .btn--primary {
  background: #00FF37;
  color: #fff;
  border-radius: 0;
  min-height: 5.5rem;
  padding: var(--space-5) var(--space-6);
  font-family: var(--font-sans);
  font-weight: 500;                              /* Switzer Medium */
  font-size: calc(var(--fs-about) * 0.9);
  letter-spacing: 0;             /* overrides the 0.02em on .btn */
}

/* ---------- Inquiry CTA + form shell ---------- */
.inquiry {
  min-height: 38rem;
  display: flex;
  flex-direction: column;
}
/* Everything else about the CTA - size, face, colour - comes from the shared
   .contact .btn--primary block above. */
.inquiry-cta { width: 100%; }
.form-shell { display: block; }
.form-shell[hidden] { display: none; }
.field--folded {
  max-height: 0;
  min-height: 0;
  opacity: 0;
  overflow: hidden;
  padding-block: 0;
  margin-block: 0;
  border-width: 0;
}

/* ---------- Form ---------- */
.form { display: grid; gap: var(--space-5); }
.field { display: grid; gap: var(--space-2); }
.field label {
  font-family: var(--font-mono); font-size: var(--fs-0);
  letter-spacing: 0.08em; text-transform: uppercase;
  color: #00ff37;          /* heading green, same in both themes */
}
.field input, .field textarea, .field select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  min-height: 44px;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-1);
  transition: border-color .15s ease;
}
.field textarea { min-height: 8rem; resize: vertical; }
.field input:hover, .field textarea:hover, .field select:hover { border-color: var(--color-text-muted); }
.field input:focus-visible,
.field textarea:focus-visible,
.field select:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-color: var(--color-focus);
}
.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"],
.field select[aria-invalid="true"] {
  border-color: var(--color-error);
}
:root[data-theme="light"] .field input,
:root[data-theme="light"] .field textarea,
:root[data-theme="light"] .field select {
  background: #fff;
  border-color: #020202;
}
:root[data-theme="light"] .field input:focus-visible,
:root[data-theme="light"] .field textarea:focus-visible,
:root[data-theme="light"] .field select:focus-visible {
  border-color: var(--color-focus);
}
:root[data-theme="light"] .field input[aria-invalid="true"],
:root[data-theme="light"] .field textarea[aria-invalid="true"],
:root[data-theme="light"] .field select[aria-invalid="true"] {
  border-color: var(--color-error);
}
/* Selects hint at short input — narrower than the full-width text fields.
   The cap sits on the control, not the field, so help text below it can still
   run the full form width. */
.field--narrow select { max-width: 22rem; }

/* Required marker + legend */
.req { color: var(--color-error); }
.form__legend {
  margin: 0;
  font-family: var(--font-mono); font-size: var(--fs-0);
  letter-spacing: 0.04em; color: #00ff37;
}

/* Per-field helper + error text */
.field__help {
  font-family: var(--font-mono); font-size: var(--fs-0);
  color: #00ff37;
}
.field__error {
  display: flex; align-items: baseline; gap: .4em;
  font-family: var(--font-mono); font-size: var(--fs-0);
  color: var(--color-error);
}
.field__error[hidden] { display: none; }
.field__error::before { content: "\26A0"; font-size: .9em; line-height: 1; } /* ⚠ icon — never color alone */

/* Email typo suggestion (e.g. gmial → gmail) */
.field__suggest {
  justify-self: start;
  background: none; border: 0; padding: var(--space-1) 0;
  font-family: var(--font-mono); font-size: var(--fs-0);
  color: var(--color-accent); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.field__suggest[hidden] { display: none; }

.field--hp {
  position: absolute; left: -10000px; top: auto;
  width: 1px; height: 1px; overflow: hidden;
}
.form__status {
  font-family: var(--font-mono); font-size: var(--fs-0);
  min-height: 1.5em;
}
.form__status[data-tone="ok"] { color: var(--color-accent); }
.form__status[data-tone="err"] { color: var(--color-error); }

/* ---------- Work modal (native <dialog>) ----------
   A near-fullscreen module: images float at native aspect on a darkened stage
   (left ~70%), a hard-edged white text panel sits opaque on the right (~30%).
   The panel overlaps the full-width canvas, so an incoming image slides out from
   BEHIND it while the outgoing one floats off into the open air on the left. */
.workmodal {
  width: 90vw; height: 90vh; height: 90svh;
  max-width: none; max-height: none;
  margin: auto; padding: 0; border: 0;
  background: transparent;
  border-radius: 0;
  overflow: hidden;
  position: fixed; inset: 0;
}
.workmodal::backdrop {
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(3px);
}

.workmodal__stage { position: relative; width: 100%; height: 100%; }

/* --- Gallery (left, but the canvas spans the whole stage) --- */
.workmodal__gallery {
  position: absolute; inset: 0;
  outline: none;
  touch-action: pan-y;
  cursor: grab;
}
.workmodal__gallery:active { cursor: grabbing; }
.workmodal__canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  z-index: 1;   /* above the blurred ::before fill */
}
.workmodal__strip {
  position: absolute; inset: 0;
  width: 100%;
  display: flex;
  will-change: transform;
  pointer-events: none;   /* the gallery handles drag; imgs never intercept */
  z-index: 1;
}
/* Each image gets a full "left-region" wide cell; centring it there floats the
   image clear of the panel, and the one-cell gap parks neighbours behind it. */
.workmodal__cell {
  flex: 0 0 70%;
  height: 100%; margin: 0;
  display: grid; place-items: center;
}
.workmodal__img {
  max-width: 80%; max-height: 82%;
  width: auto; height: auto;
  display: block;
  -webkit-user-drag: none; user-select: none;
}
/* Once WebGL takes over it draws the images (rippling) into these exact rects,
   so the DOM copies go transparent but keep their layout for the canvas to read.
   The class lands on the gallery element (see gallery.js). No WebGL -> the imgs
   stay visible as the plain fallback. */
.workmodal__gallery.is-webgl .workmodal__img { opacity: 0; }
/* Where a lazily loaded clip parks while WebGL is the one drawing it. It has to
   stay in the document and stay painted or WebKit never decodes a frame, so it's
   shrunk and faded rather than hidden — display:none / visibility:hidden would
   stop the decode dead and leave the canvas with nothing to sample. */
.workmodal__vsrc {
  position: absolute; left: 0; top: 0;
  width: 2px; height: 2px;
  opacity: 0.01;
  pointer-events: none;
  z-index: 0;
}

/* --- Video slide: poster + click-to-load play button --- */
.workmodal__cell--video { position: relative; }
.workmodal__play {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 84px; height: 84px; border-radius: 999px;
  display: grid; place-items: center;
  color: #fff;
  background: rgba(10, 10, 12, 0.42);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.4);
  opacity: 0; pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease, background 0.2s ease;
  z-index: 2;
}
.workmodal__play-icon { margin-left: 3px; }   /* optical-centre the triangle */
/* Offered only when the video slide is the centred one and hasn't started. */
.workmodal__cell--video.is-active:not(.is-playing):not(.is-loading) .workmodal__play {
  opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1);
}
.workmodal__play:hover {
  background: rgba(10, 10, 12, 0.62);
  transform: translate(-50%, -50%) scale(1.06);
}
.workmodal__play:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
/* Buffering after the click: hide the triangle, show a spinner, keep it up. */
.workmodal__cell--video.is-loading .workmodal__play {
  opacity: 1; transform: translate(-50%, -50%) scale(1);
}
.workmodal__cell--video.is-loading .workmodal__play-icon { display: none; }
.workmodal__cell--video.is-loading .workmodal__play::after {
  content: ''; width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.3); border-top-color: #fff;
  animation: workmodal-spin 0.8s linear infinite;
}
@keyframes workmodal-spin { to { transform: rotate(360deg); } }

/* --- 360 slide: placard, then a live panorama --- */
/* The frame is both the placard's border and the rect WebGL later draws the
   panorama into, so it carries the slide's aspect on its own — there's no <img>
   here to imply one. */
.workmodal__cell--pano { position: relative; }
/* Two boxes with two jobs. The SURFACE spans the whole cell and is what you drag;
   the FRAME is the 16:9 box the panorama is actually drawn into. They used to be
   one element, which meant the draggable region was the picture itself and every
   press on the black stage around it hit nothing — the majority of the visible
   area on a laptop, and a thin band on a phone. In fullscreen the frame grows to
   fill the surface, so the two coincide and that mode behaves exactly as before. */
.workmodal__pano {
  position: absolute; inset: 0;
  /* Only the centred slide takes pointer input; off-centre it stays transparent
     to events so dragging across it still scrolls the filmstrip. */
  pointer-events: none;
}
/* Solo work: no filmstrip to compete with, so the whole cell looks around. */
.workmodal__cell--pano.is-solo.is-active .workmodal__pano { pointer-events: auto; }
/* Alongside other slides only the panorama itself claims the drag, leaving the
   margin around it free to scroll the strip. */
.workmodal__cell--pano.is-active .workmodal__pano-frame { pointer-events: auto; }

/* Centred by absolute positioning rather than as a centred grid item: Safari
   sizes a non-stretched grid item from its content before it resolves
   `aspect-ratio`, which left the frame (and the placard inside it) sitting
   off-centre. Out of flow, the box depends on nothing but the surface's own box. */
.workmodal__pano-frame {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 80%; height: auto;
  aspect-ratio: 16 / 9;
  max-height: 82%;
  display: grid; place-items: center;
  border-radius: 0;
}
/* Re-enabling through a `pointer-events: none` ancestor is spec'd, but WebKit has
   missed it on composited layers, and the card composites itself with a
   backdrop-filter, so View was untappable. Say it on the controls directly too
   and the hit test never has to walk back up for an answer. */
.workmodal__cell--pano.is-active .workmodal__pano-card,
.workmodal__cell--pano.is-active .workmodal__pano-view { pointer-events: auto; }
/* The affordance has to match the hit region exactly, or you get the old bug back
   in cosmetic form: a grab cursor over pixels that ignore the press. Both boxes
   are listed because which one is hit depends on the solo gate above.
   Looking around needs both axes, and the gallery's pan-y would otherwise hand
   vertical drags to the browser — which cancels the pointer mid-gesture, and on
   touch that was the usual way the look jammed. No text selection either: a
   selection drag under the look is the other way the browser cancels it. */
.workmodal__cell--pano.is-live .workmodal__pano,
.workmodal__cell--pano.is-live .workmodal__pano-frame {
  cursor: grab;
  touch-action: none;
  user-select: none; -webkit-user-select: none;
}
.workmodal__cell--pano.is-live .workmodal__pano:active,
.workmodal__cell--pano.is-live .workmodal__pano-frame:active { cursor: grabbing; }

.workmodal__pano-card {
  position: relative;   /* the loading spinner below anchors to the card, not the frame */
  display: grid; place-items: center; gap: 0.55rem;
  padding: clamp(1.5rem, 4vw, 2.6rem) clamp(1.6rem, 5vw, 3rem);
  text-align: center;
  color: #fff;
  background: rgba(10, 10, 12, 0.42);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 0;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.42);
  transition: opacity 0.35s ease;
}
.workmodal__pano-glyph { opacity: 0.85; }
.workmodal__pano-title {
  margin: 0.2rem 0 0;
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  letter-spacing: 0.02em;
}
.workmodal__pano-note {
  margin: 0; max-width: 30ch;
  font-size: 0.85rem; line-height: 1.45;
  opacity: 0.72;
}
.workmodal__pano-view {
  margin-top: 0.5rem;
  padding: 0.6rem 1.9rem;
  font: inherit; font-size: 0.9rem; letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0a0a0c; background: #fff;
  border: 0; border-radius: 999px;
  cursor: pointer;
  transition: transform 0.25s ease, background 0.25s ease;
}
.workmodal__pano-view:hover { transform: translateY(-1px); background: #ececec; }
.workmodal__pano-view:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* Buffering the clip: swap the card's button row for a spinner, keep the frame. */
.workmodal__cell--pano.is-loading .workmodal__pano-view { visibility: hidden; }
.workmodal__cell--pano.is-loading .workmodal__pano-card::after {
  content: ''; position: absolute; bottom: clamp(1.5rem, 4vw, 2.6rem);
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.3); border-top-color: #fff;
  animation: workmodal-spin 0.8s linear infinite;
}
/* Live: the placard gets out of the way of the panorama behind it. */
.workmodal__cell--pano.is-live .workmodal__pano-card { display: none; }

.workmodal__pano-hint {
  position: absolute; left: 50%; bottom: 0.5rem;
  transform: translateX(-50%);
  margin: 0; padding: 0.35rem 0.9rem;
  font-size: 0.75rem; letter-spacing: 0.04em; white-space: nowrap;
  color: #fff; background: rgba(10, 10, 12, 0.5);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border-radius: 999px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.5s ease;
  z-index: 2;
}
/* Shown briefly once live, then faded out so it stops competing with the view. */
.workmodal__cell--pano.is-live .workmodal__pano-hint {
  animation: workmodal-hint 5s ease forwards;
}
@keyframes workmodal-hint {
  0%, 12% { opacity: 0; }
  25%, 70% { opacity: 1; }
  100% { opacity: 0; }
}

.workmodal__pano-fs {
  position: absolute; top: 0.75rem; right: 0.75rem;
  width: 40px; height: 40px; border-radius: 6px;
  display: grid; place-items: center;
  color: #fff;
  background: rgba(10, 10, 12, 0.45);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s ease, background 0.2s ease;
  z-index: 3;
}
.workmodal__cell--pano.is-live.is-active .workmodal__pano-fs {
  opacity: 1; pointer-events: auto;
}
.workmodal__pano-fs:hover { background: rgba(10, 10, 12, 0.68); }
.workmodal__pano-fs:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* Fullscreen: the gallery element itself goes fullscreen, so the cell has the
   whole screen to fill. Widen the slide and drop the panel-clearing inset. */
.workmodal__gallery.is-fullscreen { background: #000; }
.workmodal__gallery.is-fullscreen .workmodal__cell { flex-basis: 100%; }
/* The frame grows to fill the surface, so frame == surface == cell == screen and
   the hint and fullscreen button land on the screen edges exactly as they did
   when they hung off the cell. Applies to the CSS stand-in too: onFullscreenChange
   sets `is-fullscreen` in both branches. */
.workmodal__gallery.is-fullscreen .workmodal__pano-frame {
  top: 0; left: 0;
  transform: none;
  width: 100%; height: 100%;
  max-height: none; aspect-ratio: auto;
  border-radius: 0;
}
.workmodal__gallery.is-fullscreen .workmodal__dots { left: 50%; }
/* Stand-in for the fullscreen API where there isn't one (iOS Safari has no
   element fullscreen at all): lift the gallery over the text panel and out to
   the dialog's edges. On a phone the dialog is already the whole screen, so this
   fills it — the browser chrome is the only thing the real API would have taken
   that this can't. Absolute to the stage rather than fixed, so a dialog in the
   top layer can't clip or detach it. */
.workmodal__gallery.is-fullscreen--faux {
  position: absolute; inset: 0;
  z-index: 10;
}

.workmodal__dots {
  position: absolute; bottom: clamp(1rem, 3vh, 2rem);
  left: 35%; transform: translateX(-50%);
  display: flex; justify-content: center; gap: 0.6rem;
  padding: 0.5rem 0.85rem;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 999px;
  z-index: 3;
}
.workmodal__dots[hidden] { display: none; }
.workmodal__dot {
  width: 9px; height: 9px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.32);
  transition: background 0.2s ease, transform 0.2s ease;
}
.workmodal__dot:hover { background: rgba(255, 255, 255, 0.6); }
.workmodal__dot[aria-current="true"] {
  background: #fff; transform: scale(1.25);
}
.workmodal__dot:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* --- Text panel (right, opaque white, hard edges) --- */
.workmodal__panel {
  position: absolute; right: 0; top: 0;
  width: 30%; height: 100%;
  background: #fff; color: #14171c;
  padding: clamp(var(--space-5), 3vw, var(--space-7));
  display: flex; flex-direction: column; align-items: flex-start;
  gap: var(--space-4);
  overflow-y: auto;
  z-index: 2;
}
.workmodal__close {
  position: absolute; right: var(--space-4); top: var(--space-4);
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: transparent; color: #14171c;
  font-size: 1.9rem; line-height: 1;
  border-radius: 999px;
  transition: background 0.18s ease;
}
.workmodal__close:hover { background: rgba(0, 0, 0, 0.07); }
.workmodal__close:focus-visible { outline: 2px solid #14171c; outline-offset: 2px; }
.workmodal__title {
  font-family: var(--font-display); font-size: var(--fs-4);
  letter-spacing: -0.02em; line-height: 1;
  text-transform: uppercase;
  padding-right: 2.5rem;   /* clear the close button */
}
.workmodal__desc {
  font-size: var(--fs-1); line-height: 1.55;
  color: #3a3f47;
}
/* Inline credits in a work's body (sponsor, collaborators). Underlined rather
   than coloured, so they read as part of the sentence and not as a call to
   action competing with the panel's visit-site arrow. */
.workmodal__desc-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(58, 63, 71, 0.4);
  transition: text-decoration-color 0.2s ease, color 0.2s ease;
}
.workmodal__desc-link:hover {
  color: #14161a;
  text-decoration-color: currentColor;
}
.workmodal__desc-link:focus-visible {
  outline: 2px solid #14161a; outline-offset: 2px; border-radius: 2px;
}
.workmodal__tags {
  display: flex; flex-wrap: wrap; gap: var(--space-2);
  list-style: none;
}
.workmodal__tag {
  font-family: var(--font-mono); font-size: var(--fs-0);
  letter-spacing: 0.04em;
  padding: 0.25em 0.7em;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 999px;
  color: #14171c;
}
.workmodal__link {
  margin-top: auto;
  display: inline-grid; place-items: center;
  width: 2.5rem; height: 2.5rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  color: #14171c;
  transition: color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
.workmodal__link[hidden] { display: none; }
.workmodal__link:hover {
  background: #14171c; color: #fff;
  transform: translateY(-1px);
}
.workmodal__link:focus-visible { outline: 2px solid #14171c; outline-offset: 2px; }

/* --- Stacked layout on narrow screens --- */
@media (max-width: 767px) {
  .workmodal { width: 100vw; height: 100vh; height: 100svh; }
  .workmodal__gallery { inset: 0 0 42% 0; }
  .workmodal__cell { flex-basis: 100%; }
  /* Edge to edge on a phone. The desktop 80% inset exists to float the image
     clear of the side panel; stacked, there's nothing to clear, and it just
     spends a third of a ~390px stage on margin. Height still wins for anything
     tall enough to otherwise run past the bottom of the gallery. */
  .workmodal__img {
    width: 100%; height: auto;
    max-width: 100%; max-height: 100%;
  }
  .workmodal__pano-frame { width: 100%; max-height: 100%; }
  /* That frame is only ~220px tall at 16:9 on a phone, so tighten the placard to
     keep the View button inside it. The surface around it still takes the drag,
     which is what stops a press in the band above or below doing nothing. */
  .workmodal__pano-card { padding: 1rem 1.2rem; gap: 0.4rem; }
  .workmodal__pano-glyph { width: 40px; height: 27px; }
  /* left:35% centres the dots in the desktop layout's visible left region; with
     the panel below rather than beside, the centre is just the centre. */
  .workmodal__dots { left: 50%; }
  .workmodal__panel {
    top: auto; bottom: 0; width: 100%; height: 42%;
    padding: var(--space-5);
  }
}

/* ---------- Header controls (theme toggle + language picker) ---------- */
.site-header__controls {
  display: flex; align-items: center; gap: var(--space-3);
  flex-wrap: nowrap;
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Language picker: styled to match .nav-tooltip (white box, 2px black border,
   square corners, same sans type) so the header controls read as one family. */
.lang-picker { display: inline-flex; position: relative; }
.lang-picker::after {
  content: '';
  position: absolute; right: var(--space-3); top: 50%;
  width: 8px; height: 8px;
  border-right: 1.5px solid #020202;
  border-bottom: 1.5px solid #020202;
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}
.lang-picker select {
  appearance: none;
  /* Forces the native option list to render light in dark theme too. */
  color-scheme: light;
  background: #fff;
  color: #020202;
  border: 2px solid #020202;
  border-radius: 0;
  box-shadow: var(--shadow-1);
  padding: var(--space-2) calc(var(--space-3) + 14px) var(--space-2) var(--space-3);
  font-family: var(--font-sans);
  font-size: 1rem;      /* 16px, matches the tooltip */
  line-height: 1.25;    /* 20px */
  min-height: 36px;
  cursor: pointer;
  transition: background .15s ease;
}
.lang-picker select:hover { background: #ededed; }
.lang-picker select:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}
.lang-picker select option {
  background: #fff; color: #020202;
}

/* Icon toggles (theme + sound): two SVG icons stacked in the same grid cell,
   no background/box — just the bare icon. CSS is the source of truth for which
   icon is visible (state selectors below); GSAP only adds a spin-in pop. */
.theme-toggle,
.sound-toggle {
  position: relative;
  display: inline-grid; place-items: center;
  padding: 0;
  background: none;
  border: 0;
  color: var(--color-text);
  cursor: pointer;
}
/* Hover dim rides on the icons, never the button: opacity on the button groups
   the nested .nav-tooltip with it, so the page shows through the tooltip's
   white box. filter:opacity multiplies, so the hidden icon stays hidden. */
.theme-toggle:hover .theme-toggle__icon,
.sound-toggle:hover .sound-toggle__icon { filter: opacity(0.8); }
.theme-toggle:focus-visible,
.sound-toggle:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

.theme-toggle__icon,
.sound-toggle__icon {
  grid-area: 1 / 1;                   /* stack both icons in the same grid cell */
  width: 3.75rem; height: 4.5rem;    /* 60 × 72 px (Figma), aspect preserved */
  display: block;
  pointer-events: none;
  opacity: 0;                        /* hidden by default; active state reveals */
  transition: opacity .25s ease, filter .15s ease;  /* cross-fade on state flip, dim on hover */
}
/* Theme: moon in dark, sun in light. */
:root[data-theme="dark"]  .theme-toggle__icon--moon { opacity: 1; }
:root[data-theme="light"] .theme-toggle__icon--sun  { opacity: 1; }
/* Sound: off by default, on when pressed. */
.sound-toggle__icon--off { opacity: 1; }
.sound-toggle[aria-pressed="true"] .sound-toggle__icon--off { opacity: 0; }
.sound-toggle[aria-pressed="true"] .sound-toggle__icon--on  { opacity: 1; }

/* Nav tooltip: popover nested inside each toggle button (the button is the
   positioning context). CSS owns show/hide via :hover/:focus-visible so the
   browser's own hit-testing drives it — it can never get "stuck" the way a
   dropped JS pointerleave can. pointer-events:none keeps it purely visual. */
.nav-tooltip {
  position: absolute;
  pointer-events: none;
  top: calc(100% + var(--space-2));
  right: 0;
  z-index: 1;
  width: max-content;
  max-width: min(20rem, 78vw);
  padding: var(--space-2) var(--space-3);
  background: #fff;
  color: #020202;
  border: 2px solid #020202;
  box-shadow: var(--shadow-1);
  font-size: 1rem;      /* 16px, per design */
  line-height: 1.25;    /* 20px */
  text-align: center;
  white-space: normal;
  visibility: hidden;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .18s ease, transform .18s ease, visibility 0s .18s;
}

.nav-tooltip__credit {
  display: block;
  margin-top: var(--space-2);
  font-size: 0.75rem;
}

/* David Horvat sound-credit link — used in the tooltip and the marquee.
   Inherits the surrounding type/colour; underline marks it as a link. */
.credit-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
  transition: text-decoration-thickness .15s ease;
}
.credit-link:hover,
.credit-link:focus-visible {
  text-decoration-thickness: 2px;
}

[data-tooltip]:hover .nav-tooltip,
[data-tooltip]:focus-visible .nav-tooltip,
[data-tooltip]:has(.credit-link:focus-visible) .nav-tooltip {
  visibility: visible;
  opacity: 1;
  transform: none;
  /* The credit link is the sole interactive part; enable pointer events only
     while the tooltip is shown so it never blocks the page underneath. */
  pointer-events: auto;
  transition: opacity .3s cubic-bezier(.34, 1.56, .64, 1),
              transform .3s cubic-bezier(.34, 1.56, .64, 1),
              visibility 0s;
}

/* Transparent bridge across the button↔tooltip gap so the pointer can travel
   down to the link without dropping :hover and hiding the tooltip. */
.nav-tooltip::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: var(--space-2);
}

/* Escape dismisses while still hovered/focused (WCAG 1.4.13); source order beats
   the equal-specificity show rule above. */
[data-tooltip][data-tip-dismissed] .nav-tooltip {
  visibility: hidden;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .18s ease, transform .18s ease, visibility 0s .18s;
}

@media (prefers-reduced-motion: reduce) {
  .nav-tooltip { transition: none; }
}
