/* BSC: Custodial Program. An amber CRT enrollment terminal: header bar, two boxed panes, status bar.
   The 960 x 560 screen is zoomed by index.html to fit desktop windows. */

@font-face { font-family: 'Share Tech Mono'; src: url('/fonts/ShareTechMono-Regular.ttf') format('truetype'); font-display: swap; }

:root {
  --amber: #ffb43a;
  --dim: #a8741f;
  --faint: #5a3e12;
  --bg: #0b0703;
  --glow: 0 0 2px rgba(255, 180, 58, 0.9), 0 0 10px rgba(255, 150, 30, 0.35);
  /* tints colour content (Steam widget, logos) to amber monochrome */
  --phosphor: grayscale(1) sepia(1) saturate(2.6) hue-rotate(-8deg) brightness(0.9) contrast(1.05);
}

html, body { margin: 0; height: 100%; }
html { background: #000; overflow: hidden; }
body { position: relative; }

/* Curved CRT glass. Desktop: #glass fills the window and is bent through the barrel map (index.html #crt-bend);
   it overhangs the window by --oh so the bend pulls in wallpaper, not empty black, at the edges.
   An SVG (url()) filter is painted in software into the filtered element's own layer only; anything WebKit gives
   its own compositing layer inside it (a native scroller, iframes, canvas, opacity animations) draws unbent.
   iOS composites every overflow scroller, so a page scrolling inside the bent glass stayed flat on iPhones.
   Phones therefore scroll the document normally and bend each pane (.bend) on its own; see the phone block. */
:root { --oh-x: 3vw; --oh-y: 3vh; }
#glass {
  position: absolute;
  inset: calc(-1 * var(--oh-y)) calc(-1 * var(--oh-x));
  overflow: hidden;
  filter: url(#crt-bend);
  background:
    radial-gradient(ellipse at center, rgba(26, 16, 6, 0.9) 0%, rgba(11, 7, 3, 0) 70%),
    var(--bg);
}
#tube {
  position: absolute;
  inset: var(--oh-y) var(--oh-x);
  z-index: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
}

/* Mouse pointers: amber pixel arrow; inverted over anything clickable; amber I-beam in the field. */
html {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M2 2v17l4.5-4.5 3 6.5 3-1.4-3-6.4H16z' fill='%23ffb43a' stroke='%230b0703' stroke-width='1.5' stroke-linejoin='round'/%3E%3C/svg%3E") 2 2, default;
}
a, button, .social, .steam-slot, #steam {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M2 2v17l4.5-4.5 3 6.5 3-1.4-3-6.4H16z' fill='%230b0703' stroke='%23ffb43a' stroke-width='1.5' stroke-linejoin='round'/%3E%3C/svg%3E") 2 2, pointer;
}
input[type=email] {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M8 3h8M8 21h8M12 3v18' stroke='%230b0703' stroke-width='4' stroke-linecap='square'/%3E%3Cpath d='M8 3h8M8 21h8M12 3v18' stroke='%23ffb43a' stroke-width='2' stroke-linecap='square'/%3E%3C/svg%3E") 12 12, text;
}

body {
  background: var(--bg);
  color: var(--amber);
  font: 16px/1.5 'Share Tech Mono', 'Courier New', monospace;
  text-shadow: var(--glow);
  overflow: hidden;
}

a { color: var(--amber); }
a:hover, a:focus-visible { background: var(--amber); color: var(--bg); text-shadow: none; outline: none; }
::selection { background: var(--amber); color: var(--bg); }

/* Backrooms wallpaper motif behind everything: columns of upward chevrons between thin stripes.
   ::after is a bright copy shown only inside a soft band that sweeps across now and then. */
