/*
 * FlexiLoans — EDS foundation styles.
 * Token contract mirrors DESIGN.md frontmatter (stardust canon, 2026-07).
 * Fonts: Roboto (display) + Montserrat (body), self-hosted variable woff2 in
 * /fonts, declared in styles/fonts.css (lazy-loaded); metric-matched Arial
 * fallbacks below keep CLS at zero. Both families are user-pinned
 * (direction.md Iteration 2) and OFL/Apache licensed.
 */

:root {
  /* palette — stardust token contract */
  --paper: #fff;
  --ink: #101010;
  --slate: #45586b;
  --navy-trust: #0a3254;
  --tarakki-green: #00cf67;
  --lavender-veil: #f3eff9;
  --ice-wash: #e9f3ff;
  --plum-anchor: #493961;
  --plum-deep: #2d223d;
  --hero-plum: #532d54;
  --hero-navy: #2b5582;
  --hairline: #d1d5db;
  --hero-gradient: linear-gradient(0deg, var(--hero-plum) 0%, var(--hero-navy) 100%);

  /* type — modular major-third scale 16/20/25/39/61 */
  --font-display: "Roboto", "Roboto-Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-sans: "Montserrat", "Montserrat-Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;
  --text-display: clamp(2.35rem, 1.2rem + 3.4vw, 3.8125rem); /* → 61px */
  --text-headline: clamp(1.75rem, 1.3rem + 1.4vw, 2.4375rem); /* → 39px */
  --text-title: clamp(1.25rem, 1.1rem + 0.5vw, 1.5625rem); /* → 25px */
  --text-lede: 1.25rem; /* 20px */
  --text-body: 1rem; /* 16px */
  --text-eyebrow: 0.8125rem; /* 13px */

  /* radii — 12px card / 24px band / pill controls */
  --r-control: 12px;
  --r-card: 12px;
  --r-band: 24px;
  --r-pill: 9999px;

  /* spacing — 4pt scale, 64px section rhythm */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 16px;
  --sp-4: 24px;
  --sp-5: 32px;
  --sp-6: 48px;
  --sp-section: 64px;
  --shadow-card: 0 4px 30px rgb(0 0 0 / 10%);
  --shadow-chip: 0 1px 2px rgb(0 0 0 / 25%);
  --z-nav: 40;
  --container: 1240px;

  /* boilerplate compatibility aliases (blocks/cards etc.) */
  --background-color: var(--paper);
  --light-color: var(--lavender-veil);
  --dark-color: var(--slate);
  --text-color: var(--ink);
}

/* impeccable-disable overused-font, design-system-font — Roboto (display) +
   Montserrat (body) are user-pinned per stardust/direction.md Iteration 2
   (2026-07-21); the "-Fallback" faces are the metric-matched local-Arial
   overrides required by the canon CLS discipline, not new families. */

/* metric-matched fallbacks — no layout shift while the woff2s load */
@font-face {
  font-family: Roboto-Fallback;
  src: local("Arial");
  size-adjust: 99.78%;
  ascent-override: 93%;
  descent-override: 24.5%;
  line-gap-override: 0%;
}

@font-face {
  font-family: Montserrat-Fallback;
  src: local("Arial");
  size-adjust: 112.84%;
  ascent-override: 85.8%;
  descent-override: 22.25%;
  line-gap-override: 0%;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  hanging-punctuation: first;
  scroll-behavior: smooth;
}

body {
  display: none;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  font-optical-sizing: auto;
}

body.appear {
  display: block;
}

/* header is a fixed overlay (transparent → navy on scroll, in the fragment CSS);
   it occupies no flow height, so its late injection causes zero layout shift */
header {
  height: 0;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  color: var(--navy-trust);
  text-wrap: balance;
  letter-spacing: -0.015em;
  font-weight: 700;
  scroll-margin: 90px;
}

h1 {
  font-size: var(--text-display);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--text-headline);
  line-height: 1.2;
}

