/* ==================================================================
   JBR — jcss.css  (one stylesheet for every page)

   Keep this file in the site root, next to the img/ folder.
   Every page sets a class on <body>, e.g. <body class="page-news">,
   so page-specific rules never touch other pages.

   0  Backgrounds (dark + light photo)      10 News page
   1  Colors                              11 Gallery page + photo viewer
   2  Sizes                               12 Works page
   3  Symbols                             13 Audio Lab page
   4  Page basics                         14 About page (uses section 7)
   5  Language switch (hidden)            15 Hover & motion
   6  Header                              16 Screen sizes
   7  Bio & collapsible sections (index + about)
   8  Menu (pop-up, animated)
   9  Player (index + works only)
   ================================================================== */

/* 0 ── BACKGROUNDS ─────────────────────────────────────────────────
   Every page has TWO photos: one for the DARK theme (dark grayscale photos)
   and one for the LIGHT theme (bright grayscale photos).
   Change a photo by editing ONE line below.
   Paths are relative to this file (site root).

   index.html has a slideshow instead: its image lists (one "dark", one "light")
   are in index.html (window.JBR_BG_IMAGES). The lines here for the index are
   what shows first, before the slideshow starts, so each one must be the
   FIRST image of the matching list in index.html.

   The light-theme file names are PLACEHOLDERS: until you put files with these
   names into img/, the light theme shows the plain cream page color instead. */

/* ---- DARK theme photos ---- */
:root {
  --bg-image: url("img/bgi_roka.jpg"); /* index (first slideshow image) + any new page */
}
.page-news,
.page-gallery,
.page-audiolab {
  --bg-image: url("img/bgi_darkhnew.jpg");
}
.page-works {
  --bg-image: url("img/bgi_cvet.jpg");
}
.page-about {
  --bg-image: url("img/bgi_vesc.jpg");
}

/* ---- LIGHT theme photos (placeholder names, replace with your files) ---- */
:root:not([data-theme="dark"]) {
  --bg-image: url("img/bgw_kot.jpg"); /* index (first slideshow image) + any new page */
}
:root:not([data-theme="dark"]) .page-news,
:root:not([data-theme="dark"]) .page-gallery,
:root:not([data-theme="dark"]) .page-audiolab {
  --bg-image: url("img/bgw_kot.jpg");
}
:root:not([data-theme="dark"]) .page-works {
  --bg-image: url("img/bgw_kot.jpg");
}
:root:not([data-theme="dark"]) .page-about {
  --bg-image: url("img/bgw_kot.jpg");
}

/* 1 ── COLORS ─────────────────────────────────────────────────────── */
:root {
  color-scheme: light;

  --bg: #f8f7f4; /* page background */
  --header-bg: #ffffff; /* fixed header background */
  --panel: #e9e9e9; /* player background */
  --hover: #c2c2c2; /* playlist row on hover */
  --line: #c9c5bb; /* thin dividers */
  --text: #222222; /* headings, menu, name (very dark grey) */
  --text-body: #333333; /* paragraphs */
  --text-soft: #444444; /* secondary text, captions */
  --accent: #c2362b; /* vermilion red */
  --scrim: 0; /* 0 = bright photo shown as is. Try 0.2 - 0.4 for a soft veil of the page color over it (calmer, text easier to read) */
}

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

  --bg: #181817;
  --header-bg: #000000; /* fixed header background in dark mode */
  --panel: #161614;
  --hover: #242422;
  --line: #363633;
  --text: #ebe9e4;
  --text-body: #c9c7c1;
  --text-soft: #9c9a94;
  --accent: #e5483c;
  --scrim: 0.2;
}

/* News captions were a little lighter in dark mode in the old news page */
[data-theme="dark"] .page-news {
  --text-soft: #a9a7a2;
}

/* 2 ── SIZES ──────────────────────────────────────────────────────── */
:root {
  --font: "Barlow", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --size-small: 0.8rem; /* ≈13px  player, captions, small tags */
  --size-label: 0.9rem; /* ≈14px  labels, section titles, track titles */
  --size-brand: 0.9375rem; /* 15px  name in header */
  --size-menu: 1rem; /* 16px  menu links */
  --size-body: 1rem; /* uniform size for keywords & bio paragraphs */

  --page-width: 100%;
  --side-space: 1.75rem;
  --player-pad: 1.25rem;
}

/* 3 ── THE SYMBOL ─────────────────────────────────────────────────── */
:root {
  --symbol: "\022A1";
  --symbol-size: 0.8rem;
  --breathe: 0.4;
}

/* Each section gets its own symbol. Header and player keep --symbol above.
   (.mark draws the symbol and makes it breathe with the bass.) */
.is-short {
  --symbol: "\229E"; /* keywords */
}
.is-long {
  --symbol: "\229F"; /* biography */
}
.is-contact {
  --symbol: "\22A0"; /* contact */
}

/* 4 ── PAGE BASICS ────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scrollbar-color: #4a4a48 var(--bg); /* dark gray scrollbar: thumb, track */
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html.menu-open,
html.player-open {
  overflow: hidden;
}

body {
  width: var(--page-width);
  /* Padding-top accommodates fixed header floating above */
  padding: 4.8rem var(--side-space) 10rem;
  padding-left: max(var(--side-space), env(safe-area-inset-left));
  padding-right: max(var(--side-space), env(safe-area-inset-right));
  color: var(--text);
  font-family: var(--font);
  font-size: var(--size-body);
  line-height: 1.6;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  -webkit-font-smoothing: antialiased;
  transition: color 0.25s;
}