#wall {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='34' height='40'%3E%3Cg fill='none' stroke='%23ffb43a' stroke-width='1.4'%3E%3Cpath d='M9 24l8-8 8 8M9 30l8-8 8 8' stroke-opacity='.14'/%3E%3Cpath d='M.5 0v40' stroke-opacity='.07'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 34px 40px;
}
#wall::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.25;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='34' height='40'%3E%3Cg fill='none' stroke='%23ffd27a' stroke-width='1.4'%3E%3Cpath d='M9 24l8-8 8 8M9 30l8-8 8 8'/%3E%3Cpath d='M.5 0v40' stroke-opacity='.5'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 34px 40px;
  -webkit-mask: linear-gradient(100deg, transparent 38%, #000 50%, transparent 62%) 100% 0 / 250% 100% no-repeat;
          mask: linear-gradient(100deg, transparent 38%, #000 50%, transparent 62%) 100% 0 / 250% 100% no-repeat;
  animation: shine 10s ease-in-out infinite;
}
@keyframes shine {
  0% { -webkit-mask-position: 100% 0; mask-position: 100% 0; }
  60%, 100% { -webkit-mask-position: 0% 0; mask-position: 0% 0; }
}

#screen {
  position: relative;
  z-index: 1;
  width: 960px;
  height: 560px;
  /* top bar / two panes / status bar. The bars live inside the .bend wrappers (so on phones they bend with
     their pane), which are display: contents here, so the grid places them directly. */
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px 14px;
}
.topbar, .statusbar { grid-column: 1 / -1; }
.topbar { grid-row: 1; }
.statusbar { grid-row: 3; }
.pane { grid-row: 2; }

/* Header and status bars, inverted like an old text UI */
.topbar, .statusbar {
  display: flex;
  gap: 24px;
  align-items: center;
  padding: 3px 12px;
  background: var(--amber);
  color: var(--bg);
  text-shadow: none;
  letter-spacing: 0.12em;
}
.topbar .right { margin-left: auto; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: bold; letter-spacing: 0.3em; }
.mark {
  width: 18px;
  height: 21px;
  background: var(--bg);
  -webkit-mask: url(/assets/bsc_mark.svg) center / contain no-repeat;
          mask: url(/assets/bsc_mark.svg) center / contain no-repeat;
}
/* desktop: PRIVACY next to the copyright, clear of the camera feed floating in the window's bottom-right corner */
.statusbar { font-size: 13px; }
.statusbar a { color: var(--bg); }
.statusbar a:hover { background: var(--bg); color: var(--amber); }

/* Two boxed panes. .bend wraps bar + pane: no box on desktop, the per-screen CRT bend on phones. */
.bend { display: contents; }
.pane {
  position: relative;
  background: rgba(11, 7, 3, 0.35);
  border: 3px double var(--dim);
  padding: 26px 22px 18px;
  box-shadow: inset 0 0 18px rgba(255, 150, 30, 0.06);
  min-width: 0;
}
.pane-title {
  position: absolute;
  top: -12px;
  left: 14px;
  margin: 0;
  padding: 0 8px;
  background: var(--bg);
  font: 15px/1.5 'Share Tech Mono', monospace;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1 { margin: 0 0 14px; font: 22px/1.35 'Share Tech Mono', monospace; }
#message p { margin: 0 0 12px; }
.label { letter-spacing: 0.12em; }
.num {
  display: inline-block;
  min-width: 1.4em;
  margin-right: 8px;
  text-align: center;
  border: 1px solid var(--amber);
}
mark { background: var(--amber); color: var(--bg); text-shadow: none; padding: 0 3px; }
/* a failing tube: index.html switches the highlight off for a few ms at random */
mark.off { background: transparent; color: var(--amber); text-shadow: var(--glow); }
.role { text-decoration: underline dotted; text-underline-offset: 4px; text-decoration-thickness: 2px; }
#tesseract { display: block; width: 100%; height: 104px; margin: -8px 0 6px; transition: opacity 0.8s; }
#tesseract.off { opacity: 0; }
.dim { color: var(--dim); font-size: 12px; }
/* the message fills its pane so the small print sits at the bottom */
.pane:not(.menu) { display: flex; flex-direction: column; }
#message { flex: 1; display: flex; flex-direction: column; }
#message .dim { margin: auto 0 0; }
.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.05em;
  margin-left: 3px;
  vertical-align: -0.15em;
  background: var(--amber);
  box-shadow: var(--glow);
  animation: blink 1.06s steps(1) infinite;
}
/* visibility, not opacity: an opacity animation gets its own compositing layer and would escape the bend */
@keyframes blink { 50% { visibility: hidden; } }

/* Menu */
.menu { display: flex; flex-direction: column; justify-content: space-between; padding-top: 38px; padding-bottom: 30px; }
.item h3 { margin: 0 0 12px; font: 19px/1.2 'Share Tech Mono', monospace; letter-spacing: 0.13em; text-transform: uppercase; }
.item h3 .num { font-size: 15px; letter-spacing: 0; vertical-align: 2px; margin-right: 10px; }

