/* =========================================================================
   ZKCAP-X · V2 · HTML PRODUCT RUNTIME
   foundation.css — tokens, palette, typography, spacing, containers, motion
   Layer 1 of 5. Loaded first. No product-specific selectors here.
   ========================================================================= */

:root {
  /* --- Institutional palette -------------------------------------------- */
  --navy-950: #050D18;
  --navy-900: #081426;
  --navy-850: #0B1B31;
  --navy-800: #0E2140;
  --navy-700: #143052;
  --navy-600: #1C3F68;
  --navy-500: #27527F;

  --ink-900: #0C1014;
  --ink-800: #1A2026;
  --ink-700: #2E373F;
  --ink-600: #47525C;
  --ink-500: #63707B;
  --ink-400: #8A95A0;
  --ink-300: #AEB7C0;

  --paper-50: #FCFAF6;
  --paper-100: #F7F3EC;
  --paper-200: #F0EADE;
  --paper-300: #E5DCCB;
  --paper-400: #D6CAB2;
  --paper-500: #C3B393;

  --line-100: #E7E0D2;
  --line-200: #D8CEBA;
  --line-300: #C4B79E;
  --line-400: #A99A7C;

  --blue-700: #164A78;
  --blue-600: #1F5E92;
  --blue-500: #2C76AF;
  --blue-200: #BCD5E8;
  --blue-100: #E1ECF5;
  --blue-50: #F0F6FB;

  --gilt-700: #7E5F2A;
  --gilt-600: #9A7738;
  --gilt-500: #B08D4E;
  --gilt-300: #D9C08C;
  --gilt-100: #F1E7D3;
  --gilt-50: #F8F2E6;

  --green-700: #235C42;
  --green-600: #2F7554;
  --green-100: #E0EFE6;

  --amber-700: #8A5D12;
  --amber-600: #A8741B;
  --amber-100: #F7ECD6;

  --red-700: #7E3227;
  --red-600: #9C4032;
  --red-100: #F6E2DE;

  /* --- Semantic --------------------------------------------------------- */
  --bg: var(--paper-100);
  --bg-raised: #FFFDFA;
  --bg-sunken: var(--paper-200);
  --bg-inverse: var(--navy-900);
  --fg: var(--ink-900);
  --fg-muted: var(--ink-500);
  --fg-faint: var(--ink-400);
  --fg-inverse: #F4F1EA;
  --fg-inverse-muted: #9FB0C4;
  --rule: var(--line-200);
  --rule-soft: var(--line-100);
  --rule-strong: var(--line-300);
  --accent: var(--blue-600);
  --accent-ink: var(--blue-700);
  --punctuation: var(--gilt-500);

  /* --- Type ------------------------------------------------------------- */
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
    "Hoefler Text", Georgia, "Times New Roman", serif;
  --font-text: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, "Roboto Mono",
    "Courier New", monospace;

  --fs-display: clamp(2.35rem, 1.55rem + 2.5cqw, 4.05rem);
  --fs-h1: clamp(1.95rem, 1.5rem + 1.5cqw, 2.95rem);
  --fs-h2: clamp(1.52rem, 1.24rem + 1cqw, 2.05rem);
  --fs-h3: clamp(1.24rem, 1.06rem + 0.7cqw, 1.6rem);
  --fs-h4: clamp(1.05rem, 0.98rem + 0.35cqw, 1.22rem);
  --fs-lead: clamp(1.02rem, 0.95rem + 0.42cqw, 1.24rem);
  --fs-body: 1rem;
  --fs-sm: 0.9rem;
  --fs-xs: 0.8125rem;
  --fs-2xs: 0.72rem;
  --fs-mono-label: 0.7rem;

  --lh-tight: 1.06;
  --lh-snug: 1.2;
  --lh-body: 1.62;
  --lh-relaxed: 1.75;

  --tracking-label: 0.16em;
  --tracking-display: -0.018em;

  /* --- Space ------------------------------------------------------------ */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 44px;
  --s-8: 60px;
  --s-9: 84px;
  --s-10: 120px;

  --section-y: clamp(52px, 4.2cqw + 34px, 104px);
  --section-y-lg: clamp(64px, 5.4cqw + 40px, 132px);
  --block-gap: clamp(20px, 1.6cqw + 12px, 34px);

  /* --- Structure -------------------------------------------------------- */
  --container: 1264px;
  --container-narrow: 940px;
  --container-reading: 720px;
  --gutter: clamp(18px, 3.2cqw, 52px);

  --radius-xs: 2px;
  --radius-sm: 3px;
  --radius-md: 5px;
  --radius-lg: 8px;
  --radius-pill: 999px;

  --shadow-1: 0 1px 2px rgba(8, 20, 38, 0.06), 0 1px 1px rgba(8, 20, 38, 0.04);
  --shadow-2: 0 6px 22px -12px rgba(8, 20, 38, 0.28), 0 1px 2px rgba(8, 20, 38, 0.05);
  --shadow-3: 0 24px 60px -28px rgba(8, 20, 38, 0.4), 0 2px 6px rgba(8, 20, 38, 0.06);
  --shadow-4: 0 40px 90px -40px rgba(8, 20, 38, 0.5);
  --inset-hairline: inset 0 0 0 1px rgba(12, 16, 20, 0.06);

  /* --- Motion ----------------------------------------------------------- */
  --ease-out: cubic-bezier(0.22, 0.8, 0.3, 1);
  --ease-in-out: cubic-bezier(0.6, 0.02, 0.24, 1);
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 320ms;
  --dur-4: 520ms;

  --focus-ring: 0 0 0 2px var(--paper-50), 0 0 0 4px var(--blue-500);
  --focus-ring-dark: 0 0 0 2px var(--navy-900), 0 0 0 4px var(--gilt-300);
}

