/* ============================================================
   PT Template 3 — Base: reset, typography, shared components.
   Section-specific styles belong in css/sections/*.css, scoped
   under their section root class. Do NOT add section styles here.
   ============================================================ */

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

html { scroll-behavior: smooth; }
html.reduced-motion { scroll-behavior: auto; }

/* Anchored sections must clear the fixed nav when jumped to */
[id] { scroll-margin-top: calc(var(--nav-h) + 16px); }

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--text-on-bone);
  background: var(--bone);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img, svg, video, iframe { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; }
a { color: inherit; }
ul[class], ol[class] { list-style: none; padding: 0; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-wrap: balance;
  font-weight: 700;
}
h1 { font-size: var(--fs-hero); font-weight: 800; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
/* On dark ("on-ink") sections the navy accent outline drops well under the
   3:1 AA non-text contrast minimum against --ink. Swap to white there so
   focus stays visible on nav, footer, journey, booking, results, etc. */
.on-ink :focus-visible,
.on-ink:focus-visible { outline-color: #fff; }

/* --- Layout --- */
.container {
  width: min(var(--container), 100% - 2.5rem);
  margin-inline: auto;
}

/* --- Section rhythm helpers --- */
.section-pad { padding-block: var(--sp-section); }
.on-ink { color: var(--text-on-ink); background: var(--ink); }
.on-ink h1, .on-ink h2, .on-ink h3, .on-ink h4 { color: var(--white); }

/* --- Eyebrow + section heading pattern --- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  /* Client-approved AA fix: 38% lightness read 3.46:1 on --bone (fails
     4.5:1 for this 12.8px label text); 32% clears it at 4.63:1, same
     brand hue/saturation. See docs/accessibility-report.md §3. */
  color: hsl(var(--accent2-h) 45% 32%);
}
.eyebrow::before {
  content: "";
  width: 2rem;
  height: 2px;
  background: var(--accent2);
  border-radius: 2px;
}
.on-ink .eyebrow { color: var(--accent2); }
.on-ink .eyebrow::before { background: var(--accent2); }

.section-head { max-width: 46ch; margin-bottom: clamp(2rem, 4vw, 3.5rem); }
.section-head .eyebrow { margin-bottom: 1rem; }
.section-head p { margin-top: 1rem; color: var(--text-on-bone-dim); max-width: 52ch; }
.on-ink .section-head p { color: var(--text-on-ink-dim); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.95rem 1.9rem;
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 300ms var(--ease-spring), box-shadow 300ms var(--ease-out),
    background-color 200ms var(--ease-out), color 200ms var(--ease-out),
    border-color 200ms var(--ease-out);
  will-change: transform;
}
.btn--solid { background: var(--accent); color: var(--accent-on); box-shadow: 0 8px 24px var(--accent-glow); }
.btn--solid:hover { background: var(--accent-strong); box-shadow: 0 12px 32px var(--accent-glow); }
.btn--ghost { border-color: currentColor; background: transparent; color: inherit; }
.btn--ghost:hover { background: hsl(0 0% 100% / 0.08); }
.btn .btn__arrow { transition: transform 300ms var(--ease-spring); }
.btn:hover .btn__arrow { transform: translateX(4px); }

/* --- Reveal-on-scroll (driven by js/core.js) ---
   Visible by default (progressive enhancement: content must survive JS
   failure). js/core.js adds "js-anim" to <html> synchronously at the top
   of its IIFE, BEFORE it does anything else -- functionally the same
   timing as the old unconditional CSS, so this is a no-op for anyone
   with JS enabled. It only skips the hidden state entirely when motion
   is reduced, so reduced-motion users never see a flash of hidden
   content while core.js spins up its IntersectionObserver. */
[data-reveal] {
  transition: opacity var(--dur-reveal) var(--ease-out), transform var(--dur-reveal) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
html.js-anim [data-reveal] { opacity: 0; transform: translateY(28px); }
html.js-anim [data-reveal].is-visible { opacity: 1; transform: none; }
html.reduced-motion [data-reveal] { opacity: 1; transform: none; transition: none; }

/* --- Reduced-motion backstop: stops any animation/transition that a
   section's own CSS may still gate on a JS-added class, in case that
   class never arrives (JS error, slow connection, JS disabled) --- */
@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;
  }
}

/* --- Marquee (duplicate .marquee__track content twice) --- */
.marquee { overflow: hidden; display: flex; }
.marquee__track {
  display: flex;
  align-items: center;
  gap: 3rem;
  flex-shrink: 0;
  min-width: 100%;
  padding-right: 3rem;
  animation: marquee-scroll var(--marquee-dur, 36s) linear infinite;
}
/* WCAG 2.2.2 (Pause, Stop, Hide): the marquee auto-scrolls indefinitely, so
   it needs a pause trigger reachable by keyboard, not just mouse hover. */
