/* Podcast AutoEdit. Light, warm, quiet. One accent: the red of a recording light. */

:root {
  --paper: oklch(97.6% 0.008 85);
  --paper-deep: oklch(94.6% 0.012 85);
  --surface: oklch(99.2% 0.004 85);
  --ink: oklch(23% 0.02 265);
  --ink-soft: oklch(42% 0.02 265);
  --ink-faint: oklch(56% 0.018 265);
  --rule: oklch(87% 0.012 85);
  --rule-strong: oklch(74% 0.015 85);
  --accent: oklch(57% 0.19 32);
  --accent-deep: oklch(47% 0.17 32);
  --accent-wash: oklch(95% 0.03 40);
  --good: oklch(47% 0.11 155);
  --good-wash: oklch(95% 0.035 155);
  --warn: oklch(50% 0.11 75);
  --warn-wash: oklch(95.5% 0.04 85);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --page: min(100% - 2.5rem, 46rem);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, p { margin: 0; }

.skip {
  position: absolute; left: 1rem; top: -4rem;
  background: var(--ink); color: var(--paper);
  padding: 0.6rem 1rem; border-radius: 0.4rem; z-index: 10;
}
.skip:focus { top: 1rem; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 0.3rem; }

/* ---------- Top bar ---------- */

.top {
  width: var(--page);
  margin: 0 auto;
  padding: 1.4rem 0 1.1rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  border-bottom: 1px solid var(--rule);
}
.brand {
  white-space: nowrap;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  display: flex; align-items: center; gap: 0.55rem;
}
.brand-dot {
  width: 0.62rem; height: 0.62rem; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-wash);
}
.who { font-size: 0.92rem; color: var(--ink-soft); display: flex; gap: 0.9rem; align-items: baseline; min-width: 0; white-space: nowrap; }
.who span { overflow: hidden; text-overflow: ellipsis; }
.who .link { flex: none; }

main { width: var(--page); margin: 0 auto; flex: 1; }

/* ---------- Text pieces ---------- */

.intro { padding: clamp(2.2rem, 7vw, 4.2rem) 0 clamp(1.6rem, 4vw, 2.4rem); }
h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2rem, 6.4vw, 3.3rem);
  line-height: 1.06;
  letter-spacing: -0.018em;
  text-wrap: balance;
}
.lede { margin-top: 1.1rem; max-width: 34rem; color: var(--ink-soft); font-size: 1.1rem; }

.eyebrow {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.9rem;
}

.notice { padding: clamp(3rem, 12vw, 7rem) 0; max-width: 34rem; }
.notice h1 { font-size: clamp(1.7rem, 5vw, 2.4rem); }
.notice p { margin-top: 1rem; color: var(--ink-soft); }

/* ---------- Buttons and links ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font: inherit; font-weight: 600; line-height: 1.2;
  padding: 0.78rem 1.25rem;
  min-height: 2.9rem;
  border-radius: 0.5rem;
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease), transform 0.18s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: oklch(32% 0.03 265); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--rule-strong); }
.btn-secondary:hover { border-color: var(--ink); }
.btn[disabled] { opacity: 0.55; cursor: default; }
.btn-big { font-size: 1.08rem; padding: 0.95rem 1.5rem; }
.btn .btn-note { font-weight: 400; opacity: 0.75; }

.link {
  font: inherit; color: var(--ink); background: none; border: 0; padding: 0.35rem 0;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em;
  cursor: pointer;
}
.link:hover { color: var(--accent-deep); }
.link.danger { color: var(--accent-deep); }

/* ---------- Upload: drop zone ---------- */

.upload { padding-bottom: clamp(2.6rem, 7vw, 4rem); }

.drop {
  position: relative;
  background: var(--surface);
  padding: clamp(2.6rem, 9vw, 4.6rem) 1.5rem;
  text-align: center;
  transition: background-color 0.25s var(--ease);
}
/* Viewfinder corners instead of a dashed box. */
.corner {
  position: absolute; width: 2.1rem; height: 2.1rem;
  border: 0 solid var(--ink);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
  pointer-events: none;
}
.corner.tl { top: 0; left: 0; border-top-width: 3px; border-left-width: 3px; }
.corner.tr { top: 0; right: 0; border-top-width: 3px; border-right-width: 3px; }
.corner.bl { bottom: 0; left: 0; border-bottom-width: 3px; border-left-width: 3px; }
.corner.br { bottom: 0; right: 0; border-bottom-width: 3px; border-right-width: 3px; }
.drop.is-over { background: var(--accent-wash); }
.drop.is-over .corner { border-color: var(--accent); }
.drop.is-over .tl { transform: translate(0.7rem, 0.7rem); }
.drop.is-over .tr { transform: translate(-0.7rem, 0.7rem); }
.drop.is-over .bl { transform: translate(0.7rem, -0.7rem); }
.drop.is-over .br { transform: translate(-0.7rem, -0.7rem); }

