:root {
  --bg: #0b0f10;
  --bg2: #121a17;
  --gold: #ffcf4d;
  --gold-dim: #a9822f;
  --white: #eef3f0;
  --mist: #7c8a86;
  --green: #4fd18b;
  --warn: #ffb020;
  --red: #ff5d5d;
  --border: rgba(255,255,255,.09);
  --card: rgba(255,255,255,.04);
  --font-head: "Archivo Black", "Arial Narrow", sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "Courier New", monospace;
}

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

html { font-size: 16px; }

body {
  font-family: var(--font-body);
  background: radial-gradient(ellipse at top, var(--bg2) 0%, var(--bg) 70%);
  color: var(--white);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--gold); }

/* ─── Skip link (invisible until Tab key) ─────────────────────── */
.skip-link {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}
.skip-link:focus {
  clip: auto;
  clip-path: none;
  height: auto;
  overflow: auto;
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  z-index: 9999;
  background: var(--gold);
  color: var(--bg);
  font-weight: 700;
  padding: .5rem 1.4rem;
  border-radius: 6px;
  text-decoration: none;
}

/* ─── Focus ring ───────────────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ─── Header ───────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem 2rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11,15,16,.9);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  text-decoration: none;
  color: var(--white);
}
.brand-name {
  font-family: var(--font-head);
  font-size: .88rem;
  letter-spacing: .07em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 2rem;
}
.nav a {
  font-family: var(--font-mono);
  font-size: .75rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--mist);
  text-decoration: none;
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.nav a:hover { color: var(--white); }
.nav a.active { color: var(--gold); border-bottom-color: var(--gold); }

/* ─── Page wrapper ─────────────────────────────────────────────── */
.page { max-width: 900px; margin: 0 auto; padding: 3rem 1.5rem 6rem; }

/* ─── Eyebrow + heading ────────────────────────────────────────── */
.eyebrow {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: .6rem;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  animation: blink 2s ease-in-out infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}

h1 {
  font-family: var(--font-head);
  font-size: clamp(2rem, 5vw, 3.4rem);
  text-transform: uppercase;
  line-height: 1.05;
  margin-bottom: .8rem;
}
h1 .accent { color: var(--gold); }

.subtitle {
  color: var(--mist);
  max-width: 48ch;
  margin-bottom: 2.5rem;
  line-height: 1.65;
}

/* ─── Card ─────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.6rem;
  margin-bottom: 1.2rem;
}

.card-title {
  font-family: var(--font-mono);
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: .3rem;
}
.card-desc {
  font-size: .84rem;
  color: var(--mist);
  margin-bottom: 1.1rem;
  line-height: 1.55;
}

/* ─── Form ─────────────────────────────────────────────────────── */
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}
.field { display: flex; flex-direction: column; gap: .3rem; }
.field label {
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--mist);
}
select {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--white);
  font-family: var(--font-body);
  font-size: .88rem;
  padding: .5rem .75rem;
  cursor: pointer;
  min-width: 160px;
}
select:focus { border-color: var(--gold); }
select option {
  background: #0d1210;
  color: #eef3f0;
}

.ask-row { display: flex; gap: .6rem; }
.ask-row input {
  flex: 1;
  min-width: 0;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--white);
  font-family: var(--font-body);
  font-size: .9rem;
  padding: .55rem .8rem;
}
.ask-row input::placeholder { color: var(--mist); }
.ask-row input:focus { border-color: var(--gold); outline: none; }

.btn-ask {
  background: var(--gold);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  font-family: var(--font-head);
  font-size: .85rem;
  padding: .55rem 1.5rem;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .15s, transform .15s;
}
.btn-ask:hover { opacity: .85; transform: translateY(-1px); }
.btn-ask:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.reply-box {
  margin-top: 1.2rem;
  min-height: 2.5rem;
  font-size: .97rem;
  line-height: 1.65;
  color: var(--mist);
  font-style: italic;
}
.reply-box.has-answer { color: var(--white); font-style: normal; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .7rem;
}
.chip {
  background: rgba(255,207,77,.09);
  border: 1px solid rgba(255,207,77,.22);
  border-radius: 4px;
  padding: .18rem .55rem;
  font-family: var(--font-mono);
  font-size: .68rem;
  color: var(--gold-dim);
}

