/* =====================================================================
   THE MEDICAL MARVEL — Base & Components
   Depends on tokens.css. Shared across every public page.
   ===================================================================== */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-optical-sizing: auto;
  overflow-x: hidden;
}

img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--terra); color: var(--cream); }

/* Subtle paper grain on the whole canvas for editorial warmth */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body > * { position: relative; z-index: 1; }

/* ---------------------------------------------------------------- TYPE */
h1,h2,h3,h4 { font-family: var(--font-display); font-weight: 380; line-height: 1.04; letter-spacing: -.012em; color: var(--ink); }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); line-height: 1.12; }
h4 { font-size: var(--fs-h4); font-weight: 440; }
p { max-width: 68ch; }
strong, b { font-weight: 560; }
em { font-style: italic; }

.display    { font-family: var(--font-display); font-size: var(--fs-mega); font-weight: 340; line-height: .98; letter-spacing: -.02em; }
.lede       { font-size: var(--fs-lede); line-height: 1.5; color: var(--ink-2); font-weight: 360; max-width: 40ch; }
.prose p    { margin-bottom: 1.15em; }
.prose p:last-child { margin-bottom: 0; }
.prose      { max-width: var(--wrap-text); }
.muted      { color: var(--ink-3); }
.ink-2      { color: var(--ink-2); }

/* Kicker / eyebrow label */
.kicker {
  font-family: var(--font-ui);
  font-size: var(--fs-kicker);
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--terra);
  display: inline-flex; align-items: center; gap: .6em;
}
.kicker--ink { color: var(--ink-3); }
.kicker::before {
  content: ""; width: 1.8em; height: 1px; background: currentColor; opacity: .6;
}
.kicker.no-rule::before { display: none; }

/* ------------------------------------------------------------ LAYOUT */
.wrap   { width: 100%; max-width: var(--wrap);      margin-inline: auto; padding-inline: clamp(1.25rem, 4vw, 3rem); }
.wrap-w { width: 100%; max-width: var(--wrap-wide); margin-inline: auto; padding-inline: clamp(1.25rem, 4vw, 3rem); }
.wrap-t { width: 100%; max-width: var(--wrap-text); margin-inline: auto; padding-inline: clamp(1.25rem, 4vw, 3rem); }
.section { padding-block: var(--space-section); }
.section--tight { padding-block: clamp(2.5rem, 4vw, 4rem); }

.section--panel   { background: var(--cream-panel); }
.section--sink    { background: var(--cream-sink); }
.section--dark    { background: var(--espresso); color: var(--on-dark); }
.section--dark h1,.section--dark h2,.section--dark h3,.section--dark h4 { color: var(--on-dark); }
.section--dark .lede, .section--dark .muted { color: var(--on-dark-2); }
.section--dark .kicker { color: var(--terra); }

.rule { height: 1px; background: var(--line); border: 0; }

/* ----------------------------------------------------------- BUTTONS */
.btn {
  font-family: var(--font-ui);
  font-size: .92rem; font-weight: 600; letter-spacing: .02em;
  display: inline-flex; align-items: center; justify-content: center; gap: .6em;
  padding: .95em 1.7em; border-radius: var(--r-pill);
  transition: transform .25s var(--ease), background .25s var(--ease), color .25s var(--ease), box-shadow .25s var(--ease), border-color .25s;
  white-space: nowrap; line-height: 1;
}
.btn:active { transform: translateY(1px); }

/* PRIMARY — terracotta. Reserved for the main conversion action. */
.btn-primary { background: var(--terra); color: var(--cream); box-shadow: 0 6px 18px rgba(184,81,58,.28); }
.btn-primary:hover { background: var(--terra-deep); transform: translateY(-2px); box-shadow: 0 12px 28px rgba(184,81,58,.34); }

.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-2); }
.btn-ghost:hover { border-color: var(--ink); background: var(--ink); color: var(--cream); transform: translateY(-2px); }

.section--dark .btn-ghost { color: var(--on-dark); border-color: rgba(244,236,221,.32); }
.section--dark .btn-ghost:hover { background: var(--on-dark); color: var(--espresso); border-color: var(--on-dark); }

.btn-text { font-family: var(--font-ui); font-weight: 600; font-size: .94rem; color: var(--terra); display: inline-flex; align-items: center; gap: .45em; }
.btn-text .arr { transition: transform .25s var(--ease); }
.btn-text:hover .arr { transform: translateX(5px); }

