/* Homepage layout shim for win95.css.
 *
 * win95.css is a Bootstrap 4 *theme* — it skins .navbar-95, .card, .btn,
 * .dropdown-menu, etc., but assumes Bootstrap supplies the structural layout
 * (flexbox navbar, dropdown positioning, card-body padding) and jQuery drives
 * the dropdown. We don't ship Bootstrap, so this file fills in only the layout
 * the skin needs. Mobile-first: the navbar and window are full-width on a phone
 * and just gain a max-width on desktop. */

/* Archivo Black for the hero wordmark. Pulled from Google Fonts per request;
   the only external dependency on this page. If we want to stay fully
   VPS-portable later, self-host the woff2 next to BeowulfOT and swap this for
   an @font-face. @import must lead the file (only @charset may precede it). */
@import url("https://fonts.googleapis.com/css2?family=Archivo+Black&family=Space+Mono:wght@400;700&display=swap");

* {
  box-sizing: border-box;
}

/* Stop mobile browsers from auto-inflating text (iOS Safari text-size-adjust /
   Chrome "font boosting"). Without this the wide now-playing marquee in the glass
   pills gets enlarged past its set size on phones — and past the station name —
   while desktop, which doesn't boost, looks right. Pin to 100% so font-size is
   honored as written. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Hide scrollbars site-wide — the page scroller and any inner scroll container
   (profile panels, the Stationer list, etc.) — while keeping scroll working.
   Firefox honours scrollbar-width; WebKit/Blink need the pseudo-element. */
* {
  scrollbar-width: none;
}
*::-webkit-scrollbar {
  display: none;
}

body {
  margin: 0;
  /* win95.css pads the bottom for the taskbar and defaults to teal; we override
     with the classic clouds wallpaper, tiled. Dark text reads better on it. */
  min-height: 100vh;
  background: url(/static/assets/image/clouds2.jpg);
  color: #212529;
}

/* ── Navbar (homepage look, shared across every page) ───────────────────────
   Grey bar, red outline, Space Mono — the homepage's inline navbar lifted here
   so all pages read as one site (index.html keeps its own identical inline copy).
   Colours are hardcoded rather than the homepage's --vars so they resolve
   anywhere (profile.css redefines --red, which would otherwise leak in). */
.navbar-95 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 8px;
  background: #727373;
  border: 2px solid #ed1c24;
  box-shadow: none;
  padding: 0 6px 0 14px;
  font-family: "Space Mono", monospace;
}

/* Brand + profile mark: bare icons, no box (the Start button re-adds its own). */
.navbar-brand,
.navbar-95 .profile-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  padding: 0;
  text-decoration: none;
}
.navbar-brand img {
  display: block;
  width: 20px;
  height: 20px;
}
.navbar-95 .profile-link img {
  display: block;
  width: 36px;
  height: 36px;
  border-radius: 0;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-link {
  line-height: 32px; /* comfortable touch target */
  font-size: 12px;
  padding: 0 4px;
  color: #fff;
  text-decoration: none;
}
.nav-link:hover {
  text-decoration: underline;
}
/* Username + alias, shown left of the mark when signed in (navbar-auth.js
   unhides them). */
.profile-name {
  margin-right: 0;
  color: #fff;
  text-transform: uppercase;
  font-weight: bold;
  font-size: 12px;
  white-space: nowrap;
}
/* Win95 raised "Start" button — the brand on every page except the homepage
   (which keeps the PC-logo → /lab). Two-class specificity beats .navbar-brand
   above, so its border/padding win where an element has both classes. */
.navbar-95 .start-button {
  display: inline-flex;
  align-items: center;
  /* Classic Win95 raised bevel: white highlight top/left, grey shade
     bottom/right, plus a hard black outer edge. */
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  box-shadow: 1px 1px 0 #000;
  padding: 1px 8px;
  font-size: 12px;
  color: #212529;
  text-decoration: none;
  background: #c0c0c0; /* classic Win95 silver — bright against the #727373 bar */
}
/* The injected Admin button hugs Start: margin-right:auto eats the space-between
   gap so it sits next to Start instead of drifting to the bar's centre. */
.navbar-95 .admin-link {
  margin-right: auto;
}

/* ── Desktop area + window ──────────────────────────────────────────────── */
.desktop {
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

/* The captcha is a modal: a full-screen overlay above everything (taskbar is
   z-index 228), hidden until home.js adds .is-open ~2s after load. No backdrop
   click / Escape handling — it only closes on the correct plate. */
.captcha-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: auto;
  background: rgba(0, 0, 32, 0.55);
  touch-action: manipulation; /* no double-tap zoom anywhere in the modal */
}
.captcha-overlay.is-open {
  display: flex;
}

/* The captcha window is wider than the stations one so the number row + the
   plate fit comfortably. */
.captcha-box {
  max-width: 460px;
  width: 100%;
}

/* Registration plate. The <img> is the frame; container-type lets the overlay
   text scale with the plate width (cqw units below). Fills the captcha box. */
.plate {
  position: relative;
  width: 100%;
  container-type: inline-size;
}
.plate img {
  display: block;
  width: 100%;
  height: auto;
}

/* Positions the slots over the plate's white number field. The plate is already
   blank, so no fill is needed — these % place the text below the green
   ÖVNINGSKÖR bar, right of the blue EU band, inside the black border. (Measured
   from the image: green bar ends ~28%, EU band ends ~12%.) Nudge if it drifts. */
/* SVG overlay covering the whole plate; its viewBox is the image's pixel grid,
   so the text scales with the plate at any size. */
.plate-screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
/* Plate lettering, drawn in plate (viewBox) units. */
.plate-text {
  /* Condensed where available (desktop); iOS has no Arial Narrow and falls back
     to Arial. We deliberately DON'T use font-stretch:condensed — on iOS it
     selects Helvetica Neue's heavy condensed face, which looks far too thick.
     Plain bold Arial reads close to the desktop look. */
  font-family: "Arial Narrow", Arial, sans-serif;
  font-weight: 700;
  font-size: 124px; /* user units = plate pixels */
  letter-spacing: 5px;
  fill: #111;
  text-anchor: start;
  dominant-baseline: central;
}

/* On-screen keyboard, laid out like a physical one: tight rows, each lower row
   staggered to the right. Left-aligned internally and centered as a block. */
.keyboard {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px; /* vertical space between rows (+ key bottom margin) */
  margin: 14px auto 0;
  width: fit-content;
}
.keyboard-row {
  display: flex;
  gap: 2px; /* horizontal space between keys */
}
/* The half-key / one-key stagger of a real keyboard. Scales with the keys. */
.keyboard-row--stagger1 {
  margin-left: clamp(8px, 2.2vw, 14px);
}
.keyboard-row--stagger2 {
  margin-left: clamp(16px, 4.4vw, 28px);
}

/* Keys scale with the viewport so the rows stay on one line and fit a phone
   without wrapping (keyboard-css sizes from font-size; its padding is in em, so
   this shrinks the whole key). Capped on desktop. The margin override is the key
   bit: keyboard-css bakes a ~4px/7px margin into every key that otherwise sits
   on top of the gaps above — zeroing it lets the gaps actually control spacing
   (tighter rows, narrower keyboard). The small bottom margin clears the 3D
   shadow so rows don't overlap it. */
.keyboard .kbc-button {
  font-size: clamp(11px, 3.2vw, 14px);
  margin: 0 0 3px;
  /* Stop mobile from reading a fast double-tap as zoom — register both taps as
     clicks (so double-tapping backspace just deletes twice). */
  touch-action: manipulation;
}

/* A roomier backspace, like a real keyboard's, with its glyph pushed to the
   right edge. */
.key-backspace {
  min-width: 4.5em;
  text-align: right;
  padding-right: 0.5em;
}

.window {
  width: 100%;
  max-width: 360px;
}

/* win95.css skins .card-header but not the body; give it Win95-ish padding. */
.card-body {
  padding: 14px;
}
.hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: #212529;
}

