/*
 * Dialect · dialect.studio
 *
 * Legal Disclaimer for Web licence (Lineto)
 * Licence to use self-hosted webfonts for displaying dynamic text on specified website domains.
 * It is strictly prohibited to rename the font and to download or use these fonts in any other media.
 */
@font-face {
  font-family: "NumberplateLLWeb-Switzerland";
  src: url("fonts/NumberplateLLWeb-Switzerland.woff2") format("woff2"),
       url("fonts/NumberplateLLWeb-Switzerland.woff") format("woff");
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --ink: #fff;
  --ground: #000;
  --face: "NumberplateLLWeb-Switzerland", "Arial Narrow", "Helvetica Neue", sans-serif;

  --gutter: clamp(20px, 5.6vw, 96px);
  --size-display: clamp(26px, 2.95vw, 52px);   /* mission, featured, contact */
  --size-liner: clamp(14px, 1.05vw, 18px);     /* liner notes */
  --lead: 1.24;

  --underline: 0.07em;
  --underline-offset: 0.14em;

  /* Set per release by site.js */
  --accent: #fff;
  --sleeve: #111;

  --liner-w: min(30rem, 36vw);
  --ease: cubic-bezier(.2, .7, .1, 1);
  --open-ms: 720ms;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--face);
  text-transform: uppercase;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

.page {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding: clamp(40px, 7vw, 96px) 0 clamp(28px, 3vw, 44px);
}

/* ---------- Copyright slug: bottom center, pinned to the bottom of the window on short pages ---------- */
.slug {
  margin: auto 0 0;   /* pushes to the bottom of the window; .contact's bottom margin keeps a minimum gap */
  padding-inline: var(--gutter);
  text-align: center;
  font-size: var(--size-liner);
  line-height: 1.4;
  letter-spacing: 0.04em;
  opacity: .55;
}
.slug span { letter-spacing: 0; }

/* ---------- Masthead ---------- */
.masthead, .featured-line, .contact { padding-inline: var(--gutter); }

.mark { display: inline-block; line-height: 0; }
.mark img { width: clamp(44px, 4.7vw, 72px); height: auto; }

.mission,
.featured-line,
.contact {
  font-size: var(--size-display);
  line-height: var(--lead);
  font-weight: normal;
  letter-spacing: 0.005em;
  margin: 0;
}
.mission { margin-top: clamp(24px, 2.6vw, 40px); max-width: 30em; }
/* Short left-aligned rule between the two mission lines */
.mission-rule {
  display: block;
  width: 2.4em; height: 1px;              /* hairline, to match the one above the releases */
  margin: .4em 0 .45em;
  background: rgba(255,255,255,.28);
}
/* Hairline between the mission and the catalog */
.hairline {
  border: 0; height: 1px; background: rgba(255,255,255,.28);
  margin: clamp(40px, 5vw, 80px) var(--gutter) 0;
}

/* ---------- Featured release ---------- */
.featured { margin-top: clamp(32px, 4vw, 64px); }

/* Catalog: one row per release. Each title is underlined in that release's own color. */
.catalog { list-style: none; margin: 0; padding: 0; }
.release-link { text-decoration: none; }
.release-link .title {
  text-decoration: underline;
  text-decoration-color: var(--row-accent);
  text-decoration-thickness: var(--underline);
  text-underline-offset: var(--underline-offset);
  transition: color 160ms ease;
}
.release-link[aria-busy="true"] { cursor: progress; }
/* Release date: small, dim, after the title */
.catalog .date {
  font-size: .42em;
  letter-spacing: .08em;
  opacity: .5;
  margin-left: .7em;
  white-space: nowrap;
  vertical-align: .18em;
}
.release-link:hover .title,
.release-link[aria-expanded="true"] .title { color: var(--row-accent); }

/* ---------- Drawer ---------- */
/* Open/close animates grid rows 0fr -> 1fr so height follows the content, no magic numbers. */
.drawer {
  display: grid;
  grid-template-rows: 0fr;
  margin-top: 0;
  transition: grid-template-rows var(--open-ms) var(--ease),
              margin-top var(--open-ms) var(--ease),
              margin-bottom var(--open-ms) var(--ease);
}
.drawer.is-open {
  grid-template-rows: 1fr;
  margin-top: clamp(24px, 3vw, 48px);
  margin-bottom: clamp(32px, 4vw, 64px);
}
.drawer-clip { overflow: hidden; min-height: 0; }

.drawer-stage {
  position: relative;
  background: var(--sleeve);
  /* Letterbox: full bleed, wide, but never taller than the window. */
  height: clamp(420px, 62vw, 86vh);
}

