/* ── Tokens ─────────────────────────────────────────────────────────── */
:root {
  --bg: #0a0a0a;
  --panel: #0f0f0f;
  --panel-soft: #161616;
  --text: #f3f0ea;
  --muted: rgba(243, 240, 234, .76);
  --faint: rgba(243, 240, 234, .5);
  --line: rgba(243, 240, 234, .12);
  --line-strong: rgba(243, 240, 234, .22);
  --chip: rgba(255, 255, 255, .06);

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Inter', system-ui, sans-serif;

  --text-xs: clamp(.74rem, .7rem + .2vw, .88rem);
  --text-sm: clamp(.92rem, .86rem + .25vw, 1rem);
  --text-base: clamp(1rem, .95rem + .35vw, 1.12rem);
  --text-lg: clamp(1.18rem, 1rem + .8vw, 1.5rem);
  --text-hero: clamp(3.2rem, 4.8vw + 1rem, 5.8rem);

  --space-1: .25rem; --space-2: .5rem; --space-3: .75rem; --space-4: 1rem;
  --space-5: 1.25rem; --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem;
  --space-12: 3rem; --space-16: 4rem;

  --radius: 1.2rem;
  --transition: 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 300;
  letter-spacing: .005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }
img, video { display: block; max-width: 100%; }

/* ── Topbar ─────────────────────────────────────────────────────────── */
.topbar {
  display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-6);
  padding: 1.6rem 2rem 0; position: relative; z-index: 10;
}
.brand {
  font-family: var(--font-display);
  font-size: 1.45rem; font-weight: 500; letter-spacing: -0.02em;
  line-height: 1;
}
.nav-wrap {
  display: flex; align-items: center; justify-content: flex-end;
  gap: var(--space-6); flex-wrap: wrap;
}
.nav { display: flex; gap: 1.4rem; flex-wrap: wrap; align-items: center; }
.nav button {
  font-size: .82rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); padding: .3rem 0; position: relative;
  transition: color var(--transition);
}
.nav button:hover { color: var(--text); }
.nav button[aria-selected="true"] { color: var(--text); }
.nav button[aria-selected="true"]::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -4px;
  height: 1px; background: var(--text);
}
/* Terms tab — smaller, more discreet than the rest */
.nav button.nav-terms {
  font-size: .68rem;
  letter-spacing: .1em;
  opacity: .7;
}
.nav button.nav-terms:hover { opacity: 1; }
.controls { display: flex; gap: .35rem; }
.chip {
  padding: .35rem .65rem; font-size: .7rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--faint);
  border: 1px solid var(--line); border-radius: 999px;
  transition: all var(--transition);
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip.active { color: var(--text); border-color: var(--text); background: var(--chip); }

