/* ============================================================
   RehabNest Design System, shared.css
   Version: 1.0.0 | © 2026 RehabNest
   Aesthetic: Warm Clinical, trustworthy, hopeful, human
   ============================================================ */

/* ── 1. FONTS ── */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

/* ── 2. CSS CUSTOM PROPERTIES ── */
:root {
  /* Brand Colors */
  --clr-primary:      #2E6B5E;
  --clr-primary-d:    #1d4d43;
  --clr-primary-l:    #4a9b8a;
  --clr-accent:       #E8A84A;
  --clr-accent-d:     #c4872e;
  --clr-accent-l:     #f5c87a;
  --clr-warm:         #F5F0E8;
  --clr-warm-d:       #e8e0d0;

  /* Semantic Colors */
  --clr-success:      #3d8b6d;
  --clr-warning:      #d4860f;
  --clr-danger:       #c0392b;
  --clr-info:         #2471a3;

  /* Neutral Scale */
  --clr-bg:           #faf9f6;
  --clr-surface:      #ffffff;
  --clr-surface-2:    #f5f0e8;
  --clr-border:       #e0d8cc;
  --clr-border-d:     #c8bfb0;
  --clr-text:         #1a1a18;
  --clr-text-muted:   #6b6560;
  --clr-text-subtle:  #9e9890;

  /* Typography */
  --ff-display:       'DM Serif Display', Georgia, serif;
  --ff-body:          'DM Sans', system-ui, sans-serif;

  --fs-xs:    0.75rem;
  --fs-sm:    0.875rem;
  --fs-base:  1rem;
  --fs-md:    1.125rem;
  --fs-lg:    1.25rem;
  --fs-xl:    1.5rem;
  --fs-2xl:   1.875rem;
  --fs-3xl:   2.25rem;
  --fs-4xl:   3rem;
  --fs-5xl:   3.75rem;

  --fw-light:   300;
  --fw-regular: 400;
  --fw-medium:  500;
  --fw-semi:    600;
  --fw-bold:    700;

  --lh-tight:   1.2;
  --lh-snug:    1.35;
  --lh-normal:  1.6;
  --lh-loose:   1.8;

  /* Spacing Scale (4px base) */
  --sp-1:  0.25rem;
  --sp-2:  0.5rem;
  --sp-3:  0.75rem;
  --sp-4:  1rem;
  --sp-5:  1.25rem;
  --sp-6:  1.5rem;
  --sp-8:  2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;
  --sp-20: 5rem;
  --sp-24: 6rem;
  --sp-32: 8rem;

  /* Layout */
  --container-sm:  640px;
  --container-md:  768px;
  --container-lg:  1024px;
  --container-xl:  1280px;
  --container-2xl: 1440px;

  /* Borders */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs:  0 1px 3px rgba(30,20,10,0.07);
  --shadow-sm:  0 2px 8px rgba(30,20,10,0.09);
  --shadow-md:  0 4px 20px rgba(30,20,10,0.11);
  --shadow-lg:  0 8px 40px rgba(30,20,10,0.14);
  --shadow-xl:  0 16px 64px rgba(30,20,10,0.18);

  /* Transitions */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);
  --dur-fast:    150ms;
  --dur-normal:  250ms;
  --dur-slow:    400ms;

  /* Z-index layers */
  --z-base:    1;
  --z-raised:  10;
  --z-nav:     100;
  --z-modal:   1000;
  --z-toast:   2000;
}

/* ── DARK MODE ── */
[data-theme="dark"] {
  --clr-bg:           #121410;
  --clr-surface:      #1c1f1a;
  --clr-surface-2:    #232720;
  --clr-border:       #2e342a;
  --clr-border-d:     #3e4639;
  --clr-text:         #f0ede8;
  --clr-text-muted:   #9ea89a;
  --clr-text-subtle:  #6b756a;
  --clr-warm:         #1e2219;
  --clr-warm-d:       #282e22;
  --clr-primary:      #5ab8a4;
  --clr-primary-d:    #3d9b87;
  --clr-primary-l:    #7dcfbe;
  --clr-accent:       #f0b355;
  --shadow-xs:  0 1px 3px rgba(0,0,0,0.25);
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 20px rgba(0,0,0,0.35);
  --shadow-lg:  0 8px 40px rgba(0,0,0,0.4);
}