.drop-title {
  font-family: var(--serif);
  font-size: clamp(1.55rem, 5vw, 2.15rem);
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.15;
}
.drop-sub { margin-top: 1.15rem; }
.drop-hint { margin-top: 1.1rem; font-size: 0.92rem; color: var(--ink-faint); }
.drop-error { margin-top: 0.9rem; color: var(--accent-deep); font-weight: 600; }

/* ---------- Upload: details form ---------- */

.details { background: var(--surface); padding: clamp(1.2rem, 4vw, 1.9rem); border-top: 3px solid var(--ink); }
.picked { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; padding-bottom: 1.1rem; border-bottom: 1px solid var(--rule); margin-bottom: 1.3rem; }
.picked-name { font-weight: 650; overflow-wrap: anywhere; }
.picked-size { color: var(--ink-faint); font-size: 0.93rem; }
.resume-note { background: var(--good-wash); color: var(--ink); padding: 0.85rem 1rem; border-radius: 0.4rem; margin-bottom: 1.3rem; }

.field { margin-bottom: 1.15rem; }
.field label { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 0.35rem; }
.optional { font-weight: 400; color: var(--ink-faint); font-size: 0.86rem; margin-left: 0.3rem; }
.field input, .field textarea, .feedback textarea {
  width: 100%;
  font: inherit; color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--rule-strong);
  border-radius: 0.45rem;
  padding: 0.7rem 0.8rem;
}
.field input:focus-visible, .field textarea:focus-visible, .feedback textarea:focus-visible { outline-offset: 1px; border-color: var(--ink); }
.field textarea, .feedback textarea { resize: vertical; min-height: 5rem; }
.field-small input { max-width: 9rem; font-size: 1.2rem; font-weight: 600; }
::placeholder { color: oklch(66% 0.015 265); }
.form-error { color: var(--accent-deep); font-weight: 600; margin-bottom: 1rem; }

/* ---------- Upload: progress ---------- */

.progress { background: var(--surface); padding: clamp(1.2rem, 4vw, 1.9rem); border-top: 3px solid var(--accent); }
.progress-file { font-weight: 650; overflow-wrap: anywhere; }
.progress-row { display: flex; align-items: center; gap: clamp(1rem, 4vw, 1.8rem); margin-top: 0.9rem; }
.progress-pct {
  font-family: var(--serif);
  font-size: clamp(2.6rem, 11vw, 4.2rem);
  font-weight: 600; line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  min-width: 3.1ch;
}
.progress-side { flex: 1; min-width: 0; }
.progress-stats { margin-top: 0.55rem; color: var(--ink-soft); font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.progress-status { margin-top: 0.9rem; font-weight: 600; min-height: 1.5em; }
.progress-status.is-trouble { color: var(--accent-deep); }
.progress-actions { margin-top: 0.9rem; display: flex; gap: 1.4rem; align-items: center; flex-wrap: wrap; }
.progress-tip { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--rule); color: var(--ink-faint); font-size: 0.92rem; }

.bar { height: 0.6rem; background: var(--paper-deep); border-radius: 1rem; overflow: hidden; }
.bar-fill {
  display: block; height: 100%; width: 100%;
  background: var(--accent);
  border-radius: 1rem;
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.5s var(--ease);
}
.bar.is-good .bar-fill { background: var(--good); }
.bar.is-waiting .bar-fill { background: var(--rule-strong); }

.upload-done { margin-top: 1rem; background: var(--good-wash); padding: 0.9rem 1.1rem; border-radius: 0.4rem; font-weight: 600; }

/* ---------- Episode list ---------- */

.jobs { padding-bottom: 4rem; }
.jobs-empty { color: var(--ink-soft); padding: 1.2rem 0; border-top: 1px solid var(--rule); }
.jobs-error { color: var(--accent-deep); font-weight: 600; margin-bottom: 1rem; }

