/* ==========================================================================
   HLTH 2026 · Dr. Pipeline diagnostic · shared styles
   Built on the demandDrive Design System tokens (Outfit 400 headings,
   DM Sans body, navy / blue / green, orange for hover only, 6px buttons).
   Used by Quiz.html, Diagnosis-Library.html and Diagnosis.html.
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  --dd-navy: #0A0E45;
  --dd-blue: #0062DF;
  --dd-green: #00DD84;
  --dd-orange: #FF6300;
  --dd-blue-2: #0195FF;
  --dd-blue-3: #9CD1FF;
  --dd-cyan: #62E5FF;
  --dd-coral: #FF6262;
  --dd-n1: #F3F8FF;
  --dd-n2: #E2ECFA;
  --dd-n3: #CDDBEE;
  --dd-n4: #A0B0C7;
  --dd-n5: #54567D;
  --dd-white: #FFFFFF;
  --dd-supertext: #0a0e45cc;

  --dd-font-display: "Outfit", system-ui, sans-serif;
  --dd-font-body: "DM Sans", system-ui, sans-serif;

  --dd-radius-btn: 6px;
  --dd-radius-card: 14px;
  --dd-radius-lg: 24px;
  --dd-shadow-md: 0 8px 24px rgba(10, 14, 69, 0.10);
  --dd-shadow-lg: 0 24px 64px rgba(10, 14, 69, 0.22);

  /* Motion (spec): 600ms screen changes, 300ms answer selection */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-screen: 600ms;
  --dur-select: 300ms;
  --dur-ui: 220ms;

  /* Fluid type */
  --fs-display: clamp(40px, 6.2vw, 80px);
  --fs-h1: clamp(34px, 4.6vw, 56px);
  --fs-h2: clamp(28px, 3.4vw, 42px);
  --fs-h3: clamp(22px, 2.2vw, 30px);
  --fs-lead: clamp(18px, 1.6vw, 22px);
  --fs-body: clamp(16px, 1.2vw, 17px);
  --fs-small: 14px;

  --gutter: clamp(20px, 5vw, 72px);
  --maxw: 1200px;
  --nav-h: 72px;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scrollbar-gutter: stable; }