.marquee:hover .marquee__track,
.marquee:focus-within .marquee__track { animation-play-state: paused; }
html.reduced-motion .marquee__track { animation: none; }
@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(calc(-100% - 3rem)); }
}

/* --- Grain texture for dark sections --- */
.grain { position: relative; }
.grain::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}
.grain > * { position: relative; z-index: 1; }

/* --- Ghost numeral --- */
.ghost-num {
  font-family: var(--font-display);
  font-size: var(--fs-ghost);
  font-weight: 800;
  line-height: 0.8;
  color: transparent;
  -webkit-text-stroke: 1.5px hsl(0 0% 100% / 0.14);
  user-select: none;
  pointer-events: none;
}

/* --- Pulse-line brand motif (canonical EKG path lives in the addendum spec) --- */
.pulse-line { display: block; width: 100%; height: 44px; }
.pulse-line path {
  stroke: var(--accent2);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pulse-line--draw path { stroke-dasharray: 1; stroke-dashoffset: 1; }
[data-reveal].is-visible .pulse-line--draw path,
.pulse-line--draw[data-reveal].is-visible path {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1400ms var(--ease-out) 200ms;
}
html.reduced-motion .pulse-line--draw path { stroke-dashoffset: 0; transition: none; }

/* --- Auto chapter numbers (data-chapter stamped by core.js) ---
   isolation: the numeral sits at z-index:-1 behind the heading text.
   Without its own stacking context, .section-head only formed one while
   its [data-reveal] opacity/transform animation was running; once the
   reveal settled (opacity:1, transform:none) the numeral dropped behind
   the section's background and vanished. Isolating the head keeps the
   numeral behind the text but above the section background, always. */
.section-head { position: relative; isolation: isolate; }
.section-head[data-chapter]::before {
  content: attr(data-chapter);
  position: absolute;
  top: -0.55em;
  left: -0.06em;
  z-index: -1;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(4.5rem, 3rem + 6vw, 7.5rem);
  line-height: 1;
  color: currentColor;
  opacity: 0.06;
  pointer-events: none;
  user-select: none;
}

/* --- Chapter spine (injected by core.js, desktop only) --- */
.chapter-spine {
  position: fixed;
  left: 1.4rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fff;
  mix-blend-mode: difference; /* legible on both bone and ink sections */
  pointer-events: none;
}
/* .container's left margin stays flat at 20px below ~1240px (the
   "100% - 2.5rem" branch of min(1200px, 100% - 2.5rem)) while the
   spine's right edge sits ~36px from the viewport edge regardless of
   width -- measured directly, the two overlap outright at 1200-1250px
   and still crowd (4-14px gap) up to ~1300px; not clear until roughly
   1350-1400px. Gate here at the same 1400px threshold core.js uses to
   decide whether to create the spine at all (pass-6-t3 item 23). */
@media (max-width: 1399.98px) {
  .chapter-spine { display: none; }
}
.chapter-spine__rail {
  width: 2px;
  height: 72px;
  background: hsl(0 0% 100% / 0.25);
  border-radius: 2px;
  overflow: hidden;
}
.chapter-spine__fill {
  display: block;
  width: 100%;
  height: 100%;
  background: #fff;
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 500ms var(--ease-out);
}
.chapter-spine__total { opacity: 0.55; }

/* --- Back to top (injected by core.js on every page) ---
   Ink disc + white ring: the dark fill carries it over bone sections, the
   ring carries it over ink sections. Sits under the mobile nav overlay
   (199/210) and the mobile bar (180). */
.back-to-top {
  position: fixed;
  right: clamp(1rem, 2.5vw, 1.75rem);
  bottom: calc(clamp(1rem, 2.5vw, 1.75rem) + env(safe-area-inset-bottom));
  z-index: 170;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid hsl(0 0% 100% / 0.85);
  background: var(--ink);
  color: var(--white);
  box-shadow: var(--shadow-lift);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 300ms var(--ease-out), transform 300ms var(--ease-out),
    visibility 0s linear 300ms, background-color 250ms var(--ease-out),
    color 250ms var(--ease-out), border-color 250ms var(--ease-out),
    bottom 400ms var(--ease-out);
}
.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}
.back-to-top:hover {
  background: var(--accent2);
  border-color: var(--accent2);
  color: var(--ink);
}
.back-to-top:focus-visible {
  outline: 3px solid var(--accent2);
  outline-offset: 3px;
}
.back-to-top svg { display: block; }
/* Programmatic focus target after "back to top"; not in the tab order. */
main[tabindex="-1"]:focus { outline: none; }