.btn-lg { padding: 1.1em 2.1em; font-size: 1rem; }
.btn-block { display: flex; width: 100%; }

/* -------------------------------------------------------------- LINKS */
.link-u { color: var(--terra); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.link-u:hover { text-decoration-thickness: 2px; }

/* --------------------------------------------------------- HEADER/NAV */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--cream) 86%, transparent);
  backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background .3s;
}
.site-header.is-scrolled { border-bottom-color: var(--line); background: color-mix(in srgb, var(--cream) 94%, transparent); }
.nav {
  display: flex; align-items: center; justify-content: space-between; gap: 2rem;
  height: 76px;
}
.brand { font-family: var(--font-display); font-weight: 480; font-size: 1.32rem; letter-spacing: -.01em; line-height: 1; display: inline-flex; align-items: baseline; gap: .12em; }
.brand .brand-mark { color: var(--terra); }
.nav-links { display: flex; align-items: center; gap: clamp(1rem, 2.2vw, 2.1rem); list-style: none; }
.nav-links a {
  font-family: var(--font-ui); font-size: .95rem; font-weight: 500; color: var(--ink-2);
  padding: .4em 0; position: relative; transition: color .2s;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: -2px; height: 1.5px;
  background: var(--terra); transition: right .3s var(--ease);
}
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { right: 0; }
.nav-links a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.nav-links a[aria-current="page"]::after { right: 0; }
.nav-right { display: flex; align-items: center; gap: 1.1rem; }

.nav-toggle { display: none; width: 44px; height: 44px; border-radius: var(--r-sm); align-items: center; justify-content: center; }
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  content: ""; display: block; width: 22px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .3s var(--ease), opacity .2s;
}
.nav-toggle span::before { position: absolute; transform: translateY(-7px); }
.nav-toggle span::after  { position: absolute; transform: translateY(7px); }
.nav-toggle.is-open span { background: transparent; }
.nav-toggle.is-open span::before { transform: rotate(45deg); }
.nav-toggle.is-open span::after  { transform: rotate(-45deg); }

@media (max-width: 920px) {
  .nav-toggle { display: inline-flex; position: relative; }
  .nav-links {
    position: fixed; inset: 76px 0 auto 0; flex-direction: column; align-items: flex-start;
    gap: 0; background: var(--cream); border-bottom: 1px solid var(--line);
    padding: 1rem clamp(1.25rem,4vw,3rem) 2rem; transform: translateY(-12px); opacity: 0; pointer-events: none;
    transition: transform .3s var(--ease), opacity .25s; box-shadow: var(--shadow-md);
  }
  .nav-links.is-open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav-links a { font-size: 1.4rem; font-family: var(--font-display); padding: .7em 0; width: 100%; border-bottom: 1px solid var(--line); color: var(--ink); }
  .nav-links a::after { display: none; }
  .nav .btn-primary.nav-cta-desktop { display: none; }
}
@media (min-width: 921px) { .nav-cta-mobile { display: none; } }

/* --------------------------------------------------------- FOOTER */
.site-footer { border-top: 1px solid var(--line); background: var(--cream); padding-block: clamp(3rem, 5vw, 4.5rem) 2rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: clamp(2rem, 4vw, 4rem); align-items: start; }
.footer-brand .f-name { font-family: var(--font-display); font-size: 1.7rem; font-weight: 460; line-height: 1; }
.footer-brand p { color: var(--ink-2); font-size: var(--fs-sm); margin-top: 1rem; max-width: 34ch; }
.footer-col h5 { font-family: var(--font-ui); font-size: var(--fs-kicker); letter-spacing: .2em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; margin-bottom: 1.1rem; }
.footer-col ul { list-style: none; display: grid; gap: .65rem; }
.footer-col a { font-size: var(--fs-sm); color: var(--ink-2); font-family: var(--font-ui); transition: color .2s; }
.footer-col a:hover { color: var(--terra); }
.footer-strip { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center;
  margin-top: clamp(2.5rem,4vw,3.5rem); padding-top: 1.5rem; border-top: 1px solid var(--line);
  font-family: var(--font-ui); font-size: var(--fs-xs); color: var(--ink-3); }
.footer-strip .fl { display: flex; gap: 1.2rem; }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr; gap: 2.5rem; } }