/* ── 3. RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--ff-body);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
  color: var(--clr-text);
  background: var(--clr-bg);
  min-height: 100vh;
  transition: background var(--dur-normal), color var(--dur-normal);
}

/* ── 4. TYPOGRAPHY ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--ff-display);
  line-height: var(--lh-tight);
  color: var(--clr-text);
  font-weight: var(--fw-regular);
}
h1 { font-size: clamp(var(--fs-3xl), 5vw, var(--fs-5xl)); }
h2 { font-size: clamp(var(--fs-2xl), 3.5vw, var(--fs-4xl)); }
h3 { font-size: clamp(var(--fs-xl), 2.5vw, var(--fs-3xl)); }
h4 { font-size: var(--fs-xl); }
h5 { font-size: var(--fs-lg); font-family: var(--ff-body); font-weight: var(--fw-semi); }
h6 { font-size: var(--fs-base); font-family: var(--ff-body); font-weight: var(--fw-semi); }

p { margin-bottom: var(--sp-4); max-width: 68ch; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--clr-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--dur-fast);
}
a:hover { color: var(--clr-primary-d); }

strong, b { font-weight: var(--fw-semi); }
em, i { font-style: italic; }

small { font-size: var(--fs-sm); }

blockquote {
  border-left: 4px solid var(--clr-accent);
  padding: var(--sp-4) var(--sp-6);
  background: var(--clr-surface-2);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  margin: var(--sp-6) 0;
}

code, pre {
  font-family: 'Fira Code', 'Consolas', monospace;
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
}
code { padding: 2px 6px; font-size: 0.875em; }
pre { padding: var(--sp-4); overflow-x: auto; }

ul, ol { padding-left: var(--sp-6); }
li { margin-bottom: var(--sp-1); }

hr {
  border: none;
  border-top: 1px solid var(--clr-border);
  margin: var(--sp-8) 0;
}

/* ── 5. LAYOUT & GRID ── */
.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-inline: auto;
  padding-inline: var(--sp-6);
}
.container--sm  { max-width: var(--container-sm); }
.container--md  { max-width: var(--container-md); }
.container--lg  { max-width: var(--container-lg); }
.container--2xl { max-width: var(--container-2xl); }

