/* =============================================================================
   Grow Theory — Base
   Reset · typography · layout primitives · reveal motion · a11y utilities
   ========================================================================== */

/* ----------------------------------------------------------------- Reset -- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 88px; /* fixed nav height + breathing room */
}

/* Smooth scrolling is enabled by JS *after* first paint. Landing on a deep
   link like /product/scheduling.html#waitlist should jump, not animate 2,700px
   past everything; clicking that same link in-page should glide. */
html.is-smooth { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--c-void);
  color: var(--c-text-body);
  font-family: var(--f-body);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  letter-spacing: var(--tr-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden; /* belt-and-braces against the aurora bleed */
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }

a { color: inherit; text-decoration: none; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}
button { background: none; border: 0; padding: 0; cursor: pointer; }

:target { scroll-margin-top: 88px; }

/* ------------------------------------------------------------ Typography -- */
.t-hero, .t-display, .t-h2, .t-h3, .t-h4 {
  font-family: var(--f-display);
  font-weight: 500;
  color: var(--c-text);
  text-wrap: balance;
  margin: 0;
}

.t-hero    { font-size: var(--t-hero);    line-height: var(--lh-tight); letter-spacing: var(--tr-hero); }
.t-display { font-size: var(--t-display); line-height: var(--lh-tight); letter-spacing: var(--tr-display); }
.t-h2      { font-size: var(--t-h2);      line-height: 1;               letter-spacing: var(--tr-h2); }
.t-h3      { font-size: var(--t-h3);      line-height: 1.02;            letter-spacing: var(--tr-h3); }
.t-h4      { font-size: var(--t-h4);      line-height: var(--lh-snug);  letter-spacing: -0.03em; }

/* Big numerals — tabular so KPI rows don't jitter */
.t-stat {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: var(--t-stat);
  line-height: 1;
  letter-spacing: -0.045em;
  color: var(--c-text);
  font-variant-numeric: tabular-nums lining-nums;
}

.t-lead {
  font-size: var(--t-lead);
  line-height: var(--lh-body);
  color: var(--c-text-body);
  text-wrap: pretty;
}
.t-sub  { font-size: var(--t-sub); font-weight: 600; letter-spacing: -0.02em; color: var(--c-text); }
.t-body { font-size: var(--t-sm); line-height: var(--lh-body); color: var(--c-text-body); text-wrap: pretty; }
.t-sm   { font-size: var(--t-xs); line-height: 1.45; color: var(--c-text-body); }
.t-muted { color: var(--c-text-muted); }

.t-eyebrow {
  font-size: var(--t-eyebrow);
  font-weight: 600;
  line-height: 1;
  letter-spacing: var(--tr-caps);
  text-transform: uppercase;
  color: var(--c-text-muted);
}

/* Inline accent link — the "Learn about the inbox →" pattern */
.t-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--c-iris-text);
  font-size: var(--t-sm);
  font-weight: 500;
  transition: gap var(--d-base) var(--ease), color var(--d-base) var(--ease);
}
.t-link:hover { gap: 10px; color: var(--c-text); }
.t-link svg { transition: transform var(--d-base) var(--ease); }

/* --------------------------------------------------------------- Layout -- */
.wrap {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.wrap-narrow { max-width: 760px; }
.wrap-mid    { max-width: 940px; }

.section    { padding-block: var(--section-y); position: relative; }
.section-lg { padding-block: var(--section-y-lg); position: relative; }

.band-light { background: var(--c-light-bg); color: var(--c-light-body); }

/* Travelling-gradient divider — v4's .gt-thread, now a section affordance */
.thread { position: relative; }
.thread::before {
  content: '';
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent, var(--c-iris) 25%, var(--c-ember) 50%, var(--c-text) 70%, transparent);
  background-size: 50% 100%;
  animation: gt-thread 5s linear infinite;
  opacity: 0.5;
}
.thread-2::before { animation-delay: -1.6s; }
.thread-3::before { animation-delay: -3.2s; }