/* ----------------------------------------------------------- CARDS */
.card {
  background: var(--cream); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: clamp(1.5rem, 2.5vw, 2.2rem); transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--line-2); }
.card--flat:hover { transform: none; box-shadow: none; }

/* Pillar card */
.pillar-card { background: var(--cream); border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(1.6rem,2.5vw,2.4rem); position: relative; overflow: hidden; transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
.pillar-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); }
.pillar-card .pnum { font-family: var(--font-display); font-size: 3.2rem; font-weight: 300; color: var(--terra-line); line-height: 1; }
.pillar-card h3 { margin: .4rem 0 .8rem; }

/* Tinted emphasis block (e.g. "What TMM is NOT") */
.tint-block { background: var(--terra-wash); border: 1px solid var(--terra-line); border-radius: var(--r-lg); }

/* ----------------------------------------------------------- FORMS */
.field { display: block; margin-bottom: 1.35rem; }
.field > label { display: block; font-family: var(--font-ui); font-size: .85rem; font-weight: 600; letter-spacing: .02em; color: var(--ink-2); margin-bottom: .5rem; }
.field .req { color: var(--terra); }
.field .hint { font-family: var(--font-ui); font-size: var(--fs-xs); color: var(--ink-3); margin-top: .4rem; }
.input, .select, .textarea {
  width: 100%; font-family: var(--font-ui); font-size: 1rem; color: var(--ink);
  background: var(--cream); border: 1px solid var(--line-2); border-radius: var(--r-md);
  padding: .9em 1em; transition: border-color .2s, box-shadow .2s, background .2s;
}
.textarea { min-height: 130px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--terra); box-shadow: 0 0 0 3px var(--terra-wash); background: var(--paper); }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--terra); box-shadow: 0 0 0 3px var(--terra-wash); }
.field .error-msg { display: none; font-family: var(--font-ui); font-size: var(--fs-xs); color: var(--terra-deep); margin-top: .4rem; }
.field.has-error .error-msg { display: block; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; }
@media (max-width: 600px) { .grid-2 { grid-template-columns: 1fr; } }

.consent { display: flex; gap: .7rem; align-items: flex-start; font-family: var(--font-ui); font-size: var(--fs-sm); color: var(--ink-2); }
.consent input { margin-top: .25em; width: 18px; height: 18px; accent-color: var(--terra); flex: 0 0 auto; }

/* ----------------------------------------------------- FOCUS STATES */
:focus-visible { outline: 2px solid var(--terra); outline-offset: 3px; border-radius: 3px; }

/* ----------------------------------------------------- REVEAL ANIM */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
.reveal[data-d="1"] { transition-delay: .08s; }
.reveal[data-d="2"] { transition-delay: .16s; }
.reveal[data-d="3"] { transition-delay: .24s; }
.reveal[data-d="4"] { transition-delay: .32s; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } html { scroll-behavior: auto; } }

/* ----------------------------------------------------- UTILITIES */
.center { text-align: center; }
.mx-auto { margin-inline: auto; }
.stack > * + * { margin-top: var(--stack, 1.2rem); }
.flow-sm { --stack: .7rem; }
.flow-lg { --stack: 2rem; }
.cluster { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.eyebrow-gap { margin-bottom: 1.4rem; }
.measure { max-width: 54ch; }
.hidden { display: none !important; }
.tag { font-family: var(--font-ui); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.divider-dot { color: var(--terra); }

/* Big editorial pull quote */
.pullquote { font-family: var(--font-display); font-weight: 340; font-size: clamp(1.6rem, 1rem + 2.4vw, 2.7rem); line-height: 1.18; letter-spacing: -.015em; }

/* CTA strip (terracotta) */
.cta-strip { background: var(--terra); color: var(--cream); border-radius: var(--r-lg); padding: clamp(2.5rem, 5vw, 4.5rem); text-align: center; }
.cta-strip h2 { color: var(--cream); }
.cta-strip .lede { color: rgba(253,250,244,.85); margin-inline: auto; }
.cta-strip .btn-ghost { border-color: rgba(253,250,244,.45); color: var(--cream); }
.cta-strip .btn-ghost:hover { background: var(--cream); color: var(--terra); border-color: var(--cream); }
.cta-strip .btn-primary { background: var(--cream); color: var(--terra); box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.cta-strip .btn-primary:hover { background: #fff; }