.grid {
  display: grid;
  gap: var(--sp-6);
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-auto-sm { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: var(--sp-2); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.gap-8 { gap: var(--sp-8); }

/* ── 6. NAVIGATION ── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  background: var(--clr-surface);
  border-bottom: 1px solid var(--clr-border);
  box-shadow: var(--shadow-xs);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-6);
  max-width: var(--container-2xl);
  margin-inline: auto;
  gap: var(--sp-4);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  text-decoration: none;
  flex-shrink: 0;
}
.nav-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--clr-primary), var(--clr-primary-l));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
}
.nav-logo-text {
  font-family: var(--ff-display);
  font-size: var(--fs-lg);
  color: var(--clr-text);
  line-height: 1;
}
.nav-logo-text span { color: var(--clr-primary); }

.nav-links {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: var(--sp-1);
}
.nav-links a {
  display: block;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--clr-text-muted);
  transition: all var(--dur-fast);
}
.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--clr-primary);
  background: var(--clr-surface-2);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* Hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--sp-2);
  color: var(--clr-text);
}

/* ── 7. BREADCRUMB ── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  font-size: var(--fs-sm);
  color: var(--clr-text-muted);
  padding: var(--sp-4) 0;
}
.breadcrumb a { color: var(--clr-text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--clr-primary); }
.breadcrumb-sep { color: var(--clr-border-d); }
.breadcrumb [aria-current="page"] { color: var(--clr-text); font-weight: var(--fw-medium); }

/* ── 8. HERO ── */
.hero {
  padding: var(--sp-24) 0 var(--sp-16);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(46,107,94,0.08) 0%, transparent 70%);
  pointer-events: none;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--clr-primary);
  background: rgba(46,107,94,0.1);
  padding: var(--sp-1) var(--sp-4);
  border-radius: var(--radius-full);
  margin-bottom: var(--sp-6);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.hero-title {
  margin-bottom: var(--sp-6);
  max-width: 800px;
  margin-inline: auto;
}
.hero-title em {
  font-style: italic;
  color: var(--clr-primary);
}
.hero-desc {
  font-size: var(--fs-lg);
  color: var(--clr-text-muted);
  max-width: 600px;
  margin-inline: auto;
  margin-bottom: var(--sp-8);
  line-height: var(--lh-loose);
}

/* ── 9. BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--ff-body);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--dur-normal) var(--ease-out);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn:focus-visible {
  outline: 3px solid var(--clr-accent);
  outline-offset: 2px;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: currentColor;
  opacity: 0;
  transition: opacity var(--dur-fast);
}
.btn:hover::after { opacity: 0.06; }
.btn:active::after { opacity: 0.12; }

.btn-primary {
  background: var(--clr-primary);
  color: white;
  border-color: var(--clr-primary);
}
.btn-primary:hover {
  background: var(--clr-primary-d);
  border-color: var(--clr-primary-d);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(46,107,94,0.35);
}

.btn-accent {
  background: var(--clr-accent);
  color: white;
  border-color: var(--clr-accent);
}
.btn-accent:hover {
  background: var(--clr-accent-d);
  border-color: var(--clr-accent-d);
  color: white;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--clr-primary);
  border-color: var(--clr-primary);
}
.btn-outline:hover {
  background: var(--clr-primary);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--clr-text-muted);
  border-color: var(--clr-border);
}
.btn-ghost:hover {
  background: var(--clr-surface-2);
  color: var(--clr-text);
  border-color: var(--clr-border-d);
}

.btn-danger {
  background: var(--clr-danger);
  color: white;
  border-color: var(--clr-danger);
}

.btn-sm { padding: var(--sp-2) var(--sp-4); font-size: var(--fs-sm); }
.btn-lg { padding: var(--sp-4) var(--sp-8); font-size: var(--fs-md); }
.btn-xl { padding: var(--sp-5) var(--sp-10); font-size: var(--fs-lg); }
.btn-full { width: 100%; }
.btn-icon { padding: var(--sp-2); min-width: 40px; height: 40px; }

/* ── 10. CARDS ── */
.card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--dur-normal) var(--ease-out);
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card-body { padding: var(--sp-6); }
.card-header {
  padding: var(--sp-4) var(--sp-6);
  border-bottom: 1px solid var(--clr-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--clr-border);
  background: var(--clr-surface-2);
}

.card-tool {
  display: block;
  text-decoration: none;
  color: inherit;
  position: relative;
}
.card-tool:hover { text-decoration: none; }
.card-tool .tool-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: var(--sp-4);
}
.card-tool .tool-name {
  font-family: var(--ff-display);
  font-size: var(--fs-md);
  color: var(--clr-text);
  margin-bottom: var(--sp-1);
  line-height: var(--lh-snug);
}
.card-tool .tool-desc {
  font-size: var(--fs-sm);
  color: var(--clr-text-muted);
  line-height: var(--lh-normal);
  margin: 0;
}
.card-tool .tool-badge {
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
  font-size: var(--fs-xs);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: var(--fw-medium);
}

/* ── 11. FORMS ── */
.form-group {
  margin-bottom: var(--sp-5);
}
.form-label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--clr-text);
  margin-bottom: var(--sp-2);
}
.form-label .required { color: var(--clr-danger); margin-left: 2px; }
.form-hint {
  font-size: var(--fs-xs);
  color: var(--clr-text-muted);
  margin-top: var(--sp-1);
}
.form-error {
  font-size: var(--fs-xs);
  color: var(--clr-danger);
  margin-top: var(--sp-1);
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.input,
.select,
.textarea {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  background: var(--clr-surface);
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-md);
  font-family: var(--ff-body);
  font-size: var(--fs-base);
  color: var(--clr-text);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  appearance: none;
  -webkit-appearance: none;
}
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(46,107,94,0.15);
}
.input::placeholder,
.textarea::placeholder { color: var(--clr-text-subtle); }
.input.is-error { border-color: var(--clr-danger); }
.input.is-success { border-color: var(--clr-success); }

.select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6560' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: var(--sp-10);
}

.textarea { resize: vertical; min-height: 100px; }

/* Range Input */
.range-wrap { position: relative; }
.input-range {
  width: 100%;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--clr-border);
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  border: none;
  padding: 0;
}
.input-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--clr-primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(46,107,94,0.4);
  transition: transform var(--dur-fast);
}
.input-range::-webkit-slider-thumb:hover { transform: scale(1.2); }
.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-xs);
  color: var(--clr-text-muted);
  margin-top: var(--sp-2);
}

