/*
 * CleanerPodcasts — stylesheet
 * Architecture and conventions: docs/design/
 * Quiet modern aesthetic, rust accent, single radius value (2px).
 *
 * Cascade layer order (later layers always win):
 *   reset → base → components → utilities
 */

@layer reset, base, components, utilities;

/* ─────────────────────────── FONTS ─────────────────────────── */

@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Variable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ─────────────────────── DESIGN TOKENS ─────────────────────── */

:root {
  /*
   * Raw OKLCH values (Fizzy-style two-step pattern).
   * Functional tokens below compose oklch() from these.
   */
  --lch-paper:         98.1% 0.003 85;
  --lch-surface:       100%  0     0;
  --lch-warm-hairline: 92.7% 0.004 77;
  --lch-ink:           17.8% 0     0;
  --lch-warm-muted:    48.5% 0.006 70;
  --lch-rust:          53%   0.148 41.4;
  --lch-rust-hover:    45%   0.14  41.4;

  /* Functional color tokens — use these everywhere, not raw LCH */
  --color-background:    oklch(var(--lch-paper));
  --color-surface:       oklch(var(--lch-surface));
  --color-border:        oklch(var(--lch-warm-hairline));
  --color-border-strong: oklch(var(--lch-ink));
  --color-text:          oklch(var(--lch-ink));
  --color-text-muted:    oklch(var(--lch-warm-muted));
  --color-accent:        oklch(var(--lch-rust));
  --color-accent-hover:  oklch(var(--lch-rust-hover));

  /* Typography */
  --font-sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", monospace;

  /* One radius, everywhere */
  --radius: 2px;

  /* Narrow reading column — matches original Overcast-inspired design */
  --container-width: 700px;
}

/* ────────────────────────── RESET ─────────────────────────── */

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

  body,
  h1, h2, h3, h4, h5, h6,
  p, figure, blockquote,
  dl, dd, ul, ol {
    margin: 0;
  }

  ul[role="list"],
  ol[role="list"] {
    list-style: none;
    padding: 0;
  }

  html {
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }

  body {
    min-height: 100svh;
  }

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

  input, button, textarea, select {
    font: inherit;
    color: inherit;
  }

  button {
    cursor: pointer;
    background: transparent;
    border: 0;
    padding: 0;
  }

  button:disabled {
    cursor: not-allowed;
  }

  p, h1, h2, h3, h4, h5, h6 {
    overflow-wrap: break-word;
  }

  h1, h2, h3, h4 {
    text-wrap: balance;
  }

  a {
    color: inherit;
    text-decoration-skip-ink: auto;
  }

  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }
  }
}

/* ────────────────────────── BASE ──────────────────────────── */

@layer base {
  html {
    font-family: var(--font-sans);
    background: var(--color-background);
    color: var(--color-text);
  }

  body {
    font-size: 1rem;
    line-height: 1.5;
  }

  h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
  }

  h1 { font-size: 2.25rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
  h4 { font-size: 1.125rem; }
  h5 { font-size: 1rem; }
  h6 { font-size: 0.875rem; }

  p {
    line-height: 1.625;
  }

  a {
    color: inherit;
    text-decoration-color: var(--color-accent);
    text-underline-offset: 2px;
  }

  code, pre, kbd, samp {
    font-family: var(--font-mono);
  }

  ::selection {
    background: var(--color-accent);
    color: white;
  }

  hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 1.5rem 0;
  }

  /* Native range input (audio player scrubber) — quick pass;
     lives here because it's a browser-element default, not a component. */
  input[type="range"] {
    accent-color: var(--color-accent);
  }
}

/* ──────────────────────── COMPONENTS ───────────────────────── */

