/* Webcam player styles, shared by /cam/ (full page) and the compact
   player on the homepage (layouts/shortcodes/webcam-player.html).

   Sizing: the picture is never wider than the page (width: 100%), and never
   taller than the browser window: on a wide, short window the whole player
   gets narrower (centred) instead of running off the bottom. --arn is the
   stream's width/height, set from the real video size once it is known.
   Fullscreen uses the whole screen instead. */
#camtest { max-width: 1280px; margin: 0 auto; padding: 10px; }
#camtest .banner { background: #fff3cd; border: 1px solid #e0c36a; border-radius: 6px; padding: 8px 12px; margin-bottom: 12px; font-size: 0.9em; }
#camtest .stage { position: relative; background: #000; border-radius: 6px; overflow: hidden; }
/* The picture sits in a taller black frame (aspect --arn, default 2:1 like the old IPCamLive player), centred, with the
   video at its true shape (--ar). Zoom/pan move .zoompan inside the frame, so a zoomed-in viewer can pan into the black. */
#camtest .zoomclip { position: relative; overflow: hidden; width: 100%; aspect-ratio: var(--arn, 16 / 9); background: #000; }
#camtest .zoompan { position: absolute; inset: 0; display: flex; align-items: center; transform-origin: 0 0; will-change: transform; }
#camtest .zoomclip { touch-action: none; }
#camtest .zoomclip.zoomed { cursor: grab; }
#camtest .zoomclip.dragging { cursor: grabbing; }
#camtest video { display: block; width: 100%; height: auto; aspect-ratio: var(--ar, 16 / 9); background: #000; }
/* HD strip: show only the band the standard feed uses, y 648..1620 of the 2160-row frame (object-position = 648 / (2160-972)). */
#camtest .stage.hdstrip video { object-fit: cover; object-position: 50% 54.545%; }
#camtest .stage:-webkit-full-screen { display: flex; align-items: center; justify-content: center; border-radius: 0; }
#camtest .stage.pseudofs { position: fixed; inset: 0; z-index: 99999; border-radius: 0; display: flex; align-items: center; justify-content: center; }
html.ct-nosroll, html.ct-nosroll body { overflow: hidden; }
#camtest .exitfs { position: absolute; top: 8px; right: 8px; z-index: 5; }
#camtest .stage:fullscreen { display: flex; align-items: center; justify-content: center; border-radius: 0; }
#camtest .zoomhint { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,0.6); color: #fff; font-size: 0.8em; padding: 3px 8px; border-radius: 10px; pointer-events: none; }
#camtest .zoomhint[hidden] { display: none; }
#camtest button.on { background: #cfe3ff; border-color: #5b8bd6; }
#camtest .overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #ddd; font-size: 1.1em; background: rgba(0,0,0,0.55); text-align: center; padding: 1em; }
#camtest .overlay[hidden] { display: none; }
#camtest .bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; margin: 6px 0 2px; }
#camtest button { padding: 5px 12px; border: 1px solid #999; background: #f4f4f4; border-radius: 4px; cursor: pointer; font-size: 0.9em; }
#camtest button:disabled { opacity: 0.45; cursor: default; }
#camtest .pill { box-sizing: border-box; min-width: 13.5em; text-align: center; white-space: nowrap; padding: 3px 9px; border-radius: 12px; font-size: 0.85em; background: #ddd; }
#camtest .pill.live { background: #c8f0c8; }
#camtest .pill.behind { background: #ffe0b0; }
#camtest .pill.bad { background: #f5b5b5; }
#camtest pre#stats { background: #f6f6f6; border: 1px solid #ddd; border-radius: 4px; padding: 8px; font-size: 0.8em; line-height: 1.35; overflow-x: auto; white-space: pre-wrap; }
#camtest fieldset { border: 1px solid #ccc; border-radius: 6px; margin: 14px 0; padding: 8px 12px; }
#camtest legend { font-weight: bold; padding: 0 6px; }
#camtest label { margin-right: 10px; font-size: 0.9em; }
#camtest .note { color: #666; font-size: 0.85em; }

#camtest .stage { max-width: min(100%, calc((100vh - 7rem) * var(--arn, 1.7778))); margin-left: auto; margin-right: auto; }
#camtest .stage:fullscreen, #camtest .stage:-webkit-full-screen, #camtest .stage.pseudofs { max-width: none; }
#camtest .stage:fullscreen .zoomclip, #camtest .stage:-webkit-full-screen .zoomclip, #camtest .stage.pseudofs .zoomclip { height: 100%; aspect-ratio: auto; }
#camtest.compact .replaylink { text-align: center; margin: 2px 0 0; font-size: 0.9em; }

/* HD on/off switch (a checkbox styled as a slider). */
#camtest .hdswitch { display: inline-flex; align-items: center; gap: 6px; margin: 0 4px; cursor: pointer; user-select: none; font-size: 0.9em; }
#camtest .hdswitch[hidden] { display: none; }
#camtest .hdswitch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
#camtest .hdswitch .track { position: relative; width: 38px; height: 20px; border-radius: 10px; background: #b9b9b9; transition: background .15s; flex: none; }
#camtest .hdswitch .knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.4); transition: left .15s; }
#camtest .hdswitch input:checked + .track { background: #2e7d32; }
#camtest .hdswitch input:checked + .track .knob { left: 20px; }
#camtest .hdswitch input:focus-visible + .track { outline: 2px solid #5b8bd6; outline-offset: 2px; }
#camtest .hdswitch .lbl { font-weight: bold; }

/* Replay seek bar: one clock hour. */
#camtest .seekrow { display: flex; align-items: center; gap: 10px; margin: 10px 0 2px; }
#camtest .seekrow input[type=range] { flex: 1 1 auto; min-width: 0; }
#camtest #ct-rtime { flex: none; min-width: 7.5em; text-align: right; font-variant-numeric: tabular-nums; font-size: 0.9em; }

/* HD watchdog message (camtest.js): a block just under the picture, shown when HD has not started after ~15 s. */
#camtest .hdmsg { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; margin: 6px 0 2px; padding: 8px 10px; background: #fff3cd; color: #4a3b00; border: 1px solid #e0c36a; border-radius: 6px; font-size: 0.9em; text-align: center; }
#camtest .hdmsg[hidden] { display: none; }
#camtest .hdmsg button { font-size: 1em; }
