/* ezmp3 — the Now Playing world. Tokens first; the stage carries its own fixed
 * dark tokens because it is lit by the cover art, not by the page theme. */

:root {
  --bg: #F5F5F7;
  --surface: #FFFFFF;
  --surface-2: #E8E8ED;
  --label: #1D1D1F;
  --label-2: #6E6E73;
  --sep: rgba(60, 60, 67, 0.16);
  --hover: rgba(0, 0, 0, 0.035);

  --pink: #FF2D55;          /* systemPink: indicators, marks, idle art */
  --pink-ink: #D6194A;      /* filled actions under white text (5.1:1) */
  --pink-text: #D6194A;     /* pink words on the page ground (4.7:1) */
  --pink-tint: rgba(255, 45, 85, 0.1);
  --pink-on-tint: #C8174A;  /* pink words on --pink-tint (5.0:1) */
  --pink-ink-hover: #C0123F;
  --focus: #D6194A;         /* opaque: a translucent pink ring fell to 2.1:1 */
  --ink: #1D1D1F;           /* dark label on white controls, any theme */
  --on-stage-hover: #E9E9EE;

  --stage-base: #141416;
  --on-stage: #FFFFFF;
  --on-stage-2: rgba(255, 255, 255, 0.74);
  --stage-fill: rgba(255, 255, 255, 0.14);
  --stage-fill-hi: rgba(255, 255, 255, 0.22);
  --stage-track: rgba(255, 255, 255, 0.24);
  --stage-error: #FF8FA6;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r-sheet: 28px;
  --r-group: 14px;
  --r-art: 14px;
  --gutter: 16px;
  --spring: cubic-bezier(0.22, 1, 0.36, 1);
  --out: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1C1C1E;
    --surface-2: #2C2C2E;
    --label: #F5F5F7;
    --label-2: #98989D;
    --sep: rgba(84, 84, 88, 0.55);
    --hover: rgba(255, 255, 255, 0.05);
    --pink-text: #FF375F;
    --pink-tint: rgba(255, 55, 95, 0.16);
    --pink-on-tint: #FF6B88;
    --focus: #FF375F;
    color-scheme: dark;
  }
}

/* ---- base ---------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: color-mix(in srgb, var(--label-2) 45%, transparent) transparent;
  scrollbar-width: thin;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font: 400 1.0625rem/1.47 var(--font);
  letter-spacing: -0.012em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(255, 45, 85, 0.24); }

img, svg { display: block; max-width: 100%; }

a { color: var(--pink-text); text-decoration: none; text-underline-offset: 0.18em; }
a:hover { text-decoration: underline; }

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

.icon { width: 1.25rem; height: 1.25rem; flex: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: var(--gutter); top: -100px; z-index: 20;
  padding: 10px 16px; border-radius: 12px;
  background: var(--label); color: var(--bg); font-weight: 600;
}
.skip:focus-visible { top: 8px; }

[hidden] { display: none !important; }

/* ---- navigation bar ------------------------------------------------------- */

.bar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--sep);
}

.bar__in {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1040px; height: 52px; margin: 0 auto; padding: 0 var(--gutter);
}

.brand {
  display: inline-flex; align-items: center; gap: 9px;
  color: var(--label); font-size: 1.1875rem; font-weight: 700; letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; }
.brand .mark { width: 28px; height: 28px; }

.bar__nav { display: flex; gap: 2px; }
.bar__nav a {
  padding: 6px 12px; border-radius: 999px;
  color: var(--label-2); font-size: 0.9375rem; font-weight: 500;
  transition: background-color 160ms, color 160ms;
}
.bar__nav a:hover { color: var(--label); background: var(--hover); text-decoration: none; }
.bar__nav a[aria-current="page"] { color: var(--label); background: var(--surface-2); }

/* ---- page frame ----------------------------------------------------------- */

main { max-width: 1040px; margin: 0 auto; padding: 0 var(--gutter); }