/* ── Dropdown (vanilla, toggled by home.js via [data-open]) ─────────────── */
.dropdown {
  position: relative;
}

.dropdown-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
  font-size: 14px;
  cursor: pointer;
}
.caret {
  font-size: 9px;
  line-height: 1;
}

/* win95.css gives .dropdown-menu its silver border + shadow and `display:none`.
 * We position it under the button and reveal it when the parent is open. */
.dropdown-menu {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  margin-left: 0; /* override win95.css's 12px indent */
  z-index: 10;
}
.dropdown[data-open="true"] .dropdown-menu {
  display: block;
}

.dropdown-item {
  display: block;
  text-decoration: none;
  color: #212529;
  padding: 4px 8px;
  font-size: 14px; /* touch-friendly rows */
}
.dropdown-item:hover,
.dropdown-item:focus {
  background: -webkit-linear-gradient(left, #08216b, #a5cef7);
  color: #fff;
}

/* ── TESTING: single-clip YouTube background parked on the homepage ────────
   core/videoplayer.js (single-clip mode) wired up above the station picker.
   Remove with the matching #video-single markup + script in index.html once it
   moves to a station. The engine sets the box's width + aspect-ratio and fills
   it with an inset:0 layer; we give it a positioning context and clip the
   cropped edge. No background on purpose — the blank fades in from the page
   (the clouds wallpaper), not from black. */
/* Hero video banner, pinned to the top of the page and spanning the full
   viewport width (mobile-first). At body level (no side padding) 100vw is just
   full width; the calc margins are a no-op here but keep it flush if the box is
   ever nested in a padded parent again. position:relative anchors the wordmark
   overlay; overflow:hidden clips the cropped top edge. */
.home-video {
  position: relative;
  overflow: hidden;
  background: #000; /* shows until the first clip fades in over it */
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

/* The CIVILRADIO wordmark, laid over the video (Chris Macari style). Archivo
   Black is a heavy display face; scaleX widens it into the squashed look, and
   the matching text-stroke thickens the strokes so it reads at this size. */
.home-hero {
  position: absolute;
  left: 0;
  right: 0;
  top: 8px;
  z-index: 2; /* above the video layers, which the player appends after this */
  text-align: center;
  font-family: "Archivo Black", sans-serif;
  font-weight: 400;
  font-size: 38px;
  line-height: 1;
  letter-spacing: -0.5px;
  color: #e8231c;
  -webkit-text-stroke: 0.8px #e8231c;
  transform: scaleX(1.5);
  transform-origin: center; /* widen around the middle so it stays centered */
  white-space: nowrap;
  pointer-events: none; /* clicks fall through to the (silent) video */
}

/* ── Taskbar ────────────────────────────────────────────────────────────── */
.taskbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.start-button {
  padding: 2px 8px;
}

/* ── Desktop refinements ────────────────────────────────────────────────── */
@media (min-width: 600px) {
  .desktop {
    padding: 48px 24px;
  }
  .window {
    max-width: 380px;
  }
  /* On desktop the full-bleed video would be enormous; cap it to the window
     width and re-center (drop the viewport breakout). The wordmark overlay
     rides along since it's positioned inside the video box. */
  .home-video {
    width: 100%;
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
  }
}