/* .steam-slot only holds the space; the Steam iframe is laid over it from <body> (index.html fit()),
   outside every bend, with its own scanlines on top pinned to the window like the page's .crt lines */
.steam-slot { position: relative; height: 140px; }
#steam {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  width: 646px;
  height: 190px;
  border: 0;
  transform-origin: 0 0;
  filter: var(--phosphor);          /* amber tint, full colour on hover */
  transition: filter 0.25s;
}
#steam:hover { filter: none; }
#steam-lines { display: none; position: absolute; z-index: 4; pointer-events: none;
  background: repeating-linear-gradient(rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px) fixed; }
#steam-lines.on { display: block; }


/* The e-mail prompt:one bordered bar with a solid button; the border lights up while typing */
form {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--dim);
  transition: border-color 0.2s;
}
form:focus-within { border-color: var(--amber); }
label { flex: none; align-self: center; padding-left: 12px; letter-spacing: 0.08em; }
.field { position: relative; flex: 1; min-width: 0; display: flex; }
input[type=email] {
  flex: 1;
  min-width: 0;
  font: inherit;
  color: var(--amber);
  text-shadow: var(--glow);
  caret-color: var(--amber);
  background: transparent;
  border: 0;
  padding: 9px 10px 9px calc(10px + 0.6em + 8px);
  outline: none;
}
input[type=email]:focus { padding-left: 10px; }
input[type=email]::placeholder { color: var(--dim); text-shadow: none; opacity: 1; }
input[type=email]:focus::placeholder { color: transparent; }
/* flashing block at the start of the empty field; the native caret takes over on focus */
.prompt {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 0.6em;
  height: 1.05em;
  translate: 0 -50%;
  background: var(--amber);
  box-shadow: var(--glow);
  pointer-events: none;
  animation: blink 1.06s steps(1) infinite;
}
input:focus + .prompt, input:not(:placeholder-shown) + .prompt { display: none; }
button {
  flex: none;
  font: inherit;
  letter-spacing: 0.12em;
  color: var(--bg);
  background: var(--amber);
  text-shadow: none;
  border: 0;
  padding: 0 18px;
}
button:hover, button:focus-visible { background: #ffd27a; outline: none; }
button:disabled { opacity: 0.5; cursor: wait; }
.msg { margin: 6px 0 0; font-size: 14px; }
/* bot trap: off-screen field people never fill in */
/* hidden in place, never pushed off-screen: a far-off child stretches a bent pane's filter area until WebKit
   gives up painting the pane (the newsletter pane rendered blank on phones) */
.trap { position: absolute; left: 0; top: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; overflow: hidden; clip-path: inset(50%); pointer-events: none; }
.hint { margin: 8px 0 0; font-size: 12.5px; color: var(--dim); }
.hint em { font-style: normal; color: #d6943a; text-decoration: underline dotted var(--dim); text-underline-offset: 3px; }
.msg:empty { display: none; }
.msg.err { animation: blink 1.06s steps(1) 3; }

/* "Live" security-camera feed: the untinted still under faint scanlines, with a burned-in REC label and clock.
   Desktop: a floating overlay pinned to the window's bottom-right corner, over the terminal, unbent and unzoomed.
   Phones: the page's footer, bent as its own screen (so nothing in it may be composited: no opacity/transform animations). */
.feed {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 5;                       /* over the glass and the lifted Steam widget */
  width: clamp(220px, 19vw, 400px);
  margin: 0;
  border: 1px solid var(--amber);
  background: #000;
  line-height: 0;
  box-shadow: 0 0 0 3px var(--bg), 0 0 18px rgba(255, 150, 30, 0.4), 0 10px 36px rgba(0, 0, 0, 0.85);
}
.feed img { display: block; width: 100%; height: auto; }
.feed::after {                      /* faint scanlines */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(rgba(0, 0, 0, 0.06) 0 1px, transparent 1px 3px);
}
.feed .osd {
  position: absolute;
  z-index: 1;
  font: clamp(9px, 0.62vw, 12px)/1 'Share Tech Mono', monospace;
  letter-spacing: 0.12em;
  color: #fff;
  text-shadow: 0 0 2px #000, 0 1px 3px #000;
}
.feed .live { top: 8px; left: 9px; font-size: clamp(7px, 0.48vw, 10px); }
.feed .where { left: 9px; bottom: 8px; }
.feed .clock { right: 9px; bottom: 8px; }
.rec { color: #ff4a2e; animation: blink 1.06s steps(1) infinite; }

/* Old-logo social links, tinted amber until hovered */
/* three equal buttons from the left, stopping short of the camera feed floating over the bottom-right corner */
.socials { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-right: 160px; }
.social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 40px;
  padding: 0 4px;
  border: 1px solid var(--dim);
  font: bold 12px Arial, Helvetica, sans-serif;
  color: #fff;
  text-decoration: none;
  text-shadow: none;
  background: #111;
  filter: var(--phosphor);
  transition: filter 0.25s;
}
.social:hover, .social:focus-visible { filter: none; background: #111; color: #fff; }
.social svg { display: block; flex: none; }
/* YouTube wordmark, 2005 */
.yt { gap: 2px; font: bold 14px/1 Arial, Helvetica, sans-serif; letter-spacing: -0.5px; }
.yt .tube {
  padding: 3px 4px 4px;
  border-radius: 7px;
  background: linear-gradient(#ee4b47 0%, #d32a25 50%, #b81f1b 51%, #c8241f 100%);
}

/* CRT: scanlines, a curved-glass vignette, and a slow faint wave of light drifting down */
.crt {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    repeating-linear-gradient(rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.65) 100%);
}
.crt { overflow: hidden; }
/* the wave moves by transform (GPU, no repaint): two screens tall, slides down one screen and loops */
.crt::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -100vh;
  height: 200vh;
  background: repeating-linear-gradient(transparent 0, rgba(255, 190, 90, 0.035) 25vh, transparent 50vh, transparent 100vh);
  animation: wave 12s linear infinite;
}
@keyframes wave { from { transform: translateY(0); } to { transform: translateY(100vh); } }

@media (prefers-reduced-motion: reduce) {
  .cursor, .prompt, .rec, .crt::after { animation: none; }
  #wall::after { animation: none; opacity: 0; }
}

/* Phones: one column; the document scrolls normally (no inner scroller: iOS would composite it and the
   bend would not reach the content). Each .bend (top bar + Message pane, Expected pane + status bar) is bent
   as its own screen through #crt-bend-pane and has its own GPU layer (will-change), so it is filtered once and
   scrolling or the animated wallpaper behind it never re-runs the filter (that made iPhone scrolling stutter).
   overflow-x: clip, not hidden: hidden would turn html/body into a scroller. */
@media (max-width: 819px) {
  html { overflow: visible; overflow-x: clip; height: auto; }
  body { height: auto; min-height: 100%; overflow: visible; overflow-x: clip; }
  #glass { position: static; inset: auto; overflow: visible; filter: none; min-height: 100vh; }
  #wall, .crt { position: fixed; }
  #wall::after { animation: none; opacity: 0; }   /* the wallpaper shine repaints a full screen every frame */
  #steam { z-index: 1; }                /* under the fixed .crt (z 2), so its scanlines and vignette cover it too */
  #steam-lines.on { display: none; }
  .social { transition: none; }         /* a running filter transition gets its own layer and pops out of the bend */
  .bend { display: block; margin-bottom: 22px; padding: 4px 0; filter: url(#crt-bend-pane); will-change: transform; }
  .bend > .pane:first-child { margin-top: 14px; }
  .topbar + .pane { margin-top: 22px; }
  .pane + .statusbar { margin-top: 14px; }
  #tube { position: relative; inset: auto; display: block; overflow: visible; padding: 14px 12px 0; }
  #screen { display: block; width: auto; height: auto; }
  .topbar span:nth-child(2) { display: none; }
  .menu { gap: 22px; }
  /* e-mail bar: prompt and field on one row, the button full width underneath */
  form { flex-wrap: wrap; }
  .field { flex: 1 1 0; }
  button { flex: 1 0 100%; padding: 11px 0; }
  /* three buttons that shrink to fit the column */
  .socials { margin-right: 0; }
  .statusbar { justify-content: space-between; }
  /* the camera feed is the page's footer, its own bent screen */
  .feed-bend { margin: 0 12px 22px; }
  .feed { position: relative; right: auto; bottom: auto; z-index: auto; width: auto; }
  .feed .osd { font-size: 11px; }
  .feed .live { font-size: 9px; }
}