/* Checkbox & Radio */
.check-label,
.radio-label {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  cursor: pointer;
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-2);
}
.check-label input[type="checkbox"],
.radio-label input[type="radio"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: var(--clr-primary);
  cursor: pointer;
}

/* ── 12. RESULT/SCORE DISPLAYS ── */
.result-box {
  background: linear-gradient(135deg, var(--clr-primary), var(--clr-primary-l));
  color: white;
  border-radius: var(--radius-lg);
  padding: var(--sp-8);
  text-align: center;
  margin: var(--sp-6) 0;
}
.result-score {
  font-family: var(--ff-display);
  font-size: var(--fs-5xl);
  line-height: 1;
  margin-bottom: var(--sp-2);
}
.result-label {
  font-size: var(--fs-md);
  opacity: 0.9;
}
.result-desc {
  font-size: var(--fs-sm);
  opacity: 0.8;
  margin-top: var(--sp-3);
  max-width: 400px;
  margin-inline: auto;
}

.severity-bar {
  height: 8px;
  background: var(--clr-border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: var(--sp-2) 0;
}
.severity-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.8s var(--ease-out);
  background: linear-gradient(90deg, var(--clr-success), var(--clr-accent), var(--clr-danger));
}

/* Risk Levels */
.risk-low    { color: var(--clr-success); }
.risk-medium { color: var(--clr-warning); }
.risk-high   { color: var(--clr-danger); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-green  { background: rgba(61,139,109,0.12); color: var(--clr-success); }
.badge-amber  { background: rgba(212,134,15,0.12);  color: var(--clr-warning); }
.badge-red    { background: rgba(192,57,43,0.12);   color: var(--clr-danger); }
.badge-blue   { background: rgba(36,113,163,0.12);  color: var(--clr-info); }
.badge-primary { background: rgba(46,107,94,0.12);  color: var(--clr-primary); }

/* ── 13. PROGRESS & STATS ── */
.stat-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  text-align: center;
}
.stat-value {
  font-family: var(--ff-display);
  font-size: var(--fs-4xl);
  color: var(--clr-primary);
  line-height: 1;
  margin-bottom: var(--sp-1);
}
.stat-label {
  font-size: var(--fs-sm);
  color: var(--clr-text-muted);
  font-weight: var(--fw-medium);
}

.progress-ring-wrap { display: inline-block; position: relative; }
.progress-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--ff-display);
  font-size: var(--fs-2xl);
  color: var(--clr-text);
}

/* ── 14. TABS ── */
.tabs {
  border-bottom: 2px solid var(--clr-border);
  display: flex;
  gap: 0;
  overflow-x: auto;
}
.tab-btn {
  padding: var(--sp-3) var(--sp-5);
  border: none;
  background: none;
  font-family: var(--ff-body);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--clr-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--dur-fast);
  white-space: nowrap;
}
.tab-btn:hover { color: var(--clr-primary); }
.tab-btn[aria-selected="true"] {
  color: var(--clr-primary);
  border-bottom-color: var(--clr-primary);
}
.tab-panel { padding: var(--sp-6) 0; }
.tab-panel[hidden] { display: none; }

/* ── 15. ALERTS & CALLOUTS ── */
.alert {
  display: flex;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--radius-md);
  border: 1px solid;
  margin-bottom: var(--sp-4);
}
.alert-icon { flex-shrink: 0; font-size: 18px; }
.alert-body { flex: 1; }
.alert-title { font-weight: var(--fw-semi); margin-bottom: var(--sp-1); }
.alert-info    { background: rgba(36,113,163,0.08); border-color: rgba(36,113,163,0.3); color: var(--clr-info); }
.alert-success { background: rgba(61,139,109,0.08); border-color: rgba(61,139,109,0.3); color: var(--clr-success); }
.alert-warning { background: rgba(212,134,15,0.08); border-color: rgba(212,134,15,0.3); color: var(--clr-warning); }
.alert-danger  { background: rgba(192,57,43,0.08);  border-color: rgba(192,57,43,0.3);  color: var(--clr-danger); }