/* ── Pages ──────────────────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

/* Hero (home) */
.hero-page { position: relative; min-height: calc(100dvh - 90px); overflow: hidden; }
/* When home is active, the photo covers the entire viewport (including under the topbar). */
body.home-active .hero-bg,
body.home-active .hero-flare,
body.home-active .hero-flare-2 {
  position: fixed;
}
body.home-active .topbar { background: transparent; }
.hero-bg {
  position: absolute; inset: 0; z-index: 0;
  background-image: url('../img/home-bg.jpg');
  background-size: cover;
  background-position: center;
  filter: grayscale(.18) brightness(.7) contrast(1.05);
}
.hero-bg::after {
  /* darkening vignette so text remains legible */
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 30% 70%, transparent 0%, rgba(0,0,0,.35) 70%),
    linear-gradient(to top, rgba(0,0,0,.55) 0%, rgba(0,0,0,.15) 60%, rgba(0,0,0,.45) 100%);
}
/* Stage-light flare A — warm, top-left drift */
.hero-flare {
  position: absolute; z-index: 2;
  width: 70vmax; height: 70vmax;
  left: -10vmax; top: -10vmax;
  pointer-events: none; mix-blend-mode: screen;
  background: radial-gradient(circle at center,
    rgba(255, 220, 170, .55) 0%,
    rgba(255, 200, 140, .25) 18%,
    rgba(255, 200, 140, 0) 50%);
  filter: blur(30px);
  animation: flareA 22s ease-in-out infinite alternate;
  will-change: transform, opacity;
}
/* Stage-light flare B — cool, opposite phase */
.hero-flare-2 {
  position: absolute; z-index: 2;
  width: 80vmax; height: 80vmax;
  right: -20vmax; bottom: -25vmax;
  pointer-events: none; mix-blend-mode: screen;
  background: radial-gradient(circle at center,
    rgba(200, 220, 255, .35) 0%,
    rgba(180, 200, 255, .15) 22%,
    rgba(180, 200, 255, 0) 55%);
  filter: blur(50px);
  animation: flareB 32s ease-in-out infinite alternate;
  will-change: transform, opacity;
}
/* Hot-spot pulse — adds a barely-perceptible breathing intensity */
.hero-bg::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 35% 45%,
    rgba(255, 240, 210, .15) 0%,
    rgba(255, 240, 210, 0) 45%);
  mix-blend-mode: screen;
  animation: heroPulse 9s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes flareA {
  0%   { transform: translate3d(0, 0, 0)        scale(1);    opacity: .55; }
  35%  { transform: translate3d(8vw, 3vh, 0)    scale(1.08); opacity: .85; }
  70%  { transform: translate3d(-4vw, 6vh, 0)   scale(1.02); opacity: .7;  }
  100% { transform: translate3d(12vw, -2vh, 0)  scale(1.12); opacity: .9;  }
}
@keyframes flareB {
  0%   { transform: translate3d(0, 0, 0)        scale(1);    opacity: .4; }
  50%  { transform: translate3d(-6vw, -8vh, 0)  scale(1.15); opacity: .75; }
  100% { transform: translate3d(5vw, 4vh, 0)    scale(.95);  opacity: .55; }
}
@keyframes heroPulse {
  0%   { opacity: .35; transform: scale(1); }
  100% { opacity: .85; transform: scale(1.08); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-flare, .hero-flare-2, .hero-bg::before { animation: none; }
}
.hero {
  position: relative; z-index: 2;
  min-height: calc(100dvh - 90px);
  padding: 3rem 2rem 4rem;
  display: flex; align-items: flex-end;
}
.hero .intro { max-width: 50ch; }
.hero .title {
  text-shadow: 0 4px 30px rgba(0,0,0,.55);
}
.hero .lede {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.05rem, 1.6vw + .3rem, 1.45rem);
  letter-spacing: .005em;
  color: rgba(243,240,234,.78);
  max-width: 36ch;
  line-height: 1.55;
  text-shadow: 0 2px 12px rgba(0,0,0,.7);
}
.hero .lede em {
  font-style: italic;
  color: inherit;
  font-family: inherit;
}
.hero .lede-sub {
  margin-top: 1.1rem;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(.85rem, .9vw + .35rem, 1.05rem);
  letter-spacing: .01em;
  color: rgba(243,240,234,.62);
  max-width: 38ch;
  line-height: 1.5;
  text-shadow: 0 2px 10px rgba(0,0,0,.65);
}

/* Hero title doubles as the background-music toggle.
   When playing, a sepia/warm glow breathes with audio amplitude (--amp). */
.hero .title {
  --amp: 0;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  text-shadow: 0 4px 30px rgba(0, 0, 0, .55);
  transition: text-shadow 280ms ease, color 360ms ease, letter-spacing 360ms ease;
  display: inline-block;
}
.hero .title:hover {
  text-shadow:
    0 4px 30px rgba(0, 0, 0, .55),
    0 0 28px  rgba(255, 200, 140, .22),
    0 0 8px   rgba(255, 220, 170, .14);
}
.hero .title:focus-visible {
  outline: none;
  text-shadow:
    0 4px 30px rgba(0, 0, 0, .55),
    0 0 24px  rgba(255, 200, 140, .35);
}
/* Audio-reactive sepia glow while playing — text-shadow scales with --amp.
   No transition during playback (text-shadow updates each frame, smoothly via JS). */
