/* The Rig page — full-bleed hero + a wide "Live from the rig" dashboard band.
   The card components are ported from the private dashboard's style.css and scoped
   under #rig-live so they share the look without touching the blog theme. */

#rig-live { --ok: #3fb950; --warn: #d29922; --bad: #f85149; }

/* ---- full-bleed hero ---------------------------------------------------- */
.rig-hero {
  position: relative; left: 50%; right: 50%; margin: -1.5rem -50vw 0; width: 100vw;
  padding: 5rem 1.25rem 4rem; text-align: center;
  background:
    radial-gradient(60rem 30rem at 50% -10%, rgba(88,166,255,0.18), transparent 60%),
    radial-gradient(42rem 24rem at 85% 120%, rgba(63,185,80,0.14), transparent 60%),
    linear-gradient(180deg, #0b0f15 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  background-size: cover; background-position: center;
}
.rig-hero.has-photo { padding: 7rem 1.25rem 5rem; }
.rig-hero-inner { max-width: var(--maxw); margin: 0 auto; }
.rig-hero-kicker {
  text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.78rem;
  color: var(--accent); margin: 0 0 0.75rem; font-weight: 600;
}
.rig-hero-title {
  font-size: clamp(2.6rem, 7vw, 4.2rem); line-height: 1.02; margin: 0 0 0.9rem; font-weight: 800;
  background: linear-gradient(120deg, #e6edf3, var(--accent) 60%, var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.rig-hero.has-photo .rig-hero-title { filter: drop-shadow(0 2px 14px rgba(0,0,0,0.55)); }
.rig-hero-sub { color: var(--text-dim); font-size: 1.12rem; margin: 0 auto; max-width: 38rem; }
.rig-hero.has-photo .rig-hero-sub { color: #d7dee6; text-shadow: 0 1px 8px rgba(0,0,0,0.75); }

/* live status chip in the hero */
.rig-chip {
  display: inline-flex; align-items: center; gap: 0.5rem; margin-top: 1.5rem;
  padding: 0.45rem 0.95rem; border-radius: 999px;
  border: 1px solid var(--border); background: rgba(13,17,23,0.6);
  font-size: 0.9rem; color: var(--text); backdrop-filter: blur(4px);
}
.rig-chip .dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--text-dim); flex-shrink: 0; }
.rig-chip.live { border-color: rgba(63,185,80,0.5); }
.rig-chip.live .dot { background: var(--ok); box-shadow: 0 0 0 0 rgba(63,185,80,0.6); animation: rig-pulse 2s infinite; }
.rig-chip.off .dot { background: var(--bad); }
.rig-chip .dim { color: var(--text-dim); }
@keyframes rig-pulse {
  0% { box-shadow: 0 0 0 0 rgba(63,185,80,0.5); }
  70% { box-shadow: 0 0 0 9px rgba(63,185,80,0); }
  100% { box-shadow: 0 0 0 0 rgba(63,185,80,0); }
}

/* ---- wide live band ----------------------------------------------------- */
.rig-band {
  position: relative; left: 50%; right: 50%; margin: 0 -50vw 2.75rem; width: 100vw;
  padding: 2.25rem 1.25rem 2.5rem;
  background: linear-gradient(180deg, var(--bg) 0%, #0b0f15 100%);
  border-bottom: 1px solid var(--border);
}
.rig-band-inner { max-width: var(--maxw-wide); margin: 0 auto; }
.rig-band-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.rig-band-head h2 {
  margin: 0; font-size: 1.05rem; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.rig-band-head .updated { color: var(--text-dim); font-size: 0.85rem; font-variant-numeric: tabular-nums; }

/* ---- grid + cards (ported from the dashboard) --------------------------- */
#rig-live .grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; align-items: stretch; }
#rig-live .card-stack { display: flex; flex-direction: column; gap: 1rem; }
#rig-live .card-stack > .card:last-child { flex-grow: 1; }
#rig-live .card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 1rem 1.25rem;
}
#rig-live .card-stack .card { padding: 0.8rem 1.1rem; }
#rig-live .card h2 {
  margin: 0 0 0.75rem; font-size: 0.9rem; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.05em;
}
#rig-live .card-stack .card h2 { margin-bottom: 0.5rem; }
#rig-live .span-all { grid-column: 1 / -1; }
#rig-live .card-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 0.75rem; margin-bottom: 0.75rem; }
#rig-live .card-head h2 { margin: 0; }
#rig-live .pi-power { font-size: 0.85rem; color: var(--text-dim); font-weight: 500; margin-left: auto; }
#rig-live .pi-power .ok { color: var(--ok); } #rig-live .pi-power .warn { color: var(--warn); } #rig-live .pi-power .bad { color: var(--bad); }
#rig-live .pi-atoms { font-size: 0.85rem; color: var(--text-dim); font-weight: 500; }
#rig-live .atom-chip { background: rgba(255,255,255,0.06); border-radius: 6px; padding: 0.12rem 0.5rem; white-space: nowrap; }
#rig-live .atom-chip + .atom-chip { margin-left: 0.4rem; }
#rig-live .pi-atoms .ok { color: var(--ok); } #rig-live .pi-atoms .warn { color: var(--warn); } #rig-live .pi-atoms .bad { color: var(--bad); }
#rig-live .wifi-bars { color: var(--ok); letter-spacing: -0.05em; margin-right: 0.3rem; }
#rig-live .stale-flag { color: var(--bad); font-weight: 600; }
/* 8 metrics per Pi card → a fixed 4 columns = 2 even rows (no lonely orphan row,
   which auto-fit caused when only 7 fit at the band's 1200px width). */
#rig-live .span-all #rl-pihealth, #rig-live .span-all #rl-pi2health { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.3rem 1.5rem; }
#rig-live .span-all #rl-pihealth .metric-row, #rig-live .span-all #rl-pi2health .metric-row { justify-content: flex-start; gap: 0.5rem; white-space: nowrap; }
@media (max-width: 640px) { #rig-live .span-all #rl-pihealth, #rig-live .span-all #rl-pi2health { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1100px) { #rig-live .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { #rig-live .grid { grid-template-columns: 1fr; } }

#rig-live .subhead {
  margin: 0.9rem 0 0.5rem; padding-top: 0.7rem; border-top: 1px solid var(--border);
  font-size: 0.72rem; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em;
}
#rig-live .meta { color: var(--text-dim); font-size: 0.85rem; margin-top: 0.5rem; }
#rig-live .meta-inline { color: var(--text-dim); font-weight: 400; text-transform: none; letter-spacing: 0; }

#rig-live .metric-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 0.35rem 0; }
#rig-live .metric-row .label { color: var(--text-dim); font-size: 0.9rem; flex-shrink: 0; }
#rig-live .metric-row .value { font-variant-numeric: tabular-nums; font-weight: 500; text-align: right; min-width: 0; }
#rig-live .value.bad { color: var(--bad); } #rig-live .value.warn { color: var(--warn); } #rig-live .value.ok { color: var(--ok); }

#rig-live .card-total { font-size: 0.8rem; font-weight: 600; color: var(--text-dim); font-variant-numeric: tabular-nums; margin-bottom: 0.4rem; }
#rig-live .tank-barrow { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.35rem; }
#rig-live .tank-barrow:last-child { margin-bottom: 0; }
#rig-live .tank-barrow .bar { flex: 1; margin: 0; }
/* Prominent battery status line: time-to-full / time-left-on-battery */
#rig-live .batt-ttg { font-weight: 600; font-size: 0.95rem; margin: 0.1rem 0 0.15rem; }
#rig-live .batt-ttg.ok { color: var(--ok); }
#rig-live .batt-ttg.warn { color: var(--warn); }
/* Per-bank detail rows under the shunt SOC headline (Bank A/B: V · temp · spread) */
/* Stack label over value so every bank reads the same regardless of digit widths. */
#rig-live .bank-row { margin: 0.3rem 0; }
#rig-live .bank-row > span:first-child { font-weight: 600; display: block; }
#rig-live .bank-row .meta { display: block; margin-top: 0; white-space: nowrap; }
#rig-live .bank-row .warn { color: var(--warn); font-weight: 600; }
#rig-live .bank-row .bad { color: var(--bad); font-weight: 600; }
#rig-live .bar {
  position: relative; height: 1.4rem; background: #0a0e14; border: 1px solid var(--border);
  border-radius: 4px; margin: 0.25rem 0 0.6rem; overflow: hidden;
}
#rig-live .bar-fill { height: 100%; transition: width 0.3s ease; }
#rig-live .bar-fill.ok { background: var(--ok); } #rig-live .bar-fill.warn { background: var(--warn); } #rig-live .bar-fill.bad { background: var(--bad); }
#rig-live .bar-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between;
  padding: 0 0.5rem; font-size: 0.8rem; font-variant-numeric: tabular-nums; color: var(--text); mix-blend-mode: difference;
}
#rig-live .batt { font-size: 0.8rem; white-space: nowrap; color: var(--text-dim); font-variant-numeric: tabular-nums; display: inline-block; min-width: 4.2rem; text-align: right; }
#rig-live .batt.ok { color: var(--ok); } #rig-live .batt.warn { color: var(--warn); } #rig-live .batt.bad { color: var(--bad); } #rig-live .batt.stale { opacity: 0.45; }

