/* =============================================================
   MEDICAL INTELLIGENCE — pablosuxo.com
   Design system "Pulso" v3 · shared across every page
   =============================================================

   1.  Tokens
   2.  Reset & base
   3.  Utilities & language switching
   4.  Typography & labels
   5.  Buttons & links
   6.  Header / nav (desktop + mobile drawer)
   7.  Cards, chips, tags
   8.  Dark panels (--green-deep surfaces)
   9.  Forms (Netlify) + success state
   10. Pulso signature (draw animation, focal dot, lists)
   11. Footer
   12. Reveal & stagger motion
   13. Credits page
   14. Page scaffolding helpers
   15. Responsive
   16. Reduced motion
   ============================================================= */

/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --teal:        #1D9E75;
  --green-deep:  #085041;
  --green-light: #E1F5EE;
  --purple:      #534AB7;
  --lavender:    #9B92F0;
  --ink:         #0F2A23;
  --gray:        #577068;
  --line:        #CFE7DD;
  --paper:       #FBFDFC;
  --mint:        #7FE3C1;

  --serif: 'Fraunces', Georgia, serif;
  --sans:  'Inter', system-ui, -apple-system, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, monospace;

  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft:   cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  --wrap: 1120px;
  --wrap-narrow: 760px;
  --gutter: clamp(20px, 4vw, 40px);
  --nav-h: 68px;

  --radius-card: 14px;
  --radius-btn: 10px;
  --shadow-card: 0 18px 50px -28px rgba(8, 80, 65, 0.45);
  --shadow-card-hover: 0 26px 60px -24px rgba(8, 80, 65, 0.5);
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
  scroll-behavior: smooth;
}

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-y: none;
}

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
ul[class], ol[class] { list-style: none; padding: 0; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; }
::selection { background: var(--mint); color: var(--green-deep); }

:focus-visible {
  outline: 3px solid var(--purple);
  outline-offset: 3px;
  border-radius: 4px;
}

/* =============================================================
   3. Utilities & language switching
   ============================================================= */
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.wrap-narrow { max-width: var(--wrap-narrow); margin-inline: auto; padding-inline: var(--gutter); }

.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--green-deep); color: var(--paper);
  z-index: 9999; border-radius: 8px; font-weight: 500;
}
.skip-link:focus { top: 1rem; }

.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;
}

/* Language switching — CSS-only, driven by body class (en | es) */
body.en .lang-es { display: none !important; }
body.es .lang-en { display: none !important; }

.hairline { border: 0; border-top: 1px solid var(--line); }
.rule-teal { border: 0; border-top: 2px solid var(--teal); width: 46px; }

/* =============================================================
   4. Typography & labels
   ============================================================= */
h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.01em;
}

h1, .h1 { font-size: clamp(36px, 5vw, 52px); }
h2, .h2 { font-size: clamp(28px, 3.6vw, 36px); }
h3, .h3 { font-size: 20px; font-weight: 500; }

em { font-style: italic; }
h1 em, h2 em { font-weight: 500; }

.lead {
  font-size: clamp(16.5px, 1.6vw, 19px);
  color: var(--gray);
  max-width: 58ch;
}

/* Section eyebrow — JetBrains Mono uppercase label with teal rule */
.kicker {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 18px;
}
.kicker::before {
  content: "";
  width: 26px; height: 2px;
  background: var(--teal);
  border-radius: 2px;
  flex: none;
}
.kicker--bare::before { display: none; }

/* Plain mono label (no rule) — for card flags, footnotes, data */
.mono-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gray);
}

.section-title {
  font-size: clamp(30px, 4.2vw, 44px);
  max-width: 24ch;
}
.section-title em { font-style: italic; font-weight: 500; }

section { padding-block: clamp(72px, 10vw, 120px); }

/* Editorial pull-quote (Fraunces italic) */
.pull-quote {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.35;
  color: var(--green-deep);
  max-width: 30ch;
}

/* =============================================================
   5. Buttons & links
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-weight: 600; font-size: 15px;
  min-height: 48px;
  padding: 13px 28px; border-radius: var(--radius-btn);
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out),
              background .2s, border-color .2s, color .2s;
  will-change: transform;
}
.btn-primary {
  background: var(--teal); color: #fff;
  box-shadow: 0 6px 20px rgba(29, 158, 117, 0.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(29, 158, 117, 0.45); }

/* Outline on light surfaces */
.btn-outline {
  border: 1.5px solid var(--line); color: var(--green-deep);
}
.btn-outline:hover { border-color: var(--teal); color: var(--teal); transform: translateY(-2px); }

