/* ============================================================
   desertice.online — live screen
   Shared DesertIce brand system: a synthwave desert at night.
   Dark only. Display: Unbounded · Body: IBM Plex Sans · Mono: JetBrains Mono.
   ============================================================ */

:root {
  /* Shared brand tokens (dark only) */
  color-scheme: dark;

  --night: #070912;
  --night-2: #0d1222;
  --night-3: #151b30;
  --line: rgba(140, 210, 255, 0.12);
  --ice: #5ce1ff;
  --glacier: #c4f4ff;
  --deep-ice: #1e8fd0;
  --text: #e9eef7;
  --muted: #9aa6bd;
  --sand: #f2c98a; /* eyebrow labels only */
  --pink: #ff5fa2; /* LIVE indicator only */

  /* derived alphas */
  --ice-08: rgba(92, 225, 255, 0.08);
  --ice-12: rgba(92, 225, 255, 0.12);
  --ice-25: rgba(92, 225, 255, 0.25);
  --ice-40: rgba(92, 225, 255, 0.4);
  --grid-line: rgba(92, 225, 255, 0.08);

  /* type */
  --font-display: "Unbounded", "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --font-body: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--night);
  color: var(--text);
  line-height: 1.5;
  color-scheme: dark;
  /* Horizontal overflow stays locked, but vertical scrolling must remain
     available so the status screen is reachable on short viewports. */
  overflow-x: hidden;
}

/* Only the live player locks scrolling entirely. */
body.is-live {
  overflow: hidden;
}

/* Visually hidden, still available to assistive tech. */
.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;
}

/* ---------- shared ground plane (rule 5) ----------
   Faint perspective wireframe grid in ice across the bottom of the viewport.
   Fixed, static, behind content, pointer-events none. At negative z-index it
   can never appear over the live embed. */
.ground {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.ground::before {
  content: "";
  position: absolute;
  left: -40%;
  right: -40%;
  top: 55%;
  bottom: -45%;
  background-image:
    repeating-linear-gradient(90deg, var(--grid-line) 0 1px, transparent 1px 64px),
    repeating-linear-gradient(180deg, var(--grid-line) 0 1px, transparent 1px 44px);
  transform: perspective(22rem) rotateX(56deg);
  transform-origin: 50% 0;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 22%, #000 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 22%, #000 100%);
}

/* ---------- shared wordmark (rule 1) ----------
   "DesertIce" in Unbounded 600 followed directly by the site suffix in
   JetBrains Mono, ice colour, with no space. */
.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text);
}

.brand-tld {
  font-family: var(--font-mono);
  font-weight: 400;
  color: var(--ice);
}

/* ---------- Twitch embed ----------
   Fills the viewport when live. While offline it stays mounted but invisible
   (never display:none, so the player can finish initialising in the background). */
.live-embed {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  visibility: hidden;
  pointer-events: none;
  z-index: 1;
}

.live-embed iframe {
  width: 100% !important;
  height: 100% !important;
  border: 0;
  display: block;
}

body.is-live .live-embed {
  visibility: visible;
  pointer-events: auto;
}

/* ---------- offline/checking status screen ---------- */
.offline-screen {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Safe centering keeps content reachable when it outgrows short viewports. */
  justify-content: safe center;
  text-align: center;
  padding: 2rem 1.5rem;
  padding: max(2rem, env(safe-area-inset-top)) max(1.5rem, env(safe-area-inset-right))
    max(2rem, env(safe-area-inset-bottom)) max(1.5rem, env(safe-area-inset-left));
  animation: fadeInUp 0.6s ease-out;
}

body.is-live .offline-screen {
  display: none;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Avatar: plain round portrait with a thin border — no glow ring (rule 4). */
.avatar-wrapper {
  width: 110px;
  height: 110px;
  margin-bottom: 1.25rem;
}

.avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1px solid var(--line);
  overflow: hidden;
}

.avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.offline-screen h1 {
  font-size: clamp(1.3rem, 6vw, 1.7rem);
  margin-bottom: 0.5rem;
}

.offline-screen h1 .brand-tld {
  font-size: 0.62em;
}

/* Status pill: eyebrow-style label (rule 3). */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.9rem;
  background: var(--night-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--sand);
  margin-bottom: 0.75rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

.hint {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 2rem;
}

.actions {
  display: flex;
  gap: 0.875rem;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  padding: 0.875rem 1.5rem;
  background: var(--night-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex-shrink: 0;
}

.btn:hover {
  border-color: var(--ice-40);
  background: var(--night-3);
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
  transition-duration: 0.1s;
}

.btn.primary {
  background: var(--ice-08);
  border-color: var(--ice-25);
  color: var(--glacier);
}

.btn.primary:hover {
  background: var(--ice-12);
  border-color: var(--ice-40);
}

/* ---------- DesertIce network strip (rule 2) ----------
   Mirrors desertice.tech's footer crosslinks. Same five entries, same order;
   the current site gets an ice outline and "· you are here". Hidden with the
   offline screen while live, so nothing new appears over the embed. */
.crosslinks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 2.4rem;
}

.crosslink {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.34rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  text-decoration: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.crosslink:hover {
  border-color: var(--ice-40);
  background: var(--ice-08);
}

.crosslink-domain {
  color: var(--glacier);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.crosslink-desc {
  color: var(--muted);
  font-size: 0.78rem;
}

.crosslink[aria-current="page"] {
  border-color: var(--ice-40);
  background: var(--ice-12);
}

.crosslink[aria-current="page"] .crosslink-domain {
  color: var(--ice);
}

/* ---------- accessibility ---------- */
.btn:focus-visible,
.crosslink:focus-visible {
  outline: 2px solid var(--ice);
  outline-offset: 2px;
}

/* ---------- responsive ---------- */
@media (max-width: 480px) {
  .avatar-wrapper {
    width: 96px;
    height: 96px;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
    width: min(100%, 320px);
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
