/*
 * base.css — reset, typography, and layout primitives.
 * Loaded after tokens.css, before components.css.
 */
* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
}

a:visited {
  color: var(--visited-link);
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent-amber);
  outline-offset: 2px;
}

img {
  max-width: 100%;
  display: block;
}

/* <code> holds npubs, Lightning addresses and nicks: long strings with no
   natural break points. Without this they push the page wider than a phone. */
code {
  overflow-wrap: anywhere;
}

.container {
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: 1rem;
}

.section {
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.rule-label {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.85rem;
  color: var(--text-dim);
  display: block;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}

/* ── Skip link (keyboard a11y, invisible until focused) ──────────── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent-amber);
  color: var(--bg-void);
  padding: 0.5rem 1rem;
  z-index: 100;
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ── Header + nav ─────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-void);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-block: 0.75rem;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  text-decoration: none;
}

.wordmark:visited {
  color: var(--text-primary);
}

.wordmark .scoop-dot {
  color: var(--accent-amber);
}

.site-nav {
  position: relative;
}

.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
}

/* ── Mobile hamburger toggle (hidden on desktop; see base breakpoint
   below for the collapsed-menu behavior it drives) ───────────────── */
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 2.2rem;
  height: 2.2rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  display: block;
  width: 1.2rem;
  height: 2px;
  background: var(--text-primary);
  position: relative;
}

.nav-toggle__bars::before {
  content: '';
  top: -0.4rem;
}

.nav-toggle__bars::after {
  content: '';
  top: 0.2rem;
}

.site-nav a {
  text-decoration: none;
  color: var(--text-dim);
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--text-primary);
}

.site-nav .link-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-dim);
}

.site-nav .link-button:hover,
.site-nav .link-button:focus-visible {
  color: var(--text-primary);
}

.nav-logout-form {
  display: inline;
}

/* ── Ticker ───────────────────────────────────────────────────────── */
.ticker {
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  overflow: hidden;
  white-space: nowrap;
  padding-block: 0.4rem;
}

.ticker__track {
  display: inline-block;
  animation: ticker-scroll 60s linear infinite;
}

.ticker:hover .ticker__track,
.ticker:focus-within .ticker__track,
.ticker--menu-open .ticker__track {
  animation-play-state: paused;
}

/* Spacing is padding, not margin, so the hover highlight is one solid block
   per show with no dead gap between neighbours. 1.25rem each side keeps the
   old 2.5rem visual rhythm. */
.ticker a {
  display: inline-block;
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.15rem 1.25rem;
  font-size: 0.85rem;
}

.ticker a:hover,
.ticker a:focus-visible,
.ticker a.is-menu-open {
  color: var(--text-primary);
  background: color-mix(in srgb, var(--accent, var(--accent-amber)) 30%, var(--bg-panel));
  outline: none;
  box-shadow: inset 0 -2px 0 var(--accent, var(--accent-amber));
}

/* ── Ticker hover menus ───────────────────────────────────────────── */
/* Rendered outside .ticker (which clips its children) and placed by
   ticker-menu.js, which sets `left`/`top` from the hovered show's position. */
.ticker-menu {
  position: fixed;
  z-index: 40;
  min-width: 13rem;
  max-width: min(22rem, calc(100vw - 1rem));
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  background: var(--bg-panel-raised);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent, var(--accent-amber));
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.5);
  padding: 0.25rem 0;
}

.ticker-menu[hidden] {
  display: none;
}

