/* ============================================================================
   ZKCAP-X · ui-next/v3 · FOUNDATION
   Layer 1 — design tokens, typography, spacing, layout, structure, motion.

   Art direction: Editorial Institutional Fintech.
   Deep institutional navy · warm paper · ink · restrained blue · sparse gilt.
   Gilt is punctuation, never a surface.
   ========================================================================== */

:root {
  /* --- Institutional navy (structure, headers, dark bands) --- */
  --navy-1000: #050c17;
  --navy-950: #071120;
  --navy-900: #0a1728;
  --navy-850: #0d1d33;
  --navy-800: #12253e;
  --navy-700: #1a3352;
  --navy-600: #24456b;
  --navy-500: #335b87;

  /* --- Paper (warm, printed-document family) --- */
  --paper-000: #ffffff;
  --paper-050: #faf8f4;
  --paper-100: #f4f1ea;
  --paper-150: #ece7dd;
  --paper-200: #e2dbcd;
  --paper-300: #d2c9b7;

  /* --- Ink --- */
  --ink-900: #0d1622;
  --ink-800: #172433;
  --ink-700: #33465c;
  --ink-600: #4c6076;
  --ink-500: #5c6f85;
  --ink-400: #6d7f93;
  --ink-300: #9aa8b6;

  /* --- Restrained blue (interactive / links) --- */
  --blue-700: #17406b;
  --blue-600: #1e4f80;
  --blue-500: #2a6299;
  --blue-300: #a8c2dc;
  --blue-100: #e8eff7;

  /* --- Gilt (punctuation: rules, numerals, marks) --- */
  --gilt-700: #7a5f1c;
  --gilt-600: #96771f;
  --gilt-500: #b08a3e;
  --gilt-400: #c6a866;
  --gilt-300: #dcc794;
  --gilt-200: #efe4c8;

  /* --- Signal (muted, institutional) --- */
  --ok: #1c6b4d;
  --ok-bg: #e9f2ed;
  --ok-line: #bdd7ca;
  --warn: #8a6410;
  --warn-bg: #f9f1dd;
  --warn-line: #e4d0a2;
  --info: #274a78;
  --info-bg: #ecf1f8;
  --info-line: #c4d1e4;
  --stop: #8a3030;
  --stop-bg: #f9eaea;
  --stop-line: #e3c4c4;
  --mute: #5a6474;
  --mute-bg: #eff1f3;
  --mute-line: #d5dae0;

  /* --- Lines --- */
  --line: rgba(13, 22, 34, 0.14);
  --line-soft: rgba(13, 22, 34, 0.075);
  --line-strong: rgba(13, 22, 34, 0.28);
  --line-invert: rgba(250, 248, 244, 0.18);
  --line-invert-soft: rgba(250, 248, 244, 0.085);

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

  /* Display sizes are confident but not poster-scale: service pages must stay
     usable. */
  --fs-d1: clamp(2.25rem, 4.1vw, 3.35rem);
  --fs-d2: clamp(1.85rem, 2.9vw, 2.5rem);
  --fs-d3: clamp(1.45rem, 2.1vw, 1.85rem);
  --fs-t1: 1.375rem;
  --fs-t2: 1.125rem;
  --fs-t3: 1rem;
  --fs-lead: 1.0625rem;
  --fs-body: 0.9375rem;
  --fs-sm: 0.875rem;
  --fs-micro: 0.8125rem;
  --fs-label: 0.6875rem;
  --fs-label-xs: 0.625rem;

  --lh-tight: 1.1;
  --lh-snug: 1.22;
  --lh-title: 1.3;
  --lh-body: 1.62;
  --lh-loose: 1.72;

  --ls-eyebrow: 0.15em;
  --ls-label: 0.09em;
  --ls-tight: -0.012em;

  /* --- Space --- */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.25rem;
  --s-6: 1.5rem;
  --s-7: 1.75rem;
  --s-8: 2rem;
  --s-10: 2.5rem;
  --s-12: 3rem;
  --s-16: 4rem;
  --s-20: 5rem;
  --s-24: 6rem;
  --s-32: 8rem;

  /* --- Structure --- */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-pill: 999px;

  --shadow-lift: 0 1px 2px rgba(7, 17, 32, 0.05), 0 10px 26px -16px rgba(7, 17, 32, 0.3);
  --shadow-panel: 0 30px 80px -34px rgba(5, 12, 23, 0.5), 0 2px 8px rgba(5, 12, 23, 0.1);

  --measure-narrow: 44ch;
  --measure: 64ch;
  --measure-wide: 80ch;

  --shell: 1320px;
  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --nav-h: 74px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur-fast: 110ms;
  --dur: 200ms;

  --z-nav: 60;
  --z-mega: 70;
  --z-overlay: 90;
  --z-lab: 130;
  --z-toast: 170;
}

/* ---------------------------------------------------------------------------
   RESET / BASE
   ------------------------------------------------------------------------ */

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

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

body {
  margin: 0;
  background: var(--navy-1000);
  color: var(--ink-800);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

button {
  cursor: pointer;
}

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

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

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

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

:focus-visible {
  outline: 2px solid var(--gilt-500);
  outline-offset: 2px;
}

::selection {
  background: var(--gilt-200);
  color: var(--ink-900);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -80px;
  left: var(--s-4);
  z-index: var(--z-toast);
  background: var(--paper-050);
  border: 1px solid var(--line-strong);
  padding: var(--s-3) var(--s-4);
  font-size: var(--fs-sm);
}

.skip-link:focus {
  top: var(--s-4);
}

/* ---------------------------------------------------------------------------
   TYPE PRIMITIVES
   ------------------------------------------------------------------------ */

.d1,
.d2,
.d3 {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--ink-900);
  letter-spacing: var(--ls-tight);
  text-wrap: balance;
}