#rig-live .tire-grid { display: grid; grid-template-columns: max-content max-content; justify-content: center; column-gap: 1.8rem; row-gap: 0.4rem; }
#rig-live .tire { font-size: 0.82rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
#rig-live .tire .tloc { color: var(--text-dim); font-weight: 600; }
#rig-live .tire .tdim { color: var(--text-dim); }
#rig-live .tire .ok { color: var(--ok); } #rig-live .tire .warn { color: var(--warn); } #rig-live .tire .bad { color: var(--bad); }

#rig-live .wx-now { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
#rig-live .wx-ico { font-size: 1.7rem; line-height: 1; }
#rig-live .wx-temp { font-size: 1.9rem; font-weight: 600; font-variant-numeric: tabular-nums; }
#rig-live .wx-cond { color: var(--text-dim); font-size: 0.85rem; }
#rig-live .wx-badge { display: inline-block; padding: 0.05rem 0.4rem; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
#rig-live .wx-badge.bad { background: rgba(248,81,73,0.18); color: var(--bad); }
#rig-live .wx-badge.warn { background: rgba(210,153,34,0.18); color: var(--warn); }
#rig-live .wx-blurb { margin-top: 0.6rem; line-height: 1.4; }

#rig-live .status-banner {
  display: flex; align-items: center; gap: 0.55rem; padding: 0.55rem 0.75rem; border-radius: 6px;
  margin-bottom: 0.6rem; font-weight: 600; background: rgba(139,148,158,0.12); color: var(--text-dim);
}
#rig-live .status-banner .status-dot { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--text-dim); flex-shrink: 0; }
#rig-live .status-banner .status-text { font-size: 1.05rem; letter-spacing: 0.02em; }
#rig-live .status-banner .status-sub { margin-left: auto; font-size: 0.8rem; font-weight: 500; opacity: 0.85; }
#rig-live .status-banner.run { background: rgba(63,185,80,0.15); color: var(--ok); }
#rig-live .status-banner.run .status-dot { background: var(--ok); box-shadow: 0 0 7px var(--ok); }
#rig-live .status-banner.warn { background: rgba(210,153,34,0.15); color: var(--warn); }
#rig-live .status-banner.warn .status-dot { background: var(--warn); }
#rig-live .status-banner.bad { background: rgba(248,81,73,0.15); color: var(--bad); }
#rig-live .status-banner.bad .status-dot { background: var(--bad); }

