/* ==========================================================================
   DiagnoStack — design system
   Instrument-panel aesthetic: dark, precise, accent used only for status
   and action, never decoration. Every visual element maps to real data.
   ========================================================================== */

:root {
  --bg: #0F1417;
  --surface: #161D21;
  --surface-raised: #1C242A;
  --border: #2A343B;
  --border-soft: #212A30;

  --text: #E7ECEE;
  --text-muted: #8FA0A8;
  --text-faint: #5C6B72;

  --accent: #45C4A0;
  --accent-dim: #2E8A70;
  --accent-soft: rgba(69, 196, 160, 0.12);

  --warn: #E5A34A;
  --warn-soft: rgba(229, 163, 74, 0.12);
  --danger: #E1585F;
  --danger-soft: rgba(225, 88, 95, 0.12);

  --font-display: "Space Grotesk", "Segoe UI", sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "Consolas", monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --container-w: 1120px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(1.9rem, 3.4vw, 2.7rem); }
h2 { font-size: clamp(1.4rem, 2.2vw, 1.8rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; color: var(--text-muted); max-width: 66ch; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--font-mono); }
ul, ol { color: var(--text-muted); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- Layout ---------- */
.container {
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Top nav ---------- */
.site-header {
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  background: rgba(15, 20, 23, 0.92);
  backdrop-filter: blur(8px);
  z-index: 50;
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 10px; height: 10px; border-radius: 2px;
  background: var(--accent);
  display: inline-block;
  transform: rotate(45deg);
}
.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
  margin: 0; padding: 0;
}
.nav-links a {
  color: var(--text-muted);
  font-size: 0.94rem;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--text);
  text-decoration: none;
}
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  width: 40px; height: 36px;
  cursor: pointer;
}
@media (max-width: 780px) {
  .nav-links {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    background: var(--surface);
    border-bottom: 1px solid var(--border-soft);
    padding: 16px 24px;
    gap: 16px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
}

/* ---------- Hero ---------- */
.hero {
  padding: 64px 0 48px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 48px;
  align-items: center;
}
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding: 40px 0 32px; }
}
.hero-eyebrow {
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 14px;
}
.hero p.lead {
  font-size: 1.08rem;
  color: var(--text-muted);
}
.hero-actions { display: flex; gap: 14px; margin-top: 24px; flex-wrap: wrap; }

/* ---------- Gauge (used on homepage + k8s tool) ---------- */
.gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}
.gauge {
  --pct: 73;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--pct) * 1%), var(--border) 0);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.gauge-inner {
  width: 122px; height: 122px;
  border-radius: 50%;
  background: var(--surface);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.gauge-value {
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--text);
}
.gauge-label {
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-top: 2px;
}
.gauge-caption {
  font-size: 0.85rem;
  color: var(--text-faint);
  text-align: center;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.94rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--accent);
  color: #0B1613;
}
.btn-primary:hover { background: #58D2AF; }
.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover { border-color: var(--accent); }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Tool grid (bento, not uniform cards) ---------- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  padding: 12px 0 64px;
}
.tool-grid .tile.featured {
  grid-column: span 3;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
}
@media (max-width: 860px) {
  .tool-grid { grid-template-columns: 1fr; }
  .tool-grid .tile.featured { grid-template-columns: 1fr; }
}
.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 26px;
  display: block;
  color: var(--text);
  transition: border-color 120ms ease;
}
.tile:hover { border-color: var(--accent-dim); text-decoration: none; }
.tile .tag {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  background: var(--accent-soft);
  border-radius: 100px;
  padding: 3px 10px;
  margin-bottom: 12px;
}
.tile h3 { margin-bottom: 8px; }
.tile p { font-size: 0.92rem; margin-bottom: 0; }
.tile .go {
  font-size: 0.85rem;
  color: var(--text-faint);
  margin-top: 14px;
}

/* ---------- Trust strip ---------- */
.trust-strip {
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  padding: 28px 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
@media (max-width: 780px) { .trust-strip { grid-template-columns: 1fr; } }
.trust-item h4 { font-size: 0.95rem; margin-bottom: 4px; }
.trust-item p { font-size: 0.86rem; margin-bottom: 0; }

/* ---------- Tool page layout ---------- */
.tool-header { padding: 44px 0 8px; }
.tool-header p.lead { font-size: 1.02rem; }
.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
  padding: 24px 0 72px;
  align-items: start;
}
@media (max-width: 900px) {
  .tool-layout { grid-template-columns: 1fr; }
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}
.panel.sticky { position: sticky; top: 92px; }
@media (max-width: 900px) { .panel.sticky { position: static; } }

.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.field .hint {
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-top: 5px;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; } }

input[type="text"], input[type="number"], input[type="url"], select {
  width: 100%;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}
