/* Nutt Labs // Quarterly Playlists
   Direction: "Long Exposure" — one ruled horizon, condensed sticky year numerals, artwork untouched. */

@font-face {
  font-family: "Mona Sans";
  src: url("../fonts/mona-sans-latin-wdth-wght.woff2") format("woff2-variations"),
       url("../fonts/mona-sans-latin-wdth-wght.woff2") format("woff2");
  font-weight: 200 900;
  font-stretch: 75% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Martian Mono";
  src: url("../fonts/martian-mono-latin-wdth-wght.woff2") format("woff2-variations"),
       url("../fonts/martian-mono-latin-wdth-wght.woff2") format("woff2");
  font-weight: 100 800;
  font-stretch: 75% 112.5%;
  font-display: swap;
}

@font-face {
  font-family: "Unbounded";
  src: url("../fonts/unbounded-latin-wght-normal.woff2") format("woff2-variations"),
       url("../fonts/unbounded-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
}

@font-face {
  font-family: "Sedgwick Ave Display";
  src: url("../fonts/sedgwick-ave-display-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* Palette: Spotify's dark UI values; mint is reserved for the Nutt Labs mark */
  --ground: #121212;      /* Spotify canvas */
  --surface: #181818;     /* Spotify card surface: listening view */
  --tile: #282828;        /* Spotify elevated surface: artwork placeholder */
  --line: #282828;        /* Spotify hairline */
  --line-strong: #535353; /* Spotify rail grey */
  --text: #ffffff;
  --muted: #b3b3b3;       /* Spotify subdued text */
  --subtle: #949494;      /* 55% white flattened onto the page background */
  --year: #535353;        /* year numerals: a quiet backdrop for the city name */
  --focus: #ffffff;       /* Spotify-style white focus + active states */
  --ink: #000000;         /* text on white fills */
  --mint: #00e2a9;        /* Nutt Labs mark only (the // in the lockup) */
  /* City accents: Miami supplied; Raleigh and New York use The Verge's palette. */
  --miami: #fb7cc6;       /* electric pink, 7.8:1 */
  --raleigh: #3cffd0;     /* The Verge's neon green */
  --new-york: #665cff;    /* brighter neon blue-purple */

  /* Type */
  --sans: "Mona Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --tag: "Sedgwick Ave Display", "Marker Felt", "Comic Sans MS", cursive;   /* graffiti handstyle for city names */
  --mono: "Martian Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Rhythm */
  --gutter: clamp(20px, 5vw, 72px);
  --card: clamp(180px, min(18vw, 28vh), 340px);
  --q-gap: clamp(16px, 1.9vw, 28px);
  --year-gap: clamp(48px, 5.5vw, 96px);
  --year-size: clamp(48px, min(6vw, 9vh), 96px);
  --head-gap: clamp(20px, 3vh, 30px);   /* year → line */
  --head-h: calc(var(--year-size) * 1.05 + var(--head-gap));   /* room for the numeral's full height inside the scroller */
  --tick-gap: clamp(28px, 4.4vh, 44px);   /* line → artwork */
  --art-radius: 6px;      /* phones retain 4px */
  --ease: cubic-bezier(.2, .7, .1, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html:has(dialog[open]) { overflow: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--ground);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  /* masthead / timeline / navigator: equal outer rows keep the timeline centered in the viewport */
  display: grid;
  grid-template-rows: minmax(max-content, 1fr) auto minmax(max-content, 1fr);
  grid-template-columns: minmax(0, 1fr);
}
.masthead { align-self: start; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
a { color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: var(--gutter); top: 8px; z-index: 10;
  padding: 10px 14px; border-radius: 6px;
  background: var(--focus); color: var(--ink);
  font: 600 13px/1 var(--mono); text-decoration: none;
  transform: translateY(-160%);
}
.skip:focus { transform: none; }

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

/* ── Header ─────────────────────────────────────────── */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: clamp(24px, 4.4vh, 48px) var(--gutter) 0;
}
/* Lockup: logo // title on one baseline, with the logo slightly smaller than the title */
.lockup {
  margin: 0;
  font-size: clamp(15px, 2.4vw, 37px);
  font-weight: 420;
  font-stretch: 125%;
  line-height: 1.2;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.brand { border-radius: 4px; }
.brand img {
  display: inline;
  height: var(--logo-h, 1.14em);   /* website SVG includes space around its lettering */
  width: auto;
  vertical-align: var(--logo-drop, -.23em);  /* align the lettering within the website SVG to the title */
}
.lockup .slashes {
  color: var(--mint);
  font-weight: 300;
  letter-spacing: -0.06em;
  margin: 0 .34em 0 .42em;
}

.attribution {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 0 2px;
  color: var(--muted); text-decoration: none;
  font: 400 11px/1 var(--mono); font-stretch: 87.5%; letter-spacing: .04em;
  border-radius: 6px;
}
.attribution:hover { color: var(--text); }
.attribution img { height: 24px; width: auto; }

/* ── Intro ──────────────────────────────────────────── */
.intro {
  padding: clamp(18px, 2.6vh, 26px) var(--gutter) 0;
}
.intro p {
  margin: 0;
  color: var(--subtle);
  font-size: 17px;
  line-height: 1.5;
  text-wrap: pretty;
}

/* ── Timeline ───────────────────────────────────────── */
.timeline { padding-block: clamp(32px, 5vh, 56px); }

.scroller {
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 12px; margin-bottom: -12px;
  overscroll-behavior-x: contain;
  scroll-padding-inline: var(--gutter);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  outline: none;
}
/* Give the 2px keyboard outline room beyond the 12px card plate. */
.scroller:has(.q-btn:focus-visible) { padding-bottom: 14px; margin-bottom: -14px; }
.scroller::-webkit-scrollbar { display: none; }
.scroller:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

.track {
  position: relative;
  display: flex;
  width: max-content;
  margin: 0; padding: 0 var(--gutter);
  list-style: none;
}
/* The horizon: one continuous rule across every year */
.track::before {
  content: "";
  position: absolute;
  left: 0; right: var(--gutter);   /* bleeds into the present, stops at Q1 2016 */
  top: var(--head-h);
  height: 1px;
  background: var(--line);
}

.year { position: relative; margin-right: var(--year-gap); }
.year:last-child { margin-right: 0; }
/* City band: each year tints its stretch of the horizon, bridging the gap to the next year */
.year::after {
  content: "";
  position: absolute; left: 0;
  top: var(--head-h);
  width: calc(100% + var(--year-gap)); height: 1px;
  background: var(--city, var(--line));
}
.year:last-child::after { width: 100%; }

.year-head {
  position: sticky;
  left: var(--gutter);
  width: max-content;
  height: var(--head-h);
  display: flex; flex-wrap: wrap; align-content: flex-end; align-items: baseline; gap: 0;   /* year + city share one baseline, sitting at the bottom */
  padding-bottom: var(--head-gap);
  margin-right: calc(-1 * var(--year-gap));   /* release at the colored rule's end, including its gap */
  z-index: 1;
}
.year:last-child .year-head { margin-right: 0; }
.year-num {
  margin: 0;
  font-family: "Unbounded", "Mona Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: calc(var(--year-size) * .72);
  font-weight: 600;
  color: rgba(255, 255, 255, .2);
  line-height: .8;
  letter-spacing: -0.04em;
  font-variant-numeric: lining-nums tabular-nums;
  /* nudge so the numeral's ink sits on the rule's left edge */
  margin-left: -0.03em;
}
.city {
  position: relative; z-index: 1;
  display: flex; align-items: baseline;
  margin: 0 0 0 -0.4em;           /* tucks over the numeral's last digit */
  white-space: nowrap;
}
.city-name, .city-spacer {
  color: var(--city, var(--text));
  font-family: var(--tag);
  font-style: normal; font-weight: 400;
  font-size: clamp(34px, min(3.4vw, 5vh), 48px);
  letter-spacing: -0.005em; line-height: 1;
}
.city-range {
  position: absolute;
  z-index: 2;
  pointer-events: none;
}
.city-range .city {
  position: sticky;
  left: var(--city-pin);
  width: max-content;
  margin: 0;
}

.quarters {
  display: flex; gap: var(--q-gap);
  margin: 0; padding: 0; list-style: none;
}
.q { position: relative; }

.q-btn {
  position: relative;
  isolation: isolate;
  display: block;
  width: var(--card);
  padding: var(--tick-gap) 0 0;
  margin: 0;
  border: 0;
  background: none;
  text-align: left;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
}
.q-btn::before {
  content: ""; position: absolute; z-index: -1;
  top: calc(var(--tick-gap) - 12px); left: -12px; right: -12px; bottom: -12px;
  border-radius: 8px; background: #1f1f1f; opacity: 0;
  transition: opacity .3s cubic-bezier(.3, 0, 0, 1);
}
.q-btn:hover::before, .q-btn:focus-visible::before { opacity: 1; }
.q-btn:active::before { background: #000; }
.q-btn:focus-visible { outline: none; }
.q-btn:focus-visible::before { outline: 2px solid #fff; outline-offset: 0; }

/* Quarter tick on the horizon */
.tick {
  position: absolute; z-index: 1; left: -4px; top: -4px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--ground);
  border: 1px solid var(--city, var(--line-strong));   /* every dot takes its city's color */
  transition: background-color .25s var(--ease);
}
.q:hover .tick, .q:focus-within .tick { background: var(--city, var(--text)); }

.art {
  display: block;
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--art-radius);
  background: var(--tile);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}
.art img {
  width: 100%; height: 100%;
  object-fit: contain;          /* square source, never cropped */
  border-radius: inherit;
}

/* Graceful fallback when artwork can't load */
.art.is-missing { display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); }
.art.is-missing img { display: none; }
.art.is-missing::after {
  content: attr(data-fallback);
  color: var(--muted);
  font: 400 12px/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; text-align: center;
}

.meta {
  display: flex; align-items: center; gap: 12px;
  margin-top: 12px;
}
.q-label {
  font-size: 20px; font-weight: 600; font-stretch: 100%;
  letter-spacing: -0.01em; line-height: 1;
}
.q-months {
  color: var(--subtle);
  font: 500 13px/1 "Mona Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.q-open {
  margin-left: auto;
  display: grid; place-items: center;
  width: 48px; height: 48px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .14); color: #fff;
  transition: background-color .3s cubic-bezier(.3, 0, 0, 1), color .3s cubic-bezier(.3, 0, 0, 1),
              transform .3s cubic-bezier(.3, 0, 0, 1), box-shadow .3s cubic-bezier(.3, 0, 0, 1);
}
.q-open svg { width: 14px; height: 14px; margin-left: 2px; }
.q-btn:hover .q-open, .q-btn:focus-visible .q-open {
  background: var(--city); color: #000;
  box-shadow: 0 8px 8px rgba(0, 0, 0, .3); transform: scale(1.04);
}
.q-btn:active .q-open { transform: scale(1); filter: brightness(.85); }

/* ── Controls ───────────────────────────────────────── */
.controls {
  align-self: end;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 0 var(--gutter) clamp(20px, 3.4vh, 32px);
}
.years {
  display: flex; gap: 2px;
  margin: 0; padding: 0; list-style: none;
  overflow-x: auto; scrollbar-width: none;
  min-width: 0;
}
.years::-webkit-scrollbar { display: none; }
.year-link {
  position: relative;
  min-width: 44px; height: 44px; padding: 0 10px;
  border: 0; background: none; cursor: pointer;
  color: var(--muted);
  font: 500 14px/1 "Mona Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
  transition: color .2s var(--ease);
}
.year-link::after {
  content: "";
  position: absolute; left: 10px; right: 10px; bottom: 6px;
  height: 2px; border-radius: 1px;
  background: var(--city, var(--focus));   /* the selected year's city color */
  transform: scaleX(0); transform-origin: left;
  transition: transform .35s var(--ease);
}
.year-link:hover { color: var(--text); }
.year-link[aria-current="true"] { color: var(--text); }
.year-link[aria-current="true"]::after { transform: scaleX(1); }
.year-link:focus-visible { outline-offset: -2px; }

.steps { display: flex; gap: 8px; flex: none; }
.step {
  display: inline-flex; align-items: center; gap: 10px;
  height: 44px; padding: 0 20px;
  border: 1px solid #7c7c7c; border-radius: 9999px;
  background: transparent; color: #fff; cursor: pointer;
  font: 700 14px/1 "Mona Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  transition: border-color .15s, transform .15s cubic-bezier(.3, 0, 0, 1), opacity .2s;
}
.step svg { width: 16px; height: 16px; flex: none; stroke-width: 1.8; }
.step:hover:not(:disabled) { border-color: #fff; transform: scale(1.04); }
.step:active:not(:disabled) { transform: scale(1); opacity: .7; }
.step:disabled { opacity: .3; cursor: default; }

/* ── Listening view ─────────────────────────────────── */
.player {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(440px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  padding: 0; margin: 0;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
  overflow: auto;
}
.player::backdrop { background: rgba(0, 0, 0, .8); }
.player[open] { animation: player-in .32s var(--ease); }
.player[open]::backdrop { animation: fade-in .32s var(--ease); }

.player-inner {
  display: grid;
  grid-template-rows: minmax(352px, 1fr) auto;
  height: 100%;
  min-height: min-content;
  gap: 16px;
  padding: calc(20px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom));
}
.player-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.close {
  flex: none;
  display: grid; place-items: center;
  width: 44px; height: 44px; margin: 0;
  border: 1px solid var(--line-strong); border-radius: 50%;
  background: none; cursor: pointer;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.close svg { width: 16px; height: 16px; }
.close:hover { background: var(--text); color: var(--ground); }

.embed {
  position: relative;
  height: 100%;
  min-height: 352px;           /* Spotify embed standard minimum height */
  border-radius: 12px;
  background: var(--ground);
  overflow: hidden;
}
.embed iframe { position: relative; z-index: 1; display: block; width: 100%; height: 100%; border: 0; }
.embed-status {
  position: absolute; inset: 0;
  display: grid; place-content: center; gap: 6px; padding: 24px;
  text-align: center;
  color: var(--muted);
  font: 400 12px/1.5 var(--mono); font-stretch: 87.5%; letter-spacing: .02em;
}
.embed.is-failed iframe { visibility: hidden; }
.embed.is-failed .embed-status { z-index: 2; color: var(--text); }

.open-spotify {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  border-radius: 24px;
  background: var(--text); color: var(--ground);
  font-size: 15px; font-weight: 600; font-stretch: 105%;
  text-decoration: none;
  transition: background-color .2s var(--ease);
}
.open-spotify:hover { background: #ffffff; }
.open-spotify img { width: 21px; height: 21px; }   /* Spotify icon minimum: 21px */
.open-spotify .ext { width: 12px; height: 12px; opacity: .6; }

/* ── Entrance (one orchestrated reveal) ─────────────── */
.js .q { opacity: 0; transform: translateX(24px); }
.js.is-ready .q {
  opacity: 1; transform: none;
  transition: opacity .7s var(--ease), transform .9s var(--ease);
  transition-delay: calc(var(--i, 0) * 45ms);
}

@keyframes player-in { from { transform: translateX(100%); } }
@keyframes fade-in { from { opacity: 0; } }

/* ── Phones ─────────────────────────────────────────── */
@media (max-width: 640px) {
  :root {
    --card: min(calc(100vw - var(--gutter) * 2 - 84px), 340px);
    --q-gap: 16px;
    --year-gap: 40px;
    --year-size: 56px;
    --art-radius: 4px;   /* Spotify: 4px on small screens */
  }
  .lockup { font-size: min(14px, 3.55vw); }
  .top { gap: 12px; }
  .timeline { padding-block: 16px; }
  .attribution .label { display: none; }
  .controls { gap: 12px; }
  .step { width: 44px; padding: 0; justify-content: center; }
  .step .label { display: none; }
  .q-btn::before { display: none; }
  .q-open { width: 44px; height: 44px; background: var(--city); color: #000; }
  .player-inner { padding: calc(18px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom)); }
  .open-spotify { width: 100%; }
}

/* Short landscape screens: keep everything above the fold */
@media (max-height: 560px) and (min-width: 641px) {
  :root { --card: clamp(150px, 34vh, 220px); --year-size: 36px; }

}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
  .step:hover:not(:disabled), .step:active:not(:disabled),
  .q-btn:hover .q-open, .q-btn:focus-visible .q-open, .q-btn:active .q-open { transform: none; }
}

@media (forced-colors: active) {
  .tick, .year-link::after { forced-color-adjust: none; }
  .q-open, .step, .close { border-color: ButtonText; }
}