/* Background: the image comes from --bg-image (section 0).
   grayscale: 100% = black & white, 0% = color.  contrast: 100% = normal, higher = punchier */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--bg-image) center / cover no-repeat;
  filter: none;
}
/* index.html: the two slideshow layers take over */
.backdrop:has(.bg-layer) {
  background: none;
}
/* the first layer shows the --bg-image of the current theme right away (before any script runs) */
.bg-layer:first-child {
  background-image: var(--bg-image);
}
.bg-layer {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 2s ease; /* the crossfade (set by BG_FADE in jjs.js) */
}
.bg-layer.is-on {
  opacity: 1;
}
.backdrop::after {
  content: "";
  position: absolute;
  z-index: 2; /* the color layer stays above both photos */
  inset: 0;
  background: var(--bg);
  opacity: var(--scrim);
  transition: 0.25s;
}

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

button {
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

a,
button {
  transition: color 0.15s;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.mark {
  display: inline-flex;
  align-items: center;
  flex: none;
  color: var(--accent);
  font-size: var(--symbol-size);
  line-height: 1;
  transform: scale(calc(1.3 + var(--beat, 0) * var(--breathe)));
}
.mark::before {
  content: var(--symbol);
}

/* Page heading used by News, Gallery, Audio Lab */
.page-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 2rem;
  margin-bottom: 1.5rem;
  color: var(--accent);
  font-size: var(--size-label);
  font-weight: 600;
  letter-spacing: 0.12em;
}

/* 5 ── LANGUAGE SWITCH ────────────────────────────────────────────── */

/* Show only the active language. Both languages stay in every page. */
html[lang="en"] [data-lang="sl"],
html[lang="sl"] [data-lang="en"] {
  display: none !important;
}

/* >>> HIDE THE LANGUAGE SWITCH (header button + menu toggle).
   Delete this one rule to show the switch again, and set
   FORCE_ENGLISH to false in the small <script> in each page's <head>. <<< */
#lang-btn,
.toggle[data-key="lang"] {
  display: none !important;
}

/* 6 ── HEADER (PERMANENTLY FIXED & FLOATING) ──────────────────────── */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem var(--side-space);
  padding-left: max(var(--side-space), env(safe-area-inset-left));
  padding-right: max(var(--side-space), env(safe-area-inset-right));
  background: var(--header-bg);
  color: var(--text-soft);
  font-size: var(--size-small);
  transition:
    background-color 0.25s,
    color 0.25s;
}

.brand {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.6rem;
  align-items: center;
  line-height: 1.5;
}
.brand-name {
  color: var(--text);
  font-size: var(--size-brand);
  font-weight: 500;
  white-space: nowrap;
}
.brand-full {
  display: none;
}
.brand-slogan {
  grid-column: 2;
  white-space: nowrap;
}

.controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.controls button {
  padding: 0.4rem 0.3rem;
  color: var(--accent); /* menu / SLO / THEME are red */
}

/* Minimalist 3-bar hamburger icon (active on mobile) */
.hamburger-icon {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 1.15rem;
  height: 0.75rem;
}
.hamburger-icon span {
  display: block;
  width: 100%;
  height: 1.5px;
  background: currentColor;
  transition: background-color 0.15s;
}

/* 7 ── BIO & COLLAPSIBLE SECTIONS (index + about) ─────────────────── */
.bio {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 1.75rem 0 3rem;
}

.bio section {
  display: flex;
  flex-direction: column;
  transition: margin-bottom 0.2s ease;
}

.bio section.is-collapsed {
  margin-bottom: 0;
}

.bio section:not(.is-collapsed) {
  margin-bottom: 2.25rem;
}

.bio section:not(.is-collapsed) h2 {
  margin-bottom: 0.85rem;
}

.bio-toggle {
  display: flex;
  align-items: center;
  width: auto;
  color: var(--accent);
  font-size: var(--size-label);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: left;
  padding: 0.25rem 0.75rem 0.25rem 0;
}

.bio-toggle:hover {
  color: var(--text);
}

/* Section title word: hidden by default, shown when the section is open
   (or on hover with a mouse, or keyboard focus). On phones the words stay
   hidden until a section is opened, so only the symbols show. */
.bio-reveal {
  max-width: 0;
  margin-left: 0;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  transition:
    max-width 0.3s ease,
    margin-left 0.3s ease,
    opacity 0.2s ease;
}
.bio-toggle:focus-visible .bio-reveal,
.bio-toggle[aria-expanded="true"] .bio-reveal {
  max-width: 20rem;
  margin-left: 0.6rem;
  opacity: 1;
}
@media (hover: hover) {
  .bio-toggle:hover .bio-reveal {
    max-width: 20rem;
    margin-left: 0.6rem;
    opacity: 1;
  }
}
/* Tablets (touch, no hover): words always visible. Phones stay symbols only. */
@media (hover: none) and (min-width: 700px) {
  .bio-reveal {
    max-width: 20rem;
    margin-left: 0.6rem;
    opacity: 1;
  }
}

.bio-collapsible {
  width: 100%;
}

.bio p,
.bio-keywords {
  text-transform: none;
}

/* Exact uniform font size across all screen sizes */
.bio p {
  max-width: 62ch;
  color: var(--text-body);
  letter-spacing: 0.01em;
  text-wrap: pretty;
}
.bio p + p {
  margin-top: 1em;
}
.bio .bio-credits {
  color: var(--text-soft);
}

.bio p a,
.bio-keywords a {
  text-decoration: none; /* links show by color only (red on hover) */
}

.bio-keywords {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  list-style: none;
  color: var(--text-body);
  letter-spacing: 0.01em;
}

/* 8 ── MENU (pop-up dialog, built by jjs.js) ──────────────────────── */
#menu {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  margin: 0;
  padding: 1.5rem;
  border: 0;
  background: rgba(0, 0, 0, 0.4);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: inherit;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