.hero { padding: 28px 4px 0; }
.hero h1 {
  margin: 0; font-size: 2.125rem; line-height: 1.12; font-weight: 700; letter-spacing: -0.024em;
  text-wrap: balance;
}
.hero__lede {
  margin: 8px 0 0; max-width: 38ch;
  color: var(--label-2); font-size: 1.0625rem; line-height: 1.42; text-wrap: pretty;
}
.hero--text { padding-top: 40px; max-width: 720px; margin-inline: auto; }

/* ---- the stage ------------------------------------------------------------ */

.stage {
  position: relative; isolation: isolate; overflow: hidden;
  margin-top: 20px;
  scroll-margin-top: 60px;
  border-radius: var(--r-sheet);
  background: var(--stage-base);
  color: var(--on-stage);
  color-scheme: dark;
  /* A pink ring vanishes on a pink-lit wash (1.2:1); white holds on any art. */
  --focus: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 30px 60px -24px rgba(0, 0, 0, 0.45);
}

/* While a job runs the wash drifts, the way Apple Music's art light moves
 * behind a playing track; it stops when the job does. */
.wash { animation: drift 28s ease-in-out infinite alternate paused; }
/* Paused rather than removed when the job ends, so the light stays where it
 * drifted to instead of snapping back. */
.stage:is([data-state="loading"], [data-state="queued"], [data-state="working"]) .wash.is-on {
  animation-play-state: running;
}
@keyframes drift {
  from { transform: scale(1.5) translate(0, 0) rotate(0deg); }
  to { transform: scale(1.7) translate(-6%, 4%) rotate(8deg); }
}

.stage__wash { position: absolute; inset: 0; z-index: -1; }
.wash {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover;
  filter: blur(56px) saturate(1.4) brightness(0.62);
  transform: scale(1.5);
  opacity: 0;
  transition: opacity 900ms var(--out);
}
.wash.is-on { opacity: 1; }
.stage__wash::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.34) 0%, rgba(0, 0, 0, 0.46) 55%, rgba(0, 0, 0, 0.58) 100%);
}

.stage__body {
  display: grid; gap: 16px;
  /* minmax(0,1fr), not an implicit auto column: an <input>'s intrinsic width
   * counts toward min-content, and with the clear button shown it pushed the
   * column 20px past the sheet on a 390px phone (measured, hidden by overflow). */
  grid-template-columns: minmax(0, 1fr);
  padding: 16px 16px 22px;
}

/* link field — an iOS search field set in the stage's own material */
.field {
  display: flex; align-items: center; gap: 8px;
  height: 50px; padding: 0 6px 0 14px;
  border-radius: 14px;
  background: var(--stage-fill);
  transition: background-color 160ms, box-shadow 160ms;
}
.field:hover { background: var(--stage-fill-hi); }
.field:focus-within { background: var(--stage-fill-hi); box-shadow: 0 0 0 3px var(--focus); }
.field__icon { color: var(--on-stage-2); }
.field__input {
  flex: 1; min-width: 0; width: 0; height: 100%;
  border: 0; background: transparent; color: var(--on-stage);
  font: inherit; font-size: 1.0625rem; letter-spacing: -0.01em;
  caret-color: var(--pink);
}
.field__input::placeholder { color: rgba(255, 255, 255, 0.8); }
.field__input:focus-visible { outline: none; }
.field__input::-webkit-search-cancel-button { display: none; }

.field__clear, .field__paste {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; cursor: pointer; font: inherit; color: var(--on-stage);
  transition: background-color 160ms, transform 120ms;
}
.field__clear { width: 34px; height: 34px; border-radius: 50%; background: transparent; color: var(--on-stage-2); }
.field__clear:hover { background: var(--stage-fill); color: var(--on-stage); }
.field__paste {
  height: 38px; padding: 0 14px 0 11px; border-radius: 19px;
  background: var(--stage-fill-hi);
  font-size: 0.9375rem; font-weight: 600;
}
.field__paste .icon { width: 1.125rem; height: 1.125rem; }
.field__paste:hover { background: rgba(255, 255, 255, 0.3); }
.field__clear:active, .field__paste:active { transform: scale(0.96); }
.field__clear:focus-visible, .field__paste:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-radius: 19px; }

