/* WannaStream portal — clean, mobile-first, accessible. Hand-written, no framework. */

:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --text: #1a1f29;
  --muted: #5b6573;
  --border: #e2e7ee;
  --accent: #1f6feb;
  --accent-contrast: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.06);
  --maxw: 1100px;
}

* { box-sizing: border-box; }

/* The `hidden` attribute must always win, even over class rules that set
   `display` (e.g. .screen/.modal use display:grid). Without this, author
   `display` rules override the UA `[hidden] { display:none }` and every
   hidden screen/modal renders at once. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

body.modal-open { overflow: hidden; }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0.5rem 1rem;
  border-radius: 0 0 var(--radius) 0;
  z-index: 50;
}
.skip-link:focus { left: 0; }

/* Full-page states ------------------------------------------------------ */

.screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.notice {
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  max-width: 28rem;
}
.notice h1 { margin: 0 0 0.5rem; font-size: 1.25rem; }
.notice p { margin: 0 0 1rem; color: var(--muted); }

.spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: 999px;
  padding: 0.55rem 1.25rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.05); }

/* Header ---------------------------------------------------------------- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  padding-top: max(0.85rem, env(safe-area-inset-top));
}
.council-logo {
  height: 44px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
}
.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.council-name {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand-tagline {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.2;
}

/* Section tabs ---------------------------------------------------------- */

.tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 0.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
  max-width: var(--maxw);
  margin: 0 auto;
}
.tab {
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--muted);
  padding: 0.9rem 0.5rem;
  margin-right: 0.75rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* Content --------------------------------------------------------------- */

.content {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

/* Camera tabs ----------------------------------------------------------- */

.camera-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}
.camera-tab {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  cursor: pointer;
}
.camera-tab[aria-selected="true"] {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}

/* Player ---------------------------------------------------------------- */

.player-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.player-hint {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

/* Footer — attribution for CC BY-SA council coats of arms. */
.site-footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.25rem 1rem;
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  color: var(--muted);
  line-height: 1.4;
  text-align: center;
}
.site-footer p { margin: 0; }
.footer-credit {
  font-size: 0.8rem;
  opacity: 0.8;
  margin-bottom: 0.35rem !important;
}
.footer-attribution {
  font-size: 0.625rem;
  opacity: 0.45;
}
.site-footer a { color: inherit; text-decoration: underline; }

/* On Demand grid -------------------------------------------------------- */

.state {
  display: grid;
  place-items: center;
  gap: 0.75rem;
  padding: 3rem 1rem;
  color: var(--muted);
  text-align: center;
}

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.card-btn {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
  display: flex;
  flex-direction: column;
}
.card-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.duration {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
}

.card-body { padding: 0.75rem 0.85rem 0.9rem; position: relative; }
.card-title {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
}
.card-meta { margin: 0; color: var(--muted); font-size: 0.825rem; }
.badge {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.1rem 0.45rem;
  border-radius: 6px;
}

/* Modal ----------------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}
.modal-box {
  position: relative;
  width: min(960px, 100%);
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.modal-title { margin: 0; font-size: 1rem; font-weight: 600; }
.modal-close {
  appearance: none;
  border: 0;
  background: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0.25rem;
}
.modal-close:hover { color: var(--text); }
.modal .player-wrap { border-radius: 0; box-shadow: none; }