.hero .title.playing {
  color: rgba(252, 240, 220, 1);
  letter-spacing: -0.038em;
  transition: color 1.2s ease, letter-spacing 1.2s ease;
  text-shadow:
    0 4px 30px rgba(0, 0, 0, .5),
    /* tight inner warm wash */
    0 0 calc(6px  + var(--amp) * 14px)  rgba(255, 240, 210, calc(0.45 + var(--amp) * 0.30)),
    /* mid sepia layer */
    0 0 calc(22px + var(--amp) * 50px)  rgba(248, 195, 130, calc(0.40 + var(--amp) * 0.45)),
    /* outer deep-sepia bloom */
    0 0 calc(48px + var(--amp) * 90px)  rgba(220, 155, 90,  calc(0.20 + var(--amp) * 0.45));
}
.kicker {
  font-size: .78rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--faint); margin-bottom: 1.4rem;
}
.title {
  font-family: var(--font-display); font-weight: 400;
  font-size: var(--text-hero); line-height: .92; letter-spacing: -0.04em;
  margin-bottom: 1.6rem;
}
.lede {
  font-size: var(--text-lg); line-height: 1.45; color: var(--muted);
  font-weight: 300; max-width: 28ch;
}
.lede em { font-family: var(--font-display); font-style: italic; color: var(--text); }

/* Content pages */
.content-shell {
  display: grid; grid-template-columns: 1fr 1.6fr; gap: 4rem;
  padding: 6rem 2rem 4rem; max-width: 1400px; margin: 0 auto;
  align-items: start;
}
.page-label {
  font-size: .72rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--faint); margin-bottom: 1.2rem;
}
.content-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(2.6rem, 4vw + 1rem, 4.6rem);
  line-height: .95; letter-spacing: -0.04em; margin-bottom: 1.6rem;
}
.content-intro {
  color: var(--muted); font-size: var(--text-base); line-height: 1.6;
  max-width: 32ch;
}
.content-card {
  border-top: 1px solid var(--line);
  padding-top: 1.6rem;
}

/* ── Works list ──────────────────────────────────────────────────────── */
.year-heading {
  font-family: var(--font-display); font-size: 1.6rem; font-style: italic;
  color: var(--faint); margin: 2.4rem 0 .8rem;
  letter-spacing: -0.02em;
}
.year-heading:first-child { margin-top: 0; }

.work-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1.2rem; width: 100%;
  padding: 1rem 0;
  border: 0; border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;          /* override <button> default */
  font: inherit; color: inherit;
  cursor: pointer;
  transition: padding var(--transition), border-color var(--transition);
}
.work-row:hover { padding-left: .35rem; border-color: var(--line-strong); }
.work-row:focus-visible { outline: 1px solid var(--text); outline-offset: 4px; }

/* Poster thumbnail at the start of each row */
.work-thumb {
  flex-shrink: 0;
  width: 56px; height: 56px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  transition: border-color var(--transition);
}
.work-row:hover .work-thumb { border-color: var(--line-strong); }
.work-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.work-thumb--empty {
  /* subtle placeholder when no poster yet */
  background:
    repeating-linear-gradient(45deg,
      rgba(243,240,234,.025) 0 4px,
      transparent 4px 8px);
}

.work-info {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: .25rem; flex: 1; min-width: 0; text-align: left;
}
.work-title { font-size: var(--text-base); color: var(--text); font-weight: 400; text-align: left; display: block; }
.work-detail {
  font-size: var(--text-xs); color: var(--faint); line-height: 1.5; text-align: left; display: block;
}
.work-meta { display: flex; align-items: center; gap: .8rem; flex-shrink: 0; color: var(--faint); }
.work-year { font-family: var(--font-display); font-style: italic; font-size: 1.1rem; }
.work-arrow { font-size: .9rem; transition: transform var(--transition); }
.work-row:hover .work-arrow { transform: translateX(4px); color: var(--text); }