/* No sideways scrollbar while screens slide in. clip (not hidden) keeps the sticky nav working. */
html, body { overflow-x: hidden; }
@supports (overflow-x: clip) { html, body { overflow-x: clip; } }
body {
  margin: 0;
  background: var(--dd-white);
  color: var(--dd-navy);
  font-family: var(--dd-font-body);
  font-size: var(--fs-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 {
  font-family: var(--dd-font-display);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.08;
  margin: 0;
}
p { margin: 0; }
a { color: var(--dd-blue); text-underline-offset: 3px; }
a:hover { color: var(--dd-orange); }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--dd-blue-2); outline-offset: 3px; border-radius: 4px; }
[tabindex="-1"]:focus { outline: none; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

/* Supertext: DM Sans 500, Title Case, never all caps */
.supertext {
  font-family: var(--dd-font-body);
  font-weight: 500;
  font-size: 15px;
  color: var(--dd-supertext);
  text-transform: none;
  letter-spacing: normal;
}
.on-dark .supertext { color: var(--dd-white); }

/* Highlight gradient: headline text only, one phrase per section */
.dd-highlight {
  background: linear-gradient(90deg, #FF6300, #FF6262, #0195FF, #00DD84);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ---------- 3. Buttons (Primary / Secondary / Tertiary) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 14px 24px;
  border-radius: var(--dd-radius-btn);
  border: 1px solid transparent;
  font-family: var(--dd-font-display); font-weight: 500; font-size: 17px; line-height: 1.1;
  text-decoration: none; cursor: pointer;
  transition: background-color var(--dur-ui) var(--ease-out), color var(--dur-ui) var(--ease-out),
              border-color var(--dur-ui) var(--ease-out), transform 120ms var(--ease-out);
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.btn--lg { min-height: 64px; padding: 18px 36px; font-size: 20px; }
.btn--sm { min-height: 44px; padding: 10px 18px; font-size: 15px; }
.btn--primary { background: var(--dd-navy); color: var(--dd-white); }
.btn--primary:not([disabled]):hover { background: var(--dd-orange); color: var(--dd-white); }
.btn--secondary { background: transparent; color: var(--dd-navy); border-color: var(--dd-navy); }
.btn--secondary:not([disabled]):hover { background: var(--dd-navy); color: var(--dd-white); }
.btn--tertiary { background: transparent; color: var(--dd-navy); padding-left: 4px; padding-right: 4px; }
.btn--tertiary:hover { color: var(--dd-navy); }
.on-dark .btn--primary { background: var(--dd-white); color: var(--dd-navy); }
.on-dark .btn--primary:not([disabled]):hover { background: var(--dd-orange); color: var(--dd-white); }
.on-dark .btn--secondary { color: var(--dd-white); border-color: var(--dd-white); }
.on-dark .btn--secondary:hover { background: var(--dd-white); color: var(--dd-navy); }
.btn svg { width: 18px; height: 18px; flex: none; }

/* ---------- 4. Global nav ---------- */
/* The nav mounts inside #dd-nav; display: contents lets the header stick to the viewport. */
#dd-nav { display: contents; }
section[id] { scroll-margin-top: var(--nav-h); }
.dd-nav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  background: var(--dd-white);
  border-bottom: 1px solid var(--dd-n2);
}
.dd-nav__inner {
  height: 100%; display: flex; align-items: center; justify-content: space-between;
  max-width: 1440px; margin: 0 auto; padding: 0 var(--gutter);
}
.dd-nav__logo {
  display: inline-flex; align-items: center; background: none; border: 0; padding: 8px 0;
  cursor: pointer; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.dd-nav__logo svg { width: 168px; height: auto; pointer-events: none; }
.dd-nav__burger {
  width: 52px; height: 52px; display: grid; place-items: center;
  background: none; border: 1px solid var(--dd-n2); border-radius: var(--dd-radius-btn); cursor: pointer;
  transition: border-color var(--dur-ui) var(--ease-out);
}
.dd-nav__burger:hover { border-color: var(--dd-navy); }
.dd-nav__burger svg { width: 24px; height: 24px; }

.dd-menu {
  position: fixed; inset: 0; z-index: 100; display: flex; justify-content: flex-end;
  visibility: hidden; pointer-events: none;
}
.dd-menu.is-open { visibility: visible; pointer-events: auto; }
.dd-menu__scrim {
  position: absolute; inset: 0; background: rgba(10, 14, 69, .45); opacity: 0;
  transition: opacity var(--dur-screen) var(--ease-out);
}
.dd-menu.is-open .dd-menu__scrim { opacity: 1; }
.dd-menu__panel {
  position: relative; height: 100%; width: min(480px, 100%);
  background: var(--dd-navy); color: var(--dd-white);
  display: flex; flex-direction: column; overflow-y: auto;
  transform: translateX(100%); transition: transform var(--dur-screen) var(--ease-out);
}
.dd-menu.is-open .dd-menu__panel { transform: none; }
.dd-menu__head {
  height: var(--nav-h); flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
}
.dd-menu__head .supertext { color: var(--dd-white); }
.dd-menu__close {
  width: 52px; height: 52px; display: grid; place-items: center; background: none;
  border: 1px solid rgba(255,255,255,.2); border-radius: var(--dd-radius-btn); color: var(--dd-white); cursor: pointer;
}
.dd-menu__close:hover { border-color: var(--dd-white); }
.dd-menu__close svg { width: 22px; height: 22px; }
.dd-menu__list { list-style: none; margin: 0; padding: 8px 16px 32px; display: flex; flex-direction: column; gap: 4px; }
.dd-menu__group { padding: 20px 8px 8px; color: var(--dd-n3); font-weight: 500; font-size: 15px; }
.dd-menu__link {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 64px; padding: 14px 16px; border-radius: 10px;
  color: var(--dd-white); text-decoration: none;
  font-family: var(--dd-font-display); font-size: 22px; font-weight: 400;
  transition: background-color var(--dur-ui) var(--ease-out), color var(--dur-ui) var(--ease-out);
}
.dd-menu__link--primary { font-size: 26px; }
.dd-menu__link:hover, .dd-menu__link:focus-visible { background: rgba(255,255,255,.08); color: var(--dd-white); }
.dd-menu__link:hover svg { color: var(--dd-orange); }
.dd-menu__link[aria-current="page"] { background: rgba(255,255,255,.12); }
.dd-menu__link svg { width: 20px; height: 20px; flex: none; color: var(--dd-n4); transition: color var(--dur-ui); }

/* ---------- 5. Dialogs (shared shell) ---------- */
.dd-dialog {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px;
  visibility: hidden; pointer-events: none;
}
.dd-dialog.is-open { visibility: visible; pointer-events: auto; }
.dd-dialog__scrim { position: absolute; inset: 0; background: rgba(10,14,69,.55); opacity: 0; transition: opacity var(--dur-screen) var(--ease-out); }
.dd-dialog.is-open .dd-dialog__scrim { opacity: 1; }
.dd-dialog__box {
  position: relative; width: min(480px, 100%); background: var(--dd-white); border-radius: var(--dd-radius-lg);
  padding: 32px; box-shadow: var(--dd-shadow-lg);
  opacity: 0; transform: translateY(16px); transition: opacity var(--dur-screen) var(--ease-out), transform var(--dur-screen) var(--ease-out);
}
.dd-dialog.is-open .dd-dialog__box { opacity: 1; transform: none; }
.dd-dialog__box h2 { font-size: var(--fs-h3); margin-bottom: 10px; }
.dd-dialog__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

/* ---------- 6. Rx pad paper (results card + hero echo only) ---------- */
.rx-paper {
  position: relative;
  background-color: #FDFEFF;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.04  0 0 0 0 0.05  0 0 0 0 0.27  0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #FFFFFF 0%, #F6F9FE 100%);
  color: var(--dd-navy);
  border-radius: 10px;
  box-shadow: 0 1px 0 rgba(10,14,69,.06), 0 18px 48px rgba(10,14,69,.18);
}
.rx-mark { color: var(--dd-blue); }
.rx-field__label { font-weight: 500; font-size: 14px; color: var(--dd-supertext); }
.rx-signature {
  font-family: "Mrs Saint Delafield", cursive; font-size: 44px; line-height: 1; color: var(--dd-blue);
  transform: rotate(-4deg); transform-origin: left center; display: inline-block;
}

/* ---------- 7. Forms ---------- */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-weight: 500; font-size: 15px; }
.field input, .field select {
  min-height: 56px; padding: 14px 16px; border-radius: 8px;
  border: 1px solid var(--dd-n3); background: var(--dd-white); color: var(--dd-navy);
  font: 400 18px/1.3 var(--dd-font-body);
  transition: border-color var(--dur-ui) var(--ease-out), box-shadow var(--dur-ui) var(--ease-out);
}
.field input::placeholder { color: var(--dd-navy); opacity: .45; }
.field input:focus { outline: none; border-color: var(--dd-blue); box-shadow: 0 0 0 3px rgba(0,98,223,.18); }
.field.is-invalid input { border-color: var(--dd-coral); }
.field__error { color: #C42B2B; font-size: 14px; min-height: 0; }
.check { display: flex; gap: 14px; align-items: flex-start; cursor: pointer; font-size: 15px; line-height: 1.45; }
.check input { width: 24px; height: 24px; margin: 0; flex: none; accent-color: var(--dd-navy); margin-top: 1px; }

/* ---------- 8. Footer ---------- */
.dd-footer { background: var(--dd-navy); color: var(--dd-n3); padding: 40px 0; font-size: 14px; }
.dd-footer .wrap { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; justify-content: space-between; }
.dd-footer a { color: var(--dd-white); }
.dd-footer a:hover { color: var(--dd-orange); }
.dd-footer svg { width: 140px; }

/* ---------- 9. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  :root { --dur-screen: 1ms; --dur-select: 1ms; --dur-ui: 1ms; }
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}

@media (max-width: 560px) {
  .dd-nav__logo svg { width: 136px; }
  :root { --nav-h: 64px; }
}
