/* web-system.css — Web-native design system register
 * Inherits brand tokens (teal, ink, scales) from the parent project,
 * but introduces a web-standard register: Inter, flat radii, real elevation.
 */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=IBM+Plex+Serif:wght@500;600&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  /* Brand spine */
  --ink: #0f1115;
  --ink-soft: #4a5159;
  --ink-faint: #8a9099;
  --ink-whisper: #f3f4f6;
  --ink-hair: #e5e7eb;

  --paper: #ffffff;
  --surface: #fafbfc;
  --surface-warm: #f5f6f8;
  --ink-dark: #003835;
  --ink-deeper: #0c1d1b;

  --teal-50:  #f0faf9;
  --teal-100: #cde9e7;
  --teal-300: #66bfb9;
  --teal-500: #00857C;
  --teal-700: #005c57;
  --teal-900: #003835;

  /* Functional */
  --success: #00703c;
  --warning: #f4a100;
  --danger:  #c4001f;
  --info:    #1d70b8;

  /* Type stacks */
  --font-display: "IBM Plex Serif", Georgia, serif;
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, monospace;

  /* Type scale — web */
  --t-display: 64px;
  --t-h1: 48px;
  --t-h2: 36px;
  --t-h3: 28px;
  --t-h4: 22px;
  --t-h5: 18px;
  --t-lead: 20px;
  --t-body: 16px;
  --t-small: 14px;
  --t-xs: 12px;
  --t-mono: 12px;

  /* Spacing — 8pt grid */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;
  --s-12: 48px; --s-16: 64px; --s-20: 80px; --s-24: 96px;

  /* Radii — web flat */
  --r-xs: 4px; --r-sm: 6px; --r-md: 8px; --r-lg: 12px;
  --r-xl: 16px; --r-2xl: 20px; --r-3xl: 24px; --r-pill: 999px;

  /* Elevation */
  --e-0: 0 0 0 1px var(--ink-hair);
  --e-1: 0 1px 2px rgba(15,17,21,0.04), 0 0 0 1px var(--ink-hair);
  --e-2: 0 4px 12px rgba(15,17,21,0.06), 0 0 0 1px var(--ink-hair);
  --e-3: 0 12px 32px rgba(15,17,21,0.10), 0 0 0 1px var(--ink-hair);
  --e-4: 0 24px 60px rgba(15,17,21,0.14), 0 0 0 1px var(--ink-hair);

  /* Motion */
  --ease: cubic-bezier(.4,0,.2,1);
  --d-1: 120ms; --d-2: 200ms; --d-3: 320ms;

  /* Grid */
  --grid-max: 1280px;
  --grid-cols: 12;
  --grid-gutter: 24px;
  --grid-margin: 80px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--surface);
  font-family: var(--font-sans);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  padding: 96px 80px 200px;
  background-image: radial-gradient(circle at 1px 1px, rgba(0,0,0,0.04) 1px, transparent 0);
  background-size: 16px 16px;
}

/* Top bar */
.ws-topbar {
  position: fixed; inset: 0 0 auto 0;
  height: 48px;
  background: #fff;
  border-bottom: 1px solid var(--ink-hair);
  display: flex; align-items: center;
  padding: 0 16px;
  gap: 16px;
  z-index: 100;
}
.ws-topbar__crumb { font-size: 12px; color: var(--ink-soft); display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.ws-topbar__product { color: var(--teal-700); font-weight: 600; letter-spacing: -0.1px; font-family: var(--font-display); font-size: 13px; }
.ws-topbar__crumb strong { color: var(--ink); font-weight: 500; letter-spacing: -0.1px; }
.ws-topbar__sep { color: var(--ink-faint); }
.ws-topbar__pages { display: flex; gap: 0; margin-left: auto; flex-wrap: nowrap; }
.ws-topbar__page {
  font-size: 11.5px; padding: 6px 8px; border-radius: 5px;
  color: var(--ink-soft); text-decoration: none; white-space: nowrap;
  letter-spacing: -0.1px;
}
.ws-topbar__page:hover { background: var(--ink-whisper); color: var(--ink); }
.ws-topbar__page--active { background: var(--teal-50); color: var(--teal-700); font-weight: 500; }

/* Page header */
.ws-pageheader { max-width: 1100px; margin-bottom: 64px; }
.ws-pageheader__eyebrow {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--teal-500);
  margin-bottom: 14px;
}
.ws-pageheader h1 {
  font-family: var(--font-display);
  font-size: var(--t-display); font-weight: 600;
  letter-spacing: -1.6px; line-height: 1.04;
  margin: 0 0 18px;
  color: var(--ink);
}
.ws-pageheader p {
  font-size: 19px; line-height: 1.55;
  color: var(--ink-soft); max-width: 720px; margin: 0;
}

/* Section */
.ws-section {
  margin: 96px 0 28px;
  padding-top: 28px;
  border-top: 1px solid var(--ink-hair);
  display: grid; grid-template-columns: 80px 1fr auto;
  align-items: baseline; gap: 24px;
}
.ws-section__num {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--ink-faint);
  letter-spacing: 1px;
}
.ws-section h2 {
  font-family: var(--font-display);
  font-size: 32px; font-weight: 600;
  letter-spacing: -0.8px; line-height: 1.05;
  margin: 0;
  color: var(--ink);
}
.ws-section__desc {
  font-size: 14px; color: var(--ink-soft);
  max-width: 460px; line-height: 1.5;
  text-align: right;
}