#menu.open {
  display: flex;
}

.menu-card {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 81%;
  max-width: 19.125rem;
  padding: 3.5rem 2.2rem 2.5rem;
  background: var(--bg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8);
  position: relative;
}

.menu-links {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  list-style: none;
}
.menu-links a {
  display: block;
  color: var(--text);
  font-size: var(--size-menu);
  font-weight: 500;
}
.menu-links a[aria-current="page"] {
  color: var(--accent);
}

.menu-foot {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
  color: var(--text-soft);
  font-size: var(--size-small);
}
.toggle button {
  color: var(--text-soft);
}
.toggle button[aria-pressed="true"] {
  color: var(--accent);
  font-weight: 600;
}

/* Micro-scale "pop": the card starts at 95% scale and 0 opacity and snaps to 100%
   in about 200ms with a fast, bouncy curve. Closing is a short reverse (120ms,
   the same number as MENU_CLOSE_MS in jjs.js). */
@keyframes menu-pop-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes menu-pop-out {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.95);
  }
}
@keyframes menu-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes menu-fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
#menu.open {
  animation: menu-fade-in 180ms ease-out both;
}
#menu.open .menu-card {
  animation: menu-pop-in 200ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
#menu.closing {
  animation: menu-fade-out 120ms ease-in both;
}
#menu.closing .menu-card {
  animation: menu-pop-out 120ms ease-in both;
}

/* 9 ── PLAYER (mini bar + full overlay with 3D spectrogram) ───────────
   Only exists on pages with <body data-player> (index and works).
   The mini bar runs the full width of the screen, flush with the bottom edge.
   padding-bottom lets its background run under the iPhone home indicator. */
#mini {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  width: 100%;
  padding-bottom: env(safe-area-inset-bottom);
  overflow: hidden;
  background: var(--header-bg);
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.18); /* soft shadow upwards, onto the page */
  color: var(--text);
  font-size: var(--size-small);
  transition:
    transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.25s ease;
}
#mini.is-hidden {
  transform: translateY(150%);
  opacity: 0;
  pointer-events: none;
}

.mini-prog {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent; /* invisible track: only the red played part shows */
}
.mini-fill {
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 0.1s linear;
}

.mini-bar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  /* max(): on a landscape phone with a notch, the controls stay clear of it */
  padding: 0.7rem max(var(--player-pad), env(safe-area-inset-right)) 0.7rem
    max(var(--player-pad), env(safe-area-inset-left));
}

.mini-play,
.mini-open {
  display: grid;
  place-items: center;
  flex: none;
  transition:
    color 0.15s,
    background 0.15s,
    transform 0.1s;
}
.mini-play {
  width: 1.5rem;
  height: 1.5rem;
  background: var(--hover);
}
.mini-play:active {
  transform: scale(0.92);
}
.mini-open {
  width: 1.5rem;
  height: 2rem;
  color: var(--accent);
}

/* min-height: before anything plays the bar shows only "Open music player",
   centered in the same height the two lines (title + artist) use later. */
.mini-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  gap: 0.05rem;
  min-width: 0;
  min-height: calc(3.2em + 0.45rem);
  padding: 0.2rem 0;
  text-align: left;
}
.mini-title {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#mini.is-idle .mini-artist {
  display: none;
}
.mini-artist {
  overflow: hidden;
  color: var(--text-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(2rem, 5vh, 3.5rem) 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.pl-overlay.open {
  display: flex;
}

.pl-card {
  position: relative;
  width: 100%;
  max-width: 27.2rem;
  height: 90vh;
  height: 90dvh;
  max-height: 90vh;
  max-height: 90dvh;
  padding: 2.5rem 2.3rem 1.6rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: var(--bg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}
.pl-card::-webkit-scrollbar {
  display: none;
}

.pl-close {
  position: absolute;
  top: 0.4rem;
  right: 0.3rem;
  width: 2rem;
  height: 2rem;
  color: var(--accent);
  font-size: 1.4rem;
  line-height: 1;
}

.sp-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #0d0d0c;
}
#sp-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}
#sp-canvas:active {
  cursor: grabbing;
}

/* Play triangle, first in each row: triangle, number, title.
   --pl-indent lines the artist, progress line and description up under the title
   (triangle 0.5rem + gap 0.45rem + number 1rem + gap 0.45rem). */
.pl-list {
  --pl-indent: 2.4rem;
}
.pl-tri {
  display: inline-block;
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  color: var(--text-soft);
}
.pl-track.is-active .pl-tri {
  color: var(--accent);
}

.pl-list {
  display: flex;
  flex-direction: column;
  margin-top: 0.75rem;
  list-style: none;
}
.pl-row {
  display: block;
  width: 100%;
  padding: 0.8rem 0 0.32rem;
  text-align: left;
}
.pl-title {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  font-size: var(--size-label);
  font-weight: 600;
  line-height: 1.7;
  text-transform: capitalize;
}
.pl-num {
  flex: none;
  min-width: 1rem;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}
.pl-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  padding-left: var(--pl-indent);
  color: var(--text-soft);
  font-size: var(--size-small);
  text-transform: capitalize;
  letter-spacing: 0.04rem;
}
.pl-time {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pl-track.is-active .pl-title,
.pl-track.is-active .pl-num {
  color: var(--accent);
}

.pl-prog {
  position: relative;
  display: none;
  height: 12px;
  margin-left: var(--pl-indent);
  cursor: pointer;
  touch-action: none;
}
.pl-prog::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 5px;
  height: 2px;
  background: var(--line);
}
.pl-fill {
  position: absolute;
  left: 0;
  top: 5px;
  width: 0;
  height: 2px;
  background: var(--accent);
}
.pl-track.is-active .pl-prog {
  display: block;
}