/* Ghost on dark surfaces */
.btn-ghost {
  border: 1.5px solid rgba(225, 245, 238, 0.35); color: var(--green-light);
}
.btn-ghost:hover { border-color: var(--mint); transform: translateY(-2px); }

.btn[disabled], .btn.is-disabled {
  opacity: .5; pointer-events: none; box-shadow: none;
}

/* Inline text link */
.text-link {
  color: var(--teal); font-weight: 500;
  border-bottom: 1px solid transparent;
  transition: border-color .25s;
}
.text-link:hover { border-color: currentColor; }

/* Arrow link (card / service CTA) */
.arrow-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 14.5px; color: var(--teal);
}
.arrow-link .arr { transition: transform .3s var(--ease-out); }
.arrow-link:hover .arr { transform: translateX(5px); }

/* =============================================================
   6. Header / nav
   ============================================================= */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(251, 253, 252, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.nav-bar {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--nav-h); gap: 16px;
}

.wordmark { display: flex; align-items: center; gap: 11px; min-height: 44px; }
.wordmark svg { width: 34px; height: auto; flex: none; }
.wordmark-text {
  font-family: var(--serif); font-weight: 500; font-size: 17.5px;
  letter-spacing: -0.01em; color: var(--ink); white-space: nowrap;
}
.wordmark-text .dot { color: var(--purple); }

.nav-links { display: none; gap: 26px; align-items: center; }
.nav-links a {
  font-size: 14px; font-weight: 500; color: var(--gray);
  position: relative; padding-block: 4px;
  transition: color .25s var(--ease-out);
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 100%; height: 1.5px; background: var(--teal);
  transform: scaleX(0); transform-origin: right;
  transition: transform .35s var(--ease-out);
}
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { transform: scaleX(1); transform-origin: left; }
.nav-links a[aria-current="page"] { color: var(--ink); }
.nav-links a[aria-current="page"]::after { transform: scaleX(1); }

.nav-right { display: flex; align-items: center; gap: 12px; }

/* Padded pill: each button carries its own radius — no clipping against
   the container edge (avoids a hairline seam at fractional DPI, e.g.
   Windows 125% scaling) */
.lang-toggle {
  display: flex; gap: 2px; padding: 3px;
  border: 1px solid var(--line); border-radius: 100px;
  background: var(--paper);
}
.lang-toggle button {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.08em;
  padding: 5px 12px; min-height: 28px; color: var(--gray);
  border-radius: 100px;
  transition: background .2s, color .2s;
}
.lang-toggle button.active { background: var(--green-deep); color: var(--mint); }

/* Hamburger — visible below 960px */
.nav-toggle {
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper);
}
.nav-toggle-bar {
  position: relative; display: block;
  width: 18px; height: 2px; background: var(--ink); border-radius: 2px;
  transition: background .2s;
}
.nav-toggle-bar::before, .nav-toggle-bar::after {
  content: ""; position: absolute; left: 0;
  width: 18px; height: 2px; background: var(--ink); border-radius: 2px;
  transition: transform .3s var(--ease-out), top .3s var(--ease-out);
}
.nav-toggle-bar::before { top: -6px; }
.nav-toggle-bar::after { top: 6px; }
body.nav-open .nav-toggle-bar { background: transparent; }
body.nav-open .nav-toggle-bar::before { top: 0; transform: rotate(45deg); }
body.nav-open .nav-toggle-bar::after { top: 0; transform: rotate(-45deg); }

/* Mobile drawer — nav-links become a panel under the header */
body.nav-open .nav-links {
  display: flex; flex-direction: column; align-items: stretch; gap: 0;
  position: absolute; top: var(--nav-h); left: 0; right: 0;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 24px 40px -24px rgba(8, 80, 65, 0.35);
  padding: 8px var(--gutter) 16px;
}
body.nav-open .nav-links a {
  font-size: 16px; padding: 13px 4px; min-height: 48px;
  display: flex; align-items: center;
  border-bottom: 1px solid var(--line);
}
body.nav-open .nav-links a:last-child { border-bottom: 0; }
body.nav-open .nav-links a::after { display: none; }

/* =============================================================
   7. Cards, chips, tags
   ============================================================= */
.card {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: clamp(26px, 3vw, 34px) clamp(22px, 2.6vw, 30px);
  box-shadow: var(--shadow-card);
  transition: transform .35s var(--ease-out), box-shadow .35s var(--ease-out),
              border-color .35s var(--ease-out);
}
a.card:hover, .card--link:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--teal);
}