/* ─── Screen reader only ───────────────────────────────────────── */
.sr-only {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

/* ─── Ops table ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .87rem; }
thead th {
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--mist);
  padding: .55rem .8rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: .7rem .8rem;
  border-bottom: 1px solid rgba(255,255,255,.04);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,.025); }
tbody tr.best td { background: rgba(79,209,139,.05); }
tbody tr.best td:first-child::after { content: " ★"; color: var(--green); font-size: .75rem; }

.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: .35rem;
  vertical-align: middle;
  flex-shrink: 0;
}
.dot.low      { background: var(--green); }
.dot.moderate { background: var(--warn); }
.dot.high     { background: var(--warn); animation: blink 1.5s infinite; }
.dot.critical { background: var(--red);  animation: blink 1s infinite; }

.util-bar {
  display: inline-block;
  width: 52px;
  height: 5px;
  background: rgba(255,255,255,.1);
  border-radius: 3px;
  overflow: hidden;
  vertical-align: middle;
  margin-right: .4rem;
}
.util-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--green);
  transition: width .4s ease;
}
.util-fill.warn { background: var(--warn); }
.util-fill.crit { background: var(--red); }

.ops-footer {
  font-family: var(--font-mono);
  font-size: .73rem;
  color: var(--mist);
  margin-top: 1rem;
  padding-top: .9rem;
  border-top: 1px solid var(--border);
}

/* ─── What-If Server Simulator ─────────────────────────────────── */
.sim-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1.2rem;
  margin-bottom: 1.2rem;
}
.sim-adjust {
  display: flex;
  align-items: center;
  gap: .7rem;
}
.sim-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--white);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sim-btn:hover:not(:disabled) { background: rgba(255,207,77,.15); border-color: var(--gold); }
.sim-btn:disabled { opacity: .3; cursor: not-allowed; }

.sim-count-wrap { text-align: center; min-width: 70px; }
.sim-count {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.6rem;
  color: var(--gold);
  line-height: 1;
}
.sim-count-label {
  font-family: var(--font-mono);
  font-size: .65rem;
  color: var(--mist);
  text-transform: uppercase;
  letter-spacing: .07em;
}

.sim-result {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  padding: 1.1rem 1.2rem;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  flex-wrap: wrap;
}
.sim-col { text-align: center; min-width: 90px; }
.sim-label {
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--mist);
  margin-bottom: .4rem;
}
.sim-val {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--white);
  line-height: 1;
}
.sim-arrow {
  font-size: 1.4rem;
  color: var(--mist);
  flex-shrink: 0;
}
.sim-note {
  margin-top: .8rem;
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--mist);
  min-height: 1.2em;
}

/* ─── Briefing ─────────────────────────────────────────────────── */

.btn-briefing {
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: .76rem;
  letter-spacing: .06em;
  padding: .5rem 1.2rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-briefing:hover:not(:disabled) { background: var(--gold); color: var(--bg); }
.btn-briefing:disabled { opacity: .4; cursor: not-allowed; }

.briefing-panel {
  display: none;
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  background: rgba(255,207,77,.04);
  border: 1px solid rgba(255,207,77,.14);
  border-radius: 8px;
}
.briefing-panel.open { display: block; }
.briefing-meta {
  font-family: var(--font-mono);
  font-size: .69rem;
  color: var(--mist);
  margin-bottom: .7rem;
}
.briefing-list { list-style: none; }
.briefing-list li {
  font-size: .87rem;
  line-height: 1.6;
  padding: .38rem 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.briefing-list li:last-child { border-bottom: none; }

/* ─── Sustainability grid ──────────────────────────────────────── */
.sustain-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .9rem;
  margin-top: 1rem;
}
@media (max-width: 680px) { .sustain-grid { grid-template-columns: repeat(2, 1fr); } }

.sustain-card {
  background: rgba(79,209,139,.06);
  border: 1px solid rgba(79,209,139,.16);
  border-radius: 8px;
  padding: .9rem 1rem;
}
.s-num {
  font-family: var(--font-mono);
  font-size: 1.55rem;
  line-height: 1;
  color: var(--green);
  font-weight: 500;
  margin-bottom: .35rem;
}
.s-label {
  font-size: .75rem;
  color: var(--mist);
  line-height: 1.4;
}

/* ─── Footer ───────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 2rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--mist);
}
.footer a { color: var(--mist); text-decoration: underline; }
.footer a:hover { color: var(--gold); }

/* ─── RTL ──────────────────────────────────────────────────────── */
[dir="rtl"] { text-align: right; }

/* ─── Helpers (to avoid inline styling for CSP compliance) ─────── */
.color-gold  { color: var(--gold); }
.color-green { color: var(--green); }
.color-red   { color: var(--red); }
.color-mist  { color: var(--mist); }
.text-sm     { font-size: .82rem; }

/* Accessible, styleable progress elements */
progress {
  -webkit-appearance: none;
  appearance: none;
  width: 52px;
  height: 5px;
  border: none;
  background: rgba(255,255,255,.1);
  border-radius: 3px;
  overflow: hidden;
  vertical-align: middle;
  margin-right: .4rem;
}
progress::-webkit-progress-bar {
  background: rgba(255,255,255,.1);
  border-radius: 3px;
}
progress::-webkit-progress-value {
  background: var(--green);
  border-radius: 3px;
}
progress.warn::-webkit-progress-value {
  background: var(--warn);
}
progress.crit::-webkit-progress-value {
  background: var(--red);
}