.field__error {
  display: flex; align-items: flex-start; gap: 8px;
  margin: -6px 4px 0; color: var(--on-stage); font-size: 0.9375rem; font-weight: 500; line-height: 1.35;
}
.field__error .icon { width: 1.125rem; height: 1.125rem; margin-top: 1px; }
.field:has(.field__input[aria-invalid="true"]) { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85); }

/* cover art: full size while the job is live, settled back when idle — the
 * same breath Apple Music gives a paused track */
.art {
  justify-self: center;
  width: min(66vw, 300px); aspect-ratio: 1;
  margin: 6px 0 0;
  border-radius: var(--r-art);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2), 0 22px 44px -10px rgba(0, 0, 0, 0.55);
  transform: scale(0.84);
  transition: transform 560ms var(--spring), filter 400ms var(--out);
}
.art__img {
  width: 100%; height: 100%; object-fit: cover; border-radius: inherit;
  transition: opacity 360ms var(--out);
}
.stage[data-loading-art] .art__img { opacity: 0.35; }
.stage:is([data-state="loading"], [data-state="queued"], [data-state="working"], [data-state="done"]) .art { transform: scale(1); }
.stage[data-state="failed"] .art { filter: saturate(0.2) brightness(0.7); }

.track { text-align: center; min-width: 0; }
.track__title {
  margin: 0; font-size: 1.375rem; line-height: 1.22; font-weight: 600; letter-spacing: -0.02em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  text-wrap: balance;
}
.track__sub {
  margin: 4px 0 0; color: var(--on-stage-2); font-size: 1.0625rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stage[data-state="failed"] .track__sub { white-space: normal; text-wrap: pretty; }

/* scrubber: the progress is the playhead */
.scrub__bar {
  position: relative; height: 6px; border-radius: 3px; overflow: hidden;
  background: var(--stage-track);
}
.scrub__fill {
  position: absolute; inset: 0;
  background: var(--on-stage);
  transform: scaleX(0); transform-origin: left center;
  transition: transform 420ms var(--out);
}
.stage[data-phase="converting"] .scrub__fill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 45, 85, 0.85), transparent);
  background-size: 40% 100%; background-repeat: no-repeat;
  animation: sheen 1.3s linear infinite;
}
@keyframes sheen { from { background-position: -40% 0; } to { background-position: 140% 0; } }
.stage[data-state="failed"] .scrub__fill { background: var(--stage-error); }