#rig-live .pill { padding: 0.1rem 0.55rem; border-radius: 11px; font-size: 0.78rem; font-weight: 600; background: rgba(139,148,158,0.18); color: var(--text-dim); }
#rig-live .pill.ok { background: rgba(63,185,80,0.2); color: var(--ok); } #rig-live .pill.bad { background: rgba(248,81,73,0.2); color: var(--bad); }

#rig-live .sl-speeds { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin: 0 0 0.6rem; }
#rig-live .sl-speed { background: rgba(139,148,158,0.1); border-radius: 6px; padding: 0.45rem 0.3rem; text-align: center; }
#rig-live .sl-speed .v { font-size: 1.3rem; font-weight: 600; line-height: 1.1; display: block; }
#rig-live .sl-speed .k { font-size: 0.7rem; color: var(--text-dim); display: block; }

/* mini 3D obstruction dome embedded in the Starlink card */
#rig-live .sl-dome {
  position: relative; width: 100%; aspect-ratio: 4 / 3; margin: 0 0 0.6rem;
  border-radius: 8px; overflow: hidden;
  background: radial-gradient(circle at 50% 55%, #0d1117 0%, #05070a 70%);
  cursor: zoom-in; transition: box-shadow 0.2s;
}
#rig-live .sl-dome:hover { box-shadow: 0 0 0 1px rgba(63,185,80,0.45); }
#rig-live .sl-dome canvas { display: block; width: 100% !important; height: 100% !important; }
#rig-live .sl-dome::after {
  content: "tap to expand"; position: absolute; bottom: 0.35rem; right: 0.5rem;
  font-size: 0.65rem; color: var(--text-dim); pointer-events: none; opacity: 0; transition: opacity 0.15s;
}
#rig-live .sl-dome:hover::after { opacity: 0.85; }
#rig-live .sl-dome-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--text-dim); font-size: 0.8rem; }

/* full-screen sky-dome modal — appended to <body>, so NOT scoped under #rig-live */
.sky-dome-modal { --ok:#3fb950; --bad:#f85149; position: fixed; inset: 0; background: rgba(8,10,14,0.96); z-index: 1000; display: flex; flex-direction: column; }
.sky-dome-head { display: flex; align-items: center; gap: 1rem; padding: 0.7rem 1rem; border-bottom: 1px solid rgba(139,148,158,0.2); color: var(--text); }
.sky-dome-title { font-weight: 600; }
.sky-dome-meta { color: var(--text-dim); font-size: 0.85rem; }
.sky-dome-close { margin-left: auto; background: none; border: none; color: var(--text); font-size: 2rem; line-height: 1; cursor: pointer; padding: 0 0.4rem; }
.sky-dome-close:hover { color: var(--bad); }
.sky-dome-stage { flex: 1; min-height: 0; position: relative; }
.sky-dome-stage canvas { display: block; }
.sky-dome-legend { display: flex; flex-wrap: wrap; gap: 1.2rem; justify-content: center; padding: 0.65rem; color: var(--text-dim); font-size: 0.85rem; border-top: 1px solid rgba(139,148,158,0.2); }
.sky-dome-legend i { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 50%; vertical-align: middle; margin-right: 0.4rem; }
.sky-dome-tip { opacity: 0.7; font-style: italic; }