/* Mobile: ride above the sticky Call | Book bar (56px + safe area) while
   it is showing; drop back down when it hides (e.g. over #booking). */
@media (max-width: 820px) {
  html.is-loaded .sec-17-mobilebar:not(.is-hidden) ~ .back-to-top {
    bottom: calc(56px + 0.9rem + env(safe-area-inset-bottom));
  }
}
/* Stay out of the way while the mobile nav overlay is open. */
body.sec-01-nav-lock .back-to-top { opacity: 0; visibility: hidden; }

html.reduced-motion .back-to-top { transition: none; }

/* --- Cursor-reactive glow (injected by core.js on section.on-ink) ---
   .cursor-glow-layer matches the section's box and clips the glow to it;
   the layer keeps the glow's old stacking slot (z-index 0, last child). */
.cursor-glow-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}
/* Section dividers (the decorative wave/curve SVGs placed directly in a
   section) are painted in the neighbouring section's color, so the glow
   must always pass under them. The layer is appended last at z-index 0,
   which would otherwise paint it over any divider at z-index auto/0. */
section.on-ink > svg[aria-hidden="true"] { z-index: 1; }
.cursor-glow {
  position: absolute;
  top: -220px;
  left: -220px;
  width: 440px;
  height: 440px;
  z-index: 0;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow), transparent 62%);
  opacity: 0;
  pointer-events: none;
  transition: transform 700ms var(--ease-out), opacity 500ms var(--ease-out);
  will-change: transform, opacity;
}

/* --- Screen-reader only --- */
.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;
}

/* --- Skip link: first focusable element on every page, hidden until
   keyboard-focused. Visually matches the CTA button language. --- */
.skip-link {
  position: fixed;
  top: -1000px;
  left: 1rem;
  z-index: 999;
  padding: 0.85rem 1.5rem;
  background: var(--ink);
  color: var(--white);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius-pill);
  text-decoration: none;
  box-shadow: var(--shadow-lift);
}
.skip-link:focus-visible,
.skip-link:focus {
  top: 1rem;
  outline: 3px solid #fff;
  outline-offset: 3px;
}

/* --- Long-form content pages (hiring, privacy, blog) ---
   Shared base-level typography for pages that are mostly text, the
   same way .eyebrow/.section-head are shared base-level components.
   Not tied to one section number since it is reused by several
   distinct one-off pages. */
.article-hero { padding-block: calc(var(--nav-h) + clamp(2.5rem, 6vw, 4.5rem)) clamp(2rem, 4vw, 3rem); }
.article-hero__eyebrow { margin-bottom: 1rem; }
.article-hero__meta { margin-top: 1rem; color: var(--text-on-bone-dim); }
.article-body { padding-bottom: clamp(3rem, 6vw, 5rem); }
.article-body__inner { max-width: 68ch; }
.article-body h2 { font-size: var(--fs-h3); margin-top: clamp(2.25rem, 4vw, 3rem); margin-bottom: 1rem; }
.article-body h2:first-child { margin-top: 0; }
.article-body h3 { font-size: var(--fs-h4); margin-top: 1.75rem; margin-bottom: 0.75rem; }
.article-body p { margin-top: 1rem; color: var(--text-on-bone-dim); }
.article-body p:first-child { margin-top: 0; }
.article-body ul, .article-body ol { margin-top: 1rem; padding-left: 1.25rem; color: var(--text-on-bone-dim); list-style: disc; display: block; }
.article-body ol { list-style: decimal; }
.article-body li { margin-top: 0.5rem; }
.article-body li::marker { color: var(--accent2); }
.article-body a:not(.btn) { color: hsl(var(--accent2-h) 45% 32%); text-decoration: underline; text-underline-offset: 2px; }
.article-body strong { color: var(--text-on-bone); font-weight: 600; }
.article-cta { margin-top: clamp(2.5rem, 5vw, 3.5rem); display: flex; flex-wrap: wrap; gap: 1rem; }
.article-body__inner img { max-width: 100%; height: auto; display: block; border-radius: var(--radius-md, 12px); margin-top: 1.75rem; }
.article-body__inner img.article-signature { max-width: 300px; margin-top: 1.25rem; border-radius: 0; }
.article-form { margin-top: 1.75rem; max-width: 640px; }
.article-form iframe { width: 100%; display: block; border: 0; }
.video-embed { position: relative; padding-top: 56.25%; margin-top: 1.75rem; max-width: 800px; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
