/* netherBio Pulse — TV build radiator.
   Theme is the platform's "Gold (Default)" preset, matched token-for-token to
   app/data/siteConfig.ts presetThemes[0] and app/globals.css. Background is the
   homepage's own: warm near-black (--brown-dark) + a drifting gold particle field
   (particleDrift, copied from globals.css) under a soft radial amber glow.
   Sized for a 1920x1080 wall display: everything scales from a viewport-derived
   root font-size, no scrolling, no cursor. Motion is the point. */

:root {
  --amber: #d4a24a;
  --amber-light: #e8c078;
  --amber-dark: #a67c32;
  --amber-glow: rgba(212, 162, 74, 0.35);
  --brown-dark: #1a1410;
  --brown: #2a2018;
  --brown-light: #3d2e22;
  --text: #f8f4ed;
  --text-dim: rgba(248, 244, 237, 0.75);
  --text-muted: rgba(248, 244, 237, 0.5);
  --card-bg: rgba(26, 20, 16, 0.94);
  --card-border: rgba(212, 162, 74, 0.18);
  --success: #6b9b37;
  --success-light: #8bc24a;
  --error: #c45a5a;
  --error-light: #e07777;
  --font-heading: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
}

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

html {
  /* One knob scales the whole board with the display width. */
  font-size: clamp(13px, 1.02vw, 24px);
}

html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--brown-dark);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  cursor: none;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 1.1rem;
  padding: 1.4rem 1.7rem 1.3rem;
  height: 100vh;
}

/* ── Background: warm radial glow + drifting gold particles ─────────────── */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% -12%, var(--amber-glow) 0%, transparent 55%),
    radial-gradient(100% 120% at 50% 120%, rgba(61, 46, 34, 0.55) 0%, transparent 60%),
    radial-gradient(140% 120% at 50% 42%, var(--brown-light) 0%, var(--brown) 30%, var(--brown-dark) 100%);
  opacity: 0.9;
}

.particles {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
/* Copied from globals.css .particle + @keyframes particleDrift so the field is
   identical to the homepage's. */
.particle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, var(--amber-light), var(--amber));
  box-shadow: 0 0 8px var(--amber-glow);
  opacity: 0;
  animation: particleDrift 18s ease-in-out infinite;
}
@keyframes particleDrift {
  0%, 100% { opacity: 0; transform: translateY(0); }
  15% { opacity: 0.6; }
  50% { opacity: 0.8; }
  85% { opacity: 0.5; }
  100% { opacity: 0; transform: translateY(-180px); }
}

/* ── Top bar ────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 0.3rem;
}
.brand { display: flex; align-items: baseline; gap: 0.8rem; }
.brand-mark {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 2.5rem;
  letter-spacing: -0.01em;
  line-height: 1;
}
.brand-mark .g { color: var(--amber); }
.brand-mark .t { color: var(--text); }
.brand-sub {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.42em;
  color: var(--amber-light);
  opacity: 0.85;
  text-transform: uppercase;
  padding-left: 0.1em;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  font-family: var(--font-mono);
}
.repo { color: var(--text-muted); font-size: 0.95rem; letter-spacing: 0.03em; }
.clock { color: var(--text-dim); font-size: 1.15rem; font-weight: 500; letter-spacing: 0.05em; }
.live {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: rgba(26, 20, 16, 0.6);
}
.live-dot {
  width: 0.62rem; height: 0.62rem; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(107, 155, 55, 0.6);
  animation: livePulse 2.4s ease-in-out infinite;
}
.live[data-state="live"] { color: var(--success-light); border-color: rgba(107, 155, 55, 0.4); }
.live[data-state="stale"] { color: var(--error-light); border-color: rgba(196, 90, 90, 0.45); }
.live[data-state="stale"] .live-dot { background: var(--error); animation: none; }
.live[data-state="init"] { color: var(--text-muted); }
.live[data-state="init"] .live-dot { background: var(--text-muted); }
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(107, 155, 55, 0.55); }
  50% { box-shadow: 0 0 0 0.5rem rgba(107, 155, 55, 0); }
}

/* ── Board layout ───────────────────────────────────────────────────────── */
.board {
  display: grid;
  grid-template-columns: 1.72fr 1fr;
  gap: 1.1rem;
  min-height: 0;
}
.side { display: grid; grid-template-rows: 1.6fr 1fr; gap: 1.1rem; min-height: 0; }