@keyframes gt-thread {
  from { background-position: -100% 0; }
  to   { background-position:  200% 0; }
}

/* Centred section intro: eyebrow → heading → optional lede */
.sec-head { text-align: center; margin-bottom: var(--s-12); }
.sec-head .t-eyebrow { display: inline-block; margin-bottom: var(--s-5); }
.sec-head .t-lead { margin-top: var(--s-5); margin-inline: auto; max-width: 56ch; }

/* Generic responsive grids — single column is always the default */
.grid { display: grid; gap: var(--s-6); }
@media (min-width: 768px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Capstone card: sits across the full row under a 3x3 of module cards, so the
     thing that works across all of them reads as separate from the nine. */
  .grid-3 > .card-wide { grid-column: 1 / -1; }
}
@media (min-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Two-column split used by every feature blade. Collapses at 900. */
.split { display: grid; gap: var(--s-10); align-items: center; }
/* Centring suits text-beside-a-frame. Two text columns read better
   aligned to their tops. */
.split-top { align-items: start; }
@media (min-width: 900px) {
  .split          { grid-template-columns: 1fr 1.2fr; gap: var(--s-16); }
  .split-even     { grid-template-columns: 1fr 1fr; }
  .split-wide     { grid-template-columns: 1fr 1.5fr; }
  .split-reverse  { grid-template-columns: 1.5fr 1fr; }
  /* Visually flip without reordering the DOM (keeps reading order sane) */
  .split-flip > :first-child { order: 2; }
}

/* --------------------------------------------------------------- Reveal -- */
/* Scoped to `.js`, set by an inline script in <head>. If scripting is
   unavailable or blocked, content simply renders — it is never left at
   opacity 0 with nothing to reveal it. */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity   var(--d-reveal) var(--ease),
    transform var(--d-reveal) var(--ease);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }

.js [data-reveal-group] > * {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity   var(--d-reveal-group) var(--ease),
    transform var(--d-reveal-group) var(--ease);
}
.js [data-reveal-group].is-in > * { opacity: 1; transform: none; }

/* v4 capped the stagger at 4 children, so a 5+ item grid popped in unstaggered.
   This runs to 12 and then holds. */
[data-reveal-group].is-in > *:nth-child(1)  { transition-delay: 0ms; }
[data-reveal-group].is-in > *:nth-child(2)  { transition-delay: 70ms; }
[data-reveal-group].is-in > *:nth-child(3)  { transition-delay: 140ms; }
[data-reveal-group].is-in > *:nth-child(4)  { transition-delay: 210ms; }
[data-reveal-group].is-in > *:nth-child(5)  { transition-delay: 280ms; }
[data-reveal-group].is-in > *:nth-child(6)  { transition-delay: 350ms; }
[data-reveal-group].is-in > *:nth-child(7)  { transition-delay: 420ms; }
[data-reveal-group].is-in > *:nth-child(8)  { transition-delay: 460ms; }
[data-reveal-group].is-in > *:nth-child(9)  { transition-delay: 500ms; }
[data-reveal-group].is-in > *:nth-child(n+10) { transition-delay: 540ms; }

/* ------------------------------------------------------------------ a11y -- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: var(--s-2);
  left: var(--s-2);
  z-index: var(--z-skip);
  padding: 10px 18px;
  border-radius: var(--r-md);
  background: var(--c-text);
  color: var(--c-void);
  font-size: var(--t-sm);
  font-weight: 600;
  transform: translateY(-160%);
  transition: transform var(--d-base) var(--ease);
}
.skip-link:focus-visible { transform: none; }

/* One focus treatment for the whole site. v4 had none at all. */
:focus-visible {
  outline: 2px solid var(--c-iris-text);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

/* ------------------------------------------------- Reduced motion --------- */
@media (prefers-reduced-motion: reduce) {
  html.is-smooth { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  /* Reveals must not leave content invisible when transitions are killed */
  [data-reveal],
  [data-reveal-group] > * { opacity: 1 !important; transform: none !important; }

  .thread::before { animation: none; }
}
