:root {
  color-scheme: light dark;
  --font-sans: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 12px;
  --green: #2da44e;
  --red: #cf222e;
  --amber: #9a6700;
  --accent: #0969da;
  --bg: #f6f8fa;
  --bg-elevated: #ffffff;
  --panel: #ffffff;
  --panel-muted: #f6f8fa;
  --border: #d0d7de;
  --border-strong: #afb8c1;
  --text: #1f2328;
  --muted: #656d76;
  --nav-bg: rgba(246, 248, 250, 0.92);
  --shadow: 0 12px 40px rgba(31, 35, 40, 0.08);
  --term-bar: #eaeef2;
  --code-bg: rgba(175, 184, 193, 0.2);
  --btn-primary-fg: #ffffff;
  --caveat-bg: rgba(207, 34, 46, 0.08);
  --dot-glow: rgba(45, 164, 78, 0.25);
  --featured-glow: rgba(9, 105, 218, 0.2);
  --hero-glow: radial-gradient(ellipse 80% 60% at 70% 0%, rgba(9, 105, 218, 0.08), transparent 60%);
  --skip-fg: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --green: #3fb950;
    --red: #f85149;
    --amber: #d29922;
    --accent: #58a6ff;
    --bg: #0b0e14;
    --bg-elevated: #0e131c;
    --panel: #121722;
    --panel-muted: #0e131c;
    --border: #232b3a;
    --border-strong: #3a4458;
    --text: #d8dee9;
    --muted: #8b96ab;
    --nav-bg: rgba(11, 14, 20, 0.92);
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    --term-bar: #0e131c;
    --code-bg: rgba(255, 255, 255, 0.06);
    --btn-primary-fg: #0b0e14;
    --caveat-bg: rgba(248, 81, 73, 0.1);
    --dot-glow: rgba(63, 185, 80, 0.2);
    --featured-glow: rgba(88, 166, 255, 0.25);
    --hero-glow: radial-gradient(ellipse 80% 60% at 70% 0%, rgba(88, 166, 255, 0.1), transparent 60%);
    --skip-fg: #0b0e14;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --green: #3fb950;
  --red: #f85149;
  --amber: #d29922;
  --accent: #58a6ff;
  --bg: #0b0e14;
  --bg-elevated: #0e131c;
  --panel: #121722;
  --panel-muted: #0e131c;
  --border: #232b3a;
  --border-strong: #3a4458;
  --text: #d8dee9;
  --muted: #8b96ab;
  --nav-bg: rgba(11, 14, 20, 0.92);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  --term-bar: #0e131c;
  --code-bg: rgba(255, 255, 255, 0.06);
  --btn-primary-fg: #0b0e14;
  --caveat-bg: rgba(248, 81, 73, 0.1);
  --dot-glow: rgba(63, 185, 80, 0.2);
  --featured-glow: rgba(88, 166, 255, 0.25);
  --hero-glow: radial-gradient(ellipse 80% 60% at 70% 0%, rgba(88, 166, 255, 0.1), transparent 60%);
  --skip-fg: #0b0e14;
}

:root[data-theme="light"] {
  color-scheme: light;
  --green: #2da44e;
  --red: #cf222e;
  --amber: #9a6700;
  --accent: #0969da;
  --bg: #f6f8fa;
  --bg-elevated: #ffffff;
  --panel: #ffffff;
  --panel-muted: #f6f8fa;
  --border: #d0d7de;
  --border-strong: #afb8c1;
  --text: #1f2328;
  --muted: #656d76;
  --nav-bg: rgba(246, 248, 250, 0.92);
  --shadow: 0 12px 40px rgba(31, 35, 40, 0.08);
  --term-bar: #eaeef2;
  --code-bg: rgba(175, 184, 193, 0.2);
  --btn-primary-fg: #ffffff;
  --caveat-bg: rgba(207, 34, 46, 0.08);
  --dot-glow: rgba(45, 164, 78, 0.25);
  --featured-glow: rgba(9, 105, 218, 0.2);
  --hero-glow: radial-gradient(ellipse 80% 60% at 70% 0%, rgba(9, 105, 218, 0.08), transparent 60%);
  --skip-fg: #ffffff;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  max-width: 100%;
  overflow-x: clip;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: clip;
  background-image: var(--hero-glow);
  background-repeat: no-repeat;
}
img, svg, video, canvas { max-width: 100%; height: auto; }

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 16px;
  top: 16px;
  z-index: 99;
  background: var(--accent);
  color: var(--skip-fg);
  padding: 8px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
}

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
  min-width: 0;
}