.callout {
  border-left: 4px solid var(--clr-primary);
  background: var(--clr-surface-2);
  padding: var(--sp-4) var(--sp-6);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: var(--sp-6) 0;
}

/* ── 16. CATEGORY SECTIONS ── */
.category-section {
  padding: var(--sp-12) 0;
}
.category-section + .category-section {
  border-top: 1px solid var(--clr-border);
}
.section-header {
  margin-bottom: var(--sp-8);
}
.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--clr-primary);
  margin-bottom: var(--sp-3);
}
.section-title {
  font-size: clamp(var(--fs-xl), 3vw, var(--fs-3xl));
  margin-bottom: var(--sp-3);
}
.section-desc {
  font-size: var(--fs-base);
  color: var(--clr-text-muted);
  max-width: 600px;
}

/* ── 17. TOOL PAGE LAYOUT ── */
.tool-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.tool-header {
  background: linear-gradient(135deg, var(--clr-warm) 0%, var(--clr-surface) 100%);
  border-bottom: 1px solid var(--clr-border);
  padding: var(--sp-10) 0 var(--sp-8);
}
.tool-header-inner {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-6);
}
.tool-header-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  flex-shrink: 0;
}
.tool-header-meta { flex: 1; }
.tool-header-title { margin-bottom: var(--sp-2); font-size: clamp(var(--fs-2xl), 4vw, var(--fs-4xl)); }
.tool-header-desc {
  font-size: var(--fs-md);
  color: var(--clr-text-muted);
  max-width: 580px;
  margin: 0;
}

.tool-main {
  flex: 1;
  padding: var(--sp-10) 0;
}
.tool-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--sp-8);
  align-items: start;
}
.tool-content { min-width: 0; }
.tool-sidebar { position: sticky; top: calc(60px + var(--sp-4)); }

/* ── 18. STEP WIZARD ── */
.wizard-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: var(--sp-8);
  overflow-x: auto;
}
.wizard-step {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
}
.wizard-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  border: 2px solid var(--clr-border);
  color: var(--clr-text-muted);
  background: var(--clr-surface);
  transition: all var(--dur-normal);
}
.wizard-step.is-active .wizard-step-num {
  background: var(--clr-primary);
  border-color: var(--clr-primary);
  color: white;
}
.wizard-step.is-done .wizard-step-num {
  background: var(--clr-success);
  border-color: var(--clr-success);
  color: white;
}
.wizard-step-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--clr-text-muted);
}
.wizard-step.is-active .wizard-step-label { color: var(--clr-primary); }
.wizard-connector {
  flex: 1;
  min-width: 24px;
  height: 2px;
  background: var(--clr-border);
  margin: 0 var(--sp-2);
}

/* ── 19. ACCORDION / FAQ ── */
.accordion-item {
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--sp-2);
  overflow: hidden;
}
.accordion-trigger {
  width: 100%;
  background: var(--clr-surface);
  border: none;
  padding: var(--sp-4) var(--sp-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-family: var(--ff-body);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  color: var(--clr-text);
  text-align: left;
  transition: background var(--dur-fast);
}
.accordion-trigger:hover { background: var(--clr-surface-2); }
.accordion-icon {
  font-size: 18px;
  color: var(--clr-text-muted);
  transition: transform var(--dur-normal) var(--ease-out);
  flex-shrink: 0;
}
.accordion-item[open] .accordion-icon,
.accordion-trigger[aria-expanded="true"] .accordion-icon {
  transform: rotate(180deg);
}
.accordion-body {
  padding: var(--sp-4) var(--sp-5);
  background: var(--clr-surface-2);
  font-size: var(--fs-sm);
  color: var(--clr-text-muted);
  line-height: var(--lh-normal);
}

/* ── 20. TOAST NOTIFICATIONS ── */
.toast-container {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 400px;
  animation: toast-in var(--dur-slow) var(--ease-out) forwards;
}
@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);   opacity: 1; }
}
.toast.is-hiding { animation: toast-out var(--dur-normal) var(--ease-in-out) forwards; }
@keyframes toast-out {
  from { transform: translateX(0);   opacity: 1; }
  to   { transform: translateX(100%); opacity: 0; }
}

