/* ATLAS Console — SG-1 themed command surface.
   Naquadah-dark background + stargate-orange accent + iris-red hover.
   Designed for a 1200×1920 tablet in portrait; scales down to phones. */

:root {
  --bg: #070912;
  --bg-panel: #0f1322;
  --bg-panel-alt: #161a2e;
  --border: #2a3150;
  --border-bright: #3d476e;
  --fg: #e8ecff;
  --fg-dim: #a6afcf;
  --fg-subtle: #6b729a;
  --accent: #ff8c2d;          /* stargate event horizon orange */
  --accent-dim: #a85915;
  --accent-bg: rgba(255, 140, 45, 0.08);
  --iris: #ff3860;             /* iris-red, used for danger/NYX */
  --gate-blue: #5fb3ff;
  --gate-blue-glow: rgba(95, 179, 255, 0.25);
  --ok: #9ece6a;
  --warn: #ffd528;
  --error: #f7768e;
  --font-display: 'Orbitron', 'Rajdhani', 'JetBrains Mono', ui-monospace, monospace;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-sans: -apple-system, 'Segoe UI', Roboto, system-ui, sans-serif;
}

@font-face {
  font-family: 'Orbitron';
  font-display: swap;
  src: local('Orbitron');
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  -webkit-tap-highlight-color: rgba(255, 140, 45, 0.15);
  overscroll-behavior: none;
  overflow-x: hidden;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(95, 179, 255, 0.15), transparent 65%),
    radial-gradient(ellipse at 50% 100%, rgba(255, 140, 45, 0.08), transparent 65%),
    linear-gradient(180deg, #070912 0%, #050714 100%);
  pointer-events: none;
}
.backdrop::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.015) 0, rgba(255,255,255,0.015) 1px, transparent 1px, transparent 4px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.015) 0, rgba(255,255,255,0.015) 1px, transparent 1px, transparent 4px);
  mix-blend-mode: overlay;
}

.console {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* --- header / brand --- */
.brand {
  margin-bottom: 28px;
}
.chevrons {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}
.chevron {
  width: 32px;
  height: 18px;
  background: var(--border);
  clip-path: polygon(0 0, 100% 0, 85% 100%, 15% 100%);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}
.chevron[data-i="0"] { background: var(--accent); box-shadow: 0 0 18px var(--accent-dim); }
.chevron[data-i="1"] { background: var(--accent); box-shadow: 0 0 14px var(--accent-dim); }
.chevron[data-i="2"] { background: var(--accent); box-shadow: 0 0 12px var(--accent-dim); }
.chevron[data-i="3"] { background: var(--accent); box-shadow: 0 0 10px var(--accent-dim); }
.chevron[data-i="4"] { background: var(--gate-blue); box-shadow: 0 0 16px var(--gate-blue-glow); }
.chevron[data-i="5"] { background: var(--border-bright); }
.chevron[data-i="6"] { background: var(--border-bright); }

.title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.title-row h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(28px, 5vw, 44px);
  letter-spacing: 5px;
  font-weight: 900;
  color: var(--fg);
  text-shadow: 0 0 20px rgba(255, 140, 45, 0.25);
}
.meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-dim);
  display: flex;
  gap: 8px;
  align-items: center;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.meta .divider { color: var(--border-bright); }
.online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 6px var(--ok);
  margin-right: 4px;
}
.online-dot[data-state="offline"] {
  background: var(--error);
  box-shadow: 0 0 6px var(--error);
}
.subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 3px;
  margin-top: 10px;
  text-transform: uppercase;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 6px 0;
  text-align: center;
}

/* --- tile grid --- */
.grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.tile {
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 16px;
  text-decoration: none;
  color: var(--fg);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 130px;
  transition:
    transform 0.12s ease-out,
    border-color 0.2s ease-out,
    box-shadow 0.2s ease-out,
    background 0.2s ease-out;
  cursor: pointer;
  overflow: hidden;
}
.tile:active {
  transform: scale(0.97);
}
.tile::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, transparent 0%, transparent 70%, var(--accent-bg) 100%);
  opacity: 0;
  transition: opacity 0.2s ease-out;
}
.tile:hover, .tile:focus-visible {
  border-color: var(--accent);
  background: var(--bg-panel-alt);
  box-shadow: 0 4px 20px rgba(255, 140, 45, 0.1);
  outline: none;
}
.tile:hover::before, .tile:focus-visible::before { opacity: 1; }

.tile-icon {
  font-size: 28px;
  margin-bottom: 10px;
  filter: drop-shadow(0 0 6px rgba(255, 140, 45, 0.25));
}
.tile-label {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--fg);
  margin-bottom: 4px;
}
.tile-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-subtle);
  line-height: 1.4;
  letter-spacing: 0.5px;
}
.tile-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 6px;
  border-radius: 3px;
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid var(--accent-dim);
}

/* tone variants */
.tile[data-tone="orange"] { --tile-accent: var(--accent); }
.tile[data-tone="blue"] { --tile-accent: var(--gate-blue); }
.tile[data-tone="red"] { --tile-accent: var(--iris); }
.tile[data-tone="green"] { --tile-accent: var(--ok); }
.tile[data-tone]:hover { border-color: var(--tile-accent); box-shadow: 0 4px 20px rgba(255,255,255,0.05); }
.tile[data-tone] .tile-icon {
  color: var(--tile-accent);
  filter: drop-shadow(0 0 6px var(--tile-accent));
}
.tile[data-tone] .tile-badge {
  color: var(--tile-accent);
  border-color: var(--tile-accent);
  background: color-mix(in srgb, var(--tile-accent) 12%, transparent);
}

.tile[data-status="offline"] {
  opacity: 0.45;
}
.tile[data-status="offline"]::after {
  content: 'OFFLINE';
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--error);
  letter-spacing: 1px;
}

/* --- live widget --- */
.live-widget {
  margin-bottom: 24px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.live-widget::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 0%, var(--accent-bg) 50%, transparent 100%);
  opacity: 0.25;
}
.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}
.widget-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 3px;
  color: var(--accent);
  text-transform: uppercase;
}
.widget-status {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-subtle);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.widget-status[data-state="online"] { color: var(--ok); }
.widget-status[data-state="offline"] { color: var(--error); }

.widget-body {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 12px;
}
.widget-body.pulse-body {
  grid-template-columns: repeat(4, 1fr);
}
.widget-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.widget-stat-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.widget-stat-value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--fg);
}

.widget-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 140px;
  overflow-y: auto;
  border-top: 1px dashed var(--border);
  padding-top: 10px;
  margin-top: 6px;
}
.widget-list:empty { display: none; }
.widget-list-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-dim);
  padding: 3px 0;
}
.widget-list-row .name { color: var(--accent); }
.widget-list-row .meta { color: var(--fg-subtle); }

@media (max-width: 600px) {
  .widget-body { grid-template-columns: 1fr; gap: 8px; }
  .widget-body.pulse-body { grid-template-columns: repeat(2, 1fr); }
  .widget-stat-value { font-size: 18px; }
}

/* --- footer --- */
.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 4px 0;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 1px;
  flex-wrap: wrap;
}
.footer-brand { color: var(--accent); }
.footer-version { color: var(--fg-subtle); }

/* tablet-specific */
@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
  .tile { min-height: 150px; padding: 22px 20px; }
  .tile-icon { font-size: 32px; margin-bottom: 14px; }
  .tile-label { font-size: 15px; }
}

/* print-safe for paper runbook */
@media print {
  body { background: white; color: black; }
  .backdrop, .chevrons { display: none; }
  .tile { border: 1px solid #000; color: #000; }
}
