/* ============================================================
   RESHORE BRIDGE — DESIGN SYSTEM
   The Clinical Modernist · Medical Blue · Montserrat / Open Sans
   ============================================================ */

/* ── Custom Properties ─────────────────────────────────────── */
:root {
  /* Medical Blue Scale */
  --brand-50:  #f0f9ff;
  --brand-100: #e0f2fe;
  --brand-200: #bae6fd;
  --brand-300: #7dd3fc;
  --brand-400: #38bdf8;
  --brand-500: #0ea5e9;
  --brand-600: #0284c7;
  --brand-700: #0369a1;  /* Primary — Medical Blue */
  --brand-800: #075985;
  --brand-900: #0c4a6e;
  --brand-950: #082f49;

  /* Component Tokens */
  --brand-accent:         #0369a1;
  --brand-nav-bg:         rgba(12, 74, 110, 0.96);
  --brand-callout-border: #0369a1;
  --brand-callout-bg:     #f0f9ff;

  /* Silver Scale */
  --sv-50:  #f8fafc;
  --sv-100: #f1f5f9;
  --sv-200: #e2e8f0;
  --sv-300: #cbd5e1;
  --sv-400: #94a3b8;
  --sv-500: #64748b;
  --sv-600: #475569;
  --sv-700: #334155;
  --sv-800: #1e293b;
  --sv-900: #0f172a;

  /* Stone */
  --st-50:  #fafaf9;
  --st-100: #f7f9fc;
  --st-200: #eef2f8;
  --st-300: #d4cfc5;
  --st-400: #b8b2a5;

  /* Color Aliases */
  --color-brand:      var(--brand-700);
  --color-brand-dark: var(--brand-800);
  --color-brand-deep: var(--brand-900);
  --color-silver:     var(--sv-400);
  --color-stone:      var(--st-100);
  --color-white:      #ffffff;
  --color-text:       var(--sv-900);
  --color-text-muted: var(--sv-600);
  --color-text-light: var(--sv-400);
  --color-border:     var(--sv-200);
  --color-border-dark:var(--sv-300);

  /* Type Scale */
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.25rem;
  --text-5xl:  3rem;
  --text-6xl:  3.75rem;
  --text-7xl:  4.5rem;
  --text-8xl:  6rem;

  /* Spacing (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;
  --sp-40: 10rem;

  /* Nav height */
  --nav-h: 68px;

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

  /* Shadow */
  --shadow-sm:  0 1px 2px rgba(0,0,0,.06);
  --shadow-md:  0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.14);
  --shadow-xl:  0 16px 48px rgba(0,0,0,.18);

  /* Transitions */
  --ease-out: cubic-bezier(0.215, 0.61, 0.355, 1);
  --ease-in:  cubic-bezier(0.55, 0.055, 0.675, 0.19);
  --dur-fast: 140ms;
  --dur-base: 220ms;
  --dur-slow: 380ms;

  /* Fonts — Montserrat (headings) / Open Sans (body) */
  --font-head: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;

  /* Container */
  --container-max: 1200px;
  --container-pad: var(--sp-6);
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-white);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-head);
}

img, video, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, textarea, select { font: inherit; }

/* ── Container ──────────────────────────────────────────────── */
.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

/* ── Typography ─────────────────────────────────────────────── */
.text-xs   { font-size: var(--text-xs); }
.text-sm   { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg   { font-size: var(--text-lg); }
.text-xl   { font-size: var(--text-xl); }
.text-2xl  { font-size: var(--text-2xl); }
.text-3xl  { font-size: var(--text-3xl); }
.text-4xl  { font-size: var(--text-4xl); }

.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 700; }
.font-head    { font-family: var(--font-head); }

.text-muted { color: var(--color-text-muted); }
.text-light { color: var(--color-text-light); }
.text-brand { color: var(--color-brand); }
.text-white { color: var(--color-white); }

.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.05em; }
.tracking-wider { letter-spacing: 0.1em; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6);
  border-radius: var(--radius-md);
  font-family: var(--font-head);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all var(--dur-base) var(--ease-out);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}

.btn--primary {
  background: var(--brand-700);
  color: var(--color-white);
  border: 1.5px solid var(--brand-700);
}
.btn--primary:hover {
  background: var(--brand-800);
  border-color: var(--brand-800);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(3,105,161,.3);
}

.btn--primary-inv {
  background: var(--color-white);
  color: var(--brand-700);
  border: 1.5px solid var(--color-white);
}
.btn--primary-inv:hover {
  background: var(--st-100);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(255,255,255,.25);
}

.btn--ghost {
  background: transparent;
  color: var(--brand-700);
  border: 1.5px solid var(--brand-700);
}
.btn--ghost:hover {
  background: var(--brand-700);
  color: var(--color-white);
}

.btn--ghost-inv {
  background: transparent;
  color: var(--color-white);
  border: 1.5px solid rgba(255,255,255,.55);
}
.btn--ghost-inv:hover {
  background: rgba(255,255,255,.1);
  border-color: var(--color-white);
}

