/* ==========================================================
   Trackio website: shared styles (every page).
   Values come from tokens.css. A page's own styles are in its
   own sheet (css/<page>.css); anything used on a second page
   lives here.
   ========================================================== */

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: var(--space-96); }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--font); font-size: var(--fs-17); font-weight: 400; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: clip;
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.1; letter-spacing: var(--track-tight); text-wrap: balance; }
p { text-wrap: pretty; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: var(--radius-6); }
.skip-link { position: absolute; left: var(--space-16); top: var(--space-16); z-index: 100; padding: var(--space-12) var(--space-18); border-radius: var(--radius-button); background: var(--ink); color: var(--on-ink); font-weight: 500; transform: translateY(-300%); }
.skip-link:focus { transform: none; }

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: calc(var(--wrap) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--space-fluid-6); }
.section--surface { background: var(--surface); }
.section--tint { background: var(--tint); }
.section--tight { padding-block: var(--space-fluid-5); }

/* ---------- Header: a glass bar that floats over the page ---------- */
.site-header { position: sticky; top: 0; z-index: 50; padding-top: var(--space-12); pointer-events: none; }
.site-header .wrap { pointer-events: none; }
.nav-bar {
  pointer-events: auto; display: flex; align-items: center; gap: var(--space-24); min-height: 60px;
  padding: var(--space-8) var(--space-8) var(--space-8) var(--space-22); border-radius: var(--radius-pill);
  background: var(--glass-fill); border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter);
}
.logo { display: inline-flex; align-items: center; gap: var(--space-6); flex: none; }
.logo-mark, .logo-word { display: block; flex: none; background: var(--ink); }
.logo-mark { width: 42px; aspect-ratio: 320 / 183; -webkit-mask: url("../assets/trackio-mark.png") center / contain no-repeat; mask: url("../assets/trackio-mark.png") center / contain no-repeat; }
.logo-word { width: 92px; aspect-ratio: 440 / 160; -webkit-mask: url("../assets/trackio-wordmark.png") center / contain no-repeat; mask: url("../assets/trackio-wordmark.png") center / contain no-repeat; }
.logo-link { display: flex; align-items: center; min-height: var(--touch); text-decoration: none; }
.nav-cta { flex: none; margin-left: auto; }
@media (max-width: 420px) {
  .nav-bar { padding-left: var(--space-16); }
  .logo-mark { width: 36px; }
  .logo-word { width: 78px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-8); min-height: 48px;
  padding: var(--space-12) var(--space-22); border: 0; border-radius: var(--radius-button);
  font-size: var(--fs-16); font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .15s var(--ease), background-color .2s, box-shadow .2s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--blue); color: var(--on-blue); box-shadow: 0 8px 20px rgb(var(--blue-rgb) / .25); }
.btn-primary:hover { box-shadow: 0 10px 26px rgb(var(--blue-rgb) / .4); }
.btn-dark { background: var(--ink); color: var(--on-ink); }
.btn-dark:hover { background: rgb(var(--ink-rgb) / .85); }
.btn-secondary { background: var(--fill); color: var(--ink); }
.btn-secondary:hover { background: var(--line); }
.btn-ghost { background: transparent; color: var(--ink); padding-inline: var(--space-14); }
.btn-ghost:hover { background: rgb(var(--ink-rgb) / .05); }
.btn-sm { min-height: var(--touch); padding: var(--space-10) var(--space-18); font-size: var(--fs-15); border-radius: var(--radius-pill); }
.text-link { display: inline-flex; align-items: center; gap: var(--space-6); min-height: var(--touch); font-weight: 500; color: var(--ink); text-decoration: underline; text-decoration-color: var(--mid); text-underline-offset: 4px; }
.text-link:hover { text-decoration-color: var(--ink); }

/* ---------- The waitlist form: one email field and a button ---------- */
.wl { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-10); text-align: left; }
.wl-row { display: flex; gap: var(--space-8); }
.wl input {
  flex: 1; min-width: 0; min-height: 48px; padding: var(--space-10) var(--space-16); border: 1px solid var(--mid); border-radius: var(--radius-button);
  background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fs-16);
}
.wl input::placeholder { color: var(--muted); opacity: 1; }
.wl input:focus-visible { outline-offset: 1px; border-color: var(--ink); }
.wl input[aria-invalid="true"] { border-color: var(--red); }
.wl-error { font-size: var(--fs-14); font-weight: 500; color: var(--red-text); }
.wl-error[hidden] { display: none; }
.wl-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.wl .btn:disabled { opacity: .7; cursor: default; }
.wl-note a { color: var(--ink); text-underline-offset: 3px; }
.wl-note .placeholder { font-weight: 500; }
.closing-card .wl-note { text-align: center; }
@media (max-width: 420px) {
  .wl-row { flex-direction: column; }
  .wl .btn { width: 100%; }
}

