/*
Theme Name: Randomly Mythical
Theme URI: https://randomlymythical.com/
Author: Steve Alves
Description: Single-page theme for the Randomly Mythical random Good Mythical Morning episode picker. Pulls the channel's uploads from the YouTube Data API and spins a random episode.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: randomly_mythical
Tags: one-page, custom-colors, full-width-template
*/

:root {
  /* Title-card palette: deep navy canvas, mustard hero, cyan accent. */
  --navy-950: #05161f;
  --navy-900: #0a2133;
  --navy-800: #0e2c42;
  --navy-700: #143d59;
  --navy-600: #1d5075;

  --gold: #f5b915;
  --gold-deep: #c78f00;
  --cyan: #35c3f3;
  --coral: #ff5a4d;

  --cream: #f6f3ea;
  --muted: #9db8cf;
  --faint: #7d97af;   /* lightest that clears 4.5:1 on the card's top gradient stop */
  --line: rgba(53, 195, 243, 0.18);

  --display: "Anton", "Arial Narrow", Impact, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  color-scheme: dark;   /* native selects + scrollbars follow the dark theme */
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--body);
  background:
    radial-gradient(900px 480px at 50% -8%, rgba(53,195,243,0.18) 0%, transparent 62%),
    radial-gradient(700px 420px at 88% 8%, rgba(245,185,21,0.10) 0%, transparent 60%),
    var(--navy-950);
  background-attachment: fixed;
  color: var(--cream);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 34px 16px 60px;
}

/* WP pushes html down by the admin bar height, so min-height: 100vh would
   overflow into a stray scrollbar for logged-in users. */
body.admin-bar { min-height: calc(100vh - 32px); }
@media screen and (max-width: 782px) {
  body.admin-bar { min-height: calc(100vh - 46px); }
}

/* Accessible-but-invisible labels (WP's standard utility class). */
.screen-reader-text {
  border: 0;
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}

/* ── Wordmark ─────────────────────────────────────────────── */
.site-header { text-align: center; max-width: 1000px; width: 100%; }
.kicker {
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 10px;
}
.wordmark {
  margin: 0;                     /* h1 default margin is 0.67em — huge at this size */
  font-family: var(--display);
  text-transform: uppercase;
  line-height: 0.88;
  letter-spacing: 0.005em;
  color: var(--gold);
  text-shadow: 0 4px 0 rgba(0,0,0,0.35);
}
.wordmark .l1 { display: block; font-size: clamp(30px, 7.4vw, 62px); }
.wordmark .l2 {
  display: block;
  font-size: clamp(44px, 11.6vw, 98px);
  color: var(--cream);
}
.rule {
  width: min(240px, 60%);
  height: 5px;
  margin: 16px auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
}
.sub { color: var(--muted); margin: 14px 0 4px; font-size: 15px; }

/* The page's main column mirrors the header width so cards line up. */
.site-main { width: 100%; max-width: 1000px; display: flex; flex-direction: column; align-items: center; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: linear-gradient(180deg, var(--navy-800) 0%, var(--navy-900) 100%);
  width: 100%;
  max-width: 1000px;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
  padding: 24px;
  margin-top: 20px;
}

/* Prose inside a card (the catalog-warming-up notice). */
.card-body { margin-top: 14px; font-size: 14px; color: var(--muted); line-height: 1.6; }
.card-body ol { padding-left: 20px; }
.card-body strong { color: var(--cream); }
.card-body a { color: var(--cyan); }
.card-body code {
  background: var(--navy-950);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 13px;
  color: var(--cream);
}
::placeholder { color: var(--faint); }
input:focus, select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(53, 195, 243, 0.22);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  transition: transform .05s ease, filter .15s ease;
}
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost {
  background: var(--navy-700); color: var(--cream);
  padding: 11px 16px; font-size: 13px;
  border: 1px solid var(--line);
}
.btn-ghost:hover:not(:disabled) { background: var(--navy-600); }

