/* ============================================================
   AMALAB — base.css
   Tokens · reset · typography · layout primitives
   Brand: Architect + Care. Precise bones, warm surface.
   Palette locked — every color derives from brand tokens.
   ============================================================ */

/* ---------- Fonts (self-hosted, variable) ---------- */
@font-face {
  font-family: "Sora";
  src: url("../assets/fonts/Sora_wght_.woff2") format("woff2-variations"),
       url("../assets/fonts/Sora_wght_.ttf") format("truetype-variations");
  font-weight: 100 800;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("../assets/fonts/SourceSans3_wght_.woff2") format("woff2-variations"),
       url("../assets/fonts/SourceSans3_wght_.ttf") format("truetype-variations");
  font-weight: 200 900;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  /* Colors — locked (brand/colors/tokens.json) */
  --navy: #123C4A;
  --navy-dark: #0E2F3A;
  --navy-deep: #0A1A20;
  --teal: #2D7D8A;
  --orange: #E65F1D;
  --paper: #FBFAF8;
  --paper-2: #F3F1ED;
  --white: #FFFFFF;

  /* Semantic — derived from locked palette only */
  --bg: var(--white);
  --bg-alt: var(--paper);
  --fg: var(--navy-deep);
  --fg-strong: var(--navy);
  --fg-muted: rgba(18, 60, 74, 0.82);
  --border: rgba(18, 60, 74, 0.14);
  --border-strong: rgba(18, 60, 74, 0.28);
  --focus: var(--navy);
  --orange-hover: color-mix(in srgb, var(--orange) 86%, var(--navy-deep));
  --teal-bright: color-mix(in srgb, var(--teal) 55%, var(--white));

  /* Inverted (navy bands) */
  --inv-fg: var(--paper);
  --inv-fg-muted: rgba(251, 250, 248, 0.76);
  --inv-border: rgba(251, 250, 248, 0.16);

  /* Type — the site uses exactly two families: Sora (display) and Source Sans 3 (body).
     Label/metadata contexts (--font-mono token kept for compatibility) render in Sora. */
  --font-display: "Sora", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Source Sans 3", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Sora", ui-sans-serif, system-ui, sans-serif;

  --step-display: clamp(2.25rem, 1.45rem + 3.1vw, 4rem);      /* 36 → 64 */
  --step-h2: clamp(2rem, 1.6rem + 1.6vw, 3rem);              /* 32 → 48 */
  --step-h3: clamp(1.375rem, 1.25rem + 0.5vw, 1.75rem);       /* 22 → 28 */
  --step-h4: 1.25rem;                                          /* 20 */
  --step-body: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);        /* 16 → 17 */
  --step-lead: clamp(1.125rem, 1.05rem + 0.35vw, 1.3125rem);   /* 18 → 21 */
  --step-small: 0.875rem;                                      /* 14 */
  --step-mono: 0.9375rem;                                      /* 15 */

  /* Spacing — 8pt scale */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;
  --s-9: 96px; --s-10: 128px;

  --section-y: clamp(40px, 5.5vw, 72px);
  --radius-btn: 8px;
  --radius-card: 12px;
  --container: 1200px;
  --gutter: clamp(20px, 5vw, 64px);
  --nav-h: 72px;

  /* Depth — hairline-first, shadows minimal (tokens.css) */
  --shadow-card: 0 1px 2px rgba(10, 26, 32, 0.06), 0 8px 24px rgba(10, 26, 32, 0.04);
  --shadow-card-hover: 0 2px 4px rgba(10, 26, 32, 0.08), 0 16px 32px rgba(10, 26, 32, 0.06);

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --t-ui: 220ms;
  --t-reveal: 320ms;
  --t-drop: 150ms;      /* trigger-anchored popovers (nav dropdown) — fast end of
                           the dropdown budget, since chrome is opened repeatedly */
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  /* No page ever scrolls sideways. `clip` (not `hidden`) is deliberate: it
     clips without creating a scroll container, so every `position: sticky`
     on the site — the header, all the pinned journeys — keeps working.
     Safety net only: full-bleed bands still compute their own geometry. */
  overflow-x: clip;
}
/* When Lenis drives the scroll, native smooth scrolling must yield */
html.lenis-smooth { scroll-behavior: auto; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--step-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }
a { color: inherit; }
ul[class], ol[class] { list-style: none; padding: 0; }

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--fg-strong);
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.h2--two-lines {
  width: max-content;
  max-width: 100%;
  margin-inline: auto;
  text-align: center;
}
.h2--two-lines > span { display: block; white-space: nowrap; }
.section-head--wide { max-width: 100%; }
@media (max-width: 720px) {
  .h2--two-lines { width: 100%; }
  .h2--two-lines > span { white-space: normal; }
}
h1 { font-size: var(--step-display); line-height: 1.12; }
h2 { font-size: var(--step-h2); line-height: 1.15; }
h3 { font-size: var(--step-h3); line-height: 1.22; }
h4 { font-size: var(--step-h4); line-height: 1.3; }