/* Top accent notch (teal by default) */
.card--notch::before {
  content: ""; position: absolute; top: 0; left: 30px;
  width: 46px; height: 3px; border-radius: 0 0 3px 3px;
  background: var(--teal);
}

/* Tinted card on --green-light surfaces */
.card--tint { background: var(--green-light); border-color: var(--line); box-shadow: none; }

/* Muted / "coming 2027" card — non-clickable, quiet */
.card--muted {
  background: transparent;
  border: 1.5px dashed var(--line);
  box-shadow: none;
  color: var(--gray);
}
.card--muted:hover { transform: none; }
.card-flag {
  display: inline-block;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gray);
  border: 1px solid var(--line); border-radius: 100px;
  padding: 5px 12px; margin-bottom: 16px;
}

.card h3 { font-size: 21.5px; font-weight: 600; margin-bottom: 12px; }
.card p { font-size: 15px; color: var(--gray); }

/* Responsive card grids */
.card-grid { display: grid; gap: 22px; }

/* Chips — small mono pills (languages, facts) */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.05em;
  border: 1px solid var(--line); border-radius: 100px;
  padding: 6px 14px; color: var(--ink);
}
.chip b { color: var(--teal); font-weight: 500; }

/* Tags — uppercase micro-labels on cards (teal text: purple is never text) */
.tag {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--teal);
  border: 1px solid var(--line); border-radius: 100px; padding: 5px 12px;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* =============================================================
   8. Dark panels — sections on --green-deep
   ============================================================= */
.panel-dark {
  background: var(--green-deep);
  color: var(--green-light);
  position: relative;
  overflow: clip;
}
.panel-dark > .wrap, .panel-dark > .wrap-narrow { position: relative; z-index: 2; }

.panel-dark h1, .panel-dark h2, .panel-dark h3 { color: #fff; }
.panel-dark h1 em, .panel-dark h2 em { color: var(--mint); }
.panel-dark p { color: rgba(225, 245, 238, 0.82); }
.panel-dark .kicker { color: var(--mint); }
.panel-dark .kicker::before { background: var(--mint); }
.panel-dark .mono-label { color: var(--mint); }
.panel-dark .chip { border-color: rgba(225, 245, 238, 0.3); color: var(--green-light); }
.panel-dark .chip b { color: var(--mint); }
.panel-dark .hairline { border-color: rgba(225, 245, 238, 0.16); }
.panel-dark .pull-quote { color: var(--green-light); }
.panel-dark .wordmark-text { color: #fff; }
.panel-dark .wordmark-text .dot { color: var(--lavender); }

/* Ambient glow — optional decorative layer inside a dark panel */
.panel-glow {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(52% 44% at 12% 8%, rgba(29, 158, 117, 0.34), transparent 72%),
    radial-gradient(40% 38% at 88% 92%, rgba(83, 74, 183, 0.22), transparent 74%);
  animation: glowDrift 26s var(--ease-soft) infinite alternate;
}
@keyframes glowDrift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(2%, -2%, 0) scale(1.06); }
}

/* Subtle grain texture for dark heroes */
.panel-grain {
  position: absolute; inset: 0; pointer-events: none; opacity: 0.05;
  mix-blend-mode: overlay;
  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.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Light-tint section (--green-light surface) */
.panel-tint { background: var(--green-light); }

/* =============================================================
   9. Forms — Netlify pattern + success state
   ============================================================= */
.form-card {
  background: var(--paper);
  border: 1px solid var(--line); border-radius: 16px;
  padding: clamp(26px, 3.5vw, 40px);
  box-shadow: var(--shadow-card);
}
.form-card h3 { font-size: 22px; margin-bottom: 6px; }
.form-card .form-sub { font-size: 14px; color: var(--gray); margin-bottom: 26px; }

/* Form card keeps its own (light) palette even inside dark panels */
.panel-dark .form-card h3 { color: var(--ink); }
.panel-dark .form-card p { color: var(--gray); }

.form-grid { display: grid; gap: 16px; }

.form-card label, .form-label {
  display: block;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--gray); margin-bottom: 7px;
}
.form-card input, .form-card select, .form-card textarea,
.input {
  width: 100%;
  font: inherit; font-size: 15px;
  padding: 13px 16px; min-height: 48px;
  border: 1px solid var(--line); border-radius: var(--radius-btn);
  background: var(--paper); color: var(--ink);
  transition: border-color .25s;
}
.form-card input:focus, .form-card select:focus, .form-card textarea:focus,
.input:focus { outline: none; border-color: var(--teal); }