.pl-desc {
  display: none;
  padding: 0.4rem 0 0.65rem var(--pl-indent);
  color: var(--text-soft);
  font-size: calc(var(--size-label) * 0.9);
  line-height: 1.5;
  letter-spacing: 0.02em;
  text-transform: none;
}
.pl-track.show-desc .pl-desc {
  display: block;
}
.pl-link {
  color: var(--accent);
}
.pl-link:hover {
  color: var(--text);
}
/* last line of the playlist: "More recordings coming soon" */
.pl-note {
  padding: 1.1rem 0 0.4rem var(--pl-indent);
  color: var(--text-soft);
  font-size: var(--size-small);
  font-style: italic;
  letter-spacing: 0.04rem;
  text-transform: none;
}
/* close button: × on phones / tablets, "▼ HIDE" on wide screens (see WIDE PLAYER) */
.pl-hide {
  display: none;
}

/* Heading above the playlist ("Selected works"): only on wide screens.
   Gray text, the symbol keeps the red of every .mark. */
.pl-head {
  display: none;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-soft);
  font-size: var(--size-label);
  font-weight: 600;
  letter-spacing: 0.12em;
}
.mini-open svg {
  transition: transform 0.2s;
}

/* >>> WIDE PLAYER (laptops and up, 900px+) <<<
   The opened player is a panel between the header and the mini bar (jjs.js measures
   both and sets --pl-top / --pl-bottom). The space around everything (--pl-gap) is the
   height of the header, so the margins top, bottom, left and between the columns match it.
   The spectrogram is always square (like a record sleeve): as tall as the panel allows,
   but narrower if the window is too narrow for it and the playlist side by side.
   The playlist scrolls on its own. Keep 900px equal to WIDE in jjs.js. */
@media (min-width: 900px) {
  .pl-overlay {
    --pl-list-width: 27rem; /* width of the playlist column */
    --pl-gap: var(--pl-top, 4.5rem); /* = header height */
    --sp-size: min(
      calc(100vh - var(--pl-top, 4.5rem) - var(--pl-bottom, 4rem) - 2 * var(--pl-gap)),
      calc(100vw - var(--pl-list-width) - 3 * var(--pl-gap))
    );
    z-index: 40; /* under the header (90) and the mini bar (50), above the page */
    top: var(--pl-top, 4.5rem);
    bottom: var(--pl-bottom, 4rem);
    justify-content: flex-start;
    padding: 0;
    background: var(--bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .pl-card {
    display: grid;
    grid-template-columns: var(--sp-size) minmax(0, var(--pl-list-width));
    grid-template-rows: auto minmax(0, 1fr);
    align-content: start;
    column-gap: var(--pl-gap);
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    padding: var(--pl-gap);
    overflow: hidden;
    background: none;
    box-shadow: none;
  }
  .sp-wrap {
    grid-column: 1;
    grid-row: 1 / -1;
    width: var(--sp-size);
    height: var(--sp-size);
    aspect-ratio: 1 / 1;
  }
  .pl-head {
    display: flex;
    grid-column: 2;
    padding: 0 6rem 0.6rem 0; /* right: room for "▼ HIDE" */
  }
  .pl-list {
    grid-column: 2;
    grid-row: 2;
    max-height: calc(var(--sp-size) - 2.2rem); /* the list ends where the spectrogram ends */
    margin-top: 0;
    padding-right: 0.6rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
  }
  /* "▼ HIDE" at the right end of the playlist column, level with "Selected works":
     gray small capitals (artist size), the triangle red like the one in the mini bar */
  .pl-close {
    top: calc(var(--pl-gap) - 0.6rem);
    right: calc(100% - 2 * var(--pl-gap) - var(--sp-size) - var(--pl-list-width) + 0.6rem);
    width: auto;
    height: auto;
    line-height: 1.7;
  }
  .pl-x {
    display: none;
  }
  .pl-hide {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text-soft);
    font-size: var(--size-small);
    font-weight: 600;
    letter-spacing: 0.12em;
  }
  .pl-hide svg {
    color: var(--accent);
  }
  .pl-close:hover .pl-hide {
    color: var(--text);
  }
  /* the mini bar's triangle points down while the panel is open (click = close) */
  html.player-open .mini-open svg {
    transform: rotate(180deg);
  }
}

/* 10 ── NEWS PAGE (body.page-news) ────────────────────────────────── */
.page-news .page-title {
  --symbol: "\2299"; /* ⊙ symbol of this page */
}

.news-grid {
  --photo-contrast: 100%; /* contrast of the photos: 100% = normal, higher = punchier */
  display: grid;
  grid-template-columns: 1fr; /* phone: 1 column (2 on tablets, 3 on wide screens) */
  gap: 2rem 1.5rem;
}
.news-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.news-card img,
.news-card video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--panel);
  filter: grayscale(60%) contrast(var(--photo-contrast)); /* delete this line for color photos */
}
.news-card video {
  object-fit: cover; /* "cover" fills and crops. Use "contain" to see the whole video with black bars. */
  background: #000;
  cursor: pointer;
}
/* Video with one round play button in the middle instead of the browser controls.
   Click the button (or the video) to play, click the video again to pause. */
.video-wrap {
  position: relative;
}
.video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3.6rem;
  height: 3.6rem;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--accent); /* same red as the news dates */
  border: 0;
  transition:
    opacity 0.2s,
    filter 0.15s;
}
.video-play::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 54%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 0.6rem 0 0.6rem 1rem;
  border-color: transparent transparent transparent #ffffff;
}
.video-play:hover {
  filter: brightness(1.15);
}
/* the big round button only shows before the first play */
.video-wrap.started .video-play {
  opacity: 0;
  pointer-events: none;
}
/* Small control bar after the first play: play/pause, progress bar, time.
   It fades out after 2 s while playing and comes back on mouse move / tap. */
