/* ============================================================
   Hermes Web Design System — "dbt Labs Modern Data"
   Shared token layer + components. Light & dark via data-theme.
   Source of truth: ~/.hermes/web-design/design.css
   Load FIRST, then app-specific styles. No app should redefine
   tokens — reference var(--*) only.
   ============================================================ */

/* ---- Fonts ---------------------------------------------------
   'polymath' / 'polymath-text' are the dbt brand faces (proprietary).
   We fall back to a clean grotesk stack. To use real Polymath,
   self-host the woff2 and set --font-display / --font-text.
------------------------------------------------------------- */
:root {
  --font-display: "Polymath", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-text: "Polymath Text", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---- Light (default) ---------------------------------------- */
:root, [data-theme="light"] {
  color-scheme: light;
  --primary: #FE6703;
  --primary-strong: #E85B00;
  --primary-soft: #FFB36D;
  --secondary: #030711;
  --tertiary: #6B7280;
  --neutral: #FFFFFF;
  --surface: #FFFFFF;
  --surface-muted: #F8FAFC;
  --on-surface: #030711;
  --border: #E5E7EB;
  --border-strong: #D1D5DB;
  --accent: #FE6703;
  --gradient-start: #7C3AED;
  --gradient-mid: #2563EB;
  --gradient-end: #FF7A18;
  --error: #DC2626;
  --success: #16A34A;
  --warn: #D97706;
  --shadow-sm: 0 1px 2px rgba(3,7,17,.06);
  --shadow-md: 0 4px 12px rgba(3,7,17,.08);
  --shadow-lg: 0 12px 40px rgba(3,7,17,.14);
  --code-bg: #F3F4F6;
  --code-border: #E5E7EB;
}

/* ---- Dark --------------------------------------------------- */
[data-theme="dark"] {
  color-scheme: dark;
  --surface: #030711;
  --surface-muted: #111827;
  --on-surface: #F9FAFB;
  --border: #1F2937;
  --border-strong: #374151;
  --tertiary: #9CA3AF;
  --secondary: #F9FAFB;
  --neutral: #030711;
  --primary: #FE6703;
  --primary-strong: #FE6703;
  --primary-soft: #FFB36D;
  --accent: #FE6703;
  --error: #F87171;
  --success: #4ADE80;
  --warn: #FBBF24;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,.5);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.6);
  --code-bg: #0B1220;
  --code-border: #1F2937;
}

/* Dark-mode contrast fixes. #FE6703 bg + white text is ~2.9:1 (fails WCAG AA
   4.5:1) because dark --secondary flips the btn text to white. Deeper button
   bg + translucent-orange chips keep the accent while staying readable. */
[data-theme="dark"] .btn-primary { background: #C2410C; }
[data-theme="dark"] .btn-primary:hover { background: #9A3412; }
[data-theme="dark"] .chip.primary { background: rgba(254,103,3,.16); color: #FFB36D; }

/* ---- Resets & base ------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.5;
  color: var(--on-surface);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5 { font-family: var(--font-display); color: var(--on-surface); margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, kbd { font-family: var(--font-mono); }
p { margin: 0 0 16px; }

/* ---- Typography scale ---------------------------------------- */
.typo-display { font-size: 56px; font-weight: 600; line-height: 1.05; letter-spacing: -0.02em; font-family: var(--font-display); }
.typo-lg      { font-size: 48px; font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; font-family: var(--font-display); }
.typo-md      { font-size: 36px; font-weight: 600; line-height: 1.2; letter-spacing: -0.015em; font-family: var(--font-display); }
.typo-sm      { font-size: 28px; font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; font-family: var(--font-display); }
.typo-title   { font-size: 21px; font-weight: 600; line-height: 1.2; letter-spacing: 0; font-family: var(--font-display); }
.typo-body-lg { font-size: 18px; line-height: 1.55; }
.typo-body    { font-size: 16px; line-height: 1.5; }
.typo-body-sm { font-size: 14px; line-height: 1.45; }
.typo-label   { font-size: 14px; font-weight: 500; line-height: 1.2; }
.typo-label-sm{ font-size: 12px; font-weight: 500; line-height: 1.2; letter-spacing: 0.02em; }
.typo-eyebrow { font-size: 12px; font-weight: 600; line-height: 1; letter-spacing: 0.08em; text-transform: uppercase; }
.muted { color: var(--tertiary); }
.mono { font-family: var(--font-mono); font-size: 0.9em; }

/* ---- Layout ------------------------------------------------- */
.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.container.wide { max-width: 1400px; }
.section { padding: 64px 0; }
.section-sm { padding: 32px 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 16px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; }
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* ---- Header / nav ------------------------------------------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 50;
}
.site-header .container { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 18px; color: var(--on-surface); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--gradient-start), var(--gradient-mid), var(--gradient-end)); display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 14px; font-weight: 700; }
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-link { color: var(--on-surface); font-family: var(--font-text); font-size: 16px; font-weight: 500; padding: 8px 12px; border-radius: 8px; }
.nav-link:hover { background: var(--surface-muted); text-decoration: none; }
.nav-link.active { color: var(--primary); }

/* ---- Top banner --------------------------------------------- */
.top-banner { background: linear-gradient(90deg, var(--gradient-start), var(--gradient-mid), var(--gradient-end)); color: var(--neutral); font-size: 14px; text-align: center; padding: 10px 24px; }
.top-banner a { color: var(--neutral); text-decoration: underline; }

/* ---- Buttons ------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-text); font-size: 16px; font-weight: 500;
  height: 48px; padding: 0 24px; border-radius: 12px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; transition: background .12s, border-color .12s, color .12s;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--secondary); }
.btn-primary:hover { background: var(--primary-strong); text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--on-surface); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-muted); text-decoration: none; }
.btn-tertiary { background: transparent; color: var(--on-surface); height: auto; padding: 0; border-radius: 0; }
.btn-tertiary:hover { text-decoration: underline; }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #b91c1c; text-decoration: none; }
.btn-sm { height: 36px; padding: 0 16px; font-size: 14px; border-radius: 10px; }
.btn-link { background: transparent; color: var(--primary); border: none; font-size: 14px; font-weight: 500; cursor: pointer; padding: 4px 0; }
.btn-link:hover { text-decoration: underline; }

/* ---- Cards --------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 40px; }
.card-muted { background: var(--surface-muted); border-radius: 16px; padding: 40px; }
.card-pad-sm { padding: 24px; }
.card-pad-xs { padding: 16px; }
.card-title { font-family: var(--font-display); font-size: 21px; font-weight: 600; margin-bottom: 8px; }
.card-sub { color: var(--tertiary); font-size: 14px; margin-bottom: 16px; }

/* ---- Inputs -------------------------------------------------- */
.input, textarea.input, select.input {
  width: 100%; background: var(--surface); color: var(--on-surface);
  border: 1px solid var(--border-strong); border-radius: 12px;
  font-family: var(--font-text); font-size: 16px; padding: 12px 16px; height: 48px;
  transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; min-height: 120px; resize: vertical; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input::placeholder { color: var(--tertiary); }
label.field { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; color: var(--on-surface); }

/* ---- Chips --------------------------------------------------- */
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-muted); color: var(--on-surface); font-size: 12px; font-weight: 500; border-radius: 999px; padding: 8px 12px; }
.chip.badge { padding: 4px 10px; font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.chip.primary { background: var(--primary-soft); color: var(--secondary); }
.chip.success { background: rgba(22,163,74,.12); color: var(--success); }
.chip.warn { background: rgba(217,119,6,.12); color: var(--warn); }
.chip.error { background: rgba(220,38,38,.12); color: var(--error); }
.chip.neutral { background: var(--surface-muted); color: var(--tertiary); }

/* ---- Status dot / legend ------------------------------------- */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 999px; }
.dot.ok { background: var(--success); }
.dot.down { background: var(--error); }
.dot.warn { background: var(--warn); }
.dot.brand { background: var(--primary); }

/* ---- Tables -------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--tertiary); padding: 10px 12px; border-bottom: 1px solid var(--border); }
.table td { padding: 12px; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-muted); }

/* ---- Misc ---------------------------------------------------- */
.divider { height: 1px; background: var(--border); border: none; margin: 24px 0; }
.hero-media { background: linear-gradient(135deg, var(--gradient-start), var(--gradient-mid), var(--gradient-end)); border-radius: 16px; padding: 48px; color: #fff; }
.hero-media h1, .hero-media h2 { color: #fff; }
.alert { border-radius: 12px; padding: 12px 16px; font-size: 14px; margin-bottom: 16px; border: 1px solid; }
.alert-error { background: rgba(220,38,38,.08); border-color: rgba(220,38,38,.3); color: var(--error); }
.alert-success { background: rgba(22,163,74,.08); border-color: rgba(22,163,74,.3); color: var(--success); }
.alert-warn { background: rgba(217,119,6,.08); border-color: rgba(217,119,6,.3); color: var(--warn); }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; color: var(--tertiary); padding: 40px 0; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 40px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; } .mb-4 { margin-bottom: 40px; }
.text-right { text-align: right; }
.w-100 { width: 100%; }