:root {
  color-scheme: light dark;
  --bg: #fdfdfe;            --bg: oklch(0.994 0.001 250);
  --surface: #ffffff;       --surface: oklch(1 0 0);
  --surface-2: #f4f6f8;     --surface-2: oklch(0.972 0.003 250);
  --surface-3: #ebedef;     --surface-3: oklch(0.945 0.004 250);
  --text: #1b1e22;          --text: oklch(0.235 0.009 250);
  --text-muted: #585e63;    --text-muted: oklch(0.478 0.011 250);
  --border: #dee0e2;        --border: oklch(0.905 0.004 250);
  --border-strong: #71777c; --border-strong: oklch(0.565 0.011 250);
  --accent: #0d7435;        --accent: oklch(0.490 0.130 150);
  --accent-hover: #006224;  --accent-hover: oklch(0.430 0.130 150);
  --accent-soft: #e7f7e9;   --accent-soft: oklch(0.960 0.025 150);
  --on-accent: #ffffff;     --on-accent: oklch(1 0 0);
  --focus: #0d7435;         --focus: oklch(0.490 0.130 150);

  --amber: #895a00;         --amber: oklch(0.505 0.110 75);
  --amber-soft: #fef2d9;    --amber-soft: oklch(0.965 0.035 85);

  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.04), 0 1px 3px -1px rgb(0 0 0 / 0.05);
  --shadow-2: 0 1px 2px rgb(0 0 0 / 0.05), 0 12px 32px -16px rgb(0 0 0 / 0.16);
  --shadow-3: 0 1px 1px rgb(0 0 0 / 0.03), 0 3px 8px -2px rgb(0 0 0 / 0.05), 0 14px 28px -10px rgb(0 0 0 / 0.09), 0 36px 72px -28px rgb(0 0 0 / 0.16);
  --edge-hi: inset 0 0 0 0 transparent;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1114;            --bg: oklch(0.178 0.006 250);
    --surface: #191b1e;       --surface: oklch(0.222 0.007 250);
    --surface-2: #0b0d0e;     --surface-2: oklch(0.156 0.005 250);
    --surface-3: #25282c;     --surface-3: oklch(0.275 0.008 250);
    --text: #ebedef;          --text: oklch(0.945 0.003 250);
    --text-muted: #a0a5aa;    --text-muted: oklch(0.720 0.009 250);
    --border: #2f3336;        --border: oklch(0.318 0.008 250);
    --border-strong: #60656b; --border-strong: oklch(0.505 0.011 250);
    --accent: #75d78d;        --accent: oklch(0.800 0.140 150);
    --accent-hover: #89eb9f;  --accent-hover: oklch(0.860 0.140 150);
    --accent-soft: #19301e;   --accent-soft: oklch(0.285 0.045 150);
    --on-accent: #0d160f;     --on-accent: oklch(0.190 0.020 150);
    --focus: #75d78d;         --focus: oklch(0.800 0.140 150);
    --amber: #f9c267;         --amber: oklch(0.845 0.125 78);
    --amber-soft: #422b0d;    --amber-soft: oklch(0.310 0.055 70);
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.30), 0 1px 3px -1px rgb(0 0 0 / 0.36);
    --shadow-2: 0 1px 2px rgb(0 0 0 / 0.34), 0 14px 34px -18px rgb(0 0 0 / 0.62);
    --shadow-3: 0 1px 1px rgb(0 0 0 / 0.42), 0 3px 8px -2px rgb(0 0 0 / 0.46), 0 14px 28px -10px rgb(0 0 0 / 0.52), 0 36px 72px -28px rgb(0 0 0 / 0.66);
    --edge-hi: inset 0 1px 0 rgb(255 255 255 / 0.06);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1114;            --bg: oklch(0.178 0.006 250);
  --surface: #191b1e;       --surface: oklch(0.222 0.007 250);
  --surface-2: #0b0d0e;     --surface-2: oklch(0.156 0.005 250);
  --surface-3: #25282c;     --surface-3: oklch(0.275 0.008 250);
  --text: #ebedef;          --text: oklch(0.945 0.003 250);
  --text-muted: #a0a5aa;    --text-muted: oklch(0.720 0.009 250);
  --border: #2f3336;        --border: oklch(0.318 0.008 250);
  --border-strong: #60656b; --border-strong: oklch(0.505 0.011 250);
  --accent: #75d78d;        --accent: oklch(0.800 0.140 150);
  --accent-hover: #89eb9f;  --accent-hover: oklch(0.860 0.140 150);
  --accent-soft: #19301e;   --accent-soft: oklch(0.285 0.045 150);
  --on-accent: #0d160f;     --on-accent: oklch(0.190 0.020 150);
  --focus: #75d78d;         --focus: oklch(0.800 0.140 150);
  --amber: #f9c267;         --amber: oklch(0.845 0.125 78);
  --amber-soft: #422b0d;    --amber-soft: oklch(0.310 0.055 70);
  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.30), 0 1px 3px -1px rgb(0 0 0 / 0.36);
  --shadow-2: 0 1px 2px rgb(0 0 0 / 0.34), 0 14px 34px -18px rgb(0 0 0 / 0.62);
  --shadow-3: 0 1px 1px rgb(0 0 0 / 0.42), 0 3px 8px -2px rgb(0 0 0 / 0.46), 0 14px 28px -10px rgb(0 0 0 / 0.52), 0 36px 72px -28px rgb(0 0 0 / 0.66);
  --edge-hi: inset 0 1px 0 rgb(255 255 255 / 0.06);
}

