/*
  myeasytool shared design tokens + primitives.
  Used by the homepage now; the tool pages (tools/clinic-queue, tools/workshop-board) adopt this
  in a follow-up pass rather than being redesigned twice (platform/homepage-redesign.md, Pass 5).

  Principles this file encodes:
  - Motion is transform/opacity only. No layout-affecting properties are animated.
  - Everything is designed for light AND dark from the start (prefers-color-scheme), not
    retrofitted with a handful of dark overrides.
  - `prefers-reduced-motion: reduce` kills every non-essential animation — see the block at the
    bottom, which must stay last so it wins the cascade.
*/

:root {
  color-scheme: light dark;

  /* Brand gradient — same ramp as assets/logo.svg. */
  --grad-start: #6366f1;
  --grad-mid: #a855f7;
  --grad-end: #22d3ee;
  --brand-gradient: linear-gradient(120deg, var(--grad-start), var(--grad-mid) 55%, var(--grad-end));

  --bg: #f7f7fb;
  --bg-elevated: #ffffff;
  --text: #16181f;
  --text-muted: #565f70;
  --border: #e3e5ee;
  --shadow-color: 220 30% 15%;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;

  --nav-h: 72px;
  --nav-h-condensed: 56px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0b12;
    --bg-elevated: #12141f;
    --text: #eef0f6;
    --text-muted: #9ba3b7;
    --border: #262a3a;
    --shadow-color: 230 60% 3%;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

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

a { color: inherit; }

/* Anchor targets land below the sticky nav instead of underneath it. */
[id] { scroll-margin-top: calc(var(--nav-h-condensed) + 16px); }

h1, h2, h3 { line-height: 1.15; margin: 0; }

.eyebrow {
  display: inline-block;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--grad-mid);
}

.gradient-text {
  background: var(--brand-gradient);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.section {
  max-width: 1080px;
  margin: 0 auto;
  padding: 5rem 1.5rem;
}

.section-head { max-width: 640px; margin: 0 0 2.5rem; }
.section-head p { color: var(--text-muted); font-size: 1.05rem; margin: 0.6rem 0 0; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-sm);
  font-weight: 650;
  font-size: 0.98rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background-position 0.6s var(--ease);
}
.btn.primary {
  background: var(--brand-gradient);
  background-size: 160% 100%;
  background-position: 0% 0%;
  color: #fff;
  box-shadow: 0 8px 24px -8px hsl(var(--shadow-color) / 0.55);
}
.btn.primary:hover { background-position: 100% 0%; transform: translateY(-1px); }
.btn.secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn.secondary:hover { border-color: var(--grad-mid); }
.btn.ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 0.6rem 0;
  font-weight: 600;
}
.btn.ghost:hover { color: var(--text); }

/* Cards */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.6rem;
}

/* Pointer-tracked spotlight — a soft glow that follows the cursor, set via JS custom properties
   (--mx/--my) on hover. Falls back to a plain card with no glow when JS never sets them. */
.spotlight-card {
  position: relative;
  overflow: hidden;
}
.spotlight-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(320px circle at var(--mx, -999px) var(--my, -999px),
              hsl(265 85% 65% / 0.14), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
  pointer-events: none;
}
.spotlight-card:hover::before { opacity: 1; }
.spotlight-card:hover { border-color: color-mix(in srgb, var(--grad-mid) 45%, var(--border)); }

/* Focus visibility — never let a keyboard user get lost. */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--grad-mid);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Progressive-enhancement scroll reveal.
   `.js` is added by an inline head script (to avoid a visible-then-hidden flash), so a page with
   JS disabled never gets it and stays fully visible. If JS is enabled but assets/site.js itself
   fails to load (network hiccup, ad blocker, CSP), the script tag's `onerror` in index.html removes
   `.js` again — without that, `.in-view` would never get added and content would stay opacity:0
   forever. Don't drop that onerror handler; it's load-bearing, not decorative. */
html.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
html.js .reveal.in-view { opacity: 1; transform: none; }
html.js .reveal-stagger > * {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
html.js .reveal-stagger.in-view > * { opacity: 1; transform: none; }
html.js .reveal-stagger.in-view > *:nth-child(1) { transition-delay: 0ms; }
html.js .reveal-stagger.in-view > *:nth-child(2) { transition-delay: 90ms; }
html.js .reveal-stagger.in-view > *:nth-child(3) { transition-delay: 180ms; }
html.js .reveal-stagger.in-view > *:nth-child(4) { transition-delay: 270ms; }
html.js .reveal-stagger.in-view > *:nth-child(5) { transition-delay: 360ms; }

/* Scroll progress bar, driven by one rAF-throttled listener (see assets/site.js). */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: var(--scroll-pct, 0%);
  background: var(--brand-gradient);
  z-index: 60;
  transition: width 0.1s linear;
}

footer.site-footer {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  border-top: 1px solid var(--border);
}

/* Kill all non-essential motion for anyone who's asked for it — a hard requirement, not a nicety. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  html.js .reveal, html.js .reveal-stagger > * {
    opacity: 1 !important;
    transform: none !important;
  }
}