.vc {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.9rem 0.6rem 0.4rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
  color: #ffffff;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.video-wrap.started .vc {
  opacity: 1;
  pointer-events: auto;
}
.video-wrap.started.idle .vc {
  opacity: 0;
  pointer-events: none;
}
.video-wrap.started.idle {
  cursor: none;
}
.vc-play {
  display: grid;
  place-items: center;
  width: 1rem;
  height: 1rem;
  padding: 0;
  color: #ffffff;
}
.vc-track {
  position: relative;
  flex: 1;
  height: 12px;
  cursor: pointer;
  touch-action: none;
}
.vc-track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 5px;
  height: 2px;
  background: rgba(255, 255, 255, 0.3);
}
.vc-fill {
  position: absolute;
  left: 0;
  top: 5px;
  width: 0;
  height: 2px;
  background: var(--accent);
}
.vc-time {
  white-space: nowrap;
}
.news-caption {
  font-size: var(--size-small);
  color: var(--text-soft);
  text-transform: none;
  letter-spacing: 0.04em;
  line-height: 1.5;
}
.news-date {
  display: block;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
}
@media (min-width: 700px) {
  .news-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1200px) {
  .news-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 11 ── GALLERY PAGE + PHOTO VIEWER (body.page-gallery) ───────────── */
.page-gallery .page-title {
  --symbol: "\2297"; /* ⊗ symbol of this page */
  margin-bottom: 0.75rem;
}
.gallery-intro {
  margin-bottom: 2rem;
  color: var(--text-soft);
  font-size: var(--size-small);
  letter-spacing: 0.04em;
  text-transform: none;
  line-height: 1.5;
}

/* Photo look. 0% grayscale = full color (100% would be black & white), 100% contrast = unchanged.
   Both the feed and the enlarged view use these two numbers. */
.page-gallery {
  --photo-gray: 0%;
  --photo-contrast: 100%;
}

/* The feed: every photo with its caption, shown whole (never cropped).
   1 photo per row on narrow screens, 2 per row on wide screens (1200px and up). */
.gallery-feed {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem 1.5rem;
  align-items: start;
}
.gallery-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}
.gallery-entry img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: auto 3 / 2; /* reserves space while loading, real shape once loaded */
  background: var(--panel);
  filter: grayscale(var(--photo-gray)) contrast(var(--photo-contrast));
}
.gallery-caption {
  margin-top: 0.6rem;
  font-size: var(--size-small);
  color: var(--text-soft);
  text-transform: none;
  letter-spacing: 0.04em;
  line-height: 1.5;
}
@media (min-width: 1200px) {
  .gallery-feed {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Click to enlarge: full-screen viewer */
html:has(#lightbox[open]) {
  overflow: hidden; /* no scrolling behind the viewer */
}
.lightbox {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  background: #000000f2; /* black, 95% */
  color: #ebe9e4;
}
.lightbox[open] {
  display: block;
}
.lb-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  height: 100%;
  padding: 3.5rem 0.75rem 1rem;
  touch-action: pan-y pinch-zoom; /* left/right flicks change the photo */
}
.lb-img {
  flex: 1 1 0;
  width: 100%;
  min-height: 0;
  object-fit: contain;
  filter: grayscale(var(--photo-gray)) contrast(var(--photo-contrast));
  user-select: none;
  -webkit-user-drag: none;
}
.lb-caption {
  flex: none;
  max-width: 50rem;
  font-size: var(--size-small);
  color: #c9c7c1;
  text-align: center;
  text-transform: none;
  letter-spacing: 0.04em;
  line-height: 1.5;
}
.lb-btn {
  position: absolute;
  padding: 0.75rem 1rem;
  font-size: 1.75rem;
  line-height: 1;
  color: #ebe9e4;
  text-shadow: 0 0 6px #000000;
}
.lb-close {
  top: 0.5rem;
  right: 0.5rem;
}
.lb-prev,
.lb-next {
  top: 50%;
  transform: translateY(-50%);
}
.lb-prev {
  left: 0;
}
.lb-next {
  right: 0;
}
.lb-count {
  position: absolute;
  top: 1.25rem;
  left: 1.25rem;
  font-size: var(--size-small);
  letter-spacing: 0.08em;
  color: #9c9a94;
}
@media (min-width: 700px) {
  .lb-figure {
    padding: 3.5rem 4.5rem 1.5rem; /* room for the arrows beside the photo */
  }
  .lb-prev {
    left: 0.75rem;
  }
  .lb-next {
    right: 0.75rem;
  }
}

/* 12 ── WORKS PAGE (body.page-works) ──────────────────────────────────
   Narrow screens: one column, the projects first, the discography below.
   Wide screens (1200px and up): two columns. */
.page-works .works-grid-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
  margin-top: 2rem;
}
.page-works .works-col-left {
  --symbol: "\2295"; /* ⊕ symbol of the projects column */
}
.page-works .works-col-right {
  --symbol: "\229B"; /* ⊛ symbol of the discography column */
}
.page-works .section-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  color: var(--accent);
  font-size: var(--size-label);
  font-weight: 600;
  letter-spacing: 0.12em;
}