.form-card textarea { resize: vertical; min-height: 110px; }
.form-card select, select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23577068' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center;
}

.form-card .btn-primary { width: 100%; margin-top: 6px; }
.form-note { font-size: 12px; color: var(--gray); margin-top: 12px; text-align: center; }

/* Inline email row (newsletter / resources) */
.field-row { display: flex; gap: 10px; flex-wrap: wrap; }
.field-row .input { flex: 1 1 240px; width: auto; }

/* Success state — form is replaced by a drawn check */
.form-success { display: none; text-align: center; padding-block: 34px; }
.is-sent form { display: none; }
.is-sent .form-success { display: block; }
.form-success svg { width: 64px; height: 64px; margin: 0 auto 18px; }
.form-success .check-circle {
  fill: none; stroke: var(--teal); stroke-width: 2.4;
  stroke-dasharray: 180; stroke-dashoffset: 180;
  animation: pulsoDraw 0.7s var(--ease-out) forwards;
}
.form-success .check-mark {
  fill: none; stroke: var(--teal); stroke-width: 2.8;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 40; stroke-dashoffset: 40;
  animation: pulsoDraw 0.45s var(--ease-out) 0.6s forwards;
}
.form-success h4 { font-family: var(--serif); font-size: 21px; margin-bottom: 8px; }
.form-success p { font-size: 14.5px; color: var(--gray); }

/* =============================================================
   10. Pulso signature — the one brand gesture
   =============================================================
   Usage: <svg data-pulse> with .trace (stroke path) + .dot (circle).
   - [data-pulse]           → draws when scrolled into view (JS adds .is-visible)
   - [data-pulse="load"]    → draws on page load, no observer needed
   ============================================================= */
[data-pulse] .trace {
  fill: none; stroke: var(--teal); stroke-width: 2.5;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1200; stroke-dashoffset: 1200;
}
[data-pulse] .dot {
  fill: var(--purple); opacity: 0;
  transform-origin: center; transform-box: fill-box;
}
[data-pulse].is-visible .trace,
[data-pulse="load"] .trace { animation: pulsoDraw 2.2s var(--ease-out) 0.3s forwards; }
[data-pulse].is-visible .dot,
[data-pulse="load"] .dot { animation: dotPop .45s var(--ease-bounce) 2.35s forwards; }

/* On dark panels the stroke reverses to green-light, the dot to lavender */
.panel-dark [data-pulse] .trace { stroke: rgba(225, 245, 238, 0.9); }
.panel-dark [data-pulse] .dot { fill: var(--lavender); }

@keyframes pulsoDraw { to { stroke-dashoffset: 0; } }
@keyframes dotPop {
  from { opacity: 0; transform: scale(0.3); }
  to   { opacity: 1; transform: scale(1); }
}

/* No-JS: everything visible */
html.no-js [data-pulse] .trace { stroke-dashoffset: 0; animation: none; }
html.no-js [data-pulse] .dot { opacity: 1; animation: none; }

/* Pulsing focal dot (kickers, live labels) */
.pulse-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--mint); flex: none;
  animation: dotPulse 2.4s ease-in-out infinite;
}
@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(127, 227, 193, 0.5); }
  50%      { box-shadow: 0 0 0 7px rgba(127, 227, 193, 0); }
}

/* Brand bullet list — 7px purple focal dot per item (use sparingly) */
.dot-list { display: grid; gap: 12px; }
.dot-list li {
  position: relative; padding-left: 22px;
  font-size: 15px;
}
.dot-list li::before {
  content: ""; position: absolute; left: 0; top: 0.62em;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--purple);
}
.panel-dark .dot-list li::before { background: var(--lavender); }

/* =============================================================
   11. Footer
   ============================================================= */
.site-footer {
  background: var(--green-deep); color: var(--green-light);
  padding-block: 54px 34px;
}
.site-footer .wordmark-text { color: #fff; }
.site-footer .wordmark-text .dot { color: var(--lavender); }

.footer-top {
  display: grid; gap: 36px;
  padding-bottom: 34px;
  border-bottom: 1px solid rgba(225, 245, 238, 0.16);
}
.footer-tagline {
  font-family: var(--serif); font-style: italic; font-size: 15.5px;
  color: rgba(225, 245, 238, 0.75); margin-top: 10px; max-width: 30ch;
}
.footer-label {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--mint); margin-bottom: 14px;
}
.footer-col ul { display: grid; gap: 9px; list-style: none; padding: 0; }
.footer-col a {
  font-size: 13.5px; color: rgba(225, 245, 238, 0.75);
  transition: color .25s;
  display: inline-flex; align-items: center; min-height: 28px;
}
.footer-col a:hover { color: var(--mint); }