.status { margin-top: 12px; font-size: 14px; color: var(--muted); min-height: 20px; }
.status.error { color: var(--coral); }
.status.ok { color: #5fd39a; }

/* ── Loading card ─────────────────────────────────────────── */
#loader { display: none; text-align: center; padding: 38px 22px; }
.spinner {
  width: 50px; height: 50px; margin: 0 auto 18px;
  border: 5px solid rgba(53, 195, 243, 0.16);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.loader-title {
  font-family: var(--display); text-transform: uppercase; letter-spacing: .05em;
  color: var(--gold); font-size: 20px;
}
.loader-sub { color: var(--muted); font-size: 14px; margin-top: 8px; min-height: 20px; }
#loaderRetry { margin-top: 16px; }

/* ── Filters ──────────────────────────────────────────────── */
#filters { display: none; }
.filters-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.filters-title {
  font-family: var(--display); text-transform: uppercase; letter-spacing: .05em;
  color: var(--cream); font-size: 17px;
}
.filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
@media (max-width: 620px) { .filter-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 11px; font-weight: 700; color: var(--cyan);
  text-transform: uppercase; letter-spacing: .1em;
}
.field input[type="text"], .field select {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: var(--navy-950);
  color: var(--cream);
  outline: none;
  width: 100%;
}
.hint { font-size: 12px; color: var(--faint); line-height: 1.45; }
.hint em { color: var(--muted); font-style: normal; font-weight: 600; }
.year-row { display: flex; align-items: center; gap: 8px; }
.year-row span { color: var(--muted); font-size: 13px; }
.match-line {
  margin-top: 18px; font-size: 14px; color: var(--muted);
  border-top: 1px solid var(--line); padding-top: 14px;
}
.match-line strong { color: var(--gold); font-size: 16px; }
.match-line.empty { color: var(--coral); font-weight: 600; }

/* ── Spin stage ───────────────────────────────────────────── */
#stage { display: none; text-align: center; }
.spin-wrap { display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.btn-spin {
  background: var(--gold);
  color: #2b1f00;
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: clamp(19px, 4.4vw, 25px);
  padding: 16px 36px;
  border-radius: 14px;
  box-shadow: 0 6px 0 var(--gold-deep);
}
.btn-spin:hover:not(:disabled) { filter: brightness(1.06); }
.btn-spin:active:not(:disabled) { box-shadow: 0 2px 0 var(--gold-deep); transform: translateY(4px); }
.btn-spin:disabled { box-shadow: 0 6px 0 rgba(0,0,0,0.35); }

.stage-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--navy-950);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.thumbwrap { position: absolute; inset: 0; display: block; text-decoration: none; }
.thumb { width: 100%; height: 100%; object-fit: cover; display: none; }
.playbadge {
  position: absolute; inset: 0; margin: auto;
  width: 84px; height: 84px; border-radius: 50%;
  background: rgba(5, 22, 31, 0.62);
  border: 3px solid rgba(246, 243, 234, 0.9);
  display: none; align-items: center; justify-content: center;
  color: #fff; font-size: 32px; padding-left: 5px;
  transition: background .15s ease, transform .15s ease, border-color .15s ease;
}
.thumbwrap:hover .playbadge { background: #ff0000; border-color: #fff; transform: scale(1.07); }
.placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--faint); font-size: 16px; text-align: center; padding: 20px;
}
.player-mount { position: absolute; inset: 0; display: none; }
.player-mount iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.ep-title {
  margin: 18px 0 12px;
  font-size: 19px;
  font-weight: 800;
  color: var(--cream);
  line-height: 1.35;
  min-height: 24px;
}
.ep-date {
  display: none;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  margin-left: 10px;
}
.ep-date::before { content: "•"; color: var(--faint); margin-right: 10px; }

.actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn-watch {
  background: #ff0000; color: #fff;
  padding: 12px 22px; font-size: 15px;
  text-decoration: none; border-radius: 10px;
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--display); letter-spacing: .05em; text-transform: uppercase;
  box-shadow: 0 4px 0 #a80000;
}
.btn-watch:hover { filter: brightness(1.08); }
.btn-watch:active { box-shadow: 0 1px 0 #a80000; transform: translateY(3px); }

.embed-toggle { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; font-size: 13px; color: var(--muted); cursor: pointer; }
.embed-toggle input { accent-color: var(--cyan); }
.embed-note { font-size: 12px; color: var(--faint); margin-top: 6px; }
.count-pill {
  display: inline-block;
  background: rgba(53, 195, 243, 0.14);
  border: 1px solid var(--line);
  color: var(--cyan);
  border-radius: 999px; padding: 4px 14px; font-size: 12px;
  font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  margin-top: 16px;
}

/* ── Server-rendered content (about / FAQ / recent) ───────── */
/* This is the only markup crawlers and answer engines can read, so it stays
   visible rather than hidden behind a toggle. */
.prose { text-align: left; }
.section-title {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--gold);
  font-size: clamp(19px, 3.4vw, 24px);
  line-height: 1.2;
  margin: 0 0 14px;
}
.prose h3 {
  font-size: 16px;
  color: var(--cream);
  margin: 22px 0 8px;
  line-height: 1.35;
}
.prose p, .prose li {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}
.prose p { margin: 0 0 12px; }
.prose ol { padding-left: 22px; margin: 0; }
.prose ol li { margin-bottom: 8px; }
.prose a { color: var(--cyan); }
.prose a:hover { color: var(--gold); }

.faq-item { border-top: 1px solid var(--line); padding-top: 4px; }
.faq-item:first-of-type { border-top: none; }
.faq-item h3 { margin-top: 16px; }

.episode-list { list-style: none; margin: 16px 0 0; padding: 0; }
.episode-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.episode-list li:last-child { border-bottom: none; }
.episode-list a { text-decoration: none; font-weight: 600; }
.episode-list a:hover { text-decoration: underline; }
.episode-list time { color: var(--faint); font-size: 13px; white-space: nowrap; }
@media (max-width: 560px) {
  .episode-list li { flex-direction: column; gap: 2px; }
}
.prose-note { margin-top: 18px; font-size: 14px; }

.site-footer { margin-top: 34px; font-size: 12px; color: var(--faint); text-align: center; max-width: 620px; line-height: 1.6; }

/* Skip link — visually hidden until focused. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
}
.skip-link:focus {
  left: 50%;
  transform: translateX(-50%);
  z-index: 100000;
  background: var(--gold);
  color: #2b1f00;
  padding: 10px 18px;
  border-radius: 0 0 10px 10px;
  font-weight: 700;
  text-decoration: none;
}