/* Projects */
.page-works .activity-block {
  margin-bottom: 2.5rem;
}
.page-works .activity-block:last-child {
  margin-bottom: 0;
}
.page-works .activity-block strong {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text);
  font-size: var(--size-menu);
  font-weight: 600;
  letter-spacing: 0.06em;
}
.page-works .activity-block p {
  margin-bottom: 0.75rem;
  color: var(--text-body);
  font-size: var(--size-body);
  line-height: 1.6;
  letter-spacing: 0.01em;
  text-transform: none;
}
.page-works .activity-block a {
  display: block;
  width: fit-content;
  margin-top: 0.35rem;
  color: var(--accent);
  font-size: var(--size-small);
  letter-spacing: 0.08em;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

/* Discography panel */
.page-works .boxed-discography-panel {
  padding: 1.75rem 1.5rem; /* bigger on tablets and wide screens, see below */
  background: var(--panel);
  border: 0px solid var(--line);
}
.page-works .year-group + .year-group {
  margin-top: 1.75rem;
}
.page-works .year-heading {
  margin-bottom: 0.6rem;
  color: var(--accent);
  font-size: var(--size-menu);
  font-weight: 600;
  letter-spacing: 0.08em;
}
.page-works .archive-list {
  --bullet: var(--text-soft); /* color of the small squares (try var(--accent) for red) */
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  list-style: none;
}
.page-works .archive-list li {
  position: relative;
  padding-left: 1.1rem; /* room for the square */
  color: var(--text-body);
  font-size: 0.875rem;
  line-height: 1.5;
  letter-spacing: 0.02em;
  text-transform: none;
}
.page-works .archive-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em; /* lines the square up with the first line of text */
  width: 0.35rem;
  height: 0.35rem;
  background: var(--bullet);
}
.page-works .archive-list a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

@media (hover: hover) {
  .page-works .activity-block a:hover {
    color: var(--text); /* red links turn to text color on hover */
  }
}
@media (min-width: 700px) {
  .page-works .boxed-discography-panel {
    padding: 2.25rem;
  }
}
/* >>> WORKS COLUMN WIDTHS (laptops and up, 1200px+) <<<
   --works-left / --works-right are shares of the space: 1fr 1fr = equal halves.
   Wider discography: e.g. 1fr 1.3fr.  Fixed width: e.g. --works-right: 32rem
   (the left column then takes whatever is left). */
@media (min-width: 1200px) {
  .page-works .works-grid-layout {
    --works-left: 1fr;
    --works-right: 0.9fr;
    grid-template-columns: minmax(0, var(--works-left)) minmax(0, var(--works-right));
    gap: 3.5rem; /* space between the two columns */
    /* both columns together: 58% of the page width, but never narrower than 52rem
       (so small laptops keep readable columns). Raise 58% to make everything wider. */
    width: max(58%, 52rem);
    margin-inline: auto; /* centered. Delete this line to align the columns to the left */
  }
  /* other pages use a 90% wide, left-aligned body on wide screens; the works page uses
     the full width, so the 80% block above sits truly in the middle of the window */
  body.page-works {
    --page-width: 100%;
  }
}

/* 13 ── AUDIO LAB PAGE (body.page-audiolab) ───────────────────────────── */
.page-audiolab .page-title {
  --symbol: "\2296"; /* ⊖ symbol of this page */
}

/* The lab's old color names, translated to the site colors, so the lab
   follows light / dark and your accent. */
