/* prog-menu.css — the site-wide "Veritas programmes" dropdown.
 *
 * One component, rendered by assets/prog-menu.js on every page that carries a
 * [data-prog-menu] placeholder: the main navigation row on the index page and
 * the header strip on every programme page. It replaces the old rows of
 * per-page links — the same list, the same places, one floating window.
 *
 * Only presentation lives here; every fact shown is chosen in prog-menu.js.
 */

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- trigger ---------- */
.prog-menu { position: relative; display: inline-flex; align-items: center; }

/* the trigger is deliberately loud — the site's red, so it reads as the way
   into the full programme list rather than as one more quiet link */
.prog-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #ffffff;
  background: linear-gradient(135deg, rgba(204, 0, 0, 0.22), rgba(204, 0, 0, 0.05));
  border: 1.5px solid #cc0000;
  border-radius: 7px;
  padding: 0.4rem 0.7rem;
  box-shadow: 0 0 12px rgba(204, 0, 0, 0.25);
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}
.prog-trigger:hover { background: #cc0000; border-color: #cc0000; color: #ffffff; box-shadow: 0 0 20px rgba(204, 0, 0, 0.5); }
.prog-trigger:focus-visible { outline: 2px solid #00bfff; outline-offset: 2px; }
.prog-trigger[aria-expanded="true"] { background: #cc0000; border-color: #cc0000; box-shadow: 0 0 20px rgba(204, 0, 0, 0.5); }

.prog-trigger-dot {
  width: 6px; height: 6px;
  border-radius: 2px;
  background: #cc0000;
  box-shadow: 0 0 8px rgba(204, 0, 0, 0.45);
  animation: progDot 2.4s ease-in-out infinite alternate;
}
@keyframes progDot { from { opacity: 0.35; } to { opacity: 1; } }

.prog-count {
  font-family: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.62rem;
  line-height: 1;
  color: #cccccc;
  background: #242424;
  border: 1px solid #343434;
  border-radius: 999px;
  padding: 0.2rem 0.42rem;
}

/* where you are — filled from the registry match for the current page */
.prog-current {
  font-family: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9fd9f5;
  background: rgba(0, 191, 255, 0.12);
  border: 1px solid rgba(0, 191, 255, 0.35);
  border-radius: 999px;
  padding: 0.18rem 0.42rem;
}

.prog-chevron { color: #9a9a9a; transition: transform 180ms ease; }
.prog-trigger[aria-expanded="true"] .prog-chevron { transform: rotate(180deg); }

/* the navigation variant: the same red pill, sized to sit among the nav links */
.nav-links .prog-menu { margin-left: 0.2rem; }
.nav-links .prog-trigger {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.4rem 0.75rem;
  gap: 0.45rem;
}
.nav-links .prog-count {
  background: rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}
.nav-links .prog-chevron { color: #ffd9d9; }

/* ---------- floating panel ---------- */
.prog-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 240;
  width: min(94vw, 460px);
  max-height: min(74vh, 620px);
  overflow-y: auto;
  padding: 0.4rem;
  background: #121212;
  border: 1px solid #2c2c2c;
  border-radius: 12px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.62), 0 2px 8px rgba(0, 0, 0, 0.5);
  transform-origin: top left;
  animation: progIn 150ms ease-out;
  text-align: left;
}
.prog-panel[hidden] { display: none; }
@keyframes progIn { from { opacity: 0; transform: translateY(-6px) scale(0.985); } to { opacity: 1; transform: none; } }

/* ---------- filter (shown once the list grows past eight entries) ---------- */
.prog-filter {
  position: sticky;
  top: -0.4rem;
  z-index: 1;
  padding: 0.35rem 0.35rem 0.5rem;
  background: #121212;
  border-bottom: 1px solid #262626;
  margin: -0.4rem -0.4rem 0.2rem;
}
.prog-filter[hidden] { display: none; }
.prog-filter-input {
  width: 100%;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.82rem;
  color: #f2f2f2;
  background: #191919;
  border: 1px solid #2f2f2f;
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
}
.prog-filter-input::placeholder { color: #7d7d7d; }
.prog-filter-input:focus-visible { outline: 2px solid #00bfff; outline-offset: 0; border-color: #00bfff; }
.prog-filter-status {
  font-family: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  color: #9a9a9a;
  padding: 0.35rem 0.25rem 0;
  min-height: 1em;
}

/* ---------- groups and items ---------- */
.prog-section {
  font-family: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #8a8a8a;
  padding: 0.5rem 0.6rem 0.3rem;
}
.prog-section[hidden] { display: none; }
.prog-sep { height: 1px; background: #262626; margin: 0.4rem 0.35rem; }
.prog-sep[hidden] { display: none; }

.prog-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.6rem;
  border-left: 2px solid transparent;
  border-radius: 8px;
  color: #cccccc;
  text-decoration: none;
  transition: background-color 140ms ease, color 140ms ease;
}
.prog-item[hidden] { display: none; }
.prog-item:hover, .prog-item:focus-visible { background: #1c1c1c; color: #f2f2f2; outline: none; }
.prog-item:focus-visible { box-shadow: inset 0 0 0 1px #00bfff; }

.prog-item-main { display: flex; flex-direction: column; gap: 0.14rem; min-width: 0; }
.prog-item-name {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.prog-item-desc { font-size: 0.68rem; color: #8f8f8f; }

.prog-chip {
  margin-left: auto;
  flex: none;
  font-family: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.56rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9a9a9a;
  background: #1b1b1b;
  border: 1px solid #2e2e2e;
  border-radius: 999px;
  padding: 0.2rem 0.45rem;
  white-space: nowrap;
}
.prog-chip[hidden] { display: none; }
.prog-chip.flag { color: #ffb9b9; border-color: rgba(204, 0, 0, 0.55); background: rgba(204, 0, 0, 0.16); }
.prog-chip.here { color: #9fd9f5; border-color: rgba(0, 191, 255, 0.45); background: rgba(0, 191, 255, 0.14); }

/* the page you are on */
.prog-item[aria-current] { border-left-color: #00bfff; background: rgba(0, 191, 255, 0.06); }
.prog-item[aria-current] .prog-item-name { color: #f2f2f2; }

.prog-empty {
  font-size: 0.72rem;
  color: #9a9a9a;
  padding: 0.5rem 0.6rem 0.6rem;
}
.prog-empty[hidden] { display: none; }

/* ---------- narrow screens ---------- */
/* the index page hides its section links under 768px — the programmes menu stays,
   since it is the way to every page of the site */
@media (max-width: 768px) {
  .nav-links { display: flex; }
  .nav-links > a[data-nav] { display: none; }
  .nav-links .prog-trigger { font-size: 0.8rem; }
}
@media (max-width: 640px) {
  .prog-panel { width: min(calc(100vw - 1.5rem), 460px); }
  .prog-item { gap: 0.5rem; }
  .prog-item-desc { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .prog-trigger-dot, .prog-panel { animation: none !important; }
  .prog-chevron, .prog-trigger, .prog-item { transition: none !important; }
  /* pages that load this file (homepage + every programme page) stop under
     reduced motion — the site-wide kill switch for residual hover/entry
     micro-transitions and any animation this file itself did not name */
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
