/* ============================================================
   APOTHEOSIS — Shared chrome (nav, wordmark, footer)
   ============================================================ */

/* === WORDMARK LOCKUP =============================== */
.wordmark {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  user-select: none;
}
.wordmark .tagline {
  font-family: var(--font-ui);
  font-size: var(--fs-xs);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 400;
  font-style: italic;
}
.wordmark .apotheosis {
  font-family: var(--font-display);
  font-size: var(--fs-4xl);
  letter-spacing: 0.28em;
  color: var(--gold-bright);
  background: linear-gradient(180deg, var(--gold-pale) 0%, var(--gold-bright) 35%, var(--gold-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(245,176,32,0.2);
  padding-right: 0;
  margin-right: -0.28em;
}

.wordmark.hero .tagline { font-size: 20.2px; margin-bottom: 14px; letter-spacing: 0.38em; }
.wordmark.hero .apotheosis {
  font-size: clamp(62.4px, 11vw, 192px);
  letter-spacing: 0.32em;
}

/* === TOP NAV ======================================= */
.topnav {
  position: sticky; top: 0; z-index: 10100;
  background: rgba(12, 2, 0, 0.82);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.topnav::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-deep) 30%, var(--gold-bright) 50%, var(--gold-deep) 70%, transparent);
  opacity: 0.6;
}
.topnav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: var(--s-6);
  min-height: var(--nav-h);
}
.topnav .brand {
  display: flex; flex-direction: column; line-height: 1;
}
.topnav .brand .tagline {
  font-family: var(--font-ui);
  font-size: 8px;
  letter-spacing: 0.26em;
  color: var(--text-dim);
  font-style: italic;
  margin-bottom: 3px;
}
.topnav .brand .apotheosis {
  font-family: var(--font-display);
  font-size: 31.7px;
  letter-spacing: 0.24em;
  color: var(--gold-bright);
  background: linear-gradient(180deg, var(--gold-pale), var(--gold) 90%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-right: -0.24em;
}

.topnav nav {
  display: flex; gap: 2px;
  margin-left: auto;
}
.topnav nav a {
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 14px;
  border-radius: 2px;
  position: relative;
  transition: color 160ms ease;
  display: inline-flex; align-items: center; gap: 6px;
}


/* Icon-only nav mode */
.topnav nav.icons a {
  padding: 10px 12px;
  width: 50px; height: 50px;
  justify-content: center;
  border: 1px solid transparent;
}
.topnav nav.icons a:hover { border-color: var(--line); }
.topnav nav.icons a .lbl { display: none; }
.topnav nav.icons a svg { width: 23.4px; height: 23.4px; stroke: currentColor; fill: none; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.topnav nav.icons a.active::after { left: 10px; right: 10px; }
/* Tooltip — hidden when hamburger menu is open */
.topnav nav.icons:not(.is-open) a[data-tip]::before {
  content: attr(data-tip);
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  font-family: var(--font-ui); font-size: var(--fs-2xs); letter-spacing: 0.24em; color: var(--gold-bright);
  background: var(--bg-deepest); border: 1px solid var(--line-strong);
  padding: 6px 10px; border-radius: 2px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 140ms ease;
  text-transform: uppercase;
}
.topnav nav.icons:not(.is-open) a:hover::before { opacity: 1; }
.topnav nav a:hover { color: var(--gold-bright); }
.topnav nav a.active { color: var(--gold-bright); }
.topnav nav a.active::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 2px; height: 1px;
  background: var(--gold-bright);
}
.topnav nav a.admin { color: var(--gold); }
.topnav nav a .icon-sm {
  width: 10px; height: 10px; opacity: 0.7;
}

.topnav .hamburger {
  display: none;
  margin-left: auto;
  background: transparent; border: 1px solid var(--line-strong);
  color: var(--gold-bright);
  width: 40px; height: 40px;
  border-radius: 2px;
  cursor: pointer;
  align-items: center; justify-content: center;
  touch-action: manipulation;
  position: relative; z-index: 1;
}

.topnav .user-pill-wrap { position: relative; }

.topnav .user-pill {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 99px;
  color: var(--text-bright);
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  /* Solid dark background — some Android browsers ignore appearance:none on
     <button> and inject the OS default (light grey/white). Forcing a solid
     colour + tap-highlight reset stops that. */
  background: var(--bg-deepest) !important;
  background-color: var(--bg-deepest) !important;
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  transition: border-color 150ms;
  /* Cap width and clip overflow so a long name can never wrap to a second
     line. The .pill-name span inside fades out at the right when the name
     doesn't fit. */
  max-width: min(280px, 32vw);
  overflow: hidden;
  white-space: nowrap;
}
/* Username text inside the pill — single line, fade-mask at the right edge.
   Applies on both desktop and mobile; the mobile media query overrides
   sizing only. */
.topnav .user-pill .pill-name {
  display: inline-block;
  flex: 1; min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, black calc(100% - 18px), transparent 100%);
          mask-image: linear-gradient(to right, black calc(100% - 18px), transparent 100%);
}
.topnav .user-pill:hover { border-color: var(--gold); }
.topnav .user-pill:active,
.topnav .user-pill:focus { background: var(--bg-deepest) !important; outline: none; }
.topnav .user-pill .av {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-bright));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); color: var(--bg-deepest);
  font-size: 15px !important; letter-spacing: 0 !important; flex-shrink: 0;
}