.page-audiolab {
  --card-bg: var(--panel);
  --panel-bg: var(--panel);
  --border-color: var(--line);
  --text-main: var(--text);
  --text-muted: var(--text-soft);
  --accent-color: var(--accent);
  --link-hover: var(--accent);
  --btn-bg: var(--hover);
  --btn-hover: var(--line);
  --emerald-played: var(--accent);
  --emerald-glow: 0 4px 16px #00000040;
  --spectro-bg: #141413; /* background of the 3D view and scopes */
  --font-family: var(--font);
}
.lab-content {
  text-transform: none; /* lab texts keep their own case, buttons are uppercase below */
  letter-spacing: 0.02em;
}
/* Wide screens (laptops and up): the lab is a narrower column, centered */
@media (min-width: 1200px) {
  .lab-content {
    --lab-width: 48vw; /* width of the whole lab column: 48% of the window */
    width: var(--lab-width);
    min-width: 40rem; /* never narrower than this, so the controls keep fitting */
    margin-inline: auto;
  }
  /* other pages use a 90% wide, left-aligned body on wide screens; the lab uses the
     full width, so the column above sits truly in the middle of the window */
  body.page-audiolab {
    --page-width: 100%;
  }
}
.lab-content .ctrl-btn,
.lab-content .control-label,
.lab-content .card-badge {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.lab-wip-notice {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  border-left: 2px solid var(--accent-color);
  padding: 0.35rem 0.75rem;
  background: var(--card-bg);
  border-radius: 0;
  line-height: 1.45;
  margin-bottom: 0.7rem;
}
.transport-bar {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 0;
  padding: 0.9rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.35rem;
}
.transport-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.transport-center {
  flex: 1;
  min-width: 240px;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.track-title {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.time-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.time-display {
  font-size: 0.72rem;
  font-family: monospace;
  color: var(--text-muted);
  min-width: 65px;
}
.seek-slider,
.vol-slider,
.range-input {
  height: 5px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border-color);
  border-radius: 0;
  outline: none;
  cursor: pointer;
}
.seek-slider {
  flex: 1;
}
.seek-slider::-webkit-slider-thumb,
.vol-slider::-webkit-slider-thumb,
.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 0;
  background: var(--accent-color);
  cursor: pointer;
}
.transport-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.vol-slider {
  width: 80px;
}
.ctrl-btn {
  background: var(--btn-bg);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.35rem 0.65rem;
  border-radius: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  user-select: none;
  white-space: nowrap;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}
.ctrl-btn:hover {
  background: var(--btn-hover);
  border-color: var(--accent-color);
}
.ctrl-btn.active {
  background: var(--accent-color);
  color: #ffffff;
  border-color: var(--accent-color);
}
.canvas-viewport-wrap {
  position: relative;
  width: 100%;
  height: 55vh;
  min-height: 380px;
  max-height: 720px;
  background: var(--spectro-bg);
  border: 1px solid var(--border-color);
  border-radius: 0;
  overflow: hidden;
  margin-bottom: 0.35rem;
}
#spectro-lab-canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  color: #ffffff;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  z-index: 20;
  pointer-events: none;
}
.drop-overlay.drag-over {
  display: flex;
}
.drop-hint {
  font-size: 0.8rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 0.35rem;
}
.viewport-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--btn-bg);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-main);
  z-index: 10;
  pointer-events: none;
}
.spectro-fs-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
}
.spectro-zoom-ctrls {
  position: absolute;
  bottom: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  z-index: 10;
}
.spectro-zoom-btn {
  padding: 0.35rem 0.55rem;
  font-size: 0.82rem;
  font-weight: 700;
}
.spectro-nav-arrows {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  z-index: 10;
}
.spectro-arrow-btn {
  background: var(--btn-bg);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 700;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease;
}
.spectro-arrow-btn:hover {
  background: var(--btn-hover);
  border-color: var(--accent-color);
}
.fs-hud-hidden .spectro-fs-btn,
.fs-hud-hidden .spectro-zoom-ctrls,
.fs-hud-hidden .spectro-nav-arrows,
.fs-hud-hidden .viewport-badge {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.topography-panel {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 0;
  padding: 1.25rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-bottom: 0.35rem;
}
.topography-panel[hidden] {
  display: none; /* the "hidden" word in the HTML hides the whole panel */
}
.panel-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.group-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-color);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.35rem;
}
.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.8rem;
}
.control-label {
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
}
.control-value {
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 38px;
  text-align: right;
}
.range-input {
  flex: 1;
  max-width: 140px;
}
.btn-pill-group {
  display: inline-flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.pill-btn {
  background: var(--btn-bg);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 0;
  cursor: pointer;
}
.pill-btn.active {
  background: var(--accent-color);
  color: #ffffff;
  border-color: var(--accent-color);
}
.scope-box {
  position: relative;
  width: 100%;
  height: 175px;
  background: var(--spectro-bg);
  border: 1px solid var(--border-color);
  border-radius: 0;
  overflow: hidden;
  margin-bottom: 0.35rem;
}
#rta-canvas,
#waterfall-canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.ribbon-card {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 0;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
  margin-bottom: 0.35rem;
}
.theremin-header {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.65rem;
}
.theremin-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.theremin-vol-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.ribbon-header-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.ribbon-pad-wrap {
  position: relative;
  width: 100%;
  height: 200px;
  background: #000000;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0;
  overflow: hidden;
  cursor: crosshair;
}
#ribbon-canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.utility-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.7rem;
  width: 100%;
  margin-bottom: 0.35rem;
}
.utility-card {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 0;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
}
.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}
.card-badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-color);
}
.strobe-container {
  position: relative;
  width: 100%;
  height: 48px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 0;
  overflow: hidden;
}
.strobe-canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.strobe-center-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: var(--accent-color);
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 2;
}
.tuner-display-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.35rem 0;
}
.tuner-note-row {
  display: inline-flex;
  align-items: baseline;
  gap: 0.15rem;
}
.tuner-note-name {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-main);
  transition: color 0.15s ease;
}
.tuner-note-name.in-tune {
  color: var(--accent-color);
}
.tuner-octave {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
}
.tuner-freq-readout {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.tuner-gauge-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.tuner-track {
  position: relative;
  width: 100%;
  height: 8px;
  background: var(--border-color);
  border-radius: 0;
  overflow: hidden;
}
.tuner-center-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: var(--text-main);
  transform: translateX(-50%);
}
.tuner-needle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  background: #d96d14;
  transform: translateX(-50%);
  transition: left 0.08s ease-out;
}
.tuner-needle.in-tune {
  background: var(--accent-color);
}
.tuner-scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  font-family: monospace;
  color: var(--text-muted);
}
.metro-beat-light {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border-color);
  transition: background-color 0.05s ease;
}
.metro-beat-light.flash {
  background: var(--accent-color);
  box-shadow: 0 0 8px var(--accent-color);
}
.metro-display-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0;
}
.metro-bpm-row {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
}
.metro-bpm-val {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-main);
}
.metro-bpm-unit {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}
.metro-btn-row {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.metro-step-btn {
  min-width: 32px;
  padding: 0.35rem 0.45rem;
  font-size: 0.72rem;
}
.metro-controls-grid {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.metro-ts-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
}
.metro-beat-strip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding-top: 0.35rem;
  flex-wrap: wrap;
}
/* Beat dots (the old lab stylesheet had no rules for these, so they were invisible) */
.metro-dot {
  width: 14px;
  height: 14px;
  background: var(--btn-bg);
  border: 1px solid var(--border-color);
  cursor: pointer;
}
.metro-dot.accent {
  background: var(--text-muted);
}
.metro-dot.downbeat {
  background: var(--accent-color);
  border-color: var(--accent-color);
}
.metro-dot.flash-active {
  outline: 2px solid var(--text-main);
  outline-offset: 1px;
}
.metro-select {
  background: var(--btn-bg);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  font-family: var(--font-family);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.28rem 0.5rem;
  border-radius: 0;
  cursor: pointer;
  outline: none;
}
.metro-select option {
  background: var(--bg);
  color: var(--text-main);
}
/* Drum machine step grid (built by the script in audiolab.html).
   --dm-steps is set by the script to the number of steps in the bar. */