/* About-page meta lists */
.section { margin-top: 2.4rem; }
.section strong {
  display: block; font-size: .72rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--faint); margin-bottom: .9rem; font-weight: 500;
}
.bio-text { color: var(--muted); line-height: 1.7; margin-bottom: 1rem; max-width: 65ch; }
.meta-list, .award-list { list-style: none; }
.meta-list li, .award-list li {
  display: flex; justify-content: space-between; gap: 1.4rem;
  padding: .6rem 0; border-bottom: 1px solid var(--line);
  font-size: var(--text-sm); color: var(--muted); line-height: 1.5;
}
.award-list .yr {
  font-family: var(--font-display); font-style: italic;
  color: var(--faint); flex-shrink: 0; min-width: 3rem;
}

/* About-page portrait */
.about-portrait {
  margin-top: 1.6rem;
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  max-width: 100%;
}
.about-portrait img {
  width: 100%; height: auto; display: block;
  filter: grayscale(.1) contrast(1.02);
}

/* Download buttons (Softwares / TRIGUE etc.) */
.downloads-list { display: flex; flex-direction: column; gap: .6rem; margin-top: 1rem; }
.download-btn {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.2rem;
  background: var(--text); color: var(--bg);
  border-radius: 8px; font-weight: 500;
  letter-spacing: .04em; font-size: .9rem;
  transition: background var(--transition), transform var(--transition);
}
.download-btn:hover { background: #fff; transform: translateY(-1px); }
.download-btn .dl-meta {
  font-family: var(--font-display); font-style: italic;
  font-size: .82rem; opacity: .7;
}
.download-btn .dl-arrow {
  font-size: 1rem; opacity: .8;
}

.contact-links { display: flex; flex-direction: column; gap: .8rem; margin-top: 1.4rem; }
.contact-links a {
  font-size: var(--text-base); color: var(--text);
  border-bottom: 1px solid var(--line);
  padding-bottom: .4rem; width: max-content;
  transition: border-color var(--transition);
}
.contact-links a:hover { border-color: var(--text); }

/* ── Modal (work detail) ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, .82);
  display: none; align-items: center; justify-content: center;
  padding: 2rem;
  backdrop-filter: blur(4px);
  /* The OVERLAY no longer scrolls — scrolling happens inside .modal-body. */
  overflow: hidden;
}
.modal-overlay.open { display: flex; }
.modal {
  width: 100%; max-width: 980px;
  max-height: min(92vh, 100dvh);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex; flex-direction: column; overflow: hidden;
  animation: modalIn 320ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalIn {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.modal-header {
  flex-shrink: 0;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1.4rem; padding: 1.8rem 2rem 1.2rem;
}
.modal-tag {
  font-size: .68rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--faint); margin-bottom: .55rem;
}
.modal-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  line-height: 1; letter-spacing: -0.04em; color: var(--text);
  margin-bottom: .55rem;
}
.modal-detail {
  font-size: var(--text-sm); color: var(--muted); line-height: 1.6;
  max-width: 80ch;
}
/* Long-form description (e.g. plug-in README): roomy reading panel below the poster */
.long-desc {
  font-family: var(--font-body); font-size: .94rem;
  color: var(--muted); line-height: 1.7;
  white-space: pre-wrap;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.4rem 1.6rem;
  margin-bottom: 1.6rem;
  max-height: 60vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.long-desc::-webkit-scrollbar { width: 6px; }
.long-desc::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.terms-body {
  max-height: 70vh;
  font-size: .92rem;
  line-height: 1.75;
}

/* SoundCloud line on About */
.soundcloud-line {
  margin: .4rem 0 1.6rem;
  color: var(--muted); font-size: var(--text-sm); line-height: 1.6;
  font-style: italic;
}
.soundcloud-line a {
  color: var(--text); border-bottom: 1px solid var(--line);
  padding-bottom: 1px; transition: border-color var(--transition);
  font-style: normal;
}
.soundcloud-line a:hover { border-color: var(--text); }
.modal-close {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid var(--line); background: rgba(255,255,255,.04);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: var(--muted);
  transition: all var(--transition);
}
.modal-close:hover { background: rgba(255,255,255,.12); color: var(--text); }

.modal-body {
  flex: 1 1 auto;
  min-height: 0;                /* required so children can overflow inside flex column */
  padding: 1.4rem 2rem 2.4rem;
  overflow-y: scroll;           /* always show track so user notices scrollability */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(243,240,234,.32) transparent;
  /* Soft fade at the bottom edge — visual hint that there's more content below */
  mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 18px), transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 18px), transparent 100%);
}
/* When user has scrolled to the bottom, drop the fade so the last line is fully visible */
.modal-body.at-bottom {
  mask-image: none;
  -webkit-mask-image: none;
}
.modal-body::-webkit-scrollbar {
  width: 10px;
}
.modal-body::-webkit-scrollbar-track {
  background: rgba(243,240,234,.04);
  margin: 4px 0;
}
.modal-body::-webkit-scrollbar-thumb {
  background: rgba(243,240,234,.28);
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: background .2s ease;
}
.modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(243,240,234,.5);
  background-clip: padding-box;
}