.footer-note {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em;
  text-transform: uppercase; color: rgba(225, 245, 238, 0.45);
  padding-top: 24px;
}

.footer-bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px;
  padding-top: 16px;
}
.footer-bottom p {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  color: rgba(225, 245, 238, 0.55);
}
.footer-bottom a { color: rgba(225, 245, 238, 0.75); border-bottom: 1px solid rgba(225, 245, 238, 0.3); }
.footer-bottom a:hover { color: var(--mint); }

/* =============================================================
   12. Reveal & stagger motion
   ============================================================= */
/* Keyframe-driven (not transition-driven): a transition whose start
   time never resolves — e.g. after a programmatic #anchor jump — would
   leave content invisible; keyframes take their timing straight from
   the document timeline. */
@keyframes revealUp {
  from { opacity: 0; transform: translateY(34px); }
  to   { opacity: 1; transform: none; }
}

.reveal { opacity: 0; }
html.no-js .reveal { opacity: 1; }
.reveal.is-visible { animation: revealUp .9s var(--ease-out) both; }

[data-stagger] > * { opacity: 0; }
html.no-js [data-stagger] > * { opacity: 1; }
[data-stagger].is-visible > * { animation: revealUp .8s var(--ease-out) both; }
[data-stagger].is-visible > *:nth-child(2) { animation-delay: .12s; }
[data-stagger].is-visible > *:nth-child(3) { animation-delay: .24s; }
[data-stagger].is-visible > *:nth-child(4) { animation-delay: .36s; }
[data-stagger].is-visible > *:nth-child(5) { animation-delay: .48s; }
[data-stagger].is-visible > *:nth-child(6) { animation-delay: .60s; }

/* =============================================================
   13. Credits page
   ============================================================= */
.page-credits main { max-width: var(--wrap-narrow); margin-inline: auto; padding: 80px var(--gutter) 100px; }
.page-credits h1 { font-size: clamp(30px, 5vw, 42px); margin-bottom: 16px; }
.page-credits .credits-intro { color: var(--gray); margin-bottom: 40px; }
.credits-list { list-style: none; padding: 0; display: grid; gap: 14px; }
.credits-list li {
  padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px;
  font-size: 14.5px; color: var(--gray); line-height: 1.7;
}
.credits-list li strong { color: var(--ink); }
.credits-list li a { color: var(--teal); border-bottom: 1px solid currentColor; }

/* Legacy nav CTA kept for the credits page back-link */
.nav-cta {
  display: inline-flex; align-items: center;
  font-size: 13.5px; font-weight: 600; min-height: 44px;
  background: var(--teal); color: #fff;
  padding: 9px 18px; border-radius: 9px;
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out);
  box-shadow: 0 4px 14px rgba(29, 158, 117, 0.25);
}
.nav-cta:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(29, 158, 117, 0.32); }

/* =============================================================
   13b. 404 — flat-lined Pulso that revives on hover/focus
   ============================================================= */
.notfound { min-height: calc(100vh - var(--nav-h)); min-height: calc(100svh - var(--nav-h)); display: grid; align-items: center; text-align: center; }
.flatline {
  width: min(440px, 82vw); height: auto; margin: 0 auto clamp(28px, 4vw, 44px);
  cursor: pointer; outline-offset: 8px;
}
.flatline .flat {
  fill: none; stroke: rgba(225, 245, 238, 0.45); stroke-width: 4;
  stroke-linecap: round; stroke-linejoin: round;
  transition: opacity .4s var(--ease-out);
}
.flatline .peak {
  fill: none; stroke: var(--mint); stroke-width: 4;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 460; stroke-dashoffset: 460; opacity: 0;
}
.flatline .peak-dot {
  fill: var(--lavender); opacity: 0;
  transform-origin: center; transform-box: fill-box;
}
.flatline:hover .flat, .flatline:focus-visible .flat { opacity: 0; }
.flatline:hover .peak, .flatline:focus-visible .peak {
  opacity: 1; animation: pulsoDraw 1.1s var(--ease-out) forwards;
}
.flatline:hover .peak-dot, .flatline:focus-visible .peak-dot {
  animation: dotPop .4s var(--ease-bounce) 1s forwards;
}
.notfound .error-code {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--mint); margin-bottom: 18px;
}

