/* ==========================================================================
   Kaldrin Developments — base
   Tokens, reset, typography, page frame, shared layout primitives.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  /* Surfaces: near-black to graphite */
  --bg: #060606;
  --frame: #0a0a0a;
  --surface: #0e0e0e;
  --surface-2: #131312;
  --surface-3: #1a1918;

  /* Lines: thin graphite / iron */
  --line: #1f1e1c;
  --line-2: #2b2a27;
  --line-3: #3a3834;

  /* Iron scale (warm, pale) */
  --iron-50: #eeeae3;
  --iron-100: #dcd7ce;
  --iron-200: #c6c0b5;
  --iron-300: #a9a297;
  --iron-400: #9a948a;
  --iron-500: #77726a;

  /* Semantic text */
  --text-strong: var(--iron-50);
  --text: var(--iron-100);
  --text-muted: var(--iron-400);   /* 6.4:1 on --frame */
  --text-faint: var(--iron-500);   /* decorative / large only */

  /* Actions */
  --btn-fill: #cfc9be;
  --btn-fill-hover: #e8e3da;
  --btn-ink: #0a0a0a;
  --focus: #efe9df;
  --error: #d9a08f;

  /* Type */
  --font-display: "Cormorant Garamond", "Cormorant", "Times New Roman", serif;
  --font-sans: "Montserrat", "Helvetica Neue", Arial, sans-serif;

  --fs-label: 0.6875rem;      /* 11px, uppercase + tracked */
  --fs-meta: 0.75rem;         /* 12px */
  --fs-small: 0.8125rem;      /* 13px */
  --fs-body: 0.9375rem;       /* 15px */
  --fs-lede: clamp(1rem, 0.94rem + 0.25vw, 1.125rem);
  --fs-display-md: clamp(1.75rem, 1.3rem + 1.6vw, 2.5rem);
  /* Sized so the longest word ("INFRASTRUCTURE") fits a 320px screen */
  --fs-display-lg: clamp(1.625rem, 1rem + 3vw, 3.75rem);
  --fs-display-xl: clamp(2.6rem, 1.4rem + 4.6vw, 5.4rem);

  --track-display: 0.07em;
  --track-label: 0.24em;
  --track-ui: 0.16em;

  /* Layout */
  --frame-max: 1440px;
  --gutter: clamp(20px, 4.4vw, 64px);
  --section-y: clamp(64px, 7.5vw, 112px);
  --header-h: 76px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 180ms;
  --dur-base: 320ms;
  --dur-slow: 900ms;
  --dur-reveal: 1200ms;


  /* Layers */
  --z-base: 1;
  --z-media: 0;
  --z-header: 50;
  --z-menu: 60;
}

@media (max-width: 899px) {
  :root { --header-h: 64px; }
}
@media (max-width: 599px) {
  :root {
    --track-display: 0.05em;
    /* Comfortable reading size on phones */
    --fs-body: 1rem;
    --fs-small: 0.875rem;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
a, button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }

::selection { background: var(--iron-200); color: var(--bg); }

:focus-visible {
  outline: 1px solid var(--focus);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 12px 18px;
  background: var(--btn-fill);
  color: var(--btn-ink);
  font-size: var(--fs-label);
  letter-spacing: var(--track-ui);
  text-transform: uppercase;
  transform: translateY(-160%);
  transition: transform var(--dur-base) var(--ease-out);
}
.skip-link:focus { transform: none; }

/* Smooth scrolling (js/modules/smooth.js adds .lenis to <html>) */
html.lenis, html.lenis body { height: auto; }
html.lenis { scroll-behavior: auto !important; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* Page transitions: a short panel wipe, see css/flourish.css and js/modules/flourish.js */

/* Text for screen readers only */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------- Typography ---------- */
.display {
  font-family: var(--font-display);
  font-weight: 300;
  line-height: 1.02;
  letter-spacing: var(--track-display);
  text-transform: uppercase;
  color: var(--text-strong);
  text-wrap: balance;
}
/* Cormorant defaults to old-style figures; numbered UI needs lining ones */
.display {
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "lnum" 1, "tnum" 1;
}

.display--xl { font-size: var(--fs-display-xl); line-height: 0.98; }
.display--lg { font-size: var(--fs-display-lg); }
.display--md { font-size: var(--fs-display-md); }

.display .line { display: block; overflow: hidden; padding-bottom: 0.04em; margin-bottom: -0.04em; }
.display .line > span { display: block; }

.label,
.eyebrow,
.meta {
  font-family: var(--font-sans);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: var(--track-label);
  line-height: 1.8;
  text-transform: uppercase;
  color: var(--text-muted);
}
.meta span,
.eyebrow span { display: block; }
/* Keeps a phrase together so lines break only between phrases */
.eyebrow .nowrap,
.meta .nowrap { display: inline-block; white-space: nowrap; }

.label { margin-bottom: clamp(18px, 2vw, 28px); }

.lede {
  font-size: var(--fs-lede);
  line-height: 1.7;
  color: var(--text);
  max-width: 34rem;
}

p { max-width: 62ch; }

/* ---------- Frame: the page is one bordered "document" ---------- */
.frame {
  width: 100%;
  max-width: var(--frame-max);
  margin-inline: auto;
}

.page {
  position: relative;
  background: var(--frame);
  border-inline: 1px solid var(--line);
  outline: none;
}

.section {
  position: relative;
  padding: var(--section-y) var(--gutter);
  border-top: 1px solid var(--line);
}

/* Section header: title left, metadata right */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: clamp(40px, 5vw, 72px);
}
.section-head__meta { text-align: right; flex-shrink: 0; }

@media (max-width: 699px) {
  .section-head { flex-direction: column; align-items: flex-start; }
  .section-head__meta { text-align: left; }
}