/* Poster — dynamic height, never crops; black bars when needed */
.modal-poster {
  width: 100%;
  background: #000;
  margin-bottom: 1.6rem;
  border-radius: 8px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  max-height: 70vh;
}
.modal-poster img {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Empty state */
.modal-empty {
  text-align: center; padding: 3rem 1rem;
  font-family: var(--font-display); font-style: italic; font-size: 1.2rem;
  color: var(--faint); border: 1px dashed var(--line); border-radius: 8px;
}

/* ── Accordion ───────────────────────────────────────────────────────── */
.accordion { display: flex; flex-direction: column; }
.acc-item {
  border-top: 1px solid var(--line);
}
.acc-item:last-child { border-bottom: 1px solid var(--line); }
.acc-trigger {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; padding: 1.1rem 0;
  font-size: .78rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--text);
  transition: color var(--transition);
}
.acc-trigger:hover { color: var(--text); }
.acc-count {
  font-family: var(--font-display); font-style: italic;
  color: var(--faint); font-size: 1rem; letter-spacing: 0;
  text-transform: none;
}
.acc-icon {
  width: 18px; height: 18px; position: relative; flex-shrink: 0;
  transition: transform var(--transition);
}
.acc-icon::before, .acc-icon::after {
  content: ''; position: absolute; top: 50%; left: 0; right: 0;
  height: 1px; background: var(--text); transform-origin: center;
  transition: transform var(--transition);
}
.acc-icon::after { transform: rotate(90deg); }
.acc-item.open .acc-icon::after { transform: rotate(0deg); }
.acc-panel {
  overflow: hidden; max-height: 0;
  transition: max-height 360ms cubic-bezier(0.16, 1, 0.3, 1);
}
.acc-item.open .acc-panel { max-height: 4000px; }
.acc-content { padding: .4rem 0 1.6rem; }

/* ── Audio player (custom, P&B, SoundCloud-inspired) ────────────────── */
.player {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.2rem 1.4rem;
}
.player-main {
  display: flex; align-items: center; gap: 1rem;
  padding-bottom: 1rem; border-bottom: 1px solid var(--line);
}
.player-btn {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--text); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background var(--transition);
}
.player-btn:hover { background: var(--text); color: var(--bg); }
.player-btn svg { width: 14px; height: 14px; }
.player-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .35rem; }
.player-track-name {
  font-size: var(--text-sm); color: var(--text); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.player-timeline {
  position: relative; height: 3px; background: var(--line);
  cursor: pointer; border-radius: 2px;
}
.player-progress { position: absolute; left: 0; top: 0; bottom: 0; background: var(--text); border-radius: 2px; width: 0%; }
.player-time {
  font-family: var(--font-display); font-feature-settings: "tnum";
  font-size: .85rem; color: var(--faint); flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.tracklist { margin-top: .8rem; max-height: 320px; overflow-y: auto; padding-right: .4rem; }
.tracklist::-webkit-scrollbar { width: 4px; }
.tracklist::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }
.track {
  display: flex; align-items: center; gap: .9rem;
  padding: .55rem .2rem; cursor: pointer;
  border-bottom: 1px solid rgba(243,240,234,.05);
  transition: padding-left var(--transition);
}
.track:hover { padding-left: .5rem; }
.track.active { padding-left: .5rem; }
.track.active::before {
  content: ''; width: 2px; height: 14px; background: var(--text);
  margin-right: -.4rem;
}
.track-num {
  font-family: var(--font-display); font-style: italic;
  color: var(--faint); font-size: .9rem; min-width: 1.6rem;
  font-variant-numeric: tabular-nums;
}
.track-name { flex: 1; font-size: .88rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track.active .track-name { color: var(--text); }
.track-group {
  font-family: var(--font-display); font-style: italic;
  color: var(--faint); font-size: .78rem; flex-shrink: 0;
}

.tracklist-section-label {
  font-size: .68rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--faint); padding: .9rem 0 .35rem;
}

/* SoundCloud embed wrapper */
.sc-embed { background: var(--panel-soft); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; }
.sc-embed iframe { width: 100%; border: 0; }

/* ── Image grid + lightbox ──────────────────────────────────────────── */
.image-group-label {
  font-size: .68rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--faint); margin: 1.2rem 0 .8rem;
}
.image-group-label:first-child { margin-top: .4rem; }
.image-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .55rem;
}
.image-thumb {
  aspect-ratio: 4/3; border-radius: 6px; overflow: hidden;
  background: var(--panel-soft); cursor: zoom-in;
  border: 1px solid transparent; transition: border-color var(--transition);
}
.image-thumb:hover { border-color: var(--line-strong); }
.image-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 600ms ease; }
.image-thumb:hover img { transform: scale(1.04); }