.panel {
  background: var(--card-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--card-border);
  border-radius: 1.25rem;
  padding: 1.3rem 1.4rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  animation: panelIn 0.6s ease both;
}
@keyframes panelIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.side .prs { animation-delay: 0.08s; }
.side .merged { animation-delay: 0.16s; }

.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 1rem; flex: 0 0 auto;
}
.panel-head h2 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--text);
}
.panel-meta { font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-muted); letter-spacing: 0.04em; }

/* ── Builds (hero) ──────────────────────────────────────────────────────── */
.builds-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: 1fr;
  gap: 1rem;
  min-height: 0;
  flex: 1 1 auto;
}
.build {
  position: relative;
  border-radius: 1rem;
  border: 1px solid var(--card-border);
  background: linear-gradient(150deg, rgba(61, 46, 34, 0.5), rgba(26, 20, 16, 0.5));
  padding: 1.05rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  overflow: hidden;
  animation: buildIn 0.5s ease both;
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}
@keyframes buildIn { from { opacity: 0; transform: translateY(10px) scale(0.99); } to { opacity: 1; transform: none; } }

.build-top { display: flex; align-items: center; gap: 0.7rem; }
.build-glyph {
  flex: 0 0 auto;
  width: 1.9rem; height: 1.9rem; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 1.05rem; font-weight: 800;
}
.build-name {
  font-weight: 700; font-size: 1.02rem; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.build-status-word {
  margin-left: auto; flex: 0 0 auto;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.9;
}
.build-title {
  font-size: 0.95rem; color: var(--text-dim); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.build-foot {
  margin-top: auto;
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted);
}
.build-foot .meta-left { display: flex; align-items: center; gap: 0.55rem; overflow: hidden; }
.build-branch {
  color: var(--amber-light); opacity: 0.85;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 11rem;
}
.build-elapsed { color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* progress shimmer bar for active builds */
.build-progress {
  position: absolute; left: 0; right: 0; bottom: 0; height: 0.28rem;
  background: rgba(212, 162, 74, 0.14); overflow: hidden; opacity: 0;
}
.build-progress::before {
  content: ''; position: absolute; top: 0; bottom: 0; width: 40%;
  background: linear-gradient(90deg, transparent, var(--amber), var(--amber-light), transparent);
  animation: shimmer 1.5s linear infinite;
}
@keyframes shimmer { from { transform: translateX(-120%); } to { transform: translateX(320%); } }

/* state: active (in_progress / queued) */
.build.is-active {
  border-color: rgba(212, 162, 74, 0.5);
  animation: buildIn 0.5s ease both, activePulse 3s ease-in-out infinite 0.5s;
}
.build.is-active .build-glyph { background: rgba(212, 162, 74, 0.14); color: var(--amber-light); }
.build.is-active .build-status-word { color: var(--amber-light); }
.build.is-active .build-progress { opacity: 1; }
.build.is-active .spinner {
  width: 1.05rem; height: 1.05rem; border-radius: 50%;
  border: 0.16rem solid rgba(232, 192, 120, 0.28);
  border-top-color: var(--amber-light);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes activePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212, 162, 74, 0.32), 0 0 22px rgba(212, 162, 74, 0.12); }
  50% { box-shadow: 0 0 0 0.35rem rgba(212, 162, 74, 0), 0 0 30px rgba(212, 162, 74, 0.22); }
}

/* state: success */
.build.is-success .build-glyph { background: rgba(107, 155, 55, 0.16); color: var(--success-light); }
.build.is-success .build-status-word { color: var(--success-light); }
.build.is-success { border-color: rgba(107, 155, 55, 0.32); }