/* ---------- Words ---------- */
.eyebrow, .kicker { display: flex; align-items: center; gap: var(--space-8); font-size: var(--fs-12); font-weight: 600; line-height: 1.2; letter-spacing: var(--track-label); text-transform: uppercase; color: var(--muted); }
.eyebrow-dot { width: 8px; height: 8px; border-radius: var(--radius-round); background: var(--blue); }
.lede { font-size: var(--fs-lede); line-height: 1.45; color: var(--muted); }
.soft { color: var(--muted); }   /* the quieter tail of a heading */
.note { font-size: var(--fs-13); color: var(--muted); }
.placeholder { padding: 0 var(--space-4); border-radius: var(--radius-4); background: var(--amber-tint); color: var(--amber-text); }

/* ---------- Section heading ---------- */
.section-head { display: grid; gap: var(--space-16); max-width: 760px; margin-bottom: var(--space-fluid-4); }
.section-head h2 { font-size: var(--fs-h2); }
.section-head .section-lede { max-width: 620px; font-size: var(--fs-lede); line-height: 1.45; color: var(--muted); }
.section-head--center { margin-inline: auto; text-align: center; justify-items: center; }
@media (max-width: 760px) {
  /* phones: headings are centred, like the hero above them and the invitation below */
  .section-head { margin-inline: auto; text-align: center; justify-items: center; }
}

/* ---------- Cards ---------- */
.card { border-radius: var(--radius-card); background: var(--surface); padding: var(--space-fluid-1); }
.section--surface .card { background: var(--ground); }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-14); }
.card-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.feat { display: flex; flex-direction: column; gap: var(--space-12); }
.feat h3 { font-size: var(--fs-h4); letter-spacing: var(--track-snug); line-height: 1.2; }
.feat p { font-size: var(--fs-16); color: var(--muted); }
.feat .text-link { margin-top: auto; align-self: flex-start; font-size: var(--fs-15); }
.tile { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: var(--radius-tile); background: var(--ground); color: var(--ink); }
.section--surface .tile { background: var(--surface); }
.tile svg { width: 20px; height: 20px; }
a.card { text-decoration: none; transition: transform .25s var(--ease), box-shadow .25s; }
a.card:hover { transform: translateY(-3px); box-shadow: 0 18px 40px rgb(var(--shadow-rgb) / .08); }
.feat-go { display: inline-flex; align-items: center; gap: var(--space-6); margin-top: auto; padding-top: var(--space-8); font-size: var(--fs-15); font-weight: 500; }
.feat-go svg { width: 16px; height: 16px; transition: transform .25s var(--ease); }
a.card:hover .feat-go svg { transform: translateX(3px); }
@media (max-width: 1100px) { .card-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 960px) { .card-grid--3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .card-grid, .card-grid--4 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Session states: a shape and a colour together, never colour alone ---------- */
.state { display: inline-flex; align-items: center; gap: var(--space-6); font-size: var(--fs-13); font-weight: 500; white-space: nowrap; }
.state::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: var(--radius-round); background: var(--blue); }
.state--planned { color: var(--muted); }
.state--planned::before { background: transparent; box-shadow: inset 0 0 0 2px var(--mid); }
.state--amber { color: var(--amber-text); }
.state--amber::before { background: var(--amber); }
.state--missed { color: var(--red-text); }
.state--missed::before { background: transparent; box-shadow: inset 0 0 0 2px var(--red); }
.state--grey::before { background: var(--mid); }

