@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,500;0,700;1,500&family=Inter:wght@400;500&display=swap");

:root {
  /* OpalFlame opal/flame theme -- iridescent blue + deep purple + warm gold on cream */
  --bg: #f6f1ea;
  --bg-2: #ece3f1;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-solid: #fffdf9;
  --ink: #2a2440;
  --muted: #6b5d7a;
  --line: rgba(123, 63, 160, 0.18);
  --accent: #7b3fa0;
  --accent-2: #c8923f;
  --opal: #5b8fc4;
  --shadow: 0 18px 50px rgba(75, 40, 84, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(91, 143, 196, 0.18), transparent 32%),
    radial-gradient(circle at top right, rgba(200, 146, 63, 0.18), transparent 28%),
    radial-gradient(circle at bottom, rgba(123, 63, 160, 0.12), transparent 40%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  font-family: "Inter", "Segoe UI", sans-serif;
  line-height: 1.6;
}

h1,
h2,
h3,
h4 {
  font-family: "Playfair Display", "Georgia", serif;
  color: var(--accent);
  letter-spacing: 0.01em;
}

h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.12; }

strong,
.eyebrow {
  font-family: "Playfair Display", "Georgia", serif;
}

.eyebrow {
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
}

.lede { font-size: 1.12rem; color: var(--ink); opacity: 0.92; }

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

a {
  color: var(--accent);
}

.page {
  min-height: 100vh;
  padding: 28px 20px 40px;
}

.shell {
  width: min(1200px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 20px;
}

.dashboard-shell,
.detail-shell {
  gap: 24px;
}

.hero-card,
.panel,
.login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero-card {
  padding: 24px;
}

.panel {
  padding: 22px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.hero-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.9fr);
  gap: 20px;
  align-items: start;
}

.hero-intro h1 {
  font-size: clamp(2.35rem, 4vw, 4.7rem);
  line-height: 0.98;
  margin-bottom: 12px;
  letter-spacing: -0.03em;
}

.lede {
  max-width: 66ch;
  color: var(--muted);
  font-size: 1.02rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  color: var(--accent-2);
  margin-bottom: 10px;
}

.summary-grid,
.grid-2,
.grid {
  display: grid;
  gap: 16px;
}

.summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.stat {
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  gap: 4px;
}

.stat span {
  color: var(--muted);
  font-size: 0.86rem;
}

.stat strong {
  font-size: 1.6rem;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.column {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 251, 244, 0.72);
  padding: 14px;
  display: grid;
  gap: 12px;
}

.column-head h3 {
  margin: 0;
  font-size: 2rem;
}

.project-card,
.asset-card,
.message-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.project-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.project-card h4,
.project-card h3 {
  margin: 0;
}

.project-meta,
.list-row-meta,
.timeline-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(79, 106, 59, 0.1);
  color: var(--ink);
  font-size: 0.82rem;
}

.list-row,
.timeline-row {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.list-row strong,
.timeline-row strong {
  display: block;
  margin-bottom: 4px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  font-size: 0.88rem;
  color: var(--muted);
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
}

textarea {
  resize: vertical;
}

button,
.btn {
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 11px 16px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

button {
  background: var(--accent);
  color: #fff;
}

button:hover,
.btn:hover {
  transform: translateY(-1px);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--line);
}

.btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn.ghost,
.ghost-button {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.ghost-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
}

.compact-form {
  max-width: 100%;
}

.compact-panel {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
}

.slim-form {
  max-width: 420px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  flex-wrap: wrap;
}

.section-head h2 {
  margin-bottom: 0;
  font-size: 1.5rem;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.9rem;
}

.empty {
  color: var(--muted);
  padding: 10px 0;
}

.site-footer {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 16px 4px 0;
  display: grid;
  gap: 10px;
}

.footer-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.policy-copy {
  margin: 0;
  display: grid;
  gap: 14px;
  font-size: 1rem;
}

.policy-copy p {
  margin-bottom: 0;
}

.public-page .hero-card {
  padding: 22px;
}

.public-shell {
  gap: 22px;
}

.public-nav {
  justify-content: flex-end;
}

.story-intro {
  align-items: stretch;
}

.story-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 16px;
}

.related-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.fable-thumb-link {
  display: block;
}