/* =========================================================================
   Reset
   ========================================================================= */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg-sunken);
  color: var(--fg);
  font-family: var(--font-text);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5,
p,
figure,
blockquote,
dl,
dd,
ol,
ul {
  margin: 0;
}

ol,
ul {
  padding: 0;
  list-style: none;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  margin: 0;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

a {
  color: inherit;
  text-decoration: none;
}

table {
  border-collapse: collapse;
  width: 100%;
}

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 0;
}

::selection {
  background: var(--navy-700);
  color: var(--fg-inverse);
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

:where(a, button, [role="button"]):focus:not(:focus-visible) {
  outline: none;
}

/* =========================================================================
   Typography primitives
   ========================================================================= */

.t-display,
.t-h1,
.t-h2,
.t-h3 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: var(--tracking-display);
  color: var(--fg);
  text-wrap: balance;
}

.t-display {
  font-size: var(--fs-display);
  line-height: var(--lh-tight);
}
.t-h1 {
  font-size: var(--fs-h1);
  line-height: 1.12;
}
.t-h2 {
  font-size: var(--fs-h2);
  line-height: 1.16;
}
.t-h3 {
  font-size: var(--fs-h3);
  line-height: 1.24;
}

.t-h4,
.t-sans-h {
  font-family: var(--font-text);
  font-size: var(--fs-h4);
  font-weight: 600;
  line-height: 1.32;
  letter-spacing: -0.005em;
}

.t-lead {
  font-size: var(--fs-lead);
  line-height: var(--lh-relaxed);
  color: var(--ink-600);
  text-wrap: pretty;
}

.t-body {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink-700);
  text-wrap: pretty;
}

.t-sm {
  font-size: var(--fs-sm);
  line-height: 1.55;
  color: var(--ink-600);
}

.t-xs {
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: var(--ink-500);
}

.t-muted {
  color: var(--fg-muted);
}

/* Mono micro-label: metadata, jurisdiction codes, technical chips */
.t-label {
  font-family: var(--font-mono);
  font-size: var(--fs-mono-label);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  font-weight: 500;
  color: var(--ink-500);
  line-height: 1;
}

.t-label--gilt {
  color: var(--gilt-600);
}
.t-label--blue {
  color: var(--blue-600);
}
.t-label--inverse {
  color: var(--gilt-300);
}

.t-mono {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}

.t-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.t-link {
  color: var(--accent-ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--blue-600) 38%, transparent);
  transition: text-decoration-color var(--dur-1) var(--ease-out);
}
.t-link:hover {
  text-decoration-color: var(--blue-600);
}

.t-serif-em {
  font-family: var(--font-display);
  font-style: italic;
  letter-spacing: 0;
}

.measure {
  max-width: 62ch;
}
.measure-narrow {
  max-width: 50ch;
}
.measure-reading {
  max-width: var(--container-reading);
}

/* =========================================================================
   Layout primitives
   ========================================================================= */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow {
  max-width: var(--container-narrow);
}
.container--reading {
  max-width: calc(var(--container-reading) + var(--gutter) * 2);
}
.container--flush {
  padding-inline: 0;
}

