/* gammonfrog — shared components */

/* ---------- TOPBAR ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--gutter);
}
.wm {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.035em;
  color: var(--ink);
  display: inline-flex; align-items: center; gap: 6px;
}
.wm .slash {
  display: inline-block;
  width: 2px; height: 18px;
  background: var(--accent);
  transform: skew(-18deg);
  margin: 0 1px;
}
.topbar-right {
  display: flex; align-items: center; gap: 4px;
}
.topbar-right .icon-btn {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink);
}
.topbar-right .icon-btn svg { width: 18px; height: 18px; }

/* Search: collapsed by default, expands left on click */
.search {
  display: inline-flex; align-items: center;
  border: 1px solid transparent;
  background: var(--paper);
  transition: border-color 180ms ease;
}
.search-input {
  width: 0; padding: 0; margin: 0;
  border: 0; outline: 0; background: transparent;
  font: inherit; font-family: var(--sans); font-size: 14px;
  color: var(--ink); caret-color: var(--accent);
  opacity: 0;
  transition: width 220ms ease, padding 220ms ease, opacity 180ms ease;
}
.search.is-open {
  border-color: var(--rule);
}
.search.is-open .search-input {
  width: 200px;
  padding: 6px 10px;
  opacity: 1;
}
.search.is-open .search-btn { color: var(--accent); }

@media (max-width: 640px) {
  .search.is-open .search-input { width: 60vw; max-width: 240px; }
}

/* ---------- TICKER (under topbar) ---------- */
.ticker {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 6px var(--gutter);
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.02em;
  color: var(--ink-3);
  border-bottom: 1px solid var(--rule-soft);
  overflow: hidden; white-space: nowrap;
}
.ticker-left {
  display: inline-flex; align-items: center; gap: 10px;
  min-width: 0; overflow: hidden; text-overflow: ellipsis;
}
.ticker-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0;
}
.ticker-saved {
  flex-shrink: 0;
  color: var(--ink); text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
}
.ticker-saved:hover { color: var(--accent); }
.ticker-saved .ct { color: var(--ink-3); margin-left: 4px; }
.ticker-saved[aria-current="page"] { color: var(--accent); }
.ticker-saved[aria-current="page"] .ct { color: var(--accent); }

.btn.is-saved { background: var(--ink); color: var(--paper); }
.saved-remove {
  align-self: center;
  width: 32px; height: 32px;
  border: 1px solid var(--rule-soft);
  background: transparent; color: var(--ink-3);
  font-size: 18px; line-height: 1;
  cursor: pointer;
}
.saved-remove:hover { color: var(--accent); border-color: var(--accent); }
.list-rail .list-row { grid-template-columns: 56px 1fr auto; }

/* ---------- CHIP / FILTER ---------- */
.chip {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
  padding: 7px 12px;
  border: 1px solid var(--rule);
  background: var(--paper);
  border-radius: 0;
  white-space: nowrap;
  text-transform: uppercase;
}
.chip[aria-current="true"], .chip.is-active, .chip.is-on {
  background: var(--ink); color: var(--paper);
}
.filter-row {
  display: flex; gap: 6px;
  padding: 10px var(--gutter);
  overflow-x: auto;
  border-bottom: 1px solid var(--rule);
  -webkit-overflow-scrolling: touch;
}
.filter-row::-webkit-scrollbar { display: none; }

.filter-row-2 {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px var(--gutter);
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono); font-size: 11px;
  color: var(--ink-3); letter-spacing: 0.04em;
  text-transform: uppercase;
}
.filter-row-2 .toggle {
  display: flex; gap: 6px; align-items: center;
}
.filter-row-2 .toggle button {
  padding: 4px 8px;
  border: 1px solid var(--rule-soft);
  color: var(--ink-3);
  background: var(--paper);
  font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.04em; text-transform: uppercase;
  cursor: pointer;
}
.filter-row-2 .toggle button.is-on {
  background: var(--ink); color: var(--paper);
  border-color: var(--ink);
}

/* ---------- TAB BAR ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--paper);
  border-top: 1px solid var(--rule);
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(56px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 40;
}
.tabbar a, .tabbar button {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-3);
  position: relative;
  border: 0; background: transparent;
}
.tabbar a svg, .tabbar button svg { width: 20px; height: 20px; }
.tabbar a.is-active, .tabbar button.is-active { color: var(--ink); }
.tabbar a.is-active::before, .tabbar button.is-active::before {
  content: ""; position: absolute; top: 0; width: 24px; height: 2px;
  background: var(--accent);
}

/* Desktop: tabbar is hidden — the index-strip handles navigation. */
@media (min-width: 641px) {
  .tabbar { display: none; }
}