.fable-thumb,
.story-fallback-image {
  width: 100%;
  display: block;
  border-radius: 16px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: rgba(31, 27, 22, 0.06);
}

.fable-thumb {
  aspect-ratio: 16 / 9;
}

.story-fallback {
  display: grid;
  gap: 12px;
}

.story-fallback-image {
  aspect-ratio: 16 / 9;
}

.video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 18px;
  background: rgba(31, 27, 22, 0.08);
  border: 1px solid var(--line);
}

.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.share-links {
  align-items: flex-start;
}

.stack-actions {
  flex-direction: column;
  align-items: flex-start;
}

.stack-actions .btn {
  width: fit-content;
}

.source-list {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 10px;
}

.source-list li {
  color: var(--muted);
}

.source-list a {
  color: var(--ink);
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.login-panel {
  width: min(520px, 100%);
  margin: 0 auto;
  padding: 26px;
}

.replied {
  opacity: 0.82;
}

@media (max-width: 840px) {
  .hero-intro {
    grid-template-columns: 1fr;
  }

  .story-grid {
    grid-template-columns: 1fr;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  .project-card-head,
  .list-row,
  .timeline-row {
    grid-template-columns: 1fr;
    flex-direction: column;
  }
}

/* ---------------------------------------------------------------------------
   Error pages (404, 500)
   --------------------------------------------------------------------------- */
.error-page {
  text-align: center;
  padding: 4rem 2rem;
}

.error-code {
  font-size: 4rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
  font-family: "Playfair Display", serif;
}

.error-msg {
  font-size: 1.25rem;
  color: var(--muted);
  margin-bottom: 2rem;
}

.error-nav {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.error-nav a {
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
}

.error-nav a:hover {
  background: var(--opal);
}

/* ---------------------------------------------------------------------------
   YouTube-style chrome -- top bar + narrow left icon rail, so the public site
   reads as an extension of the channel. Login/Studio hide behind the coin.
   --------------------------------------------------------------------------- */
.yt-body {
  padding: 0;
}

.yt-topbar {
  position: sticky;
  top: 0;
  /* The coin menu drops BELOW the bar, over page content. At z-index 50 the shows/
     project cards were painting on top of it, so the menu opened invisible. The bar
     (and the menu inside it) must sit above ordinary page furniture -- but still
     below the real overlays (modals/lightbox/teleprompter at 1000+). */
  z-index: 500;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  height: 60px;
  padding: 8px 18px;
  background: rgba(255, 253, 249, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.yt-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.yt-burger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
}

.yt-burger:hover {
  background: var(--bg-2);
  transform: none;
}

.yt-ic {
  width: 24px;
  height: 24px;
}

.yt-logo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--accent);
  font-family: "Playfair Display", "Georgia", serif;
  font-weight: 700;
  font-size: 1.3rem;
}

.yt-flame {
  width: 24px;
  height: 24px;
  color: var(--accent-2);
}

.yt-search {
  display: flex;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  gap: 0;
}

.yt-search input {
  border-radius: 999px 0 0 999px;
  border-right: 0;
  padding: 9px 18px;
}

.yt-search button {
  flex: 0 0 62px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 0 999px 999px 0;
  background: var(--bg-2);
  color: var(--ink);
}

.yt-search button:hover {
  transform: none;
  background: var(--line);
}

.yt-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
}

/* of_public_site_scrub: the top-right slot is the Subscribe CTA now (it used to be
   an admin-only account coin). It must never wrap or push the search field out of
   the bar -- on a phone the whole top bar is the first thing a cold visitor sees. */
.yt-subscribe {
  white-space: nowrap;
  padding: 8px 16px;
}

@media (max-width: 560px) {
  .yt-search {
    max-width: 100%;
  }

  .yt-subscribe {
    padding: 7px 12px;
    font-size: 0.85rem;
  }
}

.yt-coin {
  position: relative;
}

.yt-coin summary {
  list-style: none;
  cursor: pointer;
}

.yt-coin summary::-webkit-details-marker {
  display: none;
}

.yt-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--opal));
  color: #fff;
  font-family: "Playfair Display", "Georgia", serif;
  font-weight: 700;
  font-size: 1.05rem;
}

