/* ============================================================
   Visuala Studio — Base layer
   Reset · typographic defaults · global utilities · global
   light→dark scroll transition · reduced-motion guard.
   ============================================================ */

/* ============================================================
   GLOBAL LIGHT→DARK TRANSITION (the booking "peak moment")
   Triggered by scroll (BookingForm section flips the two progress
   vars 0↔1 with hysteresis when you enter / leave the form). Two
   SEPARATELY-TIMED animated variables keep the type legible the
   whole way:
     --bg-progress   : slow, full-duration ease (the page fill)
     --text-progress : holds, then a quick LATE flip
   Decoupling them prevents the muddy mid-grey cross-fade.
   ============================================================ */
@property --bg-progress   { syntax: "<number>"; inherits: true; initial-value: 0; }
@property --text-progress { syntax: "<number>"; inherits: true; initial-value: 0; }

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

html {
  /* Opt out of mobile browser font auto-boost entirely. Chrome Android
     would otherwise enlarge text it considers "too small for readability",
     ignoring our clamp()/vw-based responsive type scale and breaking
     intentional break patterns (the mid-CTA 4-line lockup on narrow
     devices was being rendered as 5 lines because of this). The site's
     typography is already responsive by design — auto-boost only fights it. */
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  scroll-behavior: smooth;
  /* Anchor targets clear the fixed nav (~70px tall) with a little
     breathing room. Without this, clicking a #section link lands the
     section's top edge under the navbar. */
  scroll-padding-top: 78px;
}

:root {
  /* Explicit initial values for the two animated progress vars.
     Declaring them here (not only via @property initial-value) is what
     ARMS the transition: the first scroll-down flip 0→1 only animates
     if the property has an explicit declared value to transition FROM.
     Without this, the first cream→dark trip happened instantly (the
     scroll-up trip already had a real "1" to transition back from, so
     it appeared smooth — a misleading asymmetry). */
  --bg-progress: 0;
  --text-progress: 0;

  /* One animated tone ramp the whole page (form copy + footer) shares.
     Each clears mid-grey quickly thanks to --text-progress' timing. */
  --tone-strong: color-mix(in oklab, var(--ink-900), var(--cream-100) calc(var(--text-progress) * 100%));
  --tone-soft:   color-mix(in oklab, var(--ink-700), var(--green-100) calc(var(--text-progress) * 100%));
  --tone-faint:  color-mix(in oklab, var(--ink-500), var(--green-200) calc(var(--text-progress) * 100%));
  --tone-line:   color-mix(in oklab, var(--border-soft), rgba(247, 246, 239, 0.16) calc(var(--text-progress) * 100%));
  transition:
    --bg-progress   880ms cubic-bezier(0.76, 0, 0.24, 1),
    --text-progress 320ms cubic-bezier(0.65, 0, 0.35, 1) 380ms;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--lh-body);
  font-weight: var(--fw-regular);
  letter-spacing: var(--ls-normal);
  color: var(--fg-1);
  background-color: color-mix(in oklab, var(--surface-page), var(--surface-closure) calc(var(--bg-progress) * 100%));
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv01";
}

/* NOTE — The .is-dark fallback class on <html> was REMOVED because it
   ran instantly (no transition) AND won specificity over the body's
   color-mix rule, painting closure-green abruptly on the way down. On
   the way up it was removed first, exposing the in-flight color-mix
   animation, which is why the smooth path only appeared one way.
   Removing the override lets the @property-animated color-mix drive
   the cross-fade in BOTH directions symmetrically. All modern browsers
   (Chrome 85+, Firefox 128+, Safari 16.4+) support @property — the
   cutoff is well in the past. */

/* Editorial headings: tight tracking, snug leading by default */
h1, h2, h3, h4 {
  margin: 0;
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-tight);
  text-wrap: balance;
}

p { margin: 0; text-wrap: pretty; }

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

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

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

/* The brand's signature accent gesture: a key word set in
   Instrument Serif italic. Use sparingly. */
.serif-accent {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: var(--fw-regular);
  letter-spacing: 0;
}

/* Eyebrow / kicker label */
.eyebrow {
  font-size: var(--text-eyebrow);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
}

/* Global focus ring. Ink, not lime — deliberate. */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Brand selection */
::selection {
  background: var(--color-accent);
  color: var(--on-accent);
}

/* Global page wrapper + section padding helpers.
   --section-y is applied per section; --page-gutter is the side gutter
   that scales with viewport. Sections compose these via local class. */
.wrap {
  max-width: var(--content-max);
  margin: 0 auto;
  padding-left: var(--page-gutter);
  padding-right: var(--page-gutter);
}

.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}

/* Accessibility: visually hidden but readable by screen readers. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   REDUCED MOTION
   Respect the OS preference everywhere. Each section motor also
   reads this preference at boot — this rule is the safety net.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  :root { transition: none; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