.d1 { font-size: var(--fs-d1); line-height: var(--lh-tight); }
.d2 { font-size: var(--fs-d2); line-height: var(--lh-snug); }
.d3 { font-size: var(--fs-d3); line-height: var(--lh-title); }

.t1 { font-family: var(--font-display); font-size: var(--fs-t1); line-height: var(--lh-title); font-weight: 400; color: var(--ink-900); }
.t2 { font-family: var(--font-display); font-size: var(--fs-t2); line-height: var(--lh-title); font-weight: 400; color: var(--ink-900); }
.t3 { font-size: var(--fs-t3); font-weight: 600; line-height: 1.38; color: var(--ink-900); }

.lead { font-size: var(--fs-lead); line-height: var(--lh-loose); color: var(--ink-700); }
.body { font-size: var(--fs-body); line-height: var(--lh-body); color: var(--ink-700); }
.sm { font-size: var(--fs-sm); line-height: 1.56; color: var(--ink-600); }
.micro { font-size: var(--fs-micro); line-height: 1.5; color: var(--ink-600); }

.eyebrow {
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--gilt-700);
}

.label {
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--ink-500);
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.01em;
}

.numeral {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--gilt-600);
}

.strong { font-weight: 600; color: var(--ink-900); }
.quiet { color: var(--ink-500); }

.measure { max-width: var(--measure); }
.measure-narrow { max-width: var(--measure-narrow); }
.measure-wide { max-width: var(--measure-wide); }

/* Dark-band type inheritance */
.on-dark .d1,
.on-dark .d2,
.on-dark .d3,
.on-dark .t1,
.on-dark .t2,
.on-dark .t3 { color: var(--paper-050); }
.on-dark .lead,
.on-dark .body { color: rgba(250, 248, 244, 0.76); }
.on-dark .sm,
.on-dark .micro { color: rgba(250, 248, 244, 0.66); }
.on-dark .label { color: rgba(250, 248, 244, 0.55); }
.on-dark .eyebrow { color: var(--gilt-400); }
.on-dark .quiet { color: rgba(250, 248, 244, 0.6); }

/* ---------------------------------------------------------------------------
   LAYOUT
   ------------------------------------------------------------------------ */

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

.shell-narrow {
  width: 100%;
  max-width: 980px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.stack-2 > * + * { margin-top: var(--s-2); }
.stack-3 > * + * { margin-top: var(--s-3); }
.stack-4 > * + * { margin-top: var(--s-4); }
.stack-5 > * + * { margin-top: var(--s-5); }
.stack-6 > * + * { margin-top: var(--s-6); }
.stack-8 > * + * { margin-top: var(--s-8); }
.stack-10 > * + * { margin-top: var(--s-10); }
.stack-12 > * + * { margin-top: var(--s-12); }

.row { display: flex; align-items: center; gap: var(--s-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.col { display: flex; flex-direction: column; }

.g2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-6); }
.g3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-6); }
.g4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-5); }

.g-rail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 368px);
  gap: var(--s-12);
  align-items: start;
}

.g-rail-left {
  display: grid;
  grid-template-columns: minmax(250px, 296px) minmax(0, 1fr);
  gap: var(--s-10);
  align-items: start;
}

.g-split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: var(--s-16);
  align-items: center;
}

.g-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: var(--s-16);
  align-items: center;
}

.rule { border-top: 1px solid var(--line); }
.rule-soft { border-top: 1px solid var(--line-soft); }

/* ---------------------------------------------------------------------------
   BANDS
   ------------------------------------------------------------------------ */

.band { padding-block: var(--s-20); }
.band-tight { padding-block: var(--s-12); }
.band-loose { padding-block: var(--s-24); }

.band-paper { background: var(--paper-050); }
.band-raised { background: var(--paper-000); }
.band-sand { background: var(--paper-100); }
.band-navy {
  background-color: var(--navy-900);
  background-image: linear-gradient(180deg, var(--navy-950) 0%, var(--navy-900) 70%, var(--navy-850) 100%);
  color: var(--paper-050);
}

.band-navy .rule,
.band-navy .rule-soft { border-color: var(--line-invert); }

.section-head { margin-bottom: var(--s-10); }
.section-head-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr);
  gap: var(--s-10);
  align-items: end;
  margin-bottom: var(--s-10);
}

.head-index { display: flex; align-items: baseline; gap: var(--s-3); margin-bottom: var(--s-4); }
.head-index::after { content: ""; flex: 1; height: 1px; background: var(--line); transform: translateY(-4px); }
.band-navy .head-index::after { background: var(--line-invert); }

/* ---------------------------------------------------------------------------
   UTILITY
   ------------------------------------------------------------------------ */

.hide { display: none !important; }
.mt-2 { margin-top: var(--s-2); }
.mt-3 { margin-top: var(--s-3); }
.mt-4 { margin-top: var(--s-4); }
.mt-5 { margin-top: var(--s-5); }
.mt-6 { margin-top: var(--s-6); }
.mt-8 { margin-top: var(--s-8); }
.mt-10 { margin-top: var(--s-10); }
.mt-12 { margin-top: var(--s-12); }
.mb-4 { margin-bottom: var(--s-4); }
.mb-6 { margin-bottom: var(--s-6); }
.mb-8 { margin-bottom: var(--s-8); }
.center { text-align: center; }
.full { width: 100%; }
.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------------------
   MOTION
   ------------------------------------------------------------------------ */

@media (prefers-reduced-motion: no-preference) {
  .enter { animation: enter var(--dur) var(--ease) both; }
  @keyframes enter {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: none; }
  }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
