/* ===== Design tokens: change these to restyle the whole site ===== */
:root {
  --bg: #0f0e13;
  --surface: #1a1820;
  --surface-2: #24212c;
  --text: #ece8f1;
  --muted: #a39cae;
  --accent: #ffb454;          /* warm stage-light amber */
  --accent-2: #9d7bff;        /* violet */
  --line: #2f2b38;
  --highlight: #f3d3a4;       /* pale amber, used for links */

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --wide: 64rem;              /* page column: text and media share this width */
  --measure: var(--wide);
  --radius: 14px;
  --gutter: clamp(1rem, 4vw, 2rem);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; font-size: 80%; }
/* Everything is sized from this base, so 80% condenses the whole layout like browser zoom,
   keeping text, media and score edges aligned. Phones and small tablets keep full size. */
@media (max-width: 900px) { html { font-size: 100%; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.5 var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--highlight); text-underline-offset: 0.2em; }   /* links in pale amber; the deeper amber is kept for info lines and accents */
a:hover { color: var(--text); }
img, video { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; }
/* Even out line lengths in headings (no lone last word), and avoid single-word last lines in paragraphs */
h1, h2, h3, .piece-meta { text-wrap: balance; }
p { text-wrap: pretty; }
h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); margin: 0 0 0.5rem; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); margin: 3rem 0 1rem; }

/* ===== Header & tabs ===== */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 1rem var(--gutter) 0;
  /* line the header up with the page content on wide screens */
  padding-inline: max(var(--gutter), calc((100% - var(--wide)) / 2 + var(--gutter)));
}
.site-title {
  display: inline-block;
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 3vw, 1.6rem);
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}
.site-title__tag { color: var(--muted); font-weight: 400; }
.site-title__tag::before { content: "- "; }