.yt-coin-menu {
  position: absolute;
  right: 0;
  top: 48px;
  z-index: 510;   /* above the bar's own children, below modal overlays */
  min-width: 190px;
  display: grid;
  gap: 2px;
  padding: 10px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.yt-coin-title {
  margin: 0;
  padding: 6px 12px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-2);
}

.yt-coin-menu a {
  display: block;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
}

.yt-coin-menu a:hover {
  background: var(--bg-2);
}

.yt-layout {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: start;
}

.yt-rail {
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 6px;
}

.yt-rail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 4px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.66rem;
  text-align: center;
}

.yt-rail-item:hover {
  background: var(--bg-2);
}

.yt-rail-item.active {
  background: var(--bg-2);
  font-weight: 600;
}

.yt-rail-item.active .yt-ic {
  color: var(--accent);
}

.yt-content {
  min-width: 0;
  padding: 22px 20px 40px;
}

.yt-content .shell {
  margin: 0 auto;
}

.yt-content .site-footer {
  margin-top: 24px;
}

body.rail-collapsed .yt-layout {
  grid-template-columns: 1fr;
}

body.rail-collapsed .yt-rail {
  display: none;
}

@media (max-width: 840px) {
  .yt-layout {
    grid-template-columns: 1fr;
  }

  .yt-rail {
    position: static;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
  }

  .yt-rail-item {
    flex: 0 0 auto;
    min-width: 76px;
  }

  .yt-logo span {
    display: none;
  }
}

/* ---------------------------------------------------------------------------
   Admin chrome -- reuse the YouTube top bar look on /admin/* pages.
   --------------------------------------------------------------------------- */
.admin-yt-topbar {
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  margin-bottom: 8px;
}

.admin-nav-links {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.admin-nav-link {
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink);
  font-size: .92rem;
  transition: background .15s, color .15s;
}

.admin-nav-link:hover {
  background: var(--bg-2);
}

.admin-nav-link.active {
  background: var(--accent);
  color: #fff;
}

/* fap_054 (IA re-nest): one breadcrumb pattern everywhere under a show. */
.crumb {
  font-size: .86rem;
  color: var(--muted);
}
.crumb a {
  color: var(--accent);
  text-decoration: none;
}
.crumb a:hover { text-decoration: underline; }
.crumb .crumb-sep {
  color: var(--muted);
  opacity: .6;
  margin: 0 .15rem;
}

.yt-coin-logout {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  border-radius: 10px;
  cursor: pointer;
}

.yt-coin-logout:hover {
  background: var(--bg-2);
  transform: none;
}

@media (max-width: 760px) {
  .admin-yt-topbar { grid-template-columns: auto 1fr auto; }
  .admin-nav-links { justify-content: flex-start; overflow-x: auto; }
  .yt-logo span { display: none; }
}

/* FEAT_39: station version banner, rendered by admin-core's renderNav directly under
   the top bar on every admin page. Two severities, deliberately different in weight:
   .failed is the loud red box Davey asked for (upgrade broke, a human is needed);
   .drift is amber because it clears itself within minutes and crying wolf on it
   would teach the operator to stop reading the banner at all. */
#of-station-banner .of-station-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  margin: 0;
  padding: 12px 18px;
  font-size: 0.9rem;
  line-height: 1.4;
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}

#of-station-banner .of-station-banner strong {
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.82rem;
}

#of-station-banner .of-station-banner a {
  margin-left: auto;
  font-weight: 600;
  text-decoration: underline;
  white-space: nowrap;
  color: inherit;
}

#of-station-banner .of-station-banner.failed {
  background: #b3170f;
  color: #fff;
}

#of-station-banner .of-station-banner.drift {
  background: #fde68a;
  color: #4a2c00;
}

/* FEAT_39 item 9: login-time local-station notice, under the banner. Informational --
   never red; a machine with no station is a normal machine, not a fault. */
#of-local-station .of-local-station {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  padding: 10px 18px;
  font-size: 0.86rem;
  background: #e8eefc;
  color: #16244a;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

#of-local-station .of-local-station a { color: inherit; font-weight: 600; text-decoration: underline; }
#of-local-station .of-local-station button {
  margin-left: auto;
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 0.76rem;
  cursor: pointer;
}