/* =============================================================
   14. Page scaffolding helpers
   ============================================================= */
/* Page hero on dark (pillar pages) */
.page-hero {
  padding-block: clamp(80px, 11vw, 140px) clamp(60px, 8vw, 100px);
}

/* Under-construction stub */
.stub-main { min-height: 55vh; display: grid; align-items: center; }
.stub-main .kicker { justify-content: flex-start; }

/* =============================================================
   14b. Home page
   ============================================================= */
/* Hero — full viewport on --green-deep, isotype draws on entry */
.home-hero {
  min-height: calc(100vh - var(--nav-h));
  min-height: calc(100svh - var(--nav-h));
  display: flex; align-items: center;
  padding-block: clamp(70px, 9vw, 110px) clamp(56px, 7vw, 90px);
}

.pulso-isotype { width: clamp(96px, 11vw, 132px); height: auto; }
.pulso-isotype .trace {
  stroke-width: 8;
  stroke-dasharray: 150; stroke-dashoffset: 150;
  animation-duration: 1.5s; animation-delay: 0.2s;
}
.pulso-isotype .dot { animation-delay: 1.6s; }

.home-hero .hero-name {
  font-size: clamp(42px, 6.2vw, 72px);
  line-height: 1.04;
  color: #fff;
  margin-top: 36px;
  max-width: 14ch;
}
.home-hero .hero-headline {
  font-family: var(--mono); font-size: clamp(11px, 1.3vw, 13px);
  font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--mint);
  margin-top: 24px;
}
.home-hero .hero-bio { margin-top: 18px; }
.home-hero .hero-cta { margin-top: 40px; }

/* Hero entrance stagger (keyframe-driven, see section 12) */
.hero-stagger > * { opacity: 0; }
html.no-js .hero-stagger > * { opacity: 1; }
.hero-stagger > *.is-in { animation: revealUp .9s var(--ease-out) both; }

/* Triple circle — three editorial columns on --paper */
.circles-grid { display: grid; gap: 40px 34px; margin-top: 56px; }
.circle-col { border-top: 2px solid var(--teal); padding-top: 22px; }
.circle-col:nth-child(2) { border-top-color: var(--green-deep); }
.circle-col:nth-child(3) { border-top-color: var(--mint); }
.circle-col .circle-num {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em;
  color: var(--gray); display: block; margin-bottom: 18px;
}
.circle-col h3 { font-size: 21.5px; font-weight: 600; margin-bottom: 12px; }
.circle-col p { font-size: 15px; color: var(--gray); }

.moat-quote {
  margin: clamp(56px, 7vw, 84px) auto 0;
  max-width: 36ch;
  text-align: center;
}
.moat-quote .pull-quote { margin-inline: auto; max-width: none; }

/* Ecosystem doors */
.doors-grid { margin-top: 56px; }
.door-card { display: flex; flex-direction: column; align-items: flex-start; }
.door-card .mono-label { margin-bottom: 16px; color: var(--teal); }
.door-card p { flex: 1; }
.door-card .arrow-link { margin-top: 18px; }
.door-card.card--muted .mono-label { color: var(--gray); }

/* Newton close — full-width dark panel, the period is the focal dot */
.newton { text-align: center; }
.newton-quote {
  font-family: var(--serif); font-style: italic; font-weight: 500;
  font-size: clamp(26px, 4.4vw, 46px);
  line-height: 1.25;
  color: #fff;
  max-width: 22ch;
  margin-inline: auto;
}
.newton-dot {
  display: inline-block;
  width: 0.3em; height: 0.3em; border-radius: 50%;
  background: var(--lavender);
  margin-left: 0.1em;
}
.newton-attr {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--mint);
  margin-top: 26px;
}
.newton-line { margin-top: 30px; font-size: 16.5px; }
.newton .wrap { max-width: 900px; }

/* Contact strip */
.contact-strip { text-align: center; }
.contact-strip .section-title { margin-inline: auto; }
.contact-strip .contact-actions {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 14px;
  margin-top: 36px;
}

/* =============================================================
   14c. Pillar pages (Medical Writing, Audit, Academy…)
   ============================================================= */