.tabs ul {
  list-style: none; margin: 0.75rem calc(var(--gutter) * -1) 0; padding: 0 var(--gutter);
  display: flex; gap: 0.25rem;
  overflow-x: auto; scrollbar-width: none;   /* swipe sideways on phones */
}
.tabs ul::-webkit-scrollbar { display: none; }
.tabs a {
  display: block; white-space: nowrap;
  padding: 0.6rem 0.85rem;
  color: var(--muted); text-decoration: none; font-size: 0.92rem; font-weight: 500;
  border-bottom: 2px solid transparent;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

/* ===== Page body ===== */
.content { flex: 1; width: 100%; max-width: var(--wide); margin: 0 auto; padding: clamp(2rem, 6vw, 4rem) var(--gutter); }

.section__head, .prose > * { max-width: var(--measure); }
.section__head { margin-bottom: 2rem; }
.prose > * + * { margin-top: 0.85rem; }
.prose > h2 { margin-top: 3.5rem; }   /* clear break between pieces, even with dense text */
.prose p { margin-bottom: 0; }

/* ===== Home (splash page: no header bar, name + tagline, four picture tiles) ===== */
.content--home { display: flex; flex-direction: column; justify-content: center; max-width: 84rem; }
.splash { text-align: center; margin: 0 0 clamp(2rem, 6vh, 3.5rem); }
.splash__name { font-size: clamp(2.6rem, 8vw, 5rem); margin: 0; }
.splash__tag { font-family: var(--font-display); font-size: clamp(1.15rem, 2.6vw, 1.6rem); color: var(--text); margin: 0.5rem 0 0; text-wrap: balance; }
.amp { font-weight: 600; font-variation-settings: "opsz" 60; color: var(--text); font-size: 1.1em; padding: 0 0.04em; }   /* Fraunces' display-size ampersand, as in the original big tagline */
.tiles { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; grid-template-columns: repeat(4, 1fr); }
@media (max-width: 700px) { .tiles { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; } }
.tile {
  position: relative; display: flex; align-items: flex-end; aspect-ratio: 1; overflow: hidden;
  padding: 1rem 1.1rem; border-radius: var(--radius); border: 1px solid var(--line);
  text-decoration: none; color: #fff; background: var(--surface); isolation: isolate;
  transition: border-color .2s, transform .2s;
}
.tile::before {   /* the picture, so it can zoom without moving the text */
  content: ""; position: absolute; inset: 0; z-index: -2;
  background: var(--tile-img) center / cover no-repeat; transition: transform .5s ease;
}
.tile::after {    /* darkens the bottom so the title stays readable on any picture */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to top, rgb(10 9 14 / 0.85) 0%, rgb(10 9 14 / 0.35) 45%, rgb(10 9 14 / 0) 75%);
}
.tile--composition::before { filter: sepia(0.45) saturate(1.2) brightness(0.92); }   /* warms the white score paper towards cream */
.tile:hover { border-color: var(--accent); transform: translateY(-2px); color: #fff; }
.tile:hover::before { transform: scale(1.06); }
.tile__title { font-family: var(--font-display); font-size: clamp(1.3rem, 2.4vw, 1.6rem); font-weight: 600; line-height: 1.1; text-shadow: 0 1px 8px rgb(0 0 0 / 0.5); }

/* ===== Media blocks ===== */
.media { margin: 1.5rem 0 2rem; }
.media figcaption, .carousel__caption { color: var(--muted); font-size: 0.9rem; margin-top: 0.6rem; }
.media--video video { width: 100%; border-radius: var(--radius); background: #000; aspect-ratio: 16 / 9; }
.media--audio {
  max-width: var(--measure);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.media__title { margin: 0 0 0.6rem; font-weight: 600; text-wrap: balance; }
.media--audio audio { width: 100%; height: 3.125rem; display: block; }

/* ===== Carousel ===== */
.carousel { margin: 1.5rem 0 2rem; }
/* Carousels, score viewers and videos share the text column's width, at any zoom level */
.carousel, .media--video { max-width: var(--measure); }
.media--video { --ratio: 16 / 9; }
/* Carousels and videos that sit between paragraphs are centred in the column */
.prose > .carousel, .prose > .media--video, .score .carousel { margin-inline: auto; }
.prose > .media--video figcaption { text-align: center; }
/* ...unless wrapped in .full-width, which lets a carousel use the whole column */
.full-width > .carousel { max-width: none; }
.carousel__viewport { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; }
.carousel__track {
  list-style: none; margin: 0; padding: 0;
  display: flex; overflow-x: auto;
  scroll-snap-type: x mandatory; scroll-behavior: smooth;
  scrollbar-width: none; cursor: pointer;
  user-select: none; -webkit-user-select: none;
}
.carousel__track::-webkit-scrollbar { display: none; }
.carousel__slide {
  flex: 0 0 calc(100% / var(--per, 1)); scroll-snap-align: start;
  aspect-ratio: var(--ratio, 3 / 2); position: relative;
  display: flex; align-items: center; justify-content: center;
}
.carousel__slide img { width: 100%; height: 100%; object-fit: contain; }
.carousel__caption { position: absolute; left: 1rem; bottom: 0.75rem; margin: 0; }

/* Big arrows over each half of the photo, shown on hover for the side the mouse is on */
.carousel__hint {
  position: absolute; top: 50%; translate: 0 -50%;
  width: 3rem; height: 3rem; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 2rem; line-height: 1; color: #fff;
  background: rgb(0 0 0 / 0.45); backdrop-filter: blur(4px);
  pointer-events: none; opacity: 0; transition: opacity .2s;
}
.carousel__hint--prev { left: 1rem; }
.carousel__hint--next { right: 1rem; }
.carousel[data-side="prev"] .carousel__hint--prev,
.carousel[data-side="next"] .carousel__hint--next { opacity: 1; }
.carousel[data-side="full"] .carousel__track { cursor: zoom-in; }
.carousel:fullscreen[data-side="full"] .carousel__track { cursor: zoom-out; }
@media (hover: none) { .carousel__hint { opacity: 0.6; } }  /* touch screens: always show faintly */

.carousel__controls { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 0.85rem; }
.carousel__btn {
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-size: 1rem; cursor: pointer;
}
.carousel__btn:hover { border-color: var(--accent); }
.carousel__dots { display: flex; gap: 0.15rem; }
.carousel__count { color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; min-width: 4rem; text-align: center; }
.carousel__dot {
  width: 1.5rem; height: 1.5rem; padding: 0; border: 0; background: none; cursor: pointer;
  display: grid; place-items: center;
}
.carousel__dot::before {
  content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%;
  background: var(--line); transition: background .2s, transform .2s;
}
.carousel__dot:hover::before { background: var(--muted); }
.carousel__dot[aria-current="true"]::before { background: var(--accent); transform: scale(1.3); }

/* ===== Pieces ===== */
.prose h2 + .piece-meta { margin-top: 0.1rem; }
.piece-meta {   /* info line under each heading: small capitals in the deeper amber, like a gallery label */
  color: var(--accent); font-size: 0.88rem; font-weight: 600; line-height: 1.8;
  text-transform: uppercase; letter-spacing: 0.09em;
}
/* Headings within a page, and the info line under them, are centred */
.prose h2, .prose h3, .piece-meta { text-align: center; }

/* Video + image side by side, at equal heights; stacked on narrow screens */
.prose > .media-row { display: flex; gap: 1rem; align-items: flex-start; margin: 1.5rem 0 2rem; }
.media-row > .media { margin: 0; max-width: none; }
.media-row > .media--video { flex: 1.778 1 0; }
.media-row > .media--image { flex: 1 1 0; }
.media--image img { width: 100%; border-radius: var(--radius); }
@media (max-width: 600px) {
  .prose > .media-row { flex-direction: column; }
  .media-row > .media { flex: none; width: 100%; }
  .media-row > .media--image { max-width: 20rem; }
}

/* ===== Album: cover beside its tracks; stacked on narrow screens ===== */
.prose > .album { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 1.5rem; align-items: center; margin: 1.5rem 0 2rem; }
.album > .media { margin: 0; }
/* A carousel in the album's left column: one item at a time, no page fold */
.album > .carousel { margin: 0 auto; width: 100%; }
.album > .carousel:not(:fullscreen) { --per: 1 !important; }
.album > .carousel:not(:fullscreen) .carousel__viewport::after { display: none; }
.album__tracks .media--audio { max-width: none; margin: 0 0 0.6rem; padding: 0.6rem 0.85rem; }
.album__tracks .media__title { margin-bottom: 0.3rem; }
@media (max-width: 600px) {
  .prose > .album { grid-template-columns: 1fr; }
  .album > .media--image { max-width: 20rem; }
}

/* Two videos side by side; stacked on narrow screens */
.prose > .media-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.5rem 0 2rem; }
.media-pair > .media { margin: 0; max-width: none; }
.media-pair > .score .carousel { max-width: none; }
.media-pair .carousel { margin: 0; max-width: none; }
.media-pair .carousel:not(:fullscreen) { --per: 1 !important; }
.media-pair:not(.media-pair--portrait) .carousel:not(:fullscreen) { --ratio: 16 / 9 !important; }
/* Portrait document beside a video: the page keeps its own shape, so the two aren't the same height */
.prose > .media-pair--portrait { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: start; --doc-ratio: 1094 / 1551; }
/* Centre the video on the page image itself (not page + controls). Percentage margins are of the
   video's column width (v): the page is v/2 wide, so v / 2 / doc-ratio tall; the video is v * 9/16 tall. */
.prose > .media-pair--portrait > .media--video { margin-top: calc((100% / 2 / (var(--doc-ratio)) - 100% * 9 / 16) / 2); }
.media-pair .carousel:not(:fullscreen) .carousel__viewport { background: #000; }
.media-pair .carousel:not(:fullscreen) .carousel__viewport::after { display: none; }
.media-pair .score__links { margin-bottom: 0; }
@media (max-width: 600px) { .prose > .media-pair { grid-template-columns: 1fr; } }
/* The page's controls need about 230px, so the portrait pair stacks a little earlier */
@media (max-width: 760px) { .prose > .media-pair--portrait { grid-template-columns: 1fr; } .prose > .media-pair--portrait > .media--video { margin-top: 0; } }

/* A short introduction directly under a page title */
.prose > .page-intro { font-size: 1.15rem; color: var(--muted); margin-bottom: 1.5rem; }

/* Quickfire grid (Session tab): compact cards, two per row; one per row on phones */
.prose > .quickfire { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-top: 0.5rem; }   /* cards in a row stretch to the tallest one */
.qf-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; display: flex; flex-direction: column; }
/* the players fill the card's remaining height, centred, so shorter cards don't leave a gap at the bottom */
.qf-media { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 0.85rem; }
.qf-media > * { margin: 0 !important; }
/* Card heading with a small album cover on the left; title and credits left-aligned beside it */
.qf-head { display: grid; grid-template-columns: auto 1fr; column-gap: 1rem; }
.qf-head:not(:has(.qf-cover)) { display: block; }
.qf-head > * { margin: 0; grid-column: 2; }
.qf-cover { grid-column: 1; grid-row: 1 / span 2; width: 5.25rem; align-self: center; }
.qf-cover img { display: block; width: 100%; height: auto; border-radius: 4px; }
.prose .qf-head h3, .prose .qf-head .piece-meta { text-align: left; }
.qf-head h3 { align-self: end; }
.qf-head .piece-meta { align-self: start; }
.piece-meta .nowrap { display: inline-block; }   /* "For Casey Birks" moves to its own line as a whole rather than splitting */
.qf-card--wide { grid-column: 1 / -1; }
.qf-card > * { margin: 0; }
.qf-card > * + * { margin-top: 0.85rem; }
.qf-card h3 { font-size: 1.35rem; }
.qf-card .piece-meta { margin-top: 0.3rem; }
.qf-card .media, .qf-card .media-pair { margin: 0.85rem 0 0; max-width: none; }
.qf-card .media--audio { background: none; border: 0; padding: 0; }
.qf-card .media figcaption { text-align: center; }
.qf-card > .qf-link { margin-top: 1rem; font-size: 0.9rem; }   /* sits at the bottom of the card, lined up across a row */
.qf-card .media-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.qf-card .media-pair > .media { margin: 0; }
/* A card shared by two acts, stacked with a divider; each half centred in its share of the height */
.qf-card--split { justify-content: space-evenly; gap: 1.25rem; }
.qf-sub > * { margin: 0; }
.qf-sub > * + * { margin-top: 0.85rem; }
.qf-sub .piece-meta { margin-top: 0.3rem; }
.qf-sub + .qf-sub { border-top: 1px solid var(--line); padding-top: 1.25rem; }
@media (max-width: 600px) {
  .prose > .quickfire, .qf-card .media-pair { grid-template-columns: 1fr; }
}

/* A single image on its own: keep it modest and centred */
.prose > .media--image { max-width: min(var(--measure), 40rem); margin-inline: auto; }

/* A line of outbound links under a piece */
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem 1.75rem; font-size: 0.95rem; }

/* ===== Scores ===== */
/* Portrait scores: two pages side by side on wide screens */
@media (min-width: 601px) {
  .carousel--spread { --per: 2; }
  /* a soft fold down the middle, so it reads as two separate pages */
  .carousel--spread .carousel__viewport::after {
    content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 14px; translate: -50% 0;
    background: linear-gradient(to right, transparent, rgb(0 0 0 / 0.12) 45%, rgb(0 0 0 / 0.35) 50%, rgb(0 0 0 / 0.12) 55%, transparent);
    pointer-events: none;
  }
}
.carousel--score .carousel__viewport, .carousel--spread .carousel__viewport { background: #fff; }
.carousel--score .carousel__hint { background: rgb(0 0 0 / 0.6); }
.score .carousel { margin-inline: auto; margin-bottom: 0.5rem; max-width: var(--score-w, var(--measure)); }
@media (max-width: 600px) { .score .carousel { max-width: none; } }
.score__links { display: flex; justify-content: center; margin: 0 0 2rem; font-size: 0.95rem; }
.score__size { color: var(--muted); font-size: 0.85em; }

/* ===== Full-screen carousel ===== */
.carousel__full { display: grid; place-items: center; }
.carousel__full[hidden] { display: none; }
.carousel:fullscreen {
  max-width: none; margin: 0; padding: 1.5rem; background: #000;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
}
.carousel:fullscreen .carousel__viewport { width: min(100%, calc((100vh - 7rem) * var(--ratio, 3 / 2) * var(--per, 1))); }

/* ===== Footer ===== */
.site-footer { border-top: 1px solid var(--line); padding: 1.5rem var(--gutter); color: var(--muted); font-size: 0.85rem; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .carousel__track { scroll-behavior: auto; }
  .carousel__hint { transition: none; }
  .tile, .tile::before { transition: none; }
}