.btn--lg {
  padding: var(--sp-4) var(--sp-8);
  font-size: var(--text-base);
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-full);
  font-family: var(--font-head);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.badge--blue   { background: var(--brand-100); color: var(--brand-700); }
.badge--silver { background: var(--sv-100); color: var(--sv-700); }
.badge--stone  { background: var(--st-200); color: var(--sv-700); }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-8);
  transition: box-shadow var(--dur-base) var(--ease-out),
              transform var(--dur-base) var(--ease-out);
}
.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* ── Data Table ─────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.data-table thead tr {
  background: var(--brand-700);
  color: var(--brand-100);
}
.data-table th {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  font-family: var(--font-head);
  font-weight: 600;
  letter-spacing: 0.05em;
  font-size: var(--text-xs);
  text-transform: uppercase;
}
.data-table td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
  line-height: 1.5;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:nth-child(even) { background: var(--st-100); }
.data-table-wrap { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--color-border); }

/* ── Grid Utilities ─────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-8); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-8); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-6); }

/* ── Section Utilities ──────────────────────────────────────── */
.section { padding-block: var(--sp-24); }
.section--sm { padding-block: var(--sp-16); }
.section--lg { padding-block: var(--sp-32); }

.section__label {
  font-family: var(--font-head);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-600);
  margin-bottom: var(--sp-3);
}
.section__title {
  font-family: var(--font-head);
  font-size: clamp(var(--text-3xl), 4vw, var(--text-5xl));
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-4);
}
.section__subtitle {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  max-width: 640px;
  line-height: 1.7;
}

/* ── Callout ────────────────────────────────────────────────── */
.callout {
  background: var(--brand-callout-bg);
  border-left: 3px solid var(--brand-callout-border);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: var(--sp-4) var(--sp-6);
  font-size: var(--text-sm);
  color: var(--brand-900);
  line-height: 1.6;
  margin-block: var(--sp-6);
}

/* ── Dividers ───────────────────────────────────────────────── */
.divider {
  width: 40px;
  height: 2px;
  background: var(--brand-700);
  margin-bottom: var(--sp-8);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --container-pad: var(--sp-4); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .section { padding-block: var(--sp-16); }
  .section--lg { padding-block: var(--sp-24); }
}

/* ── Utility ────────────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}
.flex          { display: flex; }
.flex-center   { display: flex; align-items: center; justify-content: center; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.gap-8 { gap: var(--sp-8); }
.mt-4  { margin-top: var(--sp-4); }
.mt-8  { margin-top: var(--sp-8); }
.mb-4  { margin-bottom: var(--sp-4); }
.mb-8  { margin-bottom: var(--sp-8); }

/* ── FAQ Accordion ──────────────────────────────────────────── */
.faq { margin-top: var(--sp-12); }
.faq__item {
  border-bottom: 1px solid var(--color-border);
}
.faq__btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) 0;
  font-family: var(--font-head);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  text-align: left;
  gap: var(--sp-4);
  cursor: pointer;
  background: none;
  border: none;
}
.faq__btn:hover { color: var(--brand-700); }
.faq__icon {
  width: 22px; height: 22px;
  border: 1.5px solid var(--color-border-dark);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--brand-700);
  transition: transform var(--dur-base);
}
.faq__item.is-open .faq__icon { transform: rotate(45deg); }
.faq__body {
  display: none;
  padding-bottom: var(--sp-5);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.75;
  max-width: 720px;
}
.faq__item.is-open .faq__body { display: block; }

/* ── EEAT Author Block ──────────────────────────────────────── */
.eeat {
  background: var(--st-100);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6) var(--sp-8);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-6);
  margin-top: var(--sp-10);
}
.eeat__mark {
  width: 48px; height: 48px;
  background: var(--brand-700);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: var(--text-lg);
  color: var(--color-white);
  flex-shrink: 0;
}
.eeat__name {
  font-family: var(--font-head);
  font-size: var(--text-sm);
  font-weight: 700;
  margin-bottom: 2px;
}
.eeat__role {
  font-size: var(--text-xs);
  color: var(--brand-700);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: var(--sp-2);
}
.eeat__bio {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.65;
}

/* ── Glossary Hover Tooltips (.gt) ──────────────────────────── */
/* Applied auto by gloss-tips.js to recognized terms in article body */
.gt {
  border-bottom: 1px dashed var(--brand-500);
  color: inherit;
  cursor: help;
  position: relative;
  white-space: nowrap;
}

.gt::after {
  content: attr(data-def);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--brand-900);
  color: #fff;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: 0;
  white-space: normal;
  width: 280px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast);
  z-index: 300;
  text-transform: none;
}

/* Caret */
.gt::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--brand-900);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast);
  z-index: 301;
}

.gt:hover::after,
.gt:hover::before,
.gt:focus::after,
.gt:focus::before {
  opacity: 1;
}

/* Flip tooltip below when near top of viewport */
@media (max-width: 640px) {
  .gt::after {
    width: 220px;
    left: 0;
    transform: none;
  }
  .gt::before {
    left: 14px;
    transform: none;
  }
}