input:focus, select:focus { border-color: var(--accent); }
input::placeholder { color: var(--text-faint); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.tab-btn {
  background: none; border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.92rem; font-weight: 600;
  padding: 10px 4px;
  margin-right: 20px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab-btn.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Results / readouts ---------- */
.readout-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.92rem;
}
.readout-row:last-child { border-bottom: none; }
.readout-row .k { color: var(--text-muted); }
.readout-row .v { font-family: var(--font-mono); color: var(--text); font-weight: 600; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
}
.status-pill.pass { background: var(--accent-soft); color: var(--accent); }
.status-pill.warn { background: var(--warn-soft); color: var(--warn); }
.status-pill.fail { background: var(--danger-soft); color: var(--danger); }
.status-pill.dot::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; display: inline-block;
}

.check-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 12px;
}
.check-item-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.check-item-head strong { font-size: 0.96rem; }
.check-item p { font-size: 0.88rem; margin-bottom: 8px; }
.check-item pre {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  overflow-x: auto;
  margin: 0;
}

table.compare {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.compare th, table.compare td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
}
table.compare th { color: var(--text-faint); font-weight: 600; font-size: 0.8rem; }
table.compare td.num, table.compare th.num { text-align: right; font-family: var(--font-mono); }
table.compare tr.best td { color: var(--accent); }

.callout {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 18px;
}
.callout.warn { border-left-color: var(--warn); }
.callout.danger { border-left-color: var(--danger); }

.grade-badge {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.6rem;
  width: 84px; height: 84px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--accent);
  color: var(--accent);
}
.grade-badge.warn { border-color: var(--warn); color: var(--warn); }
.grade-badge.fail { border-color: var(--danger); color: var(--danger); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border-soft);
  padding: 40px 0 32px;
  margin-top: 40px;
}
.footer-grid {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
}
.footer-grid nav { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-grid nav a { color: var(--text-muted); font-size: 0.88rem; }
.footer-note {
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-top: 18px;
  max-width: 70ch;
}

/* ---------- Category sections (homepage groupings) ---------- */
.category-header {
  padding: 8px 0 4px;
}
.category-header .eyebrow {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.category-header p { font-size: 0.94rem; }
.section-divider {
  border-top: 1px solid var(--border-soft);
  margin: 8px 0 40px;
}

/* ---------- Textareas ---------- */
textarea {
  width: 100%;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  padding: 12px;
  border-radius: var(--radius-sm);
  resize: vertical;
  line-height: 1.5;
}
textarea:focus { border-color: var(--accent); }
textarea::placeholder { color: var(--text-faint); font-family: var(--font-body); }
select { cursor: pointer; }

/* ---------- Output blocks with copy button ---------- */
.output-block { position: relative; }
.output-block pre, .output-block textarea {
  margin: 0;
}
.copy-btn {
  position: absolute;
  top: 8px; right: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.copy-btn.copied { color: var(--accent); border-color: var(--accent-dim); }

pre.output {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 14px;
  padding-right: 70px;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  color: var(--text);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 420px;
  overflow-y: auto;
}
pre.output.error { color: var(--danger); border-color: var(--danger); }

/* ---------- Regex / diff highlighting ---------- */
mark.match {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 3px;
  padding: 0 1px;
}
.diff-line { font-family: var(--font-mono); font-size: 0.86rem; padding: 2px 10px; white-space: pre-wrap; word-break: break-word; }
.diff-line.add { background: var(--accent-soft); color: var(--accent); }
.diff-line.remove { background: var(--danger-soft); color: var(--danger); }
.diff-line.same { color: var(--text-muted); }
.diff-view { background: var(--bg); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); max-height: 420px; overflow-y: auto; }

/* ---------- Pattern chips (regex library, etc.) ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 5px 12px;
  border-radius: 100px;
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Segmented control (small tab-like toggle) ---------- */
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 16px; }
.segmented button {
  background: var(--surface-raised);
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 16px;
  cursor: pointer;
  border-right: 1px solid var(--border);
}
.segmented button:last-child { border-right: none; }
.segmented button.active { background: var(--accent-soft); color: var(--accent); }

/* ---------- Small tool grid (for category sections) ---------- */
.tool-grid-sm {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  padding: 20px 0 64px;
}
@media (max-width: 860px) { .tool-grid-sm { grid-template-columns: 1fr; } }

/* ---------- Roadmap chips (planned tools, not yet built) ---------- */
.roadmap-chip {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-faint);
  font-size: 0.8rem;
  padding: 5px 12px;
  border-radius: 100px;
  display: inline-block;
}
.roadmap-block {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  margin: 20px 0 64px;
}
.roadmap-block .chip-row { margin-bottom: 6px; }

/* ---------- Utility ---------- */
.text-muted { color: var(--text-muted); }
.mt-0 { margin-top: 0; }
.hidden { display: none !important; }
.full-width { grid-column: 1 / -1; }