.job { border-top: 1px solid var(--rule-strong); padding: 1.5rem 0 1.8rem; }
.job-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.6rem 1.2rem; flex-wrap: wrap; }
.job-name { font-family: var(--serif); font-size: clamp(1.3rem, 4vw, 1.6rem); font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.job-name .job-title { font-weight: 400; color: var(--ink-soft); }

.status { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.86rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; color: var(--ink-soft); }
.status-mark { width: 0.7rem; height: 0.7rem; border-radius: 50%; border: 2px solid currentColor; flex: none; }
.job[data-tone="busy"] .status { color: var(--accent-deep); }
.job[data-tone="busy"] .status-mark { background: currentColor; animation: pulse 1.6s ease-in-out infinite; }
.job[data-tone="good"] .status { color: var(--good); }
.job[data-tone="good"] .status-mark { background: currentColor; }
.job[data-tone="warn"] .status { color: var(--warn); }
.job[data-tone="warn"] .status-mark { border-radius: 2px; background: currentColor; }
@keyframes pulse { 50% { opacity: 0.35; } }

.job-message { margin-top: 0.55rem; color: var(--ink); }
.job-progress { margin-top: 0.85rem; display: flex; align-items: center; gap: 0.9rem; }
.job-progress .bar { flex: 1; }
.job-pct { font-variant-numeric: tabular-nums; font-weight: 650; min-width: 3.2ch; text-align: right; }
.job-meta { margin-top: 0.6rem; color: var(--ink-faint); font-size: 0.9rem; overflow-wrap: anywhere; }
.job-actions { margin-top: 0.9rem; display: flex; gap: 1.3rem; align-items: center; flex-wrap: wrap; }

/* ---------- Results ---------- */

.results { margin-top: 1.5rem; }
.results-zip { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem 1.2rem; }
.results-zip p { color: var(--ink-faint); font-size: 0.92rem; }
.results h4 { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); margin: 2rem 0 0.8rem; }

video { display: block; width: 100%; background: oklch(20% 0.01 265); border-radius: 0.35rem; }
.full video { aspect-ratio: 16 / 9; }
.file-line { display: flex; justify-content: space-between; align-items: baseline; gap: 0.4rem 1rem; flex-wrap: wrap; margin-top: 0.6rem; }
.file-title { font-weight: 600; overflow-wrap: anywhere; }
.file-size { color: var(--ink-faint); font-size: 0.88rem; white-space: nowrap; }

.reels { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.2rem, 1fr)); gap: 1.4rem 1rem; }
.reel video { aspect-ratio: 9 / 16; object-fit: cover; }
.reel .file-line { display: block; }
.reel .file-title { font-size: 0.93rem; line-height: 1.3; display: block; }
.reel .file-size { display: block; margin-top: 0.1rem; }
.reel .link { font-size: 0.93rem; }

.extras { margin-top: 1.8rem; border-top: 1px solid var(--rule); }
.extras summary { cursor: pointer; padding: 0.9rem 0; font-weight: 600; }
.extras ul { list-style: none; margin: 0; padding: 0 0 0.5rem; }
.extras li { display: flex; justify-content: space-between; align-items: baseline; gap: 0.3rem 1rem; flex-wrap: wrap; padding: 0.5rem 0; border-top: 1px solid var(--rule); }
.extras .file-title { font-weight: 400; }

.feedback { margin-top: 2rem; padding-top: 1.4rem; border-top: 1px solid var(--rule); max-width: 34rem; }
.feedback label { display: block; font-weight: 600; margin-bottom: 0.4rem; }
.feedback .btn { margin-top: 0.7rem; }
.feedback-status { margin-top: 0.6rem; font-weight: 600; color: var(--good); }
.feedback-status.is-trouble { color: var(--accent-deep); }

/* ---------- Footer ---------- */

.foot { width: var(--page); margin: 0 auto; padding: 1.4rem 0 2.2rem; border-top: 1px solid var(--rule); color: var(--ink-faint); font-size: 0.88rem; }

/* ---------- Entrance and reduced motion ---------- */

@keyframes rise { from { opacity: 0; transform: translateY(0.8rem); } to { opacity: 1; transform: none; } }
#view-app > section { animation: rise 0.7s var(--ease) both; }
#view-app > section:nth-child(2) { animation-delay: 0.08s; }
#view-app > section:nth-child(3) { animation-delay: 0.16s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 30rem) {
  body { font-size: 1rem; }
  .progress-row { flex-direction: column; align-items: stretch; gap: 0.7rem; }
  .btn-big { width: 100%; }
  .reels { grid-template-columns: repeat(2, 1fr); }
}