/* Spec frame */
.ws-frame {
  position: relative;
  background: var(--paper);
  border-radius: var(--r-lg);
  outline: 1px solid var(--teal-300);
  outline-offset: 0;
  margin: 32px 0;
  padding: 32px;
}
.ws-frame__chip {
  position: absolute;
  top: -22px; left: 0;
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.4px;
  color: var(--teal-700); font-weight: 500;
}
.ws-frame__chip .dim { color: var(--ink-faint); font-weight: 400; }

/* Spec table — token + value */
.ws-spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-family: var(--font-mono);
}
.ws-spec-table th {
  text-align: left;
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 10px 12px;
  border-bottom: 1px solid var(--ink-hair);
}
.ws-spec-table td {
  padding: 12px;
  border-bottom: 1px solid var(--ink-whisper);
  color: var(--ink-soft);
  vertical-align: top;
}
.ws-spec-table td:first-child { color: var(--ink); font-weight: 500; }
.ws-spec-table tr:last-child td { border-bottom: 0; }

/* Eyebrow + label */
.ws-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
}

.ws-callout {
  background: var(--teal-50);
  border-left: 3px solid var(--teal-500);
  padding: 16px 20px;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 16px 0;
}
.ws-callout strong { color: var(--ink); font-weight: 600; }

/* Footer */
.ws-foot {
  margin-top: 160px;
  padding-top: 32px;
  border-top: 1px solid var(--ink-hair);
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-faint); letter-spacing: 0.4px;
  display: flex; justify-content: space-between;
}

/* Component grid for variant displays */
.ws-grid {
  display: grid; gap: 24px;
}
.ws-grid--3 { grid-template-columns: repeat(3, 1fr); }
.ws-grid--4 { grid-template-columns: repeat(4, 1fr); }
.ws-grid--auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.ws-cell {
  display: flex; flex-direction: column;
  align-items: flex-start; gap: 14px;
  padding: 24px;
  background: var(--surface-warm);
  border-radius: var(--r-md);
  min-height: 120px;
  justify-content: center;
}
.ws-cell--center { align-items: center; justify-content: center; text-align: center; }
.ws-cell__label {
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--ink-faint);
  align-self: flex-start;
}
.ws-cell--dark { background: var(--ink-dark); color: #fff; }
.ws-cell--dark .ws-cell__label { color: rgba(255,255,255,0.5); }

/* Buttons (the canonical web set) */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  height: 40px;
  border-radius: var(--r-md);
  font-family: var(--font-sans);
  font-size: 14px; font-weight: 500;
  border: none; cursor: pointer;
  transition: all var(--d-1) var(--ease);
  white-space: nowrap;
}
.btn--lg { height: 48px; padding: 12px 20px; font-size: 15px; }
.btn--md { height: 40px; padding: 10px 16px; font-size: 14px; }
.btn--sm { height: 32px; padding: 6px 12px; font-size: 13px; }
.btn--xs { height: 24px; padding: 4px 10px; font-size: 12px; }

.btn--primary { background: var(--teal-500); color: #fff; }
.btn--primary:hover { background: var(--teal-700); }
.btn--secondary { background: var(--ink); color: #fff; }
.btn--secondary:hover { background: #2a2f37; }
.btn--ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink-hair); }
.btn--ghost:hover { background: var(--ink-whisper); }
.btn--text { background: transparent; color: var(--teal-700); padding-left: 8px; padding-right: 8px; }
.btn--text:hover { background: var(--teal-50); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { filter: brightness(0.9); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn--loading { position: relative; pointer-events: none; }
.btn--loading::after {
  content: ""; width: 14px; height: 14px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn--icon { width: 40px; padding: 0; justify-content: center; }
.btn--icon.btn--sm { width: 32px; }

/* Inputs */
.input {
  display: inline-flex; align-items: center;
  height: 40px; padding: 0 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--ink-hair);
  background: #fff;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink);
  width: 100%;
  transition: border-color var(--d-1) var(--ease), box-shadow var(--d-1) var(--ease);
}
.input::placeholder { color: var(--ink-faint); }
.input:hover { border-color: var(--ink-faint); }
.input:focus { outline: none; border-color: var(--teal-500); box-shadow: 0 0 0 3px rgba(0,133,124,0.15); }
.input--error { border-color: var(--danger); }
.input--error:focus { box-shadow: 0 0 0 3px rgba(196,0,31,0.15); }
.input--success { border-color: var(--success); }
.input[disabled] { background: var(--surface-warm); color: var(--ink-faint); cursor: not-allowed; }

label.field {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13px; font-weight: 500;
  color: var(--ink);
}
label.field .help { font-size: 12px; color: var(--ink-soft); font-weight: 400; }
label.field .err { font-size: 12px; color: var(--danger); font-weight: 500; }

/* Card */
.card {
  background: var(--paper);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--e-1);
}

/* Badge */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 11px; font-weight: 500;
  background: var(--ink-whisper);
  color: var(--ink-soft);
  font-family: var(--font-sans);
  height: 22px;
}
.badge--teal { background: var(--teal-50); color: var(--teal-700); }
.badge--success { background: rgba(0,112,60,0.1); color: var(--success); }
.badge--warning { background: rgba(244,161,0,0.12); color: #8a5a00; }
.badge--danger { background: rgba(196,0,31,0.1); color: var(--danger); }
.badge--solid { background: var(--ink); color: #fff; }
.badge--dot::before {
  content: ""; width: 6px; height: 6px;
  border-radius: 50%; background: currentColor;
}