.scrub__times {
  display: flex; justify-content: space-between; gap: 12px; margin-top: 7px;
  color: var(--on-stage-2); font-size: 0.8125rem; font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* format + quality */
.controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.seg {
  position: relative; display: grid; grid-template-columns: 1fr 1fr;
  margin: 0; padding: 2px; border: 0; min-width: 0;
  border-radius: 10px; background: var(--stage-fill);
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  position: relative; z-index: 1;
  display: grid; place-items: center;
  min-width: 76px; height: 34px; padding: 0 14px;
  border-radius: 8px; cursor: pointer;
  font-size: 0.9375rem; font-weight: 600; letter-spacing: 0;
  color: var(--on-stage);
  transition: color 200ms;
}
.seg input:checked + label { color: var(--ink); }
.seg input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 1px; }
.seg label:hover { color: var(--on-stage); background: rgba(255, 255, 255, 0.06); }
.seg input:checked + label:hover { color: var(--ink); background: transparent; }
.seg__thumb {
  position: absolute; top: 2px; bottom: 2px; left: 2px; width: calc(50% - 2px);
  border-radius: 8px; background: #FFFFFF;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.16), 0 1px 1px rgba(0, 0, 0, 0.08);
  transition: transform 240ms var(--out);
}
.seg:has(#f-m4a:checked) .seg__thumb { transform: translateX(100%); }

.pick { position: relative; display: inline-flex; align-items: center; margin: 0; }
.pick__select {
  appearance: none; -webkit-appearance: none;
  height: 38px; padding: 0 36px 0 15px; border: 0; border-radius: 19px;
  background: var(--stage-fill); color: var(--on-stage);
  font: inherit; font-size: 0.9375rem; font-weight: 600; letter-spacing: 0;
  cursor: pointer; transition: background-color 160ms;
}
.pick__select:hover { background: var(--stage-fill-hi); }
.pick__select:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.pick__select option { color: #F5F5F7; background: #1C1C1E; }
.pick__chev { position: absolute; right: 12px; width: 1rem; height: 1rem; pointer-events: none; color: var(--on-stage-2); }
.pick--fixed {
  height: 38px; padding: 0 15px; border-radius: 19px;
  background: transparent; color: var(--on-stage-2);
  font-size: 0.9375rem; font-weight: 600;
}

/* the one action, where Play sits */
.actions { display: grid; gap: 8px; justify-items: stretch; align-items: center; }

.primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 28px; border: 0; border-radius: 26px;
  background: var(--on-stage); color: var(--ink);
  font: inherit; font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.01em;
  cursor: pointer; text-decoration: none;
  transition: background-color 160ms, color 160ms, transform 120ms var(--out), box-shadow 160ms;
}
.primary:hover { background: var(--on-stage-hover); text-decoration: none; }
.primary:active { transform: scale(0.97); }
.primary:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 26px; }
.primary:disabled {
  cursor: default; background: var(--stage-fill); color: var(--on-stage-2); transform: none;
}
.primary--go { background: var(--pink-ink); color: #FFFFFF; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.45); }
.primary--go:hover { background: var(--pink-ink-hover); }
.primary--go .icon { width: 1.3rem; height: 1.3rem; }
.primary--inline { display: inline-flex; background: var(--pink-ink); color: #FFFFFF; height: 48px; }
.primary--inline:hover { background: var(--pink-ink-hover); }

.ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 44px; padding: 0 16px; border: 0; border-radius: 22px;
  background: transparent; color: var(--on-stage);
  font: inherit; font-size: 0.9375rem; font-weight: 600; cursor: pointer;
  transition: background-color 160ms;
}
.ghost:hover { background: var(--stage-fill); }
.ghost:active { background: var(--stage-fill-hi); }
.ghost .icon { width: 1.1rem; height: 1.1rem; }

.stage__note {
  margin: 0; min-height: 1.2em;
  color: var(--on-stage-2); font-size: 0.8125rem; text-align: center; text-wrap: balance;
}
.stage__note:empty { display: none; }

@media (min-width: 860px) {
  .stage { margin-top: 24px; }
  .stage__body {
    grid-template-columns: 320px minmax(0, 1fr);
    grid-template-areas:
      "field field"
      "error error"
      "art track"
      "art scrub"
      "art controls"
      "art actions"
      "art note";
    grid-template-rows: auto auto auto auto auto auto 1fr;
    column-gap: 40px; row-gap: 18px;
    padding: 24px 32px 32px;
  }
  .field { grid-area: field; }
  .field__error { grid-area: error; }
  .art { grid-area: art; width: 320px; margin: 8px 0 0; align-self: start; }
  .track { grid-area: track; text-align: left; align-self: end; padding-top: 36px; }
  .track__title { font-size: 1.75rem; }
  .scrub { grid-area: scrub; }
  .controls { grid-area: controls; justify-content: flex-start; }
  .actions { grid-area: actions; grid-auto-flow: column; justify-content: start; }
  .primary { min-width: 220px; }
  .stage__note { grid-area: note; text-align: left; }
}

/* ---- recently converted ------------------------------------------------- */

.recent { margin-top: 36px; }
.recent__head { padding: 0 4px; margin-bottom: 10px; }
.recent__head h2 { margin: 0; font-size: 1.375rem; font-weight: 700; letter-spacing: -0.02em; }
.recent__head p { margin: 2px 0 0; color: var(--label-2); font-size: 0.9375rem; }

.group {
  margin: 0; padding: 0; list-style: none;
  border-radius: var(--r-group); background: var(--surface); overflow: hidden;
}

.row {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto auto; align-items: center; gap: 12px;
  padding: 10px 8px 10px 14px; position: relative;
}
.row + .row::before {
  content: ""; position: absolute; top: 0; left: 74px; right: 0; height: 0.5px; background: var(--sep);
}
.row__art { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--surface-2); }
.row__text { min-width: 0; }
.row__title { margin: 0; font-size: 1rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__meta { margin: 1px 0 0; color: var(--label-2); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 32px; padding: 0 13px; border: 0; border-radius: 16px;
  background: var(--pink-tint); color: var(--pink-on-tint);
  font: inherit; font-size: 0.875rem; font-weight: 600; letter-spacing: 0;
  cursor: pointer; white-space: nowrap; transition: background-color 160ms;
}
.chip:hover { background: color-mix(in srgb, var(--pink) 20%, transparent); text-decoration: none; }
.chip:active { transform: scale(0.97); }
.chip .icon { width: 1rem; height: 1rem; }
.chip--quiet { background: var(--surface-2); color: var(--label); }
.chip--quiet:hover { background: color-mix(in srgb, var(--label) 12%, var(--surface-2)); }

.row__x {
  display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: transparent; color: var(--label-2); cursor: pointer; transition: background-color 160ms, color 160ms;
}
.row__x:hover { background: var(--hover); color: var(--label); }
.row__x .icon { width: 1rem; height: 1rem; }

/* ---- reading sections ---------------------------------------------------- */

.prose { max-width: 720px; margin: 64px auto 0; padding: 0 4px; }
.prose section + section { margin-top: 48px; }
.prose h2 {
  margin: 0 0 12px; font-size: 1.75rem; line-height: 1.18; font-weight: 700; letter-spacing: -0.022em;
  text-wrap: balance;
}
.prose p { margin: 0 0 14px; text-wrap: pretty; }
.prose strong { font-weight: 600; }
.prose a { text-decoration: underline; text-decoration-thickness: 1px; }

.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 14px; }
.steps li {
  counter-increment: step; position: relative; padding-left: 44px; text-wrap: pretty;
}
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: -1px;
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--pink-tint); color: var(--pink-on-tint);
  font-size: 0.9375rem; font-weight: 700; font-variant-numeric: tabular-nums;
}