.user-flyout {
  /* Hidden via display:none rather than opacity/visibility — some Android
     browsers don't honour the visibility/pointer-events combo reliably and
     the flyout would render permanently underneath the pill as static text. */
  display: none;
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 200px; max-width: min(260px, 100vw);
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 40px rgba(0,0,0,0.55), 0 2px 8px rgba(0,0,0,0.35);
  overflow: hidden; z-index: 10050;
}
.user-flyout.open {
  display: block;
  animation: userFlyoutIn 150ms ease forwards;
}
@keyframes userFlyoutIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.user-flyout-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px;
  font-family: var(--font-ui); font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--text-muted); text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: color 140ms, background 140ms;
  white-space: nowrap;
}
.user-flyout-item:last-child { border-bottom: none; }
.user-flyout-item:hover { color: var(--text-bright); background: var(--bg-elevated); }
.user-flyout-signoff { color: #c06060; }
.user-flyout-signoff:hover { color: #e07070; background: rgba(160,28,28,0.14); }

@media (max-width: 1023px) {
  .topnav nav { display: none; }
  .topnav .hamburger { display: inline-flex; margin-left: 0; }
  .topnav .user-pill-wrap { margin-left: auto; }
  .topnav-inner { gap: var(--s-2); }
  /* Mobile brand: hide the tagline, swap "APOTHEOSIS" for the favicon SVG.
     Pages whose <span class="apotheosis"> contains a child <i class="my-pfx">
     keep that "MY" prefix visible at small size to render as "MY [A-glyph]". */
  .topnav .brand .tagline { display: none; }
  .topnav .brand { flex-direction: row; align-items: center; gap: 6px; }
  .topnav .brand .apotheosis {
    font-size: 0;
    letter-spacing: 0;
    margin-right: 0;
    display: inline-flex;
    align-items: center;
  }
  .topnav .brand .apotheosis::after {
    content: '';
    display: inline-block;
    width: 36px; height: 36px;
    background: url('favicon.svg') center / contain no-repeat;
  }
  /* On My Apotheosis: hide the "MY" prefix on mobile — the favicon glyph
     alone is enough indicator that we're in the members area. */
  .topnav .brand .apotheosis .my-pfx { display: none; }
  /* Pill grows to fit the username with fade-out for long names. The
     avatar circle stays its size; the name span gains room and any
     overflow fades to transparent at the right edge. */
  .topnav .user-pill {
    display: inline-flex; align-items: center;
    width: auto; min-width: 40px; max-width: min(220px, 60vw);
    height: 40px;
    padding: 4px 14px 4px 4px;
    border-radius: 99px;
    overflow: hidden;
    gap: 8px;
  }
  .topnav .user-pill .av { flex-shrink: 0; }
  /* Mobile-specific tweaks for the pill name — sizing only; the global
     rule above already enforces nowrap + fade. */
  .topnav .user-pill .pill-name {
    font-family: var(--font-ui); font-size: var(--fs-xs);
    letter-spacing: 0.10em; color: var(--text-bright);
  }
  /* Sign-in link on mobile: 40×40 circle with login icon, text hidden */
  a.user-pill {
    width: 40px; height: 40px;
    padding: 0 !important;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    margin-left: auto;
    font-size: 0;
  }
  a.user-pill span { font-size: 0 !important; }
  a.user-pill::before {
    content: '';
    position: absolute; inset: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f5b020' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c0-4 3.6-7 8-7s8 3 8 7'/%3E%3C/svg%3E") center / 22px no-repeat;
  }

  nav.is-open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--nav-h); left: auto; right: 0;
    width: 90vw; max-width: 420px;
    background: rgba(8,1,0,0.98);
    border-left: 1px solid var(--line-strong);
    border-bottom: 2px solid var(--line-strong);
    box-shadow: -6px 8px 30px rgba(0,0,0,0.5);
    padding: 8px 0 16px;
    z-index: 9999;
    gap: 0;
  }
  nav.is-open a {
    width: 100%; height: auto;
    padding: 9px 24px;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--line);
    justify-content: flex-start;
    gap: 16px;
  }
  nav.is-open a:last-child { border-bottom: none; }
  nav.is-open a svg { width: 24px; height: 24px; flex-shrink: 0; }
  nav.is-open a .m-lbl { font-family: var(--font-ui) !important; font-size: 16.8px !important; letter-spacing: 0.22em !important; text-transform: uppercase !important; }
  nav.is-open a::before { display: none !important; }
  .topnav .hamburger.is-open { color: var(--gold-bright); border-color: var(--gold-deep); }
}