/* Nav */
nav {
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  position: sticky;
  top: 0;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 20;
}
.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.logo {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.6px;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}
.nav-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
}
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}
.nav-links a:hover { color: var(--text); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

nav a.cta {
  background: var(--accent);
  color: var(--btn-primary-fg);
  padding: 8px 14px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}
nav a.cta:hover { filter: brightness(1.05); }

.theme-toggle,
.nav-toggle {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s;
}
.theme-toggle:hover,
.nav-toggle:hover {
  border-color: var(--border-strong);
  background: var(--panel-muted);
}
.theme-toggle:focus-visible,
.nav-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.theme-toggle svg,
.nav-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

.nav-toggle { display: none; }
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-menu { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }

.nav-drawer {
  display: none;
}

/* Hero */
.hero { padding: 72px 0 56px; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 40px;
  align-items: center;
  min-width: 0;
}
.hero-copy,
.hero-visual {
  min-width: 0;
  max-width: 100%;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 18px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  background: var(--panel);
}
.badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--dot-glow);
}
.hero h1 {
  font-size: clamp(26px, 4.5vw, 40px);
  font-weight: 800;
  letter-spacing: -0.4px;
  line-height: 1.15;
  margin-bottom: 16px;
  overflow-wrap: anywhere;
}
.lede {
  color: var(--muted);
  font-size: 17px;
  max-width: 520px;
  margin-bottom: 28px;
  overflow-wrap: anywhere;
}
.btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.btn {
  padding: 12px 22px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  font-size: 15px;
  display: inline-block;
  transition: filter 0.15s, background 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: var(--btn-primary-fg);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-secondary {
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--panel);
}
.btn-secondary:hover { border-color: var(--border-strong); }

.term {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  max-width: 100%;
}
.term-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--term-bar);
  min-width: 0;
}
.term-dots { display: flex; gap: 6px; flex-shrink: 0; }
.term-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-strong);
  display: block;
}
.term-dots i:nth-child(1) { background: var(--red); }
.term-dots i:nth-child(2) { background: var(--amber); }
.term-dots i:nth-child(3) { background: var(--green); }
.term-title {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.term-body {
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  overflow-x: auto;
  margin: 0;
  -webkit-overflow-scrolling: touch;
}
.term-body .t { color: var(--muted); }
.term-body .ok { color: var(--green); font-weight: 700; }
.term-body .bad { color: var(--red); font-weight: 700; }
.term-body .muted { color: var(--muted); }

/* Sections */
section {
  padding: 64px 0;
  border-top: 1px solid var(--border);
}
section h2 {
  font-size: clamp(22px, 3vw, 26px);
  margin-bottom: 10px;
}
section p.lead {
  color: var(--muted);
  max-width: 640px;
  margin-bottom: 32px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.card.quiet { background: transparent; }
.card .icon {
  font-size: 20px;
  margin-bottom: 10px;
  color: var(--accent);
}
.card h3 { font-size: 16px; margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 14px; }

.tiers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.tier {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
}
.tier.featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--featured-glow);
}
.tier .name {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  font-weight: 700;
}
.tier .name.watch { color: var(--accent); }
.tier .name.guard { color: var(--amber); }
.tier .name.fortress { color: var(--red); }
.tier h3 { font-size: 20px; margin-bottom: 14px; }
.tier ul { list-style: none; }
.tier li {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 10px;
  padding-left: 20px;
  position: relative;
}
.tier li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--green);
}
.tier .caveat {
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--caveat-bg);
  border-radius: 6px;
  font-size: 12px;
  color: var(--red);
}