/* ---------- MINI PLAYER (sits above the tabbar on mobile, at viewport bottom on desktop) ---------- */
.mini {
  position: fixed; left: 0; right: 0; bottom: calc(56px + env(safe-area-inset-bottom)); z-index: 41;
  background: var(--paper-2); color: var(--ink);
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-top: 1px solid rgba(26, 26, 26, 0.5);
}
.mini[hidden] { display: none; }
.mini .mini-pl {
  width: 36px; height: 36px; background: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 0; padding: 0; cursor: pointer; border-radius: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0,0,0,0.08);
}
.mini .mini-pl svg { width: 12px; height: 12px; fill: var(--paper-2); margin-left: 1px; }
.mini .mini-pl.is-playing svg { margin-left: 0; }
.mini .mini-info { flex: 1; min-width: 0; }
.mini .mini-ek {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-3);
}
.mini .mini-label { color: var(--accent); }
.mini .mini-ttl {
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}
.mini .mini-x {
  width: 36px; height: 36px; color: var(--ink-3);
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; cursor: pointer; padding: 0;
  flex-shrink: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0,0,0,0.08);
}
.mini .mini-x:hover { color: var(--ink); }
.mini .mini-x svg { width: 16px; height: 16px; }
.mini .mini-ctl {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; padding: 0; cursor: pointer;
  color: var(--ink); flex-shrink: 0;
  position: relative;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0,0,0,0.08);
}
.mini .mini-ctl svg { width: 16px; height: 16px; fill: currentColor; }
.mini .mini-ctl:disabled { opacity: 0.3; cursor: default; }
.mini .mini-ctl:hover:not(:disabled) { opacity: 0.6; }
.mini .mini-queue .count {
  position: absolute; top: -2px; right: -4px;
  min-width: 14px; height: 14px; padding: 0 3px;
  background: var(--accent); color: #fff;
  border-radius: 7px;
  font-family: var(--mono); font-size: 9px; font-weight: 500;
  line-height: 14px; text-align: center;
  letter-spacing: 0;
}
@media (max-width: 380px) {
  .mini { gap: 6px; padding: 10px 8px; }
  .mini .mini-ctl { width: 24px; height: 24px; }
  .mini .mini-ctl svg { width: 14px; height: 14px; }
}

@media (min-width: 641px) {
  .mini { bottom: 0; }
}

/* When the mini bar is visible, reserve room at the bottom so it doesn't
   overlap the last items of long lists (listen/podcast/articles) or the
   footer. The bar is ~58px tall; combined with the 56px tabbar on mobile
   we need ~120px of clearance. On desktop the tabbar is hidden so the
   mini bar alone reserves space. */
body.mini-visible main.scroll { padding-bottom: 160px; }
body.mini-visible .footer { padding-bottom: 140px; }
@media (min-width: 641px) {
  body.mini-visible main.scroll { padding-bottom: 88px; }
  body.mini-visible .footer { padding-bottom: 88px; }
}

/* ---------- AUDIO PLAYER ---------- */
.player {
  background: var(--paper-3);
  color: var(--ink);
  padding: 14px;
  display: flex; align-items: center; gap: 14px;
}
.player .play-big {
  width: 48px; height: 48px; flex-shrink: 0;
  background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
}
.player .play-big svg { width: 16px; height: 16px; fill: #fff; margin-left: 2px; }
.player .ap-meta {
  font-family: var(--mono); font-size: 10.5px;
  color: var(--ink-3); letter-spacing: 0.06em;
  text-transform: uppercase; margin-bottom: 4px;
}
.player .title {
  font-family: var(--sans); font-weight: 600; font-size: 14.5px;
  line-height: 1.25;
  color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.player .scrub {
  margin-top: 8px;
  height: 3px; background: var(--rule-soft);
  position: relative;
}
.player .scrub-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--accent);
}
.player.is-inline {
  border: 1px solid var(--rule);
  background: var(--paper-3); color: var(--ink);
  margin: 0 var(--gutter);
}
.player .body { flex: 1; min-width: 0; }
.player .ap-duration {
  font-family: var(--mono); font-size: 11px;
  color: var(--ink-4); letter-spacing: 0.04em;
  flex-shrink: 0;
}

/* ---------- LISTEN SHEET ---------- */
.ls-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  opacity: 0; pointer-events: none;
  transition: opacity 200ms ease;
  z-index: 60;
}
.ls-backdrop.open { opacity: 1; pointer-events: auto; }
.ls-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--paper);
  border-top: 1px solid var(--rule);
  padding: 12px 18px max(24px, env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 240ms cubic-bezier(.2,.7,.2,1);
  z-index: 61;
}
.ls-sheet.open { transform: translateY(0); }
.ls-grip {
  width: 36px; height: 4px;
  background: var(--rule-soft);
  border-radius: 2px;
  margin: 4px auto 14px;
}
.ls-title {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 14px;
}
.ls-row {
  display: grid;
  grid-template-columns: 44px 1fr 18px;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--rule-soft);
  text-decoration: none;
  color: var(--ink);
}
.ls-row:first-of-type { border-top: 0; }
.ls-icon {
  width: 44px; height: 44px;
  background: var(--paper-2);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink);
}
.ls-icon svg { width: 18px; height: 18px; }
.ls-name {
  font-family: var(--sans); font-weight: 600; font-size: 16px;
  letter-spacing: -0.012em;
}
.ls-sub {
  margin-top: 2px;
  font-family: var(--mono); font-size: 11px;
  color: var(--ink-3); letter-spacing: 0.04em;
}
.ls-chev { width: 18px; height: 18px; color: var(--ink-3); }