:root {

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --step--1: clamp(0.8125rem, 0.79rem + 0.12vw, 0.875rem);
  --step-0: clamp(1.0625rem, 1.036rem + 0.13vw, 1.125rem);
  --step-1: clamp(1.1875rem, 1.121rem + 0.33vw, 1.375rem);
  --step-2: clamp(1.3125rem, 1.156rem + 0.78vw, 1.75rem);
  --step-3: clamp(1.75rem, 1.482rem + 1.34vw, 2.5rem);
  --step-4: clamp(2.25rem, 1.714rem + 2.68vw, 3.75rem);

  --dur-1: 140ms; --dur-2: 240ms; --dur-3: 420ms; --dur-4: 720ms;
  --ease-out: cubic-bezier(0.2, 0, 0, 1);
  --ease-emph: cubic-bezier(0.3, 0, 0, 1);
  --ease-settle: cubic-bezier(0.16, 1, 0.3, 1);

  --r-1: 6px; --r-2: 10px; --r-3: 16px; --r-pill: 999px;

  --sp-1: 0.25rem; --sp-2: 0.5rem; --sp-3: 0.75rem; --sp-4: 1rem;
  --sp-5: 1.5rem;  --sp-6: 2rem;   --sp-7: 3rem;    --sp-8: 4rem;

  --gutter: clamp(1.25rem, 5vw, 2.5rem);
  --rhythm: clamp(4.5rem, 10vw, 8rem);
  --header-h: 4rem;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--border-strong) transparent;
}

body {
  margin: 0;
  overflow-x: clip;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--step-0);
  font-weight: 400;
  line-height: 1.6;
  font-optical-sizing: auto;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, p, figure, blockquote, ol, ul, dl, dd { margin: 0; }
ol[class], ul[class] { list-style: none; padding: 0; }
img, svg, picture, video, canvas { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; }
table { border-collapse: collapse; width: 100%; }

[id] { scroll-margin-top: calc(var(--header-h) + 1.5rem); }

::selection { background-color: var(--accent-soft); color: var(--text); }

h1, h2, h3, h4 {
  font-weight: 600;
  letter-spacing: -0.02em;
  text-wrap: balance;
  color: var(--text);
}

h1 { font-size: var(--step-4); line-height: 1.06; letter-spacing: -0.028em; }
h2 { font-size: var(--step-3); line-height: 1.14; }
h3 { font-size: var(--step-2); line-height: 1.22; }
h4 { font-size: var(--step-1); line-height: 1.3; letter-spacing: -0.01em; }

p { text-wrap: pretty; }
strong, b { font-weight: 600; }
small { font-size: var(--step--1); }

blockquote {
  border-left: 2px solid var(--border);
  padding-left: var(--sp-4);
  color: var(--text-muted);
}

.lead { font-size: var(--step-1); line-height: 1.5; color: var(--text-muted); }
.muted { color: var(--text-muted); }
.measure { max-width: 68ch; }

.eyebrow {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
}

.mono {
  font-family: var(--mono);
  font-size: 0.9em;
  font-variant-ligatures: none;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
  background-image:
    linear-gradient(var(--accent), var(--accent)),
    linear-gradient(var(--border-strong), var(--border-strong));
  background-repeat: no-repeat;
  background-position: 0 100%, 0 100%;
  background-size: 0% 1px, 100% 1px;
  padding-bottom: 0.08em;
  transition: background-size var(--dur-2) var(--ease-out), color var(--dur-1) var(--ease-out);
}

