/* AudioTrim — shared styles.
   Direction: one motif, the waveform. Flat colour only: no gradients, no shadows,
   no hairlines. Five type sizes. Paragraphs capped at 60 characters. */

:root {
  /* surfaces, one step apart */
  --ink: #0d1013;
  --ink-2: #14191d;
  --ink-3: #1d242a;
  --ink-4: #2a333a;

  --paper: #eef0ec;
  --muted: #a9b3ba;
  --accent: #c8f24a;
  --accent-hi: #dcff74;
  --accent-ink: #0d1013;

  --danger-bg: #3a1a17;
  --danger-fg: #ffb4a8;
  --warn-bg: #33280c;
  --warn-fg: #ffd166;
  --ok-fg: #c8f24a;

  /* type scale — five sizes */
  --fs-h1: clamp(46px, 7.4vw, 104px);
  --fs-h2: clamp(28px, 3.2vw, 40px);
  --fs-lead: 21px;
  --fs-body: 17px;
  --fs-small: 14px;

  --band: 34vh;
  --gap: clamp(56px, 7vw, 104px);
  --edge: clamp(18px, 4.2vw, 40px);
}

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

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  background: var(--ink);
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.02em; }
h2 {
  font-size: var(--fs-h2);
  line-height: 1.06;
  letter-spacing: -0.028em;
  font-weight: 800;
}
p { margin: 0; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition: color 0.15s ease-out;
}
a:hover { color: var(--accent); }
a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.wrap {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--edge);
}

.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;
}

/* ---------------------------------------------------------------- header */

.site-header { padding: 16px 0; }

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-lead);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.brand:hover { color: var(--paper); }

.brand-mark {
  width: 28px;
  height: 28px;
  background: var(--accent);
  display: grid;
  place-items: center;
  flex: none;
}
.brand-mark svg { width: 16px; height: 16px; display: block; }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: var(--fs-small);
}
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--paper); }

/* ---------------------------------------------------------------- hero */

.hero {
  position: relative;
  overflow: clip;
  background: var(--ink);
  /* the band lives in padding, not a collapsed child margin: an absolutely
     positioned wave anchored at top:0 then covers exactly the band area and
     cannot bleed over the lede below it */
  padding-top: var(--band);
}
.hero--sub { --band: 26vh; }

.hero-wave {
  position: absolute;
  top: 0;
  left: -6%;
  width: 112%;
  height: calc(var(--band) + 2px);
  display: block;
  color: var(--accent);
  transform-origin: 0 50%;
}
.hero-wave path { fill: currentColor; }
.hero-wave .wave-real { opacity: 0; }
.hero-wave.is-real .wave-decor { opacity: 0; }
.hero-wave.is-real .wave-real { opacity: 1; }
.hero-wave path { transition: opacity 0.45s ease-out; }

.hero-title {
  position: relative;
  background: var(--accent);
  color: var(--accent-ink);
  padding: clamp(18px, 2.2vw, 30px) 0 clamp(22px, 2.6vw, 36px);
}
.hero-title h1 {
  font-size: var(--fs-h1);
  line-height: 0.94;
  letter-spacing: -0.038em;
  font-weight: 800;
}

.hero-sub { padding-top: clamp(16px, 2vw, 26px); }

.lede {
  font-size: var(--fs-lead);
  line-height: 1.4;
  max-width: 44ch;
  color: var(--paper);
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 22px;
  border: 0;
  background: var(--ink-3);
  color: var(--paper);
  font: inherit;
  font-size: var(--fs-body);
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease-out, background-color 0.15s ease-out, color 0.15s ease-out;
}
.btn:hover { background: var(--ink-4); }
.btn:active { transform: translateY(2px); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:disabled:hover { background: var(--ink-3); }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hi); }
.btn-primary:disabled:hover { background: var(--accent); }

.btn-lg { min-height: 58px; padding: 0 26px; }