.table { margin-top: 18px; border-radius: var(--r-group); background: var(--surface); overflow-x: auto; }
.table table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.table th, .table td { padding: 13px 16px; text-align: left; vertical-align: top; }
.table thead th { color: var(--label-2); font-size: 0.8125rem; font-weight: 600; border-bottom: 0.5px solid var(--sep); }
.table tbody tr + tr > * { border-top: 0.5px solid var(--sep); }
.table tbody th { font-weight: 700; }

.faq details { position: relative; }
.faq details + details::before {
  content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 0.5px; background: var(--sep);
}
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 15px 16px; cursor: pointer; list-style: none;
  font-weight: 600; transition: background-color 160ms;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover { background: var(--hover); }
.faq summary:focus-visible { outline-offset: -3px; border-radius: var(--r-group); }
.faq__chev { width: 1.1rem; height: 1.1rem; color: var(--label-2); transition: transform 240ms var(--out); }
.faq details[open] .faq__chev { transform: rotate(180deg); }
.faq details p { margin: 0; padding: 0 16px 16px; color: var(--label-2); }

.prose--doc { margin-top: 24px; }
.prose--doc h2 { font-size: 1.375rem; margin-top: 36px; }
.prose--doc ul { margin: 0 0 14px; padding-left: 1.2em; }
.prose--doc li { margin-bottom: 8px; }

/* ---- footer --------------------------------------------------------------- */

.foot { margin-top: 96px; border-top: 0.5px solid var(--sep); }
.foot__in { max-width: 1040px; margin: 0 auto; padding: 28px var(--gutter) 48px; }
.foot__cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; max-width: 520px; }
.foot h2 { margin: 0 0 8px; font-size: 0.8125rem; font-weight: 600; color: var(--label-2); }
.foot ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.foot ul a { color: var(--label); font-size: 0.9375rem; }
.foot ul a:hover { color: var(--pink-text); }
.foot__note { margin: 20px 0 0; color: var(--label-2); font-size: 0.8125rem; }
.foot__note + .foot__note { margin-top: 4px; }

@media (min-width: 600px) {
  :root { --gutter: 24px; }
  .hero { padding-top: 40px; }
  .hero h1 { font-size: 2.75rem; }
  .hero__lede { font-size: 1.1875rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation: none !important; }
  .stage[data-state] .art { transform: none; }
}