a:hover, a:focus-visible { color: var(--accent-hover); background-size: 100% 1px, 100% 1px; }

a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-1);
}

.container {
  width: 100%;
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--rhythm); }
.section--tight { padding-block: clamp(3rem, 7vw, 5rem); }
.section--alt { background-color: var(--surface-2); border-block: 1px solid var(--border); }

.hero { padding-block: clamp(4.5rem, 11vw, 8rem) clamp(3.5rem, 8vw, 6rem); }

.section-head { max-width: 60ch; }
.section-head > * + * { margin-top: var(--sp-4); }
.section-head .eyebrow + h2 { margin-top: var(--sp-3); }

.stack > * + * { margin-top: var(--stack-gap, 1rem); }

.grid-cards {
  display: grid;
  gap: clamp(1rem, 2.2vw, 1.5rem);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
  align-items: stretch;
}

.grid-2 { display: grid; gap: clamp(1.5rem, 4vw, 3rem); grid-template-columns: 1fr; }
@media (min-width: 52rem) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: hai-step;
  display: grid;
  gap: clamp(1.5rem, 3.5vw, 2.25rem);
}

.step {
  counter-increment: hai-step;
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  gap: var(--sp-2) var(--sp-4);
  align-items: start;
}

.step::before {
  content: counter(hai-step);
  grid-row: span 2;
  width: 2.25rem; height: 2.25rem;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background-color: var(--accent-soft);
  color: var(--accent);
  font-size: 0.9375rem; font-weight: 600; line-height: 1;
  font-variant-numeric: tabular-nums;
}

.step p { color: var(--text-muted); max-width: 62ch; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 2.75rem;
  padding: 0.625rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--r-2);
  background-color: transparent;
  background-image: none;
  color: var(--text);
  font-size: var(--step-0);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.005em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color var(--dur-1) var(--ease-out),
    border-color var(--dur-1) var(--ease-out),
    color var(--dur-1) var(--ease-out),
    box-shadow var(--dur-2) var(--ease-out),
    transform var(--dur-1) var(--ease-out);
}

.btn-sm { min-height: 2.75rem; padding: 0.5rem 0.875rem; font-size: var(--step--1); }

.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; color: var(--text); }

.btn-primary { background-color: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.btn-primary:hover,
.btn-primary:focus-visible {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--on-accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}

.btn-quiet { border-color: var(--border-strong); color: var(--text); }

.btn-quiet:hover,
.btn-quiet:focus-visible {
  background-color: var(--surface-2);
  border-color: var(--text-muted);
  color: var(--text);
  transform: translateY(-1px);
}

.btn:active { transform: translateY(0) scale(0.99); box-shadow: none; transition-duration: 80ms; }

.btn[aria-disabled="true"], .btn:disabled {
  cursor: default;
  pointer-events: none;
  transform: none;
  box-shadow: none;
}

.cta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-4); }
.cta-note { font-size: var(--step--1); line-height: 1.5; color: var(--text-muted); max-width: 46ch; }

.card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  padding: clamp(1.25rem, 2.4vw, 1.75rem);
  box-shadow: var(--shadow-1);
  transition: border-color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out);
}

.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.card p { color: var(--text-muted); }
.card-title { font-size: var(--step-1); font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.card-title + p { margin-top: var(--sp-3); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.3125rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background-color: var(--surface);
  color: var(--text);
  font-size: var(--step--1);
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
}

.pill--status::before {
  content: "";
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: var(--r-pill);
  background-color: var(--accent);
  animation: hai-pulse 2.8s var(--ease-out) 3;
}

@keyframes hai-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.pill--accent { background-color: var(--accent-soft); color: var(--accent); }
.pill--quiet { background-color: var(--surface-2); color: var(--text-muted); font-weight: 400; }

.pill--amber {
  background-color: var(--amber-soft);
  border-color: var(--border);
  border-color: color-mix(in srgb, var(--amber) 32%, transparent);
  color: var(--amber);
}

@media (max-width: 24rem) { .pill { white-space: normal; } }

.rule { display: block; width: 100%; height: 1px; border: 0; margin: 0; background-color: var(--border); }

.rule-label {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.rule-label::after { content: ""; flex: 1 1 auto; height: 1px; background-color: var(--border); }

.frame {
  position: relative;
  isolation: isolate;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 200;
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.625rem 1rem;
  border: 1px solid var(--accent);
  border-radius: var(--r-2);
  background-color: var(--accent);
  background-image: none;
  color: var(--on-accent);
  font-size: var(--step--1);
  font-weight: 600;
  box-shadow: var(--shadow-2);
  transform: translateY(-200%);
  transition: transform var(--dur-2) var(--ease-out);
}

.skip:focus, .skip:focus-visible { transform: translateY(0); color: var(--on-accent); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: transparent;
  border-bottom: 1px solid transparent;
  transition: background-color var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out);
}

.site-header.is-scrolled {
  background-color: var(--bg);
  background-color: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom-color: var(--border);
  box-shadow: var(--shadow-1);
}

.scroll-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background-color: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-2) var(--ease-out);
}