.btn-plain {
  background: none;
  border: 0;
  color: var(--muted);
  padding: 0;
  min-height: 0;
  text-decoration: underline;
  text-decoration-color: var(--ink-4);
}
.btn-plain:hover { background: none; color: var(--paper); }

/* ---------------------------------------------------------------- tool */

.tool-band { padding-top: clamp(22px, 3vw, 36px); }

.tool {
  background: var(--ink-2);
  padding: clamp(12px, 1.6vw, 20px);
}

.dropzone {
  display: grid;
  gap: 16px;
  padding: clamp(18px, 2.4vw, 26px);
  background: var(--ink-3);
  cursor: pointer;
  transition: background-color 0.15s ease-out, transform 0.15s ease-out;
}
.dropzone:hover { background: var(--ink-4); }
.dropzone:active { transform: translateY(1px); }
.dropzone:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.dropzone.is-over { background: var(--accent); color: var(--accent-ink); }
.dropzone.is-over .dz-sub { color: var(--accent-ink); }
.dropzone.is-over .dz-wave { color: var(--accent-ink); }

.dz-wave {
  display: block;
  width: 100%;
  height: 42px;
  color: var(--accent);
  pointer-events: none;
}
.dz-wave path { fill: currentColor; }

.dz-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
}
.dz-copy { display: grid; gap: 4px; min-width: 220px; }
.dz-title { font-size: var(--fs-lead); font-weight: 600; }
.dz-sub { font-size: var(--fs-small); color: var(--muted); }

/* editor */

.editor { display: grid; gap: 16px; padding-top: 4px; }

.filebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.filemeta {
  font-size: var(--fs-small);
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}
.filemeta strong { color: var(--paper); font-weight: 600; }

.wave {
  position: relative;
  height: 190px;
  background: var(--ink);
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.wave canvas {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.5s ease-out;
}
.wave.is-loaded canvas { opacity: 1; }

.sel {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(200, 242, 74, 0.16);
  pointer-events: none;
}
.sel::before,
.sel::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
}
.sel::before { left: 0; }
.sel::after { right: 0; }

.handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 46px;
  margin-left: -23px;
  display: grid;
  place-items: center;
  cursor: ew-resize;
  touch-action: none;
  outline: none;
}
.handle span {
  position: relative;
  display: block;
  width: 6px;
  height: 100%;
  background: var(--accent);
  transition: background-color 0.15s ease-out, transform 0.15s ease-out;
}
.handle span::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  background: var(--accent-ink);
}
.handle:hover span { background: var(--accent-hi); }
.handle:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.handle.is-active span { background: var(--accent-hi); }

/* time inputs */

.times {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  font-size: var(--fs-small);
  color: var(--muted);
}
.times label { display: inline-flex; align-items: center; gap: 8px; }
.times input,
.mp3group select {
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  background: var(--ink-3);
  color: var(--paper);
  font: inherit;
  font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
  transition: background-color 0.15s ease-out;
}
.times input { width: 92px; }
.times input:hover,
.mp3group select:hover { background: var(--ink-4); }
.times input:focus-visible,
.mp3group select:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.times .len strong { color: var(--paper); font-variant-numeric: tabular-nums; }
.times .total { margin-left: auto; }
.times .total span { color: var(--paper); font-variant-numeric: tabular-nums; }

/* controls */

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
}

.seg { display: inline-flex; background: var(--ink-3); }
.seg-btn {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: var(--fs-small);
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.15s ease-out, color 0.15s ease-out;
}
.seg-btn:hover { color: var(--paper); background: var(--ink-4); }
.seg-btn.is-active { background: var(--accent); color: var(--accent-ink); }
.seg-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }

.switches { display: inline-flex; gap: 18px; }
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: var(--fs-small);
  color: var(--muted);
  cursor: pointer;
  touch-action: manipulation;
}
.switch input {
  appearance: none;
  -webkit-appearance: none;
  width: 44px;
  height: 24px;
  background: var(--ink-4);
  position: relative;
  cursor: pointer;
  flex: none;
  transition: background-color 0.15s ease-out;
}
.switch input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--paper);
  transition: transform 0.15s ease-out;
}
.switch input:checked { background: var(--accent); }
.switch input:checked::after { background: var(--accent-ink); transform: translateX(20px); }
.switch input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.play { margin-left: auto; }

.warn {
  padding: 12px 14px;
  background: var(--warn-bg);
  color: var(--warn-fg);
  font-size: var(--fs-small);
  max-width: 60ch;
}

.exports { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.mp3group { display: inline-flex; align-items: center; gap: 8px; }
.export-note {
  font-size: var(--fs-small);
  color: var(--muted);
  max-width: 30ch;
}

.status { min-height: 22px; font-size: var(--fs-small); color: var(--muted); }
.status.is-busy { color: var(--accent); }
.status.is-done { color: var(--ok-fg); }

.error {
  padding: 14px 16px;
  background: var(--danger-bg);
  color: var(--danger-fg);
  font-size: var(--fs-body);
  max-width: 60ch;
}
.error strong { color: #ffd7d0; }

/* ---------------------------------------------------------------- bands */

.band { padding: var(--gap) 0; }
.band-surface { background: var(--ink-2); }
.band-tight { padding-top: clamp(34px, 4vw, 56px); }

.band .wrap > h2 { margin-bottom: 24px; }
.prose.stack h2 { margin-bottom: 0; }
.after-steps { margin-top: 22px; max-width: 60ch; }
.prose .formats { margin-bottom: 4px; }

.wave-strip {
  display: block;
  width: 100%;
  height: 46px;
  color: var(--ink-3);
  overflow: hidden;
}
.wave-strip svg { display: block; width: 100%; height: 100%; }
.wave-strip path { fill: currentColor; }

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 60px);
  align-items: center;
}
.split--flip .split-fig { order: -1; }

.stack { display: grid; gap: 18px; }

.prose p,
.prose ul,
.prose ol,
.prose .lede { max-width: 60ch; }
.prose > p + p { margin-top: 14px; }
.prose strong { color: var(--paper); }

.prose ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.prose ul li {
  position: relative;
  padding-left: 32px;
}
.prose ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 20px;
  height: 12px;
  background-repeat: no-repeat;
  background-position: left center;
  background-size: 20px 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 12'%3E%3Cpath d='M0 12h2V7H0zM4 12h2V3H4zM8 12h2V5H8zM12 12h2V1h-2zM16 12h2V8h-2z' fill='%23c8f24a'/%3E%3C/svg%3E");
}

.prose ol {
  margin: 0;
  padding-left: 1.4em;
  display: grid;
  gap: 12px;
}
.prose ol li::marker { color: var(--accent); font-weight: 700; }

.prose h3 {
  font-size: var(--fs-lead);
  margin-bottom: 10px;
}

/* three real steps, no cards */
.steps {
  list-style: decimal;
  margin: 0;
  padding-left: 1.3em;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px 30px;
}
.steps li { padding-right: 6px; }
.steps li::marker { color: var(--accent); font-weight: 700; }
.steps strong { display: block; color: var(--paper); font-size: var(--fs-lead); font-weight: 700; }
.steps span { display: block; color: var(--paper); font-size: var(--fs-body); margin-top: 4px; }

.formats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0 !important;
}
.formats li {
  padding: 6px 12px;
  background: var(--ink-3);
  font-size: var(--fs-small);
  color: var(--paper);
  padding-left: 12px !important;
}
.formats li::before { display: none; }

/* figures */

.fig { display: grid; gap: 12px; }
.fig img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--ink-3);
}
.fig figcaption {
  font-size: var(--fs-small);
  color: var(--muted);
  max-width: 54ch;
}