.dm-grid {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.dm-row {
  display: grid;
  grid-template-columns: 3.1rem repeat(var(--dm-steps, 16), minmax(0, 1fr));
  gap: 2px;
}
.dm-lane {
  padding: 0;
  color: var(--text-muted);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-align: left;
}
.dm-lane.muted {
  opacity: 0.35;
  text-decoration: line-through;
}
.dm-cell {
  height: 18px;
  padding: 0;
  background: var(--btn-bg);
  border: 0;
}
/* light line on every beat, stronger line where each group (2+2+3 ...) begins */
.dm-cell.beat-start {
  box-shadow: inset 1px 0 0 color-mix(in srgb, var(--text-muted) 45%, transparent);
}
.dm-cell.group-start {
  box-shadow: inset 2px 0 0 var(--text-muted);
}
/* header: beat light + TAP button side by side */
.dm-head-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
/* pattern menu + square dice button */
.dm-pattern-wrap {
  align-items: center;
  gap: 0.3rem;
}
.dm-dice {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  justify-content: center;
}
/* Compact drum machine card: smaller BPM, speed slider under it,
   settings in a two-column grid with small labels on top */
.dm-card {
  gap: 0.75rem;
  padding: 1rem 1.1rem;
}
.dm-card .card-header-row {
  padding-bottom: 0.4rem;
}
.dm-card .dm-cell {
  height: 15px;
}
.dm-card .metro-display-center {
  gap: 0.45rem;
  padding: 0;
}
.dm-card .metro-bpm-val {
  font-size: 1.9rem;
}
.dm-speed {
  width: 70%;
  max-width: none;
}
.dm-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 0.9rem;
}
.dm-field {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.3rem;
  min-width: 0;
}
.dm-label {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.dm-label span {
  font-family: monospace;
  font-weight: 400;
}
.dm-field > .metro-select {
  width: 100%;
}
.dm-field > .range-input {
  width: 100%;
  max-width: none;
  margin: 0.6rem 0;
}
.dm-pattern-wrap {
  display: flex;
  min-width: 0;
}
.dm-pattern-wrap .metro-select {
  flex: 1;
  min-width: 0;
}
/* START and CLEAR: same width, a bit wider than the -1 / +1 buttons */
.dm-main-btn {
  min-width: 4.4rem;
  justify-content: center;
}
.dm-cell.on {
  background: var(--accent-color);
}
.dm-cell.now {
  outline: 1px solid var(--text-main);
  outline-offset: -1px;
}

@media (max-width: 640px) {
  .page-audiolab .utility-row,
  .page-audiolab .topography-panel {
    grid-template-columns: 1fr;
  }
}

/* 14 ── ABOUT PAGE (body.page-about) ──────────────────────────────────
   about.html uses the same bio sections as the index (section 7),
   only opened by default. Its background photo is set in section 0. */

/* 15 ── HOVER & MOTION ─────────────────────────────────────────────── */
@media (hover: hover) {
  a:hover,
  button:hover {
    color: var(--accent);
  }
  .controls button:hover {
    color: var(--text); /* red buttons turn to text color on hover */
  }
}

/* Reduced motion: UI transitions and the menu pop are switched off, but the
   background crossfade (.bg-layer) is exempt so it still fades smoothly. */
@media (prefers-reduced-motion: reduce) {
  *:not(.bg-layer) {
    transition-duration: 0.01ms !important;
  }
  #menu,
  #menu .menu-card {
    animation: none !important;
  }
}

/* 16 ── SCREEN SIZES & MOBILE TRUNCATION ──────────────────────────── */

/* Phone: controls collapse into the hamburger menu */
@media (max-width: 699px) {
  .controls #lang-btn,
  .controls #theme-btn {
    display: none !important;
  }
  #menu-btn .menu-label {
    display: none;
  }
  #menu-btn .hamburger-icon {
    display: flex;
  }
  #menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.2rem;
  }

  /* Full-screen player on phones: no gap around the card, inner padding unchanged.
     env(safe-area-*) only adds space on phones with a notch / home bar (0 elsewhere). */
  .pl-overlay {
    padding: 0;
  }
  .pl-card {
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    padding-top: calc(2.5rem + env(safe-area-inset-top));
    padding-bottom: calc(1.6rem + env(safe-area-inset-bottom));
    padding-left: max(2.3rem, env(safe-area-inset-left));
    padding-right: max(2.3rem, env(safe-area-inset-right));
    box-shadow: none;
  }
  .pl-close {
    top: calc(0.4rem + env(safe-area-inset-top));
    right: max(0.3rem, env(safe-area-inset-right));
  }
}

/* Tablet and up: 700px+ */
@media (min-width: 700px) {
  :root {
    --side-space: 3rem;
  }
  body {
    padding-top: 5.5rem;
  }
  .brand-full {
    display: inline;
  }
  .brand-short {
    display: none;
  }

  /* Mini player: play button, label and triangle sit close together in the
     middle of the full-width bar. The label is only as wide as its text
     (up to 26rem; longer titles end in "…"). */
  .mini-bar {
    justify-content: center;
  }
  .mini-meta {
    flex: 0 1 auto;
    max-width: 26rem;
  }
  .mini-title,
  .mini-artist {
    max-width: 100%;
  }
}

/* Wide screens: 1200px+ */
@media (min-width: 1200px) {
  :root {
    --page-width: 90%;
  }
  .bio section {
    display: grid;
    grid-template-columns: 10.5rem 1fr;
    column-gap: 2.5rem;
    align-items: start;
  }
  .bio section:not(.is-collapsed) h2 {
    margin-bottom: 0;
  }
  .is-short:not(.is-collapsed) h2,
  .is-long:not(.is-collapsed) h2,
  .is-contact:not(.is-collapsed) h2 {
    min-height: calc(var(--size-body) * 1.6);
  }
}