p { max-width: 65ch; }

/* Terminal dot of a title carries the tertiary (orange) accent */
.title-dot { color: var(--orange); }
.on-dark .title-dot { color: var(--orange); }
.lead {
  font-size: var(--step-lead);
  line-height: 1.55;
}
.muted { color: var(--fg-muted); }
.small { font-size: var(--step-small); line-height: 1.5; }
strong { font-weight: 600; color: var(--fg-strong); }

.mono {
  font-family: var(--font-mono);
  font-size: var(--step-mono);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Section eyebrow: `01 · LE CONSTAT` with hairline */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--step-mono);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
  display: block;
  margin-bottom: var(--s-6);
}
.eyebrow::before {
  content: "";
  display: block;
  width: 32px;
  height: 1px;
  background: var(--border-strong);
  margin-bottom: var(--s-3);
}
.on-dark .eyebrow { color: var(--teal-bright); }
.on-dark .eyebrow::before { background: var(--inv-border); }

/* ---------- Layout primitives ---------- */
.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { padding-block: var(--section-y); }
.section--alt { background: var(--bg-alt); }
.section--navy {
  background: var(--navy);
  color: var(--inv-fg);
}
.section--deep {
  /* Never black backgrounds — deep bands share the primary navy (footer continuity) */
  background: var(--navy);
  color: var(--inv-fg);
}
.on-dark h1, .on-dark h2, .on-dark h3, .on-dark h4 { color: var(--inv-fg); }
.on-dark p { color: var(--inv-fg); }
.on-dark .muted { color: var(--inv-fg-muted); }
.on-dark strong { color: var(--white); }

.section-head { max-width: 720px; margin-bottom: var(--s-8); }
.section-head--center {
  margin-inline: auto;
  text-align: center;
}
.section-head--center .eyebrow::before { margin-inline: auto; }
.section-head p { margin-top: var(--s-6); }
.section-head--center p { margin-inline: auto; }
/* A page whose navy hero was dropped hosts its h1 in the first section head
   (rendez-vous). It stays the document h1 for structure, but reads at section
   scale — display size there would push the content it introduces past the fold. */
.section-head h1 { font-size: var(--step-h2); line-height: 1.15; }

/* Home editorial rhythm: section introductions are centered, while cards,
   lists and the two explicitly directional conversion blocks stay left-aligned. */
.home main .section-head {
  margin-inline: auto;
  text-align: center;
}
.home main .section-head p { margin-inline: auto; }
.home main .section-head--tight { margin-bottom: var(--s-4); }
.home main .section > .container > .lead {
  margin-inline: auto;
  text-align: center;
}
.home .saas-field-copy { text-align: center; }

.grid {
  display: grid;
  gap: clamp(16px, 2vw, 32px);
}
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }

.hairline { border: none; border-top: 1px solid var(--border); }

/* ---------- Accessibility ---------- */
.skip-link {
  position: absolute;
  /* Parked at its focused position and held off-screen by a transform, so the
     reveal animates on the compositor instead of animating `top` (a layout
     property) each frame. Same visual, transform-only like the rest of the site. */
  top: var(--s-4);
  left: var(--s-4);
  z-index: 200;
  background: var(--navy);
  color: var(--white);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--radius-btn);
  text-decoration: none;
  transform: translateY(calc(-100% - var(--s-4) - 8px));
  /* No transition, deliberately. This is reachable only by Tab, and animating a
     keyboard-initiated action delays the one thing an assistive-tech user needs
     immediately. It appears instantly. (v22 slid it in over 220ms.) */
}
.skip-link:focus { transform: none; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}
.on-dark :focus-visible { outline-color: var(--inv-fg); }

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

[id] { scroll-margin-top: calc(var(--nav-h) + 24px); }

/* ---------- Scroll reveal ----------
   Hidden state only applies when JS is running (html.js set inline in <head>),
   so content is never lost if scripts fail to load. */
html.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 480ms var(--ease-out), transform 480ms var(--ease-out);
}
html.js .reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Reduced motion (mandatory) ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}