/* ── 21. MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-normal);
}
.modal-overlay.is-open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--clr-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(8px);
  transition: transform var(--dur-slow) var(--ease-out);
}
.modal-overlay.is-open .modal { transform: scale(1) translateY(0); }
.modal-header {
  padding: var(--sp-6);
  border-bottom: 1px solid var(--clr-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-body { padding: var(--sp-6); }
.modal-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--clr-border);
  display: flex;
  gap: var(--sp-3);
  justify-content: flex-end;
}

/* ── 21b. LEAD-GEN CTA (floating button + inline result banner) ── */
.leadgen-fab {
  position: fixed;
  bottom: var(--sp-6);
  left: var(--sp-6);
  z-index: var(--z-toast);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  background: linear-gradient(135deg, #1B5E20, #2E7D32);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--ff-body);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: transform var(--dur-fast);
}
.leadgen-fab:hover { transform: translateY(-2px); }
@media (max-width: 640px) {
  .leadgen-fab { left: var(--sp-3); bottom: var(--sp-3); padding: var(--sp-2) var(--sp-4); font-size: var(--fs-xs); }
}
.leadgen-banner {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  background: linear-gradient(135deg, rgba(27,94,32,0.08), rgba(46,125,50,0.04));
  border: 1px solid rgba(27,94,32,0.2);
  border-radius: var(--radius-lg);
  padding: var(--sp-4) var(--sp-5);
  margin: var(--sp-5) 0;
  animation: leadgen-banner-in var(--dur-slow) var(--ease-out);
}
@keyframes leadgen-banner-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.leadgen-banner-icon { font-size: 1.8rem; flex-shrink: 0; }
.leadgen-banner-text { flex: 1; font-size: var(--fs-sm); color: var(--clr-text); }
.leadgen-banner-text strong { display: block; margin-bottom: 2px; }
.leadgen-banner-close { background: none; border: none; cursor: pointer; font-size: 1.1rem; color: var(--clr-text-muted); flex-shrink: 0; padding: 4px; }
.leadgen-form-group { margin-bottom: var(--sp-4); }
.leadgen-form-group:last-child { margin-bottom: 0; }
.leadgen-honeypot { position: absolute; left: -9999px; opacity: 0; }
.leadgen-success { text-align: center; padding: var(--sp-4) 0; }
.leadgen-success-icon { font-size: 2.5rem; margin-bottom: var(--sp-3); }

/* ── 22. CHART CONTAINERS ── */
.chart-wrap {
  position: relative;
  width: 100%;
  padding-top: 60%;
}
.chart-wrap canvas,
.chart-wrap svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.chart-wrap-fixed { height: 240px; position: relative; }
.chart-wrap-fixed canvas,
.chart-wrap-fixed svg { width: 100%; height: 100%; }

/* ── 23. DARK MODE TOGGLE ── */
.theme-toggle {
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-full);
  padding: var(--sp-1);
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  cursor: pointer;
}
.theme-toggle-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background var(--dur-fast);
  color: var(--clr-text-muted);
}
.theme-toggle-btn.is-active {
  background: var(--clr-surface);
  box-shadow: var(--shadow-xs);
  color: var(--clr-text);
}

/* ── 24. FOOTER ── */
.site-footer {
  background: var(--clr-surface);
  border-top: 1px solid var(--clr-border);
  padding: var(--sp-16) 0 var(--sp-8);
  margin-top: auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--sp-8);
  margin-bottom: var(--sp-10);
}
.footer-brand p {
  font-size: var(--fs-sm);
  color: var(--clr-text-muted);
  margin-top: var(--sp-3);
  max-width: 280px;
}
.footer-nav-title {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--clr-text);
  margin-bottom: var(--sp-4);
}
.footer-nav-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.footer-nav-list a {
  font-size: var(--fs-sm);
  color: var(--clr-text-muted);
  text-decoration: none;
  transition: color var(--dur-fast);
}
.footer-nav-list a:hover { color: var(--clr-primary); }
.footer-bottom {
  border-top: 1px solid var(--clr-border);
  padding-top: var(--sp-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-4);
  font-size: var(--fs-xs);
  color: var(--clr-text-muted);
}
.footer-disclaimer {
  background: rgba(192,57,43,0.06);
  border: 1px solid rgba(192,57,43,0.2);
  border-radius: var(--radius-md);
  padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-8);
  font-size: var(--fs-xs);
  color: var(--clr-text-muted);
}