/* === TAB BAR — inactive-title contrast bump ========
   Per-page CSS sets `.tab-btn { color: var(--text-dim) }` which is too dark
   to read comfortably. The `.tab-bar .tab-btn` selector below has higher
   specificity (0,2,0) than the per-page (0,1,0), so this wins without
   touching every page. */
.tab-bar .tab-btn { color: var(--text-muted); }
.tab-bar .tab-btn:hover { color: var(--text-bright); }
.tab-bar .tab-btn.active { color: var(--gold-bright); }

/* === PAGE HEAD ===================================== */
.page-head {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 32px;
}
.page-head h1 {
  font-family: var(--font-ui); font-size: var(--fs-xl); letter-spacing: 0.36em;
  color: var(--gold-bright); text-transform: uppercase; font-weight: 500;
  display: flex; align-items: center; gap: 14px; margin: 0;
}
.page-head .ph-icon {
  width: 24px; height: 24px; min-width: 24px; flex-shrink: 0; display: block;
  stroke: currentColor; fill: none; stroke-width: 1.3;
  stroke-linecap: round; stroke-linejoin: round;
}
.page-head .line {
  flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--line-strong), transparent);
}
@media (max-width: 600px) {
  .page-head h1 {
    font-family: 'Cinzel', 'Trajan Pro', 'Cormorant Garamond', serif;
    font-size: var(--fs-md); letter-spacing: 0.36em; font-weight: 500;
    text-transform: uppercase; gap: 10px;
  }
  .page-head .ph-icon { width: 20px; height: 20px; min-width: 20px; }
}

/* === FOOTER ======================================== */
.footer {
  margin-top: var(--s-7);
  padding: var(--s-7) 24px var(--s-6);
  border-top: 1px solid var(--line);
  background: var(--bg-deepest);
  position: relative;
}
.footer::before {
  content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-ember), var(--gold-deep), var(--gold-ember), transparent);
}
.footer-inner {
  max-width: var(--max-w); margin: 0 auto;
  display: grid; gap: var(--s-6);
}
@media (min-width: 768px) {
  .footer-inner { grid-template-columns: 2fr 1fr 1fr 1fr; }
}
.footer h4 {
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold-bright);
  margin-bottom: var(--s-3);
}
.footer ul { list-style: none; }
.footer li { margin-bottom: 6px; }
.footer a { color: var(--text-muted); font-size: var(--fs-md); }
.footer a:hover { color: var(--gold-bright); }
.footer .fine {
  margin-top: var(--s-6);
  padding-top: var(--s-4);
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--text-dim);
  letter-spacing: 0.08em;
}

/* Audio player bar styles are in faves-panel.php */

/* ── Fav-star buttons (hoisted from faves-panel.php so the empty/filled
   icon toggle is settled before the body renders — otherwise both icons
   briefly show until faves-panel.php's CSS loads at end of body) ── */
.fav-star {
  background: none; border: none; padding: 0 4px 0 0; cursor: pointer;
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  line-height: 1; color: var(--text-faint); transition: color 150ms;
}
.tab-bar .fav-star { padding: 0 0 0 6px; margin-right: -14px; position: relative; z-index: 1; }
.fav-star:hover { color: var(--gold); }
.fav-star.starred { color: var(--gold-bright); }
.fav-star .fav-empty,
.fav-star .fav-filled { display: flex; align-items: center; }
.fav-star .fav-empty svg,
.fav-star .fav-filled svg { display: block; }
.fav-star .fav-filled { display: none; }
.fav-star.starred .fav-empty { display: none; }
.fav-star.starred .fav-filled { display: flex; }
