/*
 * /assets/site.css
 *
 * Oninit design-system tokens + safe base rules — Phase 1 foundation
 * per /home/oninit/Projects/Control/WEBUPGRADE.md §4 (tokens) and §5
 * (typography). This file deliberately stops at the design vocabulary
 * plus two low-risk visible improvements (no-ligature code, tabular
 * numerals in tables). Component styles (.topbar, .hero, .sidebar,
 * .btn, etc.) land in later phases when the shared partials are
 * modernised.
 *
 * Loaded only on ripper pages via the conditional <link> in
 * /inc/master.inc (Phase 1 ripper-only application 2026-06-02).
 */

:root {
  /* Surfaces */
  --bg:        #FAFAF7;
  --surface:   #FFFFFF;

  /* Text */
  --text:      #0F1115;
  --muted:     #5A6470;

  /* Lines */
  --border:    #E5E2DA;

  /* Accent — Oninit orange, recalibrated for WCAG AA contrast */
  --accent:    #E8742A;
  --accent-hv: #F08A45;

  /* Code */
  --code-bg:   #F4F1EA;
  --code-fg:   #0F1115;

  /* Links */
  --link:      #0F1115;
  --link-hv:   #E8742A;

  /* Semantic */
  --success:   #3DD68C;
  --warn:      #E8B14A;
  --danger:    #E5484D;

  /* Effects */
  --shadow:    0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.06);

  /* Type stacks */
  --font-ui:      Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Inter Tight", Inter, ui-sans-serif, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
}

/* DBAs read raw bytes; ligatures lie. Always disable them in code. */
code, pre, kbd, samp {
  font-feature-settings: "liga" 0, "calt" 0;
}

/* Tabular numerals so byte counts, LSNs, and timing columns align. */
table {
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
 * WEBUPGRADE Phase 3 — drwatson 2026-06-02
 * §6 shell, §7.2 hero, §7.6 card grid, §7.8 buttons, §7.9 callouts.
 * Scoped under .wu so legacy markup on the same page isn't affected.
 * Other products opt in when they enrol in Phase 3.
 * ========================================================================== */

.wu, .wu * { box-sizing: border-box; }

.wu {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
}
.wu h1, .wu h2, .wu h3, .wu h4 {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
  font-weight: 600;
  color: var(--text);
  margin: 1.4em 0 0.6em;
}
.wu h1 { font-size: 36px; font-weight: 700; margin-top: 0; }
.wu h2 { font-size: 24px; }
.wu h3 { font-size: 18px; }
.wu h4 { font-size: 16px; }
.wu p { margin: 0 0 1em; max-width: 72ch; }
.wu p.lede { font-size: 17px; color: var(--muted); max-width: 60ch; }
.wu a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
  transition: color 120ms, text-decoration-color 120ms;
}
.wu a:hover {
  color: var(--link-hv);
  text-decoration-color: var(--link-hv);
}
.wu code {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.92em;
}
.wu pre {
  background: #0B0D10;
  color: #E6E8EB;
  padding: 16px;
  border-radius: 8px;
  overflow: auto;
  font-family: var(--font-mono);
  line-height: 1.5;
}
.wu pre code { background: transparent; color: inherit; padding: 0; }

/* ----- §6 shell ----- */

.wu .shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 32px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}
.wu .shell main { min-width: 0; }

/* ----- §7.3 sidebar ----- */

.wu .sidebar { font-size: 14px; }
.wu .sidebar h4 {
  margin: 16px 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}
.wu .sidebar h4:first-child { margin-top: 0; }
.wu .sidebar a {
  display: block;
  padding: 4px 10px;
  margin-left: -10px;
  border-left: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
}
.wu .sidebar a:hover { color: var(--text); }
.wu .sidebar a.active {
  border-left-color: var(--accent);
  color: var(--text);
  font-weight: 500;
}

/* ----- §7.2 hero ----- */

.wu .hero {
  border-bottom: 1px solid var(--border);
  padding: 48px 0 32px;
  margin-bottom: 24px;
}
.wu .hero-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
.wu .hero .eyebrow {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 8px;
}
.wu .hero h1 { margin-top: 0; }
.wu .hero .ctas {
  margin-top: 16px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.wu .code-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
}

/* ----- §7.6 card grid ----- */

.wu .card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 24px 0;
}
.wu .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
}
.wu .card .ic {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--accent);
  margin-bottom: 8px;
}
.wu .card h5 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--text);
}
.wu .card p { margin: 0; font-size: 14px; color: var(--muted); max-width: none; }

/* ----- §7.8 buttons ----- */

.wu .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
}
.wu .btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.wu .btn-primary:hover {
  background: var(--accent-hv);
  border-color: var(--accent-hv);
  color: #fff;
  text-decoration: none;
}
.wu .btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.wu .btn-ghost:hover {
  border-color: var(--text);
  text-decoration: none;
}

/* ----- §7.9 callouts ----- */

.wu .callout {
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  margin: 1.5em 0;
}
.wu .callout p { margin: 0; max-width: none; }
.wu .callout p + p { margin-top: 8px; }

/* ----- §7.5 docs tables ----- */

.wu table.docs {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-variant-numeric: tabular-nums;
}
.wu table.docs caption {
  text-align: left;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.wu table.docs thead th {
  text-align: left;
  font-weight: 600;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.wu table.docs tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.wu table.docs tbody tr:nth-child(even) td { background: var(--surface); }

/* ----- focus visibility per §13 ----- */

.wu :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ----- breakpoints per §6 ----- */

@media (max-width: 960px) {
  .wu .shell {
    grid-template-columns: 1fr;
  }
  .wu .sidebar {
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    margin-bottom: 16px;
  }
  .wu .card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .wu .hero h1 { font-size: 32px; }
  .wu .card-grid { grid-template-columns: 1fr; }
}