/* ── 25. UTILITY CLASSES ── */
.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }
.text-primary { color: var(--clr-primary); }
.text-accent  { color: var(--clr-accent); }
.text-muted   { color: var(--clr-text-muted); }
.text-danger  { color: var(--clr-danger); }
.text-success { color: var(--clr-success); }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.text-lg { font-size: var(--fs-lg); }
.text-xl { font-size: var(--fs-xl); }

.font-display { font-family: var(--ff-display); }
.font-bold   { font-weight: var(--fw-bold); }
.font-semi   { font-weight: var(--fw-semi); }
.font-medium { font-weight: var(--fw-medium); }

.mt-auto { margin-top: auto; }
.mb-0    { margin-bottom: 0; }
.mb-4    { margin-bottom: var(--sp-4); }
.mb-6    { margin-bottom: var(--sp-6); }
.mb-8    { margin-bottom: var(--sp-8); }
.mt-4    { margin-top: var(--sp-4); }
.mt-6    { margin-top: var(--sp-6); }
.mt-8    { margin-top: var(--sp-8); }
.p-4     { padding: var(--sp-4); }
.p-6     { padding: var(--sp-6); }

.rounded-md  { border-radius: var(--radius-md); }
.rounded-lg  { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }

.hidden { display: none !important; }
.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;
}

.divider { border: none; border-top: 1px solid var(--clr-border); margin: var(--sp-6) 0; }

/* Bg helpers */
.bg-surface   { background: var(--clr-surface); }
.bg-surface-2 { background: var(--clr-surface-2); }
.bg-warm      { background: var(--clr-warm); }
.bg-primary   { background: var(--clr-primary); color: white; }

/* ── 26. ANIMATIONS ── */
@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slide-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(46,107,94,0.4); }
  70%  { box-shadow: 0 0 0 12px rgba(46,107,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(46,107,94,0); }
}

.animate-fade-in    { animation: fade-in var(--dur-slow) var(--ease-out) both; }
.animate-slide-up   { animation: slide-up var(--dur-slow) var(--ease-out) both; }
.animate-pulse-ring { animation: pulse-ring 2s infinite; }

/* Stagger children */
.stagger > * { animation: fade-in var(--dur-slow) var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 80ms; }
.stagger > *:nth-child(3) { animation-delay: 160ms; }
.stagger > *:nth-child(4) { animation-delay: 240ms; }
.stagger > *:nth-child(5) { animation-delay: 320ms; }
.stagger > *:nth-child(6) { animation-delay: 400ms; }