.lightbox {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.94);
  display: none; align-items: center; justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 90vh; object-fit: contain; }
.lightbox-close {
  position: absolute; top: 1.4rem; right: 1.6rem;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.05);
  color: #fff; display: flex; align-items: center; justify-content: center;
}
.lightbox-close:hover { background: rgba(255,255,255,.18); }

/* PDF iframe */
.pdf-frame {
  width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel-soft);
}
.pdf-link {
  display: inline-block; margin-top: .6rem;
  font-size: .78rem; letter-spacing: .15em; text-transform: uppercase;
  color: var(--faint); border-bottom: 1px solid var(--line); padding-bottom: .2rem;
}
.pdf-link:hover { color: var(--text); border-color: var(--text); }

/* ── Video grid + modal ─────────────────────────────────────────────── */
.video-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .8rem;
}
.video-thumb {
  position: relative; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden;
  background: var(--panel-soft); cursor: pointer;
  border: 1px solid var(--line); transition: border-color var(--transition);
}
.video-thumb:hover { border-color: var(--line-strong); }
.video-thumb video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.video-thumb-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,.25);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.video-thumb:hover .video-thumb-overlay { background: rgba(0,0,0,.1); }
.video-thumb-play {
  width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.7); background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
}
.video-thumb-play::before {
  content: ''; width: 0; height: 0;
  border-left: 12px solid #fff; border-top: 7px solid transparent; border-bottom: 7px solid transparent;
  margin-left: 3px;
}
.video-thumb-name {
  position: absolute; left: .6rem; bottom: .55rem; right: .6rem;
  font-size: .78rem; color: rgba(255,255,255,.92);
  text-shadow: 0 1px 4px rgba(0,0,0,.6); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}

.video-modal {
  position: fixed; inset: 0; z-index: 310;
  background: rgba(0,0,0,.95);
  display: none; align-items: center; justify-content: center;
  padding: 2rem;
}
.video-modal.open { display: flex; }
.video-modal-inner {
  width: 100%; max-width: 1100px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  overflow: hidden; display: flex; flex-direction: column;
}
.video-modal video {
  width: 100%; max-height: 75vh; background: #000;
}
.video-controls {
  display: flex; align-items: center; gap: 1rem;
  padding: .8rem 1.2rem; background: var(--panel);
  border-top: 1px solid var(--line);
}
.video-controls .player-btn { width: 36px; height: 36px; }
.video-controls .player-timeline { flex: 1; }
.video-modal-close {
  position: absolute; top: 1.2rem; right: 1.6rem;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.05);
  color: #fff;
}