@layer components {

  /* ─── Page containers ─── */

  .page {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 1.5rem 1rem;
  }

  .page--narrow {
    max-width: 28rem;
    padding-top: 3rem;
    padding-bottom: 3rem;
  }

  .page__header {
    margin-bottom: 1.5rem;
  }

  .page__title {
    font-size: 2.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.1;
  }

  .page__subtitle {
    margin-top: 0.5rem;
    color: var(--color-text-muted);
  }

  /* ─── Buttons ─── */

  .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 2.5rem;
    padding: 0 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1;
    color: var(--color-text);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 150ms, color 150ms, border-color 150ms;
    text-decoration: none;
    white-space: nowrap;

    &:focus-visible {
      outline: 2px solid var(--color-accent);
      outline-offset: 2px;
    }

    &:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }
  }

  .button--primary {
    background: var(--color-accent);
    color: white;

    &:hover:not(:disabled) {
      background: var(--color-accent-hover);
    }
  }

  .button--secondary {
    border-color: var(--color-text);
    color: var(--color-text);

    &:hover:not(:disabled) {
      background: var(--color-text);
      color: white;
    }
  }

  .button--ghost {
    color: var(--color-text);

    &:hover:not(:disabled) {
      background: var(--color-border);
    }
  }

  .button--sm {
    height: 2rem;
    padding: 0 0.75rem;
    font-size: 0.75rem;
    letter-spacing: 0.025em;
  }

  .button--full {
    width: 100%;
  }

  /* Rails' button_to generates a wrapping <form class="button_to">
     we neutralize so the form doesn't cause a line break. */
  form.button_to {
    display: inline-block;
    margin: 0;
  }

  /* ─── Forms ─── */

  .form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
  }

  .field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
  }

  .label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .input,
  .textarea,
  .select {
    width: 100%;
    height: 2.5rem;
    padding: 0 0.75rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    transition: border-color 150ms;

    &::placeholder {
      color: var(--color-text-muted);
    }

    &:focus {
      outline: 2px solid var(--color-accent);
      outline-offset: 2px;
      border-color: var(--color-accent);
    }

    &[aria-invalid="true"] {
      border-color: var(--color-accent);
    }

    &:disabled {
      background: var(--color-background);
      color: var(--color-text-muted);
      cursor: not-allowed;
    }
  }

  .textarea {
    height: auto;
    min-height: 7.5rem;
    padding: 0.5rem 0.75rem;
    resize: vertical;
    line-height: 1.5;
  }

  .input--code {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    letter-spacing: 0.35em;
    text-align: center;
    height: 3rem;
  }

  .helper {
    font-size: 0.75rem;
    color: var(--color-text-muted);
  }

  .error {
    font-size: 0.75rem;
    color: var(--color-accent);
  }

  .checkbox,
  .radio {
    appearance: none;
    width: 1rem;
    height: 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-text);
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;

    &:focus-visible {
      outline: 2px solid var(--color-accent);
      outline-offset: 2px;
    }
  }

  .checkbox {
    border-radius: var(--radius);

    &:checked {
      background-color: var(--color-accent);
      border-color: var(--color-accent);
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8l3 3 6-6'/%3E%3C/svg%3E");
      background-size: contain;
      background-repeat: no-repeat;
    }
  }

  .radio {
    border-radius: 50%;

    &:checked {
      background: radial-gradient(circle, var(--color-accent) 40%, var(--color-surface) 45%);
      border-color: var(--color-accent);
    }
  }

  .checkbox-field {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
  }

  /* ─── Navigation ─── */

  .nav {
    border-bottom: 1px solid var(--color-border);
    background: var(--color-background);
  }

  .nav__inner {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .nav__brand {
    text-decoration: none;
    color: var(--color-text);
    flex-shrink: 0;
  }

  /* ─── Logo (mark + wordmark lockup) ─── */

  .logo {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4em;
    color: inherit;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1;
  }

  .logo-mark {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
    /* Treat the SVG as inline so its bottom sits on the text baseline */
    display: inline-block;
    vertical-align: baseline;
  }

  .logo__wordmark {
    font-size: 1rem;
  }

  /* Size variants for hero / marketing / email use */
  .logo--lg {
    font-size: 1.5rem;
  }

  .logo--xl {
    font-size: 2.5rem;
  }

  .logo--icon-only .logo__wordmark {
    position: absolute;
    width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
  }

  /* Nav search — compact, inline with brand. */

  .nav__search {
    position: relative;
    flex: 1;
    max-width: 22rem;
    margin-left: 1.5rem;
  }

  .nav__search-icon {
    position: absolute;
    left: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0.875rem;
    height: 0.875rem;
    color: var(--color-text-muted);
    pointer-events: none;
  }

  .nav__search-input {
    width: 100%;
    height: 2.25rem;
    padding: 0 0.75rem 0 2rem;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    transition: border-color 150ms;

    &::placeholder {
      color: var(--color-text-muted);
    }

    &:focus {
      outline: 2px solid var(--color-accent);
      outline-offset: 1px;
      border-color: var(--color-accent);
    }
  }

  @media (max-width: 480px) {
    .nav__search {
      max-width: none;
      margin-left: 0.75rem;
    }

    .nav__search-input::placeholder {
      content: "Search";
    }
  }

  /* ─── Footer ─── */

  .footer {
    max-width: var(--container-width);
    margin: 6rem auto 3rem;
    padding: 1.5rem 1rem 0;
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
  }

  .footer__links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.375rem 0.875rem;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-muted);
  }

  .footer__links > :not(:last-child)::after {
    content: "·";
    margin-left: 0.875rem;
    color: var(--color-border-strong);
    opacity: 0.4;
  }

  .footer__link {
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color 150ms;

    &:hover {
      color: var(--color-accent);
    }
  }

  /* Rails button_to wraps the sign-out link in a <form>; button--bare
     neutralizes it to look and behave like a plain inline link. */
  .button--bare {
    display: inline;
    background: transparent;
    border: 0;
    padding: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    letter-spacing: inherit;
    text-transform: inherit;
  }

  .footer__meta {
    font-size: 0.6875rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    opacity: 0.6;
    font-family: var(--font-mono);
  }

  /* ─── Podcast cell (dashboard list item) ─── */

  .podcast-cell {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--color-text);
    transition: border-color 150ms;

    &:hover {
      border-color: var(--color-border-strong);
    }
  }

  .podcast-cell__artwork {
    flex-shrink: 0;
    width: 70px;
    height: 70px;
    background: var(--color-background);
    border-radius: var(--radius);
    overflow: hidden;
  }

  .podcast-cell__artwork img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .podcast-cell__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
  }

  .podcast-cell__title {
    font-size: 1rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .podcast-cell__author {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .podcast-cell__meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-family: var(--font-mono);
  }

  .podcast-cell__chevron {
    flex-shrink: 0;
    color: var(--color-text-muted);
  }

  /* ─── Badge (small status tag) ─── */

  .badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text-muted);
    background: var(--color-background);
  }

  .badge--accent {
    color: var(--color-accent);
    border-color: var(--color-accent);
  }

  .badge--filled {
    color: white;
    background: var(--color-text);
    border-color: var(--color-text);
  }

  /* ─── Episode item (list row) ─── */

  .episode-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--color-border);
    text-decoration: none;
    color: var(--color-text);

    &:last-child {
      border-bottom: none;
    }
  }

  .episode-item__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }

  .episode-item__title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
  }

  .episode-item__description {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .episode-item__meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--color-text-muted);
  }

  /* ─── Flash messages ─── */

  .flash {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 50;
    width: 22rem;
    max-width: calc(100vw - 2.5rem);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
  }

  .flash__item {
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    line-height: 1.4;
    pointer-events: auto;
    display: flex;
    align-items: start;
    gap: 0.75rem;
  }

  .flash__item--accent {
    border-color: var(--color-accent);
    border-left-width: 3px;
  }

  .flash__dismiss {
    flex-shrink: 0;
    margin-left: auto;
    color: var(--color-text-muted);
    transition: color 150ms;

    &:hover {
      color: var(--color-text);
    }
  }

  /* ─── Search input (editorial — larger than a standard .input) ─── */

  .search-form {
    position: relative;
    margin-bottom: 2rem;
  }

  .search-form__input {
    width: 100%;
    height: 3.25rem;
    padding: 0 1rem 0 3rem;
    font-size: 1.125rem;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    transition: border-color 150ms;

    &::placeholder {
      color: var(--color-text-muted);
    }

    &:focus {
      outline: 2px solid var(--color-accent);
      outline-offset: 2px;
      border-color: var(--color-accent);
    }
  }

  .search-form__icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.125rem;
    height: 1.125rem;
    color: var(--color-text-muted);
    pointer-events: none;
  }

  /* ─── Search results ─── */

  .search-result__info-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border-strong);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-muted);
  }

  .search-result__info-row strong {
    color: var(--color-text);
    font-weight: 600;
    letter-spacing: normal;
    text-transform: none;
  }

  .search-result {
    display: flex;
    gap: 1rem;
    padding: 1rem 0.5rem;
    margin: 0 -0.5rem;
    border-bottom: 1px solid var(--color-border);
    text-decoration: none;
    color: var(--color-text);
    transition: background-color 120ms;

    &:last-child {
      border-bottom: none;
    }

    &:hover {
      background: color-mix(in oklch, var(--color-accent) 5%, transparent);
    }

    &:hover .search-result__title {
      color: var(--color-accent);
    }
  }

  .search-result__artwork {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
  }

  .search-result__artwork img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .search-result__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
  }

  .search-result__title {
    font-size: 1rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 150ms;
  }

  .search-result__author {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .search-result__description {
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* ─── Search results container / pagination ─── */

  .search-results {
    display: flex;
    flex-direction: column;
  }

  .pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.875rem;
  }

  .pagination a {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 500;

    &:hover {
      text-decoration: underline;
    }
  }

  .pagination__page {
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    font-size: 0.75rem;
  }

  /* ─── Callout (dev banner, inline note) ─── */

  .callout {
    padding: 0.75rem 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-left-width: 3px;
    font-size: 0.875rem;
    line-height: 1.5;
  }

  .callout--dev {
    border-color: var(--color-accent);
    border-left-width: 3px;
  }

  .callout__label {
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-accent);
    display: block;
    margin-bottom: 0.25rem;
  }

  .callout__code {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    letter-spacing: 0.3em;
  }

  /* ─── Divider with inline text ─── */

  .divider {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.875rem;
  }

  .divider a {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 500;
    margin-left: 0.25rem;

    &:hover {
      text-decoration: underline;
    }
  }

  /* ─── Back link ─── */

  .back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1.5rem;

    &:hover { color: var(--color-accent); }
  }

  /* ─── Podcast hero (detail page header) ─── */

  .podcast-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 2rem;
  }

  .podcast-hero__artwork {
    width: 200px;
    height: 200px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1.25rem;
  }

  .podcast-hero__artwork img { width: 100%; height: 100%; object-fit: cover; }

  .podcast-hero__title {
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.2;
    margin-bottom: 0.25rem;
  }

  .podcast-hero__author { color: var(--color-text-muted); margin-bottom: 1rem; }

  .podcast-hero__meta {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
  }

  .podcast-hero__actions {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  .podcast-hero__description {
    margin-top: 2rem;
    color: var(--color-text);
    line-height: 1.625;
    text-align: left;

    & p { margin-bottom: 0.75rem; }
    & a { color: var(--color-accent); }
  }

  /* ─── Episode row (inside podcast detail) ─── */

  .episode-row {
    padding: 1rem 0;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 1rem;

    &:last-child { border-bottom: none; }
    &.is-unsaved { opacity: 0.55; }
  }

  .episode-row__body { flex: 1; min-width: 0; cursor: pointer; }

  .episode-row__title {
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 0.25rem;
  }

  .episode-row__meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--color-text-muted);
  }

  .episode-row__description {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .episode-row__action { flex-shrink: 0; }

  /* ─── Tabs ─── */

  .tabs {
    display: flex;
    gap: 2rem;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 1.5rem;
  }

  .tabs__tab {
    padding: 0.75rem 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 150ms, border-color 150ms;

    &:hover { color: var(--color-text); }
    &.is-active {
      color: var(--color-text);
      border-bottom-color: var(--color-accent);
    }
  }

  /* ─── Audio player ─── */

  .player {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem 0;
  }

  .player__artwork {
    width: 180px;
    height: 180px;
    margin: 0 auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
  }

  .player__artwork img { width: 100%; height: 100%; object-fit: cover; }

  .player__title {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    text-wrap: balance;
  }

  .player__podcast {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    margin-top: 0.25rem;
  }

  .player__progress { display: flex; flex-direction: column; gap: 0.375rem; }

  .player__times {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-text-muted);
  }

  .player__track { position: relative; height: 4px; background: var(--color-border); border-radius: 2px; }
  .player__track-fill { position: absolute; top: 0; left: 0; height: 100%; background: var(--color-accent); border-radius: 2px; pointer-events: none; }
  .player__track-slider { position: absolute; top: -8px; left: 0; width: 100%; height: 20px; opacity: 0; cursor: pointer; }

  .player__controls { display: flex; justify-content: center; align-items: center; gap: 1.5rem; }

  .player__skip {
    width: 2.5rem; height: 2.5rem;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--color-text); background: transparent; border: none; cursor: pointer;
    transition: color 150ms;

    &:hover { color: var(--color-accent); }
  }

  .player__play-pause {
    width: 4rem; height: 4rem; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--color-accent); color: white; border: none; cursor: pointer;
    transition: background-color 150ms;

    &:hover { background: var(--color-accent-hover); }
  }

  .player__speed { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; font-size: 0.75rem; color: var(--color-text-muted); }
  .player__speed input[type="range"] { width: 16rem; }

  /* ─── Empty state ─── */

  .empty-state {
    text-align: center;
    padding: 4rem 1rem;
  }

  .empty-state__title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
  }

  .empty-state__body {
    color: var(--color-text-muted);
    max-width: 24rem;
    margin: 0 auto 1.5rem;
  }

  /* ─── Status banner (blocked / inactive feeds) ─── */

  .status-banner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    margin: 0 0 1.25rem;
    font-size: 0.875rem;
    line-height: 1.4;
  }

  .status-banner__label {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
  }

  .status-banner__detail {
    color: var(--color-text-muted);
    flex: 1 1 auto;
    min-width: 12rem;
  }

  .status-banner__action {
    flex-shrink: 0;
  }

  .status-banner--blocked {
    border-color: var(--color-border-strong);
  }

  .status-banner--blocked .status-banner__label {
    color: var(--color-text);
  }

  .status-banner--inactive {
    border-color: var(--color-accent);
    border-left-width: 3px;
  }

  .status-banner--inactive .status-banner__label {
    color: var(--color-accent);
  }
}

/* ──────────────────────── UTILITIES ────────────────────────── */

@layer utilities {

  /* Hidden — display:none; (used by Stimulus controllers that toggle visibility) */
  .hidden {
    display: none !important;
  }

  /* Visually-hidden (screen-reader only) */
  .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;
  }

  /* Layout helpers — a handful only */
  .stack {
    display: flex;
    flex-direction: column;
  }

  .stack-gap-sm > * + * { margin-top: 0.5rem; }
  .stack-gap-md > * + * { margin-top: 1rem; }
  .stack-gap-lg > * + * { margin-top: 2rem; }

  .row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
  }

  .row--between {
    justify-content: space-between;
  }

  .row--wrap {
    flex-wrap: wrap;
  }

  /* Text helpers */
  .muted { color: var(--color-text-muted); }
  .mono  { font-family: var(--font-mono); }
  .small { font-size: 0.875rem; }
  .tiny  { font-size: 0.75rem; }

  /* Rare utility for images that should fill their container */
  .cover { object-fit: cover; width: 100%; height: 100%; }
}