/* ---------- Questions and answers ---------- */
.faq { display: grid; gap: var(--space-8); max-width: 820px; }
.faq details { border-radius: var(--radius-card); background: var(--surface); }
.section--surface .faq details { background: var(--ground); }
.faq summary { display: flex; align-items: center; justify-content: space-between; gap: var(--space-16); min-height: 64px; padding: var(--space-16) var(--space-22); font-size: var(--fs-18); font-weight: 500; letter-spacing: var(--track-snug); cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; flex: none; width: 10px; height: 10px; margin-right: var(--space-4); border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: translateY(-3px) rotate(45deg); transition: transform .2s var(--ease); }
.faq details[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.faq .faq-a { padding: 0 var(--space-22) var(--space-22); max-width: 680px; color: var(--muted); }

/* ---------- Closing call to action ---------- */
.closing { padding-block: var(--space-fluid-5) var(--space-fluid-6); }
.closing-card { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: var(--space-20); padding: var(--space-fluid-5) var(--space-fluid-2); border-radius: var(--radius-sheet); background: var(--ink); color: var(--on-ink); text-align: center; }
.closing-card h2 { max-width: 16em; font-size: var(--fs-h2); }
.closing-card > p { max-width: 34em; font-size: var(--fs-lede); color: rgb(var(--on-ink-rgb) / .7); }
.closing-card .wl { width: 100%; max-width: 480px; }
.closing-card .wl-note { color: rgb(var(--on-ink-rgb) / .7); }
.closing-card .wl-note a { color: var(--on-ink); }
.closing-card .wl-error { color: var(--on-ink); }
.closing-card .wl input { border-color: transparent; }

/* ---------- Footer ---------- */
.site-footer { padding-block: var(--space-fluid-4); border-top: 1px solid var(--line); }
.footer-grid { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-32); }
.footer-brand { display: grid; gap: var(--space-12); max-width: 320px; }
.footer-brand p { font-size: var(--fs-15); color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--space-4) var(--space-24); }
.footer-links a { display: inline-flex; align-items: center; min-height: var(--touch); font-size: var(--fs-15); color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--ink); text-decoration: underline; }
.footer-legal { margin-top: var(--space-32); padding-top: var(--space-20); border-top: 1px solid var(--line); display: grid; gap: var(--space-6); font-size: var(--fs-13); color: var(--muted); }

/* ---------- Pause button on an animation (glass: it floats over the drawing) ---------- */
.anim-pause {
  position: absolute; z-index: 5; display: grid; place-items: center; width: var(--touch); height: var(--touch); border-radius: var(--radius-round);
  background: var(--glass-fill); border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter); cursor: pointer;
}
.anim-pause[hidden] { display: none; }
.ic-pause { width: 12px; height: 14px; border-inline: 4px solid var(--ink); }
.anim-pause[aria-pressed="true"] .ic-pause { width: 0; height: 0; margin-left: var(--space-2); border-block: 7px solid transparent; border-left: 12px solid var(--ink); border-right: 0; }

/* ---------- Scroll reveal (js/site.js adds .is-in) ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease), transform .6s var(--ease); transition-delay: var(--reveal-delay, 0s); }
.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .15s !important; }
  .js .reveal { opacity: 1; transform: none; }
}

/* ---------- Hero (every page's first section) ---------- */
.hero { overflow: clip; }
.hero-ctas { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-8); }
.hero-ctas .btn-ghost svg { width: 18px; height: 18px; }
.hero-facts { display: flex; flex-wrap: wrap; gap: var(--space-8) var(--space-20); font-size: var(--fs-14); color: var(--muted); }
.hero-facts li { display: flex; align-items: center; gap: var(--space-8); }
.hero-facts svg { width: 18px; height: 18px; }

/* ---------- A plain, centred page (thank you, not found) ---------- */
.plain { padding-block: var(--space-fluid-6); }
.plain-inner { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: var(--space-20); text-align: center; }
.plain-inner h1 { font-size: var(--fs-title); }
.plain-inner .lede { max-width: 28em; }
.plain-mark { display: grid; place-items: center; width: 56px; height: 56px; border-radius: var(--radius-round); background: var(--ink); color: var(--on-ink); }

/* ---------- Long text (privacy) ---------- */
.prose { max-width: calc(720px + 2 * var(--gutter)); }
.prose h1 { margin-top: var(--space-12); font-size: var(--fs-title); }
.prose h2 { margin-top: var(--space-40); font-size: var(--fs-h3); letter-spacing: var(--track-snug); }
.prose p { margin-top: var(--space-14); color: var(--muted); }
.prose p.eyebrow { margin-top: 0; }
.prose-notice { padding: var(--space-16) var(--space-18); border-radius: var(--radius-button); background: var(--amber-tint); }
.prose p.prose-notice { margin-top: var(--space-24); color: var(--amber-text); }