.wide-figure { margin: 0; }
.wide-figure img {
  display: block;
  width: 100%;
  height: clamp(220px, 34vh, 400px);
  object-fit: cover;
  object-position: center 45%;
}
.wide-figure figcaption {
  max-width: 1180px;
  margin: 14px auto 0;
  padding: 0 var(--edge);
  font-size: var(--fs-small);
  color: var(--muted);
}

/* waveform sketch used on the ringtone page */
.flow-wave {
  display: block;
  width: 100%;
  height: 72px;
  color: var(--accent);
}
.flow-wave path { fill: currentColor; }

/* inner-page cross links */
.next-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  font-size: var(--fs-body);
}
.next-links a { color: var(--paper); }

/* ---------------------------------------------------------------- faq */

.faq { display: grid; gap: 4px; max-width: 74ch; }
.faq details { padding: 18px 0 20px; }
.faq summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  font-size: var(--fs-lead);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  color: var(--accent);
  font-weight: 400;
  flex: none;
}
.faq details[open] summary::after { content: "\2013"; }
.faq summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.faq p { margin-top: 12px; max-width: 60ch; color: var(--paper); }

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

.site-footer {
  margin-top: var(--gap);
  padding: clamp(40px, 5vw, 64px) 0 48px;
  background: var(--ink-2);
  font-size: var(--fs-small);
  color: var(--muted);
}
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px 32px;
}
.footer-h {
  font-size: var(--fs-small);
  color: var(--paper);
  margin: 0 0 12px;
  font-weight: 600;
}
.footer-grid p { max-width: 42ch; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-grid a { color: var(--muted); text-decoration-color: var(--ink-4); }
.footer-grid a:hover { color: var(--paper); }
.footer-mark { display: inline-flex; align-items: center; gap: 10px; color: var(--paper); text-decoration: none; }

.credits {
  margin-top: clamp(28px, 3vw, 40px);
  max-width: 96ch;
  line-height: 1.6;
}
.credits a { color: var(--paper); text-decoration-color: var(--ink-4); }
.credits a:hover { color: var(--accent); }
.footer-note { margin-top: 12px; }

/* ---------------------------------------------------------------- motion */

.reveal {
  transition: opacity 0.55s ease-out, transform 0.55s ease-out;
}
.js .reveal { opacity: 0; transform: translateY(22px); }
.js .reveal.is-in { opacity: 1; transform: none; }
.js .reveal[data-d="1"] { transition-delay: 70ms; }
.js .reveal[data-d="2"] { transition-delay: 140ms; }
.js .reveal[data-d="3"] { transition-delay: 210ms; }

@keyframes wave-grow {
  from { transform: scaleX(0.02); }
  to { transform: scaleX(1); }
}
.js .hero-wave { animation: wave-grow 0.7s ease-out both; }

/* ---------------------------------------------------------------- narrow */

@media (max-width: 900px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .split--flip .split-fig { order: 0; }
  .steps { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .footer-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .footer-grid > :first-child { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  :root {
    --band: 30vh;
    --fs-lead: 19px;
    --fs-body: 17px;
  }
  .hero--sub { --band: 18vh; }
  .hero-title h1 { letter-spacing: -0.03em; }
  .lede { max-width: 34ch; }
  .site-nav { gap: 6px 14px; }
  .dz-row { flex-direction: column; align-items: stretch; }
  .dz-row .btn { width: 100%; }
  .wave { height: 160px; }
  .times .total { margin-left: 0; }
  .play { margin-left: 0; width: 100%; }
  .play .btn { width: 100%; }
  .exports { flex-direction: column; align-items: stretch; }
  .exports .btn,
  .mp3group { width: 100%; }
  .mp3group select { flex: 1; }
  .mp3group .btn { flex: 2; }
  .export-note { max-width: none; }
  .footer-grid { grid-template-columns: minmax(0, 1fr); }
  .wide-figure img { height: clamp(200px, 30vh, 300px); }
}

@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; }
  .js .hero-wave { animation: none; }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .wave canvas { opacity: 1; }
}