.site-header.is-scrolled .scroll-progress { opacity: 1; }

@media (scripting: none) {
  .site-header { background-color: var(--bg); border-bottom-color: var(--border); }
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  min-height: var(--header-h);
  padding-block: 0.75rem;
  transition: padding-block var(--dur-2) var(--ease-out);
}

.site-header.is-scrolled .header-inner { padding-block: 0.375rem; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 2.75rem;
  padding-bottom: 0;
  background-image: none;
  color: var(--text);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1;
}

.brand:hover, .brand:focus-visible { color: var(--text); }
.brand svg, .brand img { flex: none; width: 1.5rem; height: 1.5rem; color: var(--accent); }

a.brand:hover svg path { animation: hai-trace 640ms var(--ease-emph); }

@keyframes hai-trace {
  from { stroke-dasharray: 36; stroke-dashoffset: 36; }
  to   { stroke-dasharray: 36; stroke-dashoffset: 0; }
}

.site-footer {
  background-color: var(--surface-2);
  border-top: 1px solid var(--border);
  padding-block: clamp(2.5rem, 6vw, 4rem);
}

.footer-grid { display: grid; gap: var(--sp-6); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 48rem) {
  .footer-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr); }
}

.site-footer p { color: var(--text-muted); }
.site-footer ul { display: grid; gap: var(--sp-2); list-style: none; padding: 0; }

.site-footer li a,
.site-footer p a[href^="mailto:"] { display: inline-block; padding-block: 0.625rem; background-origin: content-box; }

.footer-fine {
  margin-top: var(--sp-6);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-5);
  font-size: var(--step--1);
  line-height: 1.6;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.reveal {
  transition: opacity var(--dur-3) var(--ease-out), transform 560ms var(--ease-settle);
}

@media (scripting: enabled) {
  .reveal { opacity: 0; transform: translateY(14px); }
  .reveal.is-visible { opacity: 1; transform: none; }

  .stagger > .reveal { transition-delay: calc(min(var(--i, 0), 6) * 60ms); }

  .section-head .reveal:nth-child(2) { transition-delay: 70ms; }
  .section-head .reveal:nth-child(3) { transition-delay: 150ms; }
}

@media print {
  :root, :root[data-theme="dark"] {
    color-scheme: light;
    --bg: #ffffff; --surface: #ffffff; --surface-2: #ffffff; --surface-3: #f5f6f7;
    --text: #2b2f33; --text-muted: #66707a;
    --border: #e3e6e9; --border-strong: #7f8993;
    --accent: #10715a; --accent-hover: #0b5c49; --accent-soft: #e8f4ef; --on-accent: #ffffff;
    --amber: #7a5200; --amber-soft: #fdf3dc;
    --shadow-1: none; --shadow-2: none; --shadow-3: none; --edge-hi: none;
  }

  body { background-color: var(--bg); color: var(--text); font-size: 11pt; line-height: 1.45; }

  .site-header {
    position: static;
    background-color: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-bottom: 1px solid var(--border);
  }

  .skip, .scroll-progress { display: none; }
  .section, .hero { padding-block: 1.5rem; }
  .reveal,
  .hero-copy > *,
  .hero-figure,
  .prev-panel { opacity: 1; transform: none; transition: none; animation: none; }
  .card, .frame, .step, .hero-viz { break-inside: avoid; box-shadow: none; }
  a { color: var(--text); background-image: none; text-decoration: underline; }
  a[href^="http"]::after, a[href^="mailto:"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: var(--text-muted);
    word-break: break-all;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur-1: 0ms; --dur-2: 0ms; --dur-3: 0ms; --dur-4: 0ms; }

  html { scroll-behavior: auto !important; }

  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .reveal, .reveal.is-visible, .stagger > .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}