h3 {
  font-size: var(--text-title);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

p {
  text-wrap: pretty;
}

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

/* links — plain anchors render as navy text links (arrow glyphs authored in text) */
main a:any-link {
  color: var(--navy-trust);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1.5px solid transparent;
  transition: border-color 160ms ease;
}

main a:hover {
  border-bottom-color: var(--navy-trust);
}

/* buttons — decorateButtons() emits a.button.(primary|secondary|accent)
   from <strong><a> / <em><a> / <em><strong><a>. Brand mapping:
   primary = tarakki-green pill (Apply Now), secondary = navy fill,
   accent = navy ghost outline. */
p.button-wrapper {
  margin: 0;
}

a.button:any-link,
button.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  max-width: 100%;
  border: 0;
  border-radius: var(--r-pill);
  font-weight: 700;
  font-size: var(--text-body);
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  padding: 14px 32px;
  transition: transform 160ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 160ms cubic-bezier(0.22, 1, 0.36, 1), background-color 160ms ease;
}

a.button:focus-visible,
button.button:focus-visible {
  outline: 3px solid var(--hero-navy);
  outline-offset: 2px;
}

a.button.primary,
button.button.primary {
  background: var(--tarakki-green);
  color: var(--navy-trust);
  box-shadow: var(--shadow-chip);
}

a.button.primary:hover,
button.button.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgb(10 50 84 / 22%);
  border-bottom-color: transparent;
  color: var(--navy-trust);
}

a.button.secondary,
button.button.secondary {
  background: var(--navy-trust);
  color: var(--paper);
  font-weight: 600;
  padding: 14px 28px;
}

a.button.secondary:hover,
button.button.secondary:hover {
  /* impeccable-disable-next-line design-system-color — captured canon.css btn-secondary:hover value */
  background: #0d3f6a;
  border-bottom-color: transparent;
  color: var(--paper);
}

a.button.accent,
button.button.accent {
  background: transparent;
  color: var(--navy-trust);
  font-weight: 600;
  padding: 13px 28px;
  border: 1.5px solid var(--navy-trust);
}

a.button.accent:hover,
button.button.accent:hover {
  background: rgb(10 50 84 / 6%);
  border-bottom-color: var(--navy-trust);
}

/* icons — decorateIcons() renders /icons/<name>.svg into span.icon */
.icon {
  display: inline-block;
  height: 24px;
  width: 24px;
}

.icon img {
  height: 100%;
  width: 100%;
}

/* icon chip — the single stroke icon system in tinted circular chips */
.icon-chip {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--ice-wash);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.icon-chip .icon {
  width: 24px;
  height: 24px;
}

.icon-chip.on-tint {
  background: var(--paper);
}

.icon-chip.lg {
  width: 56px;
  height: 56px;
}

.icon-chip.lg .icon {
  width: 26px;
  height: 26px;
}

/* sections — 64/48/32 rhythm, tint bands touch (no margins) */
main > .section {
  padding-block: var(--sp-section);
}

/* the consumed metadata block leaves an empty section — collapse it */
main > div:empty,
main > .section:empty {
  display: none;
}

main > .section > div {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--sp-4);
}

/* rhythm between a section's wrappers (head → block → foot): 32px */
main > .section > div + div {
  margin-top: var(--sp-5);
}

/* section heads authored as default content above blocks */
main .default-content-wrapper h2 {
  margin-bottom: var(--sp-2);
}

main .default-content-wrapper p {
  color: var(--slate);
  max-width: 68ch;
}

main .default-content-wrapper p:not(:first-child) {
  margin-top: var(--sp-2);
}

/* tint bands — painted by the owning block's section container class */
main .section.live-status-container,
main .section.chips-container.ice-band {
  background: var(--ice-wash);
}

main .section.chips-container:not(.ice-band),
main .section.blog-index-container,
main .section.partner-strip-container {
  background: var(--lavender-veil);
}

main .section.chips-container:has(.chips.ice) {
  background: var(--ice-wash);
}

/* tint bands — authored via section metadata (style: lavender | ice | navy)
   for blockless prose sections; wins over block-container band rules */
main > .section.lavender {
  background: var(--lavender-veil);
}

main > .section.ice {
  background: var(--ice-wash);
}

main > .section.navy {
  background: var(--navy-trust);
  color: var(--paper);
}

@media (width <= 1023px) {
  main > .section {
    padding-block: var(--sp-6);
  }
}

/* imported long-form prose: long tokens (URLs, form names) must wrap, and
   authored CTA buttons wrap their labels instead of forcing h-scroll */
main .default-content-wrapper {
  overflow-wrap: break-word;
}

@media (width <= 767px) {
  main .default-content-wrapper a.button {
    white-space: normal;
    text-align: center;
  }

  main > .section {
    padding-block: var(--sp-5);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