.ticker-menu__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ticker-menu__item {
  display: block;
  width: 100%;
  padding: 0.5rem 0.9rem;
  background: none;
  border: none;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

/* The global `a:visited` rule paints visited links purple, and it outranks a
   plain class, so links you had clicked before turned purple while unvisited
   links and the Play button (a <button>, never "visited") stayed white. Naming
   :link and :visited here at higher specificity makes every item look the same
   whatever your browsing history. */
.ticker-menu a.ticker-menu__item:link,
.ticker-menu a.ticker-menu__item:visited {
  color: var(--text-primary);
}

.ticker-menu__item:hover,
.ticker-menu__item:focus-visible {
  background: color-mix(in srgb, var(--accent, var(--accent-amber)) 25%, var(--bg-panel-raised));
  outline: none;
  box-shadow: inset 3px 0 0 var(--accent, var(--accent-amber));
}

.ticker-menu__group-label {
  margin: 0.4rem 0 0;
  padding: 0.4rem 0.9rem 0.2rem;
  border-top: 1px dotted var(--border);
  color: var(--text-dim);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ticker-menu__child-name {
  margin: 0;
  padding: 0.3rem 0.9rem 0;
  color: var(--accent, var(--accent-amber));
  font-size: 0.8rem;
  font-weight: 700;
}

@media (pointer: coarse) {
  .ticker a {
    padding-block: 0.5rem;
  }

  .ticker-menu__item {
    min-height: 2.75rem;
  }
}

/* The track renders ticker_shows twice in a row (see base.html) so this
   animation can loop seamlessly: translating by exactly -50% of the
   track's total width scrolls past one full copy and lands back on
   the start of the second (identical) copy with no gap or jump. */
@keyframes ticker-scroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ticker__track {
    animation: none;
  }
}

/* ── Footer ───────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.85rem;
  padding-block: 1.5rem;
  /* auto pushes the footer to the bottom of the body's flex column (see `body`). It replaces the old fixed
     margin-top: 2rem, so that 2rem now lives on the strip above (#newsletter, below). An auto margin
     only takes whatever space is LEFT, so on a long page it is 0 and the 2rem is still there. */
  margin-top: auto;
}

/* The footer-strip signup is the element directly above the footer: its bottom margin is the minimum
   gap above the footer, and the footer's auto margin soaks up anything beyond it on a short page. */
#newsletter {
  margin-bottom: 2rem;
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
}

.site-footer a {
  color: var(--text-dim);
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--accent-amber);
}

/* The player dock itself is styled in player.css (it used to be duplicated here, and the two copies
   disagreed). This is only the room it needs: the dock is position:fixed, so it no longer takes up
   space, and --dock-height (measured and published by dock-space-wire.js, 0 while nothing plays) keeps
   the last of the content and the footer from sitting underneath it. */
body {
  padding-bottom: var(--dock-height, 0px);
  /* Sticky footer: the body is at least one window tall, and the FOOTER's auto top margin (below) takes
     up the spare room, so on a short page the footer sits at the bottom of the window (just above the
     player when it is showing) while the content and the newsletter signup stay together at the top.
     box-sizing is border-box (set at the top of this file), so the dock padding above counts INSIDE the
     min-height rather than adding to it, which would otherwise make every page scroll by exactly the
     dock's height. */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

body > main {
  width: 100%;
}

/* ── Mobile layout (nav collapses into a hamburger dropdown, ticker
   and container tighten up) ───────────────────────────────────────── */
@media (max-width: 640px) {
  .nav-toggle {
    display: inline-flex;
  }

  .site-nav ul[data-nav-menu] {
    display: none;
    flex-direction: column;
    gap: 0;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 11rem;
    max-width: calc(100vw - 2rem);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem;
    z-index: 20;
  }

  .site-nav ul[data-nav-menu][data-open] {
    display: flex;
  }

  .site-nav ul[data-nav-menu] li {
    width: 100%;
  }

  .site-nav ul[data-nav-menu] a,
  .site-nav ul[data-nav-menu] .link-button {
    display: block;
    padding: 0.6rem 0.5rem;
  }

  .ticker a {
    padding-inline: 0.75rem;
    font-size: 0.78rem;
  }
}

@media (max-width: 420px) {
  .container {
    padding-inline: 0.65rem;
  }
}