/* ── 27. RESPONSIVE ── */
@media (max-width: 1024px) {
  .tool-layout { grid-template-columns: 1fr; }
  .tool-sidebar { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  :root { --sp-6: 1.25rem; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
  .nav-links.is-open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--clr-surface);
    border-bottom: 1px solid var(--clr-border);
    padding: var(--sp-4);
    box-shadow: var(--shadow-md);
    z-index: var(--z-nav);
  }
  .hero { padding: var(--sp-16) 0 var(--sp-10); }
  .tool-header-inner { flex-direction: column; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .tabs { gap: 0; }
}
@media (max-width: 480px) {
  .toast-container { left: var(--sp-4); right: var(--sp-4); }
  .toast { min-width: unset; }
}

/* ── 28. PRINT STYLES ── */
@media print {
  .site-nav,
  .site-footer,
  .btn,
  .toast-container,
  .nav-actions,
  .tool-sidebar .card:not(.print-include) { display: none !important; }

  body { background: white; color: black; font-size: 11pt; }
  .container { max-width: 100%; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  h1,h2,h3 { break-after: avoid; }
  a { color: inherit; text-decoration: none; }

  .print-header {
    display: block !important;
    text-align: center;
    padding: 20px 0;
    border-bottom: 2px solid #2E6B5E;
    margin-bottom: 20px;
  }
  .print-footer {
    display: block !important;
    text-align: center;
    font-size: 9pt;
    color: #666;
    margin-top: 20px;
    border-top: 1px solid #ddd;
    padding-top: 10px;
  }
}
.print-header,
.print-footer { display: none; }

/* ── 29. CATEGORY COLOR THEMES ── */
.cat-tracking    { --cat-clr: #2E6B5E; --cat-bg: rgba(46,107,94,0.1); }
.cat-mental      { --cat-clr: #7B5EA7; --cat-bg: rgba(123,94,167,0.1); }
.cat-physical    { --cat-clr: #D4860F; --cat-bg: rgba(212,134,15,0.1); }
.cat-harm        { --cat-clr: #C0392B; --cat-bg: rgba(192,57,43,0.1); }
.cat-family      { --cat-clr: #1A6E9A; --cat-bg: rgba(26,110,154,0.1); }
.cat-cbt         { --cat-clr: #5A8A3C; --cat-bg: rgba(90,138,60,0.1); }
.cat-financial   { --cat-clr: #B07A2C; --cat-bg: rgba(176,122,44,0.1); }
.cat-community   { --cat-clr: #8B3A62; --cat-bg: rgba(139,58,98,0.1); }
.cat-crisis      { --cat-clr: #C0392B; --cat-bg: rgba(192,57,43,0.1); }
.cat-substances  { --cat-clr: #4A7C9B; --cat-bg: rgba(74,124,155,0.1); }

.cat-icon {
  background: var(--cat-bg);
  color: var(--cat-clr);
}
.cat-badge {
  background: var(--cat-bg);
  color: var(--cat-clr);
}

/* ── 30. AD ZONES ──
   Centralized, policy-compliant ad placement system.
   Rules this component enforces by design:
   1. Never sits adjacent to a .btn / interactive control (min 40px clearance
      enforced via the required margin below).
   2. Always visually labelled "Advertisement" so it can't be mistaken for
      editorial content or a navigational element (Google Publisher Policies:
      ads must be distinguishable from content).
   3. Reserves a min-height before the real ad script loads, so the layout
      doesn't shift under the user's cursor when the ad renders (shift =
      accidental-click risk, and also a Core Web Vitals / CLS problem).
   4. Only three placement classes exist site-wide. Do not invent new ad
      positions per-page, if a new placement is needed, add a class here
      first so every page stays consistent and auditable.

   Usage: drop one of the three <div class="ad-zone ad-zone--X"> blocks
   (see /ad-zone-snippet.html) at the matching HTML comment marker on each
   page. Never place inside .tool-actions, .btn-group, or within 2 sections
   of an interactive form control.
── */

.ad-zone {
  width: 100%;
  margin: var(--sp-10) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
}

.ad-zone-label {
  font-size: 10px;
  font-weight: var(--fw-semi);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--clr-text-muted);
  opacity: 0.6;
}

.ad-zone-slot {
  width: 100%;
  background: var(--clr-surface-2);
  border: 1px dashed var(--clr-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* In-content break: sits between the interactive tool and the article,
   or between the article and the FAQ. Never inside either. */
.ad-zone--content {
  max-width: 100%;
}
.ad-zone--content .ad-zone-slot {
  min-height: 100px;
}

/* Sidebar unit: lives in .tool-sidebar only, among the static link/quote
   cards, never near the crisis alert box (keep at least one card of
   separation from the 988 alert, both for visual hierarchy and so it
   never reads as competing with a safety resource). */
.ad-zone--sidebar {
  margin: var(--sp-4) 0;
}
.ad-zone--sidebar .ad-zone-slot {
  min-height: 250px;
}

/* End-of-page unit: sits after the FAQ / article, before the footer.
   Content has fully ended by this point, nothing interactive is nearby. */
.ad-zone--footer-adjacent {
  margin: var(--sp-10) 0 var(--sp-6);
}
.ad-zone--footer-adjacent .ad-zone-slot {
  min-height: 120px;
}

/* Hard safety rule: an ad-zone is never allowed to sit inside or
   immediately touching an actions/button group. This selector makes the
   mistake visually obvious in dev (bright warning outline) rather than
   silently shipping a bad placement if someone pastes one in the wrong
   spot by hand later. */
.tool-actions .ad-zone,
.btn-group .ad-zone,
.ad-zone + .tool-actions,
.ad-zone + .btn-group,
.tool-actions + .ad-zone,
.btn-group + .ad-zone {
  outline: 3px solid #C0392B !important;
  outline-offset: 4px;
}
.tool-actions .ad-zone::before,
.btn-group .ad-zone::before {
  content: "⚠ Misplaced ad zone: never adjacent to action buttons";
  display: block;
  color: #C0392B;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  text-align: center;
  padding: var(--sp-2);
}

@media print {
  .ad-zone { display: none !important; }
}