.drawer-media,
.drawer-media img,
.drawer-media video {
  display: block;
  width: 100%;
  height: 100%;
}
.drawer-media img,
.drawer-media video { object-fit: cover; object-position: center; }
.drawer-media img { opacity: 0; transition: opacity 450ms ease; }
.drawer-media img.is-loaded { opacity: 1; }

/* Media fades up a beat after the drawer opens */
.drawer-media { opacity: 0; transition: opacity 500ms ease 200ms; }
.drawer.is-open .drawer-media { opacity: 1; }

/* ---------- Liner notes (the back of the sleeve) ---------- */
.liner {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--liner-w);
  padding: clamp(24px, 3vw, 48px) clamp(20px, 2.4vw, 40px);
  padding-left: var(--gutter);
  background: rgba(0, 0, 0, .74);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  font-size: var(--size-liner);
  line-height: 1.3;
  letter-spacing: 0.02em;
  display: flex;
  flex-direction: column;
  gap: .85em;
  overflow-y: auto;

  opacity: 0;
  transform: translateX(-12px);
  transition: opacity 400ms ease 380ms, transform 600ms var(--ease) 380ms;
}
.drawer.is-open .liner { opacity: 1; transform: none; }
/* The blur only matters over a picture; skip it (it's costly to keep re-rendering) behind the waveform */
/* Over the reel the liner sits on plain black (the app column is off to the right), so no blur needed */
.drawer-stage[data-media="video"] .liner { -webkit-backdrop-filter: none; backdrop-filter: none; background: #0a0a0a; --liner-solid: #0a0a0a; }
.drawer-stage[data-media="waveform"] .liner { -webkit-backdrop-filter: none; backdrop-filter: none; background: #0a0a0a; }

.liner h2 { font-size: 1.6em; line-height: 1.1; font-weight: normal; margin: 0; }
.liner .cat { opacity: .6; display: block; font-size: .62em; letter-spacing: .08em; margin-bottom: .5em; }
.liner dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .25em 1.2em; }
.liner dt { opacity: .6; }
.liner dd { margin: 0; white-space: pre-line; }
.liner .accent { color: var(--accent); }
.liner dd a, .liner p a {
  text-decoration: underline; text-decoration-thickness: .08em; text-underline-offset: .2em;
  text-decoration-color: rgba(255,255,255,.4);
}
.liner dd a:hover, .liner p a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.liner em { font-style: italic; }
.liner p { margin: 0; }
.liner .credit { opacity: .6; }
.liner .outs {
  margin-top: auto; display: flex; flex-direction: column; gap: .6em; align-items: flex-start;
  /* always in view: if the notes run long, they scroll underneath the download links */
  position: sticky; bottom: calc(-1 * clamp(24px, 3vw, 48px));
  margin-bottom: calc(-1 * clamp(24px, 3vw, 48px)); padding: 1em 0 clamp(24px, 3vw, 48px);
  background: linear-gradient(to bottom, transparent, var(--liner-solid, #0a0a0a) 1.2em);
}
.liner .out.quiet { opacity: .6; text-decoration-color: currentColor; text-decoration-thickness: .06em; }
.liner .out {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: .1em;
  text-underline-offset: .2em;
}
.liner .out:hover { color: var(--accent); }

/* ---------- Waveform player (audio releases) ---------- */
.drawer-media.is-waveform { position: relative; }
.wf-backdrop {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  opacity: .35; mix-blend-mode: screen; pointer-events: none;
}
.wf {
  position: absolute;
  top: 50%;
  left: calc(var(--liner-w) + clamp(24px, 3vw, 56px));
  right: clamp(72px, 7vw, 120px);
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 18px;
}
.wf-bar { display: flex; align-items: baseline; flex-wrap: wrap; gap: .4em 1.2em; font-size: var(--size-display); line-height: 1; }
.wf-play {
  font: inherit; text-transform: inherit; color: var(--accent);
  background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline; text-decoration-thickness: var(--underline); text-underline-offset: var(--underline-offset);
}
.wf-play:hover { color: #fff; }
.wf-play-label::before { content: "▶ "; font-size: .7em; vertical-align: .12em; }
.is-playing .wf-play-label::before { content: "❚❚ "; }
.is-buffering .wf-play-label { animation: wf-blink 900ms steps(2) infinite; }
@keyframes wf-blink { 50% { opacity: .35; } }
.wf-time { font-size: var(--size-liner); letter-spacing: .06em; opacity: .7; font-variant-numeric: tabular-nums; }

.wf-track {
  position: relative;
  height: clamp(140px, 22vw, 300px);
  cursor: crosshair;
  touch-action: none;
}
.wf-track:focus-visible { outline-offset: 8px; }
.wf-canvas { display: block; width: 100%; height: 100%; }
.wf-hover {
  position: absolute; top: -6px; bottom: -6px; left: 0; width: 1px;
  background: rgba(255,255,255,.6);
  opacity: 0; pointer-events: none;
}
.is-hovering .wf-hover { opacity: 1; }
.wf-hover-time {
  position: absolute; bottom: 100%; left: 6px; margin-bottom: 4px;
  font-size: var(--size-liner); letter-spacing: .06em; white-space: nowrap;
}
/* Flight strip: Chicago (left) to Burlington (right), the recorded stretch in the accent color */
/* Never stretched: the box keeps the map's real proportions (--map-ratio, set from the data)
   and simply grows or shrinks; it sits at the left, over the start of the waveform. */
.wf-map {
  --map-h: clamp(110px, 11vw, 190px);
  position: relative;
  width: min(100%, calc(var(--map-h) * var(--map-ratio, 2.9)));
  aspect-ratio: var(--map-ratio, 2.9);
  margin-bottom: 4px; opacity: 0; transition: opacity 500ms ease;
}
.wf-map.is-ready { opacity: 1; }
.wf-map svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; }
.wf-lakes { fill: rgba(255,255,255,.06); stroke: rgba(255,255,255,.32); stroke-width: 1; vector-effect: non-scaling-stroke; }
.wf-route { fill: none; stroke: rgba(255,255,255,.35); stroke-width: 1; stroke-dasharray: 2 4; vector-effect: non-scaling-stroke; }
.wf-route-rec { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.wf-apt {
  position: absolute; transform: translate(-50%, 8px);
  font-size: calc(var(--size-liner) * .8); letter-spacing: .08em; opacity: .55;
}
.wf-plane {
  position: absolute; width: 20px; height: 20px; margin: -10px 0 0 -10px;
  filter: drop-shadow(0 0 1.5px var(--accent)) drop-shadow(0 0 6px var(--accent));
}
.wf-plane svg { display: block; width: 100%; height: 100%; fill: #fff; }
.wf-credit {
  position: absolute; right: 0; top: 100%; margin-top: 2px; white-space: nowrap;
  font-size: calc(var(--size-liner) * .65); letter-spacing: .08em; opacity: .4; text-decoration: none;
}
.wf-credit:hover { opacity: .8; text-decoration: underline; }
.wf-where { font-size: var(--size-liner); letter-spacing: .06em; opacity: .7; font-variant-numeric: tabular-nums; }
.has-map .wf-track { height: clamp(120px, 17vw, 240px); }

/* Head row: the map on the left, the week + download count on the right */
.wf-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.wf-head .wf-map { flex: none; }
.wf-stats {
  margin: 0; margin-left: auto; text-align: right;
  display: flex; flex-direction: column; gap: .3em;
  font-size: var(--size-liner); letter-spacing: .08em; line-height: 1.2;
}
.wf-week { color: var(--accent); }
.wf-dl { opacity: .7; font-variant-numeric: tabular-nums; }

/* Listener marks */
.wf-stage { position: relative; }
.wf-marks { position: relative; height: 30px; margin-bottom: 6px; }
.wf-pin {
  position: absolute; bottom: 0; transform: translateX(-50%);
  background: none; border: 0; padding: 0 2px; cursor: pointer;
  font-size: 18px; line-height: 1; text-transform: none;
  filter: saturate(.9);
  transition: transform 150ms ease;
}
.wf-pin:hover, .wf-pin:focus-visible { transform: translateX(-50%) translateY(-3px) scale(1.25); }
.wf-pin sup {
  font-family: var(--face); font-size: 11px; color: #fff; opacity: .75;
  margin-left: 1px; vertical-align: 9px;
}
.wf-pin.is-fresh { animation: wf-pop 520ms cubic-bezier(.3, 1.6, .5, 1); }
@keyframes wf-pop {
  0% { transform: translateX(-50%) translateY(10px) scale(.2); opacity: 0; }
  100% { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
}
.wf-mark {
  font: inherit; font-size: var(--size-liner); letter-spacing: .06em; text-transform: inherit;
  color: #fff; background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline; text-decoration-color: rgba(255,255,255,.4);
  text-decoration-thickness: .08em; text-underline-offset: .2em;
}
.wf-mark::before { content: "+ "; }
.wf-mark:hover, .wf-mark[aria-expanded="true"] { color: var(--accent); text-decoration-color: var(--accent); }
.wf-note {
  font-size: var(--size-liner); letter-spacing: .04em; opacity: 0;
  transition: opacity 300ms ease; text-transform: none;
}
.wf-note.is-on { opacity: .8; }
.wf-flyout {
  position: absolute; top: -14px; z-index: 3;
  display: flex; align-items: center; gap: 2px;
  padding: 6px 8px; background: #000; border: 1px solid rgba(255,255,255,.25);
}
.wf-flyout[hidden] { display: none; }
/* caret pointing at the exact spot that was clicked or tapped */
.wf-flyout.has-caret::after {
  content: ""; position: absolute; left: var(--caret, 50%); top: 100%;
  width: 10px; height: 10px; margin-left: -5px; margin-top: -5px;
  background: #000; border-right: 1px solid rgba(255,255,255,.25); border-bottom: 1px solid rgba(255,255,255,.25);
  transform: rotate(45deg);
}
.wf-flyout.has-caret.is-below::after { top: auto; bottom: 100%; margin: 0 0 -5px -5px; transform: rotate(-135deg); }
.wf-flyout-at {
  font-size: var(--size-liner); letter-spacing: .06em; opacity: .6; padding: 0 8px 0 2px;
  font-variant-numeric: tabular-nums;
}
.wf-flyout button {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: none; border: 0; cursor: pointer; font-size: 22px; line-height: 1;
}
.wf-flyout button:hover, .wf-flyout button:focus-visible { background: rgba(255,255,255,.12); outline: none; }
.wf-track { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
/* hover timecode sits under the strip so it never covers the pins */
.wf-hover-time { bottom: auto; top: 100%; margin: 4px 0 0; }

.wf-ticks { position: relative; height: 1.2em; font-size: calc(var(--size-liner) * .85); opacity: .45; }
.wf-ticks span { position: absolute; top: 0; transform: translateX(-1px); padding-left: 4px; border-left: 1px solid currentColor; line-height: 1.2; }

/* ---------- Close ---------- */
.drawer-close {
  position: absolute;
  top: clamp(12px, 1.6vw, 24px);
  right: clamp(12px, 1.6vw, 24px);
  width: 48px; height: 48px;
  display: grid; place-items: center;
  background: #000;
  color: #fff;
  border: 0; border-radius: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 300ms ease 450ms, background 150ms ease;
}
.drawer.is-open .drawer-close { opacity: 1; }
.drawer-close:hover { background: var(--accent); color: #000; }
.drawer-close svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2.5; fill: none; }

/* ---------- Contact ---------- */
.contact { margin-top: clamp(80px, 9vw, 150px); margin-bottom: clamp(96px, 12vw, 200px); }
.contact a {
  text-decoration: underline;
  text-decoration-thickness: var(--underline);
  text-underline-offset: var(--underline-offset);
  text-decoration-color: rgba(255,255,255,.35);
  transition: text-decoration-color 160ms ease;
}
.contact a:hover { text-decoration-color: #fff; }

/* ---------- Small screens: taller crop, liner notes stack under the image ---------- */
@media (max-width: 720px) {
  .drawer-stage { height: auto; }
  .drawer-media { aspect-ratio: 4 / 5; height: auto; }
  .liner {
    position: static;
    width: 100%;
    padding: 28px var(--gutter) 36px;
    background: #0d0d0d;
    -webkit-backdrop-filter: none; backdrop-filter: none;
    transform: none;
    font-size: 16px;
  }
  .liner .outs { margin-top: .4em; position: static; margin-bottom: 0; padding: 0; background: none; }

  /* Release dates sit on their own line under the title on phones, so every row matches */
  .catalog .date { display: block; margin: .15em 0 .55em; vertical-align: 0; font-size: .5em; }

  /* Waveform: full width, shorter stage */
  .drawer-media.is-waveform { aspect-ratio: auto; }
  .wf { left: var(--gutter); right: var(--gutter); }
  .wf-track { height: 120px; }
  .drawer-media.is-waveform { height: 340px; }
  .wf-pin { font-size: 16px; }
  .wf-map { width: 100%; }
  .wf-head { flex-direction: column; gap: 10px; }
  .wf-stats { flex-direction: row; gap: 1.2em; margin-left: 0; text-align: left; }
  .drawer-media.is-waveform.has-map { height: 530px; }
  .has-map .wf-track { height: 100px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  :root { --open-ms: 0ms; }
  .drawer-media, .liner, .drawer-close { transition: none; transform: none; }
}

/* First paint on a deep link: open with no animation */
.no-anim, .no-anim * { transition: none !important; }