/* Light hero on --paper with teal accents */
.pillar-hero {
  padding-block: clamp(72px, 9vw, 120px) clamp(48px, 6vw, 72px);
  border-bottom: 1px solid var(--line);
}
.pillar-hero h1 { max-width: 18ch; }
.pillar-hero .lead { margin-top: 20px; }
.pillar-hero .hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 36px; }
.pillar-hero [data-pulse] { width: 100%; max-width: 560px; margin-top: clamp(40px, 5vw, 60px); }

/* Service-line cards — Line C flagged as the differentiator */
.line-card .mono-label { color: var(--teal); margin-bottom: 16px; }
.line-card ul { margin-top: 14px; display: grid; gap: 8px; list-style: none; padding: 0; }
.line-card li { font-size: 14.5px; color: var(--gray); padding-left: 18px; position: relative; }
.line-card li::before {
  content: ""; position: absolute; left: 0; top: 0.62em;
  width: 8px; height: 2px; border-radius: 2px; background: var(--teal);
}
.line-card--flag { border: 2px solid var(--teal); }
.line-card--flag::before { background: var(--purple); }
.line-flag {
  display: inline-block;
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--green-deep); background: var(--green-light);
  border-radius: 100px; padding: 5px 12px; margin-bottom: 16px;
}

/* Price list — grouped rows with mono prices */
.price-cols { display: grid; gap: 40px; margin-top: 56px; }
.price-group > .mono-label { color: var(--teal); display: block; margin-bottom: 6px; }
.price-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  padding-block: 14px;
  border-bottom: 1px solid var(--line);
}
.price-row .price-name { font-size: 15px; color: var(--ink); }
.price-row .price-meta {
  display: block; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.08em; color: var(--gray); margin-top: 3px;
}
.price-row .price-val {
  font-family: var(--mono); font-size: 13.5px; font-weight: 500;
  color: var(--green-deep); white-space: nowrap;
}
.price-note { font-size: 13px; color: var(--gray); margin-top: 26px; }

/* Pipeline — numbered stages with the MD gate as the focal point */
.pipeline { margin-top: 56px; display: grid; gap: 0; max-width: 720px; }
.pipeline-step {
  display: grid; grid-template-columns: 56px 1fr; gap: 18px;
  padding-block: 22px;
  border-bottom: 1px solid var(--line);
}
.pipeline-step:last-child { border-bottom: 0; }
.pipeline-step .step-num {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em;
  color: var(--teal); padding-top: 3px;
}
.pipeline-step h3 { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.pipeline-step p { font-size: 14.5px; color: var(--gray); }
.pipeline-step--gate { background: var(--green-light); border-radius: 12px; padding-inline: 18px; border-bottom: 0; margin-block: 6px; }
.pipeline-step--gate h3 { display: flex; align-items: center; gap: 10px; }
.pipeline-step--gate h3::after {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--purple); flex: none;
}

/* Portfolio cards + sample badges */
.badge-phi, .badge-pub {
  display: inline-block;
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
  border-radius: 100px; padding: 5px 12px; margin-bottom: 16px;
}
.badge-pub { color: var(--paper); background: var(--teal); }
.badge-phi { color: var(--gray); border: 1px solid var(--line); }

/* Formal citation + small print on portfolio cards */
.cite strong { color: var(--ink); font-weight: 600; }
.fine-note { font-size: 12px; color: var(--gray); margin-top: 10px; }

/* Academy sub-brand lockup — Fraunces 500, purple period */
.academy-lockup {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(19px, 2.3vw, 25px);
  letter-spacing: -0.01em; color: var(--ink);
}
.academy-lockup .dot { color: var(--purple); }

/* Brand-echo line under a translated headline (muted, Fraunces italic) */
.hero-echo {
  font-family: var(--serif); font-style: italic; font-weight: 500;
  font-size: clamp(16px, 1.9vw, 20px);
  color: var(--gray);
  margin-top: 12px;
}

/* Newsletter */
.newsletter-name { font-size: clamp(38px, 6.4vw, 72px); line-height: 1.02; max-width: 16ch; }
.subscribe-mount { max-width: 520px; }
.subscribe-mount iframe { display: block; width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.newsletter-issues { margin-top: 20px; }

/* About — opening portrait block */
.about-hero-grid { display: grid; gap: clamp(30px, 5vw, 52px); align-items: center; }
.about-portrait { margin: 0; }
.about-portrait img {
  width: 100%; height: auto; display: block;
  border-radius: 18px;
  border: 1px solid rgba(225, 245, 238, 0.18);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.55);
}
@media (min-width: 820px) {
  .about-hero-grid { grid-template-columns: 1.15fr 0.85fr; }
  .about-portrait { max-width: 420px; margin-left: auto; }
}