/* ── Links list ─────────────────────────────────────────────────────── */
.link-list { display: flex; flex-direction: column; gap: .4rem; }
.link-item {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .9rem 0; border-bottom: 1px solid var(--line);
  transition: padding-left var(--transition);
}
.link-item:hover { padding-left: .35rem; }
.link-label { font-size: .92rem; color: var(--text); }
.link-url { font-size: .76rem; color: var(--faint); }
.link-arrow { color: var(--faint); transition: transform var(--transition), color var(--transition); }
.link-item:hover .link-arrow { color: var(--text); transform: translateX(3px); }

/* ── Sound visualization (theatre page) ─────────────────────────────── */
.sound-visual { width: 100%; margin-bottom: 1rem; opacity: .7; }
.sound-visual canvas { width: 100%; height: 80px; }

/* ── Footer ─────────────────────────────────────────────────────────── */
/* Normal-flow footer: appears only at the natural end of page content,
   so it never floats over the body. The user sees it when they scroll
   to the bottom of any page. */
.site-footer {
  text-align: right;
  padding: 2.8rem 2rem 1.2rem;
  font-family: var(--font-body);
  font-weight: 300;
  font-size: .68rem;
  letter-spacing: .14em;
  color: rgba(243,240,234,.36);
  user-select: none;
  position: relative; z-index: 5;
}
body.home-active .site-footer {
  /* Subtler over the photo background, with shadow for legibility. */
  color: rgba(243,240,234,.32);
  text-shadow: 0 1px 4px rgba(0,0,0,.55);
  padding: 1.4rem 2rem 1rem;
}
@media (max-width: 640px) {
  .site-footer { font-size: .62rem; padding: 1.8rem 1rem .8rem; }
}

