/* ==========================================================================
   Base: reset, typography, layout primitives, global UI (preloader,
   cursor, scroll progress, skip link). Section styles live in sections.css.
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: auto; /* Lenis handles smoothing */
}
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

/* Paint the phone's top safe-area band so content never scrolls under host UI */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 90;
  background: var(--bg);
  pointer-events: none;
}

[hidden] { display: none !important; }
img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
ul[role="list"], ol[role="list"] { list-style: none; margin: 0; padding: 0; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: var(--track-heading);
  line-height: 1.08;
  text-wrap: balance;
}
p { margin: 0; text-wrap: pretty; }
em { font-style: italic; }

/* Selection has its own pair of tokens so it can never become same-colour-on-same-colour
   (on charcoal sections --accent is white, and --bg is white everywhere). */
::selection { background: var(--selection-bg); color: var(--selection-fg); }

/* ---- Layout primitives ------------------------------------------------ */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) + var(--gutter-r));
  margin-inline: auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}
.section { padding-block: var(--section-space); position: relative; }

/* ---- Type helpers ----------------------------------------------------- */
.display {
  font-size: var(--fs-display);
  font-weight: 500;
  letter-spacing: var(--track-display);
  line-height: 1.02;
}
.display em, .h2 em {
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.02em;
}
.h2 { font-size: var(--fs-h2); letter-spacing: var(--track-display); line-height: 1.05; }
.lead { font-size: var(--fs-lead); color: var(--muted); line-height: 1.55; max-width: 62ch; }
.label {
  font-size: var(--fs-caption);
  font-weight: 500;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--muted);
}

/* ---- Accessibility ---------------------------------------------------- */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: calc(var(--gutter) + 4px);
  z-index: 200;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--on-ink);
  font-weight: 500;
  transform: translateY(-160%);
  transition: transform var(--dur-fast) var(--ease-out);
}
.skip-link:focus-visible { transform: translateY(0); }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---- Split text masks (filled by js/modules/split-text.js) ------------ */
.split-w { display: inline-block; overflow: hidden; vertical-align: top; padding: 0 0.05em 0.08em 0; margin: 0 -0.05em -0.08em 0; }
.split-wi { display: inline-block; will-change: transform; }

/* ---- Scroll progress bar ---------------------------------------------- */
.scroll-progress {
  position: fixed;
  top: env(safe-area-inset-top, 0px);
  left: 0; right: 0;
  height: 2px;
  z-index: 120;
  pointer-events: none;
}
.scroll-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

/* ---- Preloader: handled by the xRD Page Loader plugin ("wordmark" style). */

/* ---- Custom cursor: dot + ring (fine pointers only; js adds .has-cursor) */
.cursor, .cursor-dot { display: none; }
html.has-cursor .cursor {
  display: grid;
  place-items: center;
  position: fixed;
  top: 0; left: 0;
  z-index: 1000; /* above the floating chat/WhatsApp widgets (900) */
  width: 96px; height: 96px;
  margin: -48px 0 0 -48px;
  pointer-events: none;
}
html.has-cursor .cursor-dot {
  display: block;
  position: fixed;
  top: 0; left: 0;
  z-index: 1001;
  width: 6px; height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: var(--ink);
  pointer-events: none;
  transition: opacity 0.2s, background-color 0.3s;
}
.cursor__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--ink-40);
  background: transparent;
  transform: scale(0.38);
  transition: transform 0.4s var(--ease-out), background-color 0.3s, border-color 0.3s, opacity 0.3s;
}
.cursor__label {
  position: relative;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: var(--on-ink);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.25s, transform 0.35s var(--ease-out);
}
.cursor.is-link .cursor__ring { transform: scale(0.58); border-color: var(--accent); background: rgba(43, 43, 43, 0.06); }
.cursor.is-label .cursor__ring { transform: scale(1); background: var(--ink); border-color: var(--ink); }
.cursor.is-label .cursor__label { opacity: 1; transform: scale(1); }
.cursor-dot.is-hidden, .cursor.is-label + .cursor-dot { opacity: 0; }
.cursor.is-hidden .cursor__ring { transform: scale(0); opacity: 0; }
.cursor.on-dark .cursor__ring { border-color: var(--cream-60); }
.cursor.on-dark.is-label .cursor__ring { background: var(--on-ink); border-color: var(--on-ink); }
.cursor.on-dark .cursor__label { color: var(--ink); }
.cursor-dot.on-dark { background: var(--on-ink); }

/* ---- Placeholder marks: everything to replace before launch ----------- */
.ph {
  display: inline-block;
  padding: 0 6px;
  border-radius: 4px;
  border: 1px dashed var(--color-gray-medium);
  background: var(--bg-alt);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.72em;
  font-weight: 600;
  font-style: normal;
  letter-spacing: 0.02em;
  line-height: 1.6;
  vertical-align: middle;
  white-space: nowrap;
}
.ph--dark { color: var(--cream-60); background: var(--cream-12); border-color: rgba(255, 255, 255, 0.3); }
.ph--media {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 3;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.92);
  pointer-events: none;
}

/* ---- Reduced motion: everything settles instantly --------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Hide the native pointer only where the custom cursor is active */
html.has-cursor body,
html.has-cursor a,
html.has-cursor button,
html.has-cursor [data-cursor] { cursor: none; }
[tabindex="-1"]:focus { outline: none; }
@media (max-width: 599px) { .hide-sm { display: none; } }