/* state: failure */
.build.is-failure .build-glyph { background: rgba(196, 90, 90, 0.18); color: var(--error-light); }
.build.is-failure .build-status-word { color: var(--error-light); }
.build.is-failure { border-color: rgba(196, 90, 90, 0.4); }

/* state: neutral / cancelled */
.build.is-neutral .build-glyph { background: rgba(248, 244, 237, 0.08); color: var(--text-muted); }
.build.is-neutral .build-status-word { color: var(--text-muted); }

/* ── The centerpiece: completion animations ─────────────────────────────── */
.build.just-succeeded { animation: buildIn 0.5s ease both, winFlash 1.7s ease-out; }
.build.just-succeeded::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  border: 0.18rem solid var(--success-light);
  animation: winRing 1.4s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
.build.just-succeeded .build-glyph { animation: glyphPop 0.7s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes winFlash {
  0% { box-shadow: 0 0 0 0 rgba(139, 194, 74, 0), 0 0 0 rgba(139, 194, 74, 0); }
  18% { box-shadow: 0 0 0 0.25rem rgba(139, 194, 74, 0.55), 0 0 48px rgba(139, 194, 74, 0.5); }
  100% { box-shadow: 0 0 0 0 rgba(139, 194, 74, 0), 0 0 0 rgba(139, 194, 74, 0); }
}
@keyframes winRing {
  0% { transform: scale(0.82); opacity: 0.9; }
  100% { transform: scale(1.12); opacity: 0; }
}
@keyframes glyphPop {
  0% { transform: scale(0.2) rotate(-25deg); opacity: 0; }
  55% { transform: scale(1.35) rotate(6deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.build.just-failed { animation: buildIn 0.5s ease both, failFlash 1.6s ease-out, shake 0.5s ease-in-out; }
.build.just-failed .build-glyph { animation: glyphPop 0.7s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes failFlash {
  0% { box-shadow: 0 0 0 0 rgba(224, 119, 119, 0); }
  16% { box-shadow: 0 0 0 0.25rem rgba(224, 119, 119, 0.5), 0 0 46px rgba(196, 90, 90, 0.5); }
  100% { box-shadow: 0 0 0 0 rgba(224, 119, 119, 0); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-0.5rem); }
  40% { transform: translateX(0.42rem); }
  60% { transform: translateX(-0.3rem); }
  80% { transform: translateX(0.18rem); }
}

.build.is-empty {
  border-style: dashed;
  border-color: rgba(212, 162, 74, 0.14);
  background: transparent;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  animation: none;
}

/* ── PRs ────────────────────────────────────────────────────────────────── */
.pr-list, .merged-list { display: flex; flex-direction: column; gap: 0.7rem; overflow: hidden; min-height: 0; flex: 1 1 auto; }
.pr {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.6rem 0.35rem;
  border-bottom: 1px solid rgba(212, 162, 74, 0.09);
  animation: rowIn 0.5s ease both;
}
.pr:last-child { border-bottom: none; }
@keyframes rowIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.pr-checks {
  flex: 0 0 auto; width: 0.72rem; height: 0.72rem; border-radius: 50%;
  background: var(--text-muted);
}
.pr-checks[data-c="success"] { background: var(--success); box-shadow: 0 0 8px rgba(107, 155, 55, 0.5); }
.pr-checks[data-c="failure"] { background: var(--error); box-shadow: 0 0 8px rgba(196, 90, 90, 0.5); }
.pr-checks[data-c="pending"] { background: var(--amber); box-shadow: 0 0 8px var(--amber-glow); animation: livePulse 1.8s ease-in-out infinite; }
.pr-body { min-width: 0; flex: 1 1 auto; }
.pr-title {
  font-size: 0.98rem; color: var(--text); font-weight: 500; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pr-sub { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted); margin-top: 0.12rem; }
.pr-num { color: var(--amber-light); }
.pr-draft {
  flex: 0 0 auto; font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-muted);
  border: 1px solid var(--card-border); border-radius: 0.4rem; padding: 0.12rem 0.4rem;
}

.merged { min-height: 0; }
.merged-item {
  display: flex; align-items: baseline; gap: 0.6rem;
  padding: 0.42rem 0.35rem;
  animation: rowIn 0.5s ease both;
}
.merged-num { font-family: var(--font-mono); color: var(--success-light); font-size: 0.85rem; flex: 0 0 auto; }
.merged-title {
  font-size: 0.92rem; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.merged-when { margin-left: auto; flex: 0 0 auto; font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); }

.empty-row { color: var(--text-muted); font-size: 0.95rem; padding: 0.6rem 0.35rem; font-style: italic; }

/* ── Stats band ─────────────────────────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.1rem;
}
.stat {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 1.1rem;
  padding: 0.9rem 1.2rem;
  display: flex; flex-direction: column; gap: 0.15rem;
  animation: panelIn 0.6s ease both;
}
.stat-num {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 2.9rem;
  line-height: 1;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.stat-num.bump { animation: countGlow 0.6s ease; }
@keyframes countGlow {
  0% { text-shadow: 0 0 0 rgba(232, 192, 120, 0); transform: scale(1); }
  40% { text-shadow: 0 0 24px rgba(232, 192, 120, 0.65); transform: scale(1.06); color: var(--amber-light); }
  100% { text-shadow: 0 0 0 rgba(232, 192, 120, 0); transform: scale(1); }
}
.stat-label {
  font-size: 0.9rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .particle, .build.is-active, .live-dot, .pr-checks[data-c="pending"] { animation: none !important; }
  .build.just-succeeded, .build.just-failed { animation: buildIn 0.5s ease both; }
}

/* ── Auth pages (login + change password) ───────────────────────────────────
   Reuse the board's theme + background; a normal cursor here (the board itself
   is cursor:none for the kiosk). Centered card. */
body.auth-body {
  cursor: auto;
  display: grid;
  grid-template-rows: none;
  place-items: center;
  gap: 0;
  padding: 2rem;
  overflow: auto;
}
.auth-wrap { width: 100%; max-width: 26rem; }
.auth-card {
  background: var(--card-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--card-border);
  border-radius: 1.25rem;
  padding: 2.4rem 2.2rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  animation: panelIn 0.5s ease both;
}
.auth-brand { font-size: 2.2rem; text-align: center; }
.auth-sub {
  text-align: center;
  font-family: var(--font-mono);
  letter-spacing: 0.38em;
  color: var(--amber-light);
  font-size: 0.78rem;
  opacity: 0.85;
  text-transform: uppercase;
  margin: 0.35rem 0 1.6rem;
}
.auth-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-top: 0.85rem;
  margin-bottom: 0.35rem;
}
.auth-input {
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: var(--text);
  background: rgba(26, 20, 16, 0.6);
  border: 1px solid var(--card-border);
  border-radius: 0.7rem;
  padding: 0.75rem 0.9rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.auth-input:focus { border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-glow); }
.auth-btn {
  margin-top: 1.4rem;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  color: #1a1410;
  background: linear-gradient(135deg, var(--amber-light), var(--amber));
  border: none;
  border-radius: 0.7rem;
  padding: 0.8rem;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}
.auth-btn:hover { box-shadow: 0 8px 24px var(--amber-glow); }
.auth-btn:active { transform: translateY(1px); }
.auth-msg { min-height: 1.2rem; margin-top: 0.95rem; font-size: 0.9rem; text-align: center; color: var(--text-dim); }
.auth-msg.err { color: var(--error-light); }
.auth-msg.ok { color: var(--success-light); }
.auth-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(212, 162, 74, 0.1);
}
.auth-foot a, .auth-link {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  padding: 0;
}
.auth-foot a:hover, .auth-link:hover { color: var(--amber-light); }