/* ── Mobile navigation (hamburger drawer) ───────────────────────────── */
.nav-toggle {
  display: none;
  width: 44px; height: 44px; padding: 0;
  position: relative; z-index: 12;
  background: transparent; border: 0; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.nav-toggle span {
  position: absolute; left: 50%; top: 50%;
  width: 22px; height: 1.5px; background: var(--text);
  transform-origin: center;
  transition: transform 280ms cubic-bezier(0.16, 1, 0.3, 1),
              opacity 200ms ease;
}
.nav-toggle span:nth-child(1) { transform: translate(-50%, calc(-50% - 7px)); }
.nav-toggle span:nth-child(2) { transform: translate(-50%, -50%); }
.nav-toggle span:nth-child(3) { transform: translate(-50%, calc(-50% + 7px)); }
body.nav-open .nav-toggle span:nth-child(1) { transform: translate(-50%, -50%) rotate(45deg); }
body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle span:nth-child(3) { transform: translate(-50%, -50%) rotate(-45deg); }

.nav-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 8;
  background: rgba(8, 8, 8, .82);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;            /* never block clicks when not open */
  transition: opacity 280ms ease;
}
body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 980px) {
  /* Topbar: brand on the left, hamburger on the right. */
  .topbar {
    flex-direction: row; justify-content: space-between; align-items: center;
    padding: 1rem 1.1rem; gap: 1rem;
    position: relative;
  }
  .nav-toggle { display: block; }
  .nav-backdrop { display: block; }

  /* Nav becomes a slide-in drawer from the right. */
  .nav-wrap {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    z-index: 10;
    width: min(82vw, 360px);
    background: #0c0c0c;
    border-left: 1px solid var(--line);
    padding: 5rem 1.6rem 2rem;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;             /* CRITICAL: base CSS sets `wrap` which would
                                      otherwise overflow children into a 2nd column. */
    align-items: stretch;          /* children take the full drawer width */
    justify-content: flex-start;
    gap: 1rem;
    transform: translateX(100%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0s linear 320ms;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Account for iPhone notch & home indicator */
    padding-top: calc(5rem + env(safe-area-inset-top));
    padding-right: max(1.6rem, env(safe-area-inset-right));
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
  }
  body.nav-open .nav-wrap {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
    transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0s linear 0s;
  }
  body.nav-open { overflow: hidden; }

  .nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    width: 100%;
  }
  .nav button {
    width: 100%;
    padding: .9rem 0;
    font-size: .82rem;
    text-align: left;
    border-bottom: 1px solid var(--line);
  }
  .nav button[aria-selected="true"]::after { display: none; }
  .nav button[aria-selected="true"] { color: var(--text); padding-left: .35rem; }
  .nav button.nav-terms {
    font-size: .72rem; opacity: .65; border-bottom: 0; padding-top: 1.2rem;
  }
  /* EN/PT chips: horizontal row directly below the Contact item. */
  .controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    margin: 1.4rem 0 0;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
    gap: .55rem;
  }
  .chip {
    padding: .55rem 1.1rem;
    font-size: .78rem;
    flex: 0 0 auto;
  }

  /* Hero adjustments */
  .hero { padding: 2rem 1.25rem 3rem; }
  .hero .intro { max-width: 100%; }
  .hero .lede { max-width: 32ch; }
  .hero .lede-sub { max-width: 32ch; }

  /* Content pages */
  .content-shell {
    grid-template-columns: 1fr;
    gap: 1.6rem;
    padding: 3rem 1.25rem 2rem;
  }
  .content-title { font-size: clamp(2.2rem, 8vw, 3.6rem); }
  .content-intro { max-width: 100%; }

  /* About portrait — tame on mobile so it doesn't dominate */
  .about-portrait { max-width: 320px; }

  /* Soundcloud line */
  .soundcloud-line { font-size: .92rem; }

  /* Modal */
  .modal-overlay { padding: 0; align-items: stretch; }
  .modal {
    border-radius: 0;
    min-height: 100dvh; max-height: 100dvh;
    margin: 0;
  }
  .modal-header {
    padding: calc(1rem + env(safe-area-inset-top)) 1.2rem .9rem;
    gap: .8rem;
  }
  .modal-title { font-size: clamp(1.5rem, 6.5vw, 2.2rem); }
  .modal-body {
    padding: 0 1.2rem calc(1.6rem + env(safe-area-inset-bottom));
  }
  .modal-close { width: 44px; height: 44px; }
  .image-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .video-grid { grid-template-columns: 1fr; }
  .pdf-frame { height: 56vh; }
  .long-desc { padding: 1.1rem 1.2rem; max-height: 50vh; }
  .terms-body { max-height: 65vh; }

  /* Audio player on mobile */
  .player { padding: 1rem 1.1rem; }
  .player-btn { width: 48px; height: 48px; }
  .tracklist { max-height: 260px; }

  /* Video modal */
  .video-modal { padding: 0; }
  .video-modal-inner { border-radius: 0; min-height: 100dvh; }
  .video-modal video { max-height: 60vh; }
  .video-modal-close {
    top: calc(.8rem + env(safe-area-inset-top));
    right: 1rem; width: 44px; height: 44px;
  }

  /* Lightbox */
  .lightbox-close {
    top: calc(.8rem + env(safe-area-inset-top));
    right: 1rem; width: 44px; height: 44px;
  }

  /* Footer on mobile sits at end of content cleanly */
  .site-footer { padding: 2rem 1.25rem calc(1rem + env(safe-area-inset-bottom)); }

  /* Disable heavy animations on small/low-power devices */
  .hero-flare-2 { animation-duration: 50s; }
}

/* Phones (≤640px): tighten padding further */
@media (max-width: 640px) {
  .topbar { padding: .85rem .9rem; }
  .brand { font-size: 1.25rem; }
  .hero { padding: 1.6rem 1.1rem 2.5rem; }
  .title { font-size: clamp(2.8rem, 14vw, 4.4rem); }
  .content-shell { padding: 2.4rem 1.1rem 1.6rem; }
  .work-row { gap: .85rem; padding: .9rem 0; }
  .work-thumb { width: 44px; height: 44px; border-radius: 3px; }
  .work-meta { gap: .5rem; }
  .work-year { font-size: 1rem; }
  .modal-detail { font-size: .88rem; }
}

/* Touch-friendly hover suppression — keep visuals on tap clean */
@media (hover: none) {
  .work-row:hover { padding-left: 0; }
  .image-thumb:hover img { transform: none; }
  .hero .title:hover { text-shadow: 0 4px 30px rgba(0,0,0,.55); }
}

/* Modal scroll containment — prevents iOS rubber-band leaking */
.modal-overlay.open,
.video-modal.open,
.lightbox.open {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