.section {
  padding-block: var(--section-y);
}
.section--lg {
  padding-block: var(--section-y-lg);
}
.section--tight {
  padding-block: calc(var(--section-y) * 0.62);
}
.section--none {
  padding-block: 0;
}

.stack > * + * {
  margin-top: var(--flow, var(--s-4));
}
.stack-1 { --flow: var(--s-1); }
.stack-2 { --flow: var(--s-2); }
.stack-3 { --flow: var(--s-3); }
.stack-4 { --flow: var(--s-4); }
.stack-5 { --flow: var(--s-5); }
.stack-6 { --flow: var(--s-6); }
.stack-7 { --flow: var(--s-7); }
.stack-8 { --flow: var(--s-8); }

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap, var(--s-3));
  align-items: var(--cluster-y, center);
}
.cluster--between { justify-content: space-between; }
.cluster--end { justify-content: flex-end; }
.cluster--top { --cluster-y: flex-start; }
.cluster--baseline { --cluster-y: baseline; }

.grid {
  display: grid;
  gap: var(--grid-gap, var(--s-5));
}
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--auto {
  grid-template-columns: repeat(auto-fill, minmax(min(var(--min, 260px), 100%), 1fr));
}

.rule {
  height: 1px;
  background: var(--rule);
  border: 0;
}
.rule--soft { background: var(--rule-soft); }
.rule--gilt {
  height: 2px;
  width: 40px;
  background: var(--gilt-500);
  border: 0;
}
.rule--ink {
  height: 2px;
  width: 56px;
  background: var(--navy-800);
  border: 0;
}

.hr-inverse {
  height: 1px;
  background: rgba(244, 241, 234, 0.14);
  border: 0;
}

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

.skip-link {
  position: absolute;
  left: var(--s-4);
  top: -60px;
  z-index: 300;
  background: var(--navy-900);
  color: var(--fg-inverse);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  transition: top var(--dur-2) var(--ease-out);
}
.skip-link:focus {
  top: var(--s-4);
}

/* =========================================================================
   Inverse (navy) context
   ========================================================================= */

.on-navy {
  background: var(--navy-900);
  color: var(--fg-inverse);
  --fg: #F4F1EA;
  --fg-muted: var(--fg-inverse-muted);
  --fg-faint: #7A8DA3;
  --rule: rgba(244, 241, 234, 0.16);
  --rule-soft: rgba(244, 241, 234, 0.09);
  --rule-strong: rgba(244, 241, 234, 0.3);
  --bg-raised: rgba(255, 255, 255, 0.03);
  --bg-sunken: rgba(0, 0, 0, 0.16);
  --ink-600: #C3CFDB;
  --ink-500: #9FB0C4;
  --ink-400: #7A8DA3;
  --ink-700: #D7E0E9;
  --accent: var(--gilt-300);
  --accent-ink: var(--gilt-300);
  --t-label-color: var(--gilt-300);
}

.on-navy .t-body,
.on-navy .t-lead,
.on-navy .t-sm,
.on-navy .t-xs {
  color: var(--ink-500);
}
.on-navy .t-display,
.on-navy .t-h1,
.on-navy .t-h2,
.on-navy .t-h3,
.on-navy .t-h4 {
  color: #F7F5F0;
}
.on-navy .t-label {
  color: var(--gilt-300);
}
.on-navy .t-link {
  color: var(--gilt-300);
  text-decoration-color: rgba(217, 192, 140, 0.4);
}

.on-navy-deep {
  background: var(--navy-950);
  color: var(--fg-inverse);
}

.on-sunken {
  background: var(--bg-sunken);
}
.on-raised {
  background: var(--bg-raised);
}
.on-paper {
  background: var(--paper-50);
}
.on-ink {
  background: var(--navy-800);
  color: var(--fg-inverse);
}

/* =========================================================================
   Micro motion
   ========================================================================= */

@keyframes fade-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes draw-in {
  from { stroke-dashoffset: var(--dash, 400); }
  to { stroke-dashoffset: 0; }
}
@keyframes sweep {
  from { transform: translateX(-120%); }
  to { transform: translateX(320%); }
}
@keyframes pulse-node {
  0%, 100% { opacity: 0.28; }
  50% { opacity: 0.85; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.anim-rise {
  animation: fade-rise var(--dur-4) var(--ease-out) both;
}
.anim-fade {
  animation: fade-in var(--dur-3) var(--ease-out) both;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

.print-only {
  display: none;
}