code {
  font-family: var(--font-mono);
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12.5px;
  word-break: break-word;
}

.access-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 20px;
  margin-bottom: 24px;
}
.access-panel > div {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.access-panel h3 { margin-bottom: 8px; }
.access-panel p {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 16px;
}
.facts ul { list-style: none; }
.facts li {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 10px;
}
.snippet {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  font-size: 13px;
  color: var(--muted);
  font-family: var(--font-mono);
  -webkit-overflow-scrolling: touch;
}

footer {
  padding: 40px 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}
.footer-inner p { margin-bottom: 8px; }
.footer-inner a { color: var(--accent); }
.fine { opacity: 0.85; }

/* Tablet */
@media (max-width: 900px) {
  .hero-grid,
  .tiers,
  .grid-3,
  .grid-2,
  .access-panel {
    grid-template-columns: 1fr;
  }
  .hero { padding: 48px 0 36px; }
  section { padding: 48px 0; }
}

/* Mobile nav + small screens */
@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .nav-links { display: none; }
  .nav-toggle { display: inline-flex; }
  nav a.cta { display: none; }

  .nav-drawer {
    display: none;
    border-top: 1px solid var(--border);
    background: var(--bg-elevated);
    padding: 12px 16px 16px;
    width: 100%;
    max-width: 100%;
  }
  .nav-drawer.open { display: block; }
  .nav-drawer[hidden] { display: none !important; }
  .nav-drawer a {
    display: block;
    padding: 12px 8px;
    color: var(--text);
    text-decoration: none;
    font-size: 15px;
    border-radius: 6px;
  }
  .nav-drawer a:hover { background: var(--panel-muted); }
  .nav-drawer a.cta {
    display: block;
    text-align: center;
    background: var(--accent);
    color: var(--btn-primary-fg);
    font-weight: 600;
    margin-top: 8px;
    padding: 12px;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
  .hero h1 {
    font-size: clamp(22px, 6.5vw, 30px);
    overflow-wrap: break-word;
    word-break: normal;
  }
  .lede { font-size: 16px; margin-bottom: 22px; max-width: 100%; }
  .btn { width: 100%; text-align: center; box-sizing: border-box; }
  .btn-row { flex-direction: column; width: 100%; }
  .term { width: 100%; }
  .term-body {
    font-size: 11px;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    overflow-x: hidden;
  }
  .snippet {
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: hidden;
  }
  .access-panel .btn { width: 100%; text-align: center; word-break: break-word; }
  .badge { max-width: 100%; white-space: normal; }
}

@media (max-width: 380px) {
  .logo { font-size: 16px; }
  .theme-toggle,
  .nav-toggle {
    width: 36px;
    height: 36px;
  }
}

/* EAP pages */
.page-hero {
  padding: 56px 0 72px;
}
.narrow {
  max-width: 680px;
}
.form-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-top: 8px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.field abbr {
  text-decoration: none;
  color: var(--red);
}
.field-full { grid-column: 1 / -1; }
.field input,
.field select,
.field textarea {
  appearance: none;
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  font-size: 15px;
}
.field textarea {
  resize: vertical;
  min-height: 96px;
  line-height: 1.45;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.45;
}
.check input {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--accent);
}
.form-actions {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}
.form-actions .btn {
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.form-actions .btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.form-hint {
  font-size: 13px;
  color: var(--muted);
  min-height: 1.2em;
}
.success-panel h2 { margin-bottom: 8px; }
.mono-id {
  margin: 16px 0 20px;
  font-size: 14px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.next-steps {
  margin: 0 0 20px 18px;
  color: var(--muted);
  font-size: 14px;
}
.next-steps li { margin-bottom: 10px; }

@media (max-width: 760px) {
  .page-hero { padding: 36px 0 48px; }
  .form-panel { padding: 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-actions .btn { width: 100%; text-align: center; }
}


/* Form feedback (overnight cycle 1) */
.field-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted, #8b949e);
}
.form-hint.form-error {
  color: var(--danger, #f85149);
  font-weight: 500;
}