/* ---------- FOLLOW SHEET (article share row → social links) ---------- */
.follow-sheet .fs-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--rule-soft);
  text-decoration: none;
  color: var(--ink);
}
.follow-sheet .fs-row:first-of-type { border-top: 0; }
.follow-sheet .fs-row .lt {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 4px;
}
.follow-sheet .fs-row .ttl {
  font-family: var(--sans); font-weight: 600; font-size: 15px;
  color: var(--ink); letter-spacing: -0.01em;
  transition: color 120ms ease;
}
.follow-sheet .fs-row:hover .ttl { color: var(--accent); }
.follow-sheet .fs-chev {
  width: 16px; height: 16px; color: var(--ink-3);
  flex-shrink: 0;
}
@media (min-width: 601px) {
  .ls-sheet.follow-sheet {
    left: 50%; right: auto;
    top: 50%; bottom: auto;
    width: min(380px, 92vw);
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 22px 24px;
    transform: translate(-50%, -45%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease, transform 220ms cubic-bezier(.2,.7,.2,1);
  }
  .ls-sheet.follow-sheet.open {
    transform: translate(-50%, -50%);
    opacity: 1;
    pointer-events: auto;
  }
  .follow-sheet .ls-grip { display: none; }
}

/* ---------- FORMS ---------- */
.field {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 14px;
}
.field label {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-3);
}
.field input, .field textarea {
  font: inherit; font-family: var(--sans);
  padding: 12px;
  background: var(--paper);
  border: 1px solid var(--rule);
  color: var(--ink);
  border-radius: 0;
}
.field input:focus, .field textarea:focus {
  outline: 2px solid var(--accent); outline-offset: -1px;
}

/* ---------- FOOTER ---------- */
.footer {
  max-width: var(--max);
  margin: 0 auto;
  border-top: 1px solid var(--rule);
  padding: 24px var(--gutter);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.02em;
  color: var(--ink-3);
}
.footer .row-flex { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer h4 {
  font-size: 11px; font-family: var(--mono); font-weight: 500;
  text-transform: uppercase; color: var(--ink); letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.footer ul { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.footer .colophon {
  margin-top: 24px; padding-top: 16px;
  border-top: 1px solid var(--rule-soft);
  line-height: 1.5;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
@media (max-width: 640px) {
  .footer { padding-bottom: 80px; }
  .footer .row-flex { display: none; }
  .footer .colophon { margin-top: 0; padding-top: 0; border-top: 0; }
}

/* ---------- BUTTONS ---------- */
.btn {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 8px 12px;
  border: 1px solid var(--rule);
  background: var(--paper); color: var(--ink);
}
.btn.is-primary { background: var(--ink); color: var(--paper); }

/* ---------- UTILITY ---------- */
.dot-sep::before { content: "·"; margin: 0 6px; color: var(--ink-4); }
.eyebrow {
  font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-3);
}
.divider-rule { border-top: 1px solid var(--rule); }

/* ---------- AUDIO-PLAYER WRAP (JS hooks) ---------- */
.audio-player-wrap { width: 100%; }
.audio-player-wrap .ap-track {
  position: relative;
  height: 3px;
  background: rgba(255,255,255,0.18);
  margin-top: 8px;
}
.audio-player-wrap .ap-progress {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--accent);
  width: 0%;
}
.audio-player-wrap .ap-seek {
  position: absolute;
  top: -6px;
  left: 0;
  width: 100%;
  height: 15px;
  opacity: 0;
  cursor: pointer;
}
.audio-player-wrap .ap-current,
.audio-player-wrap .ap-duration {
  font-family: var(--mono);
  font-size: 10.5px;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.04em;
}
.audio-player-wrap .ap-sep {
  color: rgba(255,255,255,0.3);
  margin: 0 4px;
}

/* ----- Card pills (Listen / + Queue) ----- */
.pills {
  display: flex; flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.pill {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--rule-soft);
  padding: 4px 10px;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  line-height: 1.2;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.pill:hover { background: var(--paper-2); }
.pill svg { width: 10px; height: 10px; flex: none; }
.pill-listen svg { fill: var(--accent); }
.pill-queue svg { fill: currentColor; }
.pill-queue.is-in-queue {
  color: var(--ink-3);
  border-color: var(--ink-3);
}
.pill-queue.is-added {
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
}
/* Pills inside an .ep row sit alongside meta */
.ep .pills { margin-top: 6px; }
/* .row is a 2-col grid (title | thumb). When pills are present we add a
   second row beneath the title for them; the thumb spans both rows so the
   title link keeps its natural top-down flow (h3 → meta with 8px gap)
   without empty stretched space below the meta. align-self: center keeps
   the 88×88 thumb visually centered between the row's top + bottom rules
   regardless of how tall the text column grows. */
.row { row-gap: 6px; }
.row > a.thumb { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.row .pills { grid-column: 1; grid-row: 2; margin-top: 0; }