/* About — editorial long-form story */
.story { max-width: var(--wrap-narrow); margin-inline: auto; padding-inline: var(--gutter); }
.story-chapter {
  border-top: 1px solid var(--line);
  padding-block: clamp(40px, 5.5vw, 60px);
}
.story-chapter .chapter-num {
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--teal); display: block; margin-bottom: 16px;
}
.story-chapter h2 { font-size: clamp(24px, 3vw, 30px); margin-bottom: 18px; }
.story-chapter p { font-size: 16.5px; line-height: 1.75; }
.story-chapter p + p { margin-top: 16px; }
.story-date {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em;
  color: var(--teal); white-space: nowrap;
}
.story .pull-quote { margin-block: 8px; }

/* Small Newton reprise (quiet anchor, not the full dark close) */
.newton-small { text-align: center; }
.newton-small .newton-quote {
  color: var(--green-deep);
  font-size: clamp(20px, 2.8vw, 28px);
  max-width: 30ch;
}
.newton-small .newton-dot { background: var(--purple); }
.newton-small .newton-attr { color: var(--teal); }

/* Module map (Academy program pages) */
.module-grid { display: grid; gap: 14px; margin-top: 48px; }
.module-card {
  background: var(--paper);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 20px 20px 18px;
}
.module-card .module-num {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em;
  color: var(--teal); display: block; margin-bottom: 10px;
}
.module-card h3 { font-size: 16.5px; font-weight: 600; line-height: 1.3; margin-bottom: 8px; }
.module-card p { font-size: 13.5px; color: var(--gray); margin-bottom: 14px; }
/* Differentiator modules (e.g. "Spanish to practice in the system") */
.module-card--sys { border: 2px solid var(--teal); }
.module-lvl {
  display: inline-block;
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--gray); border: 1px solid var(--line);
  border-radius: 100px; padding: 3px 10px;
}
.module-lvl--core { color: var(--paper); background: var(--teal); border-color: var(--teal); }

/* UK ↔ US contrast boxes — the only place these two tokens exist */
.ukus-row { display: grid; gap: 14px; margin-top: 28px; }
.ukus {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--paper);
  padding: 14px 18px;
  font-size: 14.5px;
}
.ukus .flag-uk, .ukus .flag-us {
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  letter-spacing: 0.14em;
}
.ukus .flag-uk { color: #1d4ed8; }
.ukus .flag-us { color: #b91c1c; }
.ukus .vs { color: var(--gray); font-family: var(--mono); font-size: 11px; }

/* Contact split — info column + form card */
.contact-split { display: grid; gap: 48px; margin-top: 56px; }
.contact-split .contact-ways { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; margin-top: 28px; }

/* =============================================================
   15. Responsive
   ============================================================= */
/* Very narrow screens: isotype only, so nav controls always fit */
@media (max-width: 479px) {
  .wordmark-text { display: none; }
}

@media (min-width: 540px) {
  .field-row { flex-wrap: nowrap; }
  .footer-top { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 720px) {
  .card-grid--2 { grid-template-columns: repeat(2, 1fr); }
  .card-grid--3 { grid-template-columns: repeat(3, 1fr); }
  .card-grid--4 { grid-template-columns: repeat(2, 1fr); }
  .footer-top { grid-template-columns: 1.4fr 1fr 1fr; }
  .circles-grid { grid-template-columns: repeat(3, 1fr); }
  .price-cols { grid-template-columns: repeat(3, 1fr); gap: 34px; }
  .contact-split { grid-template-columns: 1fr 1.1fr; align-items: start; }
  .module-grid { grid-template-columns: repeat(3, 1fr); }
  .ukus-row { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 960px) {
  .nav-links { display: flex; }
  .nav-toggle { display: none; }
  .card-grid--4 { grid-template-columns: repeat(4, 1fr); }
}

/* =============================================================
   16. Reduced motion — animations off, content always visible
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal, [data-stagger] > *, .hero-stagger > * { opacity: 1; transform: none; }
  [data-pulse] .trace { stroke-dashoffset: 0; animation: none; }
  [data-pulse] .dot { opacity: 1; animation: none; }
  .pulse-dot { animation: none; }
  .panel-glow { animation: none; }

  /* 404: show the pulse alive and static — never stuck flat, no motion */
  .flatline .flat { opacity: 0; }
  .flatline .peak { opacity: 1; stroke-dashoffset: 0; animation: none; }
  .flatline .peak-dot { opacity: 1; animation: none; }
}
