/* TypeMed website — tokens from TypeMed Design System v1.0
   Teal primary, slate neutrals, Inter Tight + IBM Plex Mono + Instrument Serif
*/

@keyframes tm-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

:root {
  /* Teal ramp */
  --teal-900:#062a26;
  --teal-800:#0d3b36;
  --teal-700:#0f6d64;
  --teal-600:#0fb3a5;   /* primary */
  --teal-500:#14c6b7;
  --teal-400:#2de3d5;
  --teal-300:#7df0e6;
  --teal-200:#b8f5ee;
  --teal-100:#cff7f1;
  --teal-50 :#f4fbfa;

  /* Neutrals — cool slate */
  --ink-950:#050814;
  --ink-900:#0f172a;
  --ink-700:#334155;
  --ink-600:#475569;
  --ink-500:#64748b;
  --ink-400:#94a3b8;
  --ink-300:#cbd5e1;
  --ink-200:#e2e8f0;
  --ink-100:#f1f5f9;
  --ink-50 :#f8fafc;
  --paper:#ffffff;

  /* Semantics */
  --success:#16a34a;
  --success-50:#ecfdf5;
  --warn:#d97706;
  --warn-50:#fffbeb;
  --danger:#dc2626;
  --danger-50:#fef2f2;
  --danger-900:#7f1d1d;
  --info:#2563eb;
  --info-50:#eff6ff;

  /* Role colors */
  --role-doctor:#0fb3a5;
  --role-nurse:#6366f1;
  --role-resident:#d97706;
  --role-visitor:#64748b;
  --role-admin:#0f172a;

  /* Website surface mapping (so existing components keep working) */
  --bg: var(--ink-50);
  --bg-2: var(--paper);
  --bg-3: var(--ink-100);
  --ink: var(--ink-900);
  --ink-2: var(--ink-700);
  --ink-3: var(--ink-600);
  --ink-4: var(--ink-500);
  --rule: var(--ink-200);
  --rule-2: var(--ink-300);
  --accent: var(--teal-600);
  --accent-ink: var(--teal-700);
  --accent-bg: var(--teal-50);
  --red: var(--danger);
  --green: var(--success);

  /* Radii */
  --r-xs:4px; --r-sm:6px; --r-md:10px; --r-lg:14px; --r-xl:20px; --r-2xl:28px; --r-pill:999px;
  --radius: var(--r-md);

  /* Elevation */
  --e-1: 0 1px 0 rgba(15,23,42,.04), 0 1px 2px rgba(15,23,42,.05);
  --e-2: 0 1px 2px rgba(15,23,42,.04), 0 6px 16px -6px rgba(15,23,42,.12);
  --e-3: 0 2px 4px rgba(15,23,42,.06), 0 20px 40px -12px rgba(15,23,42,.18);
  --e-teal: 0 8px 24px -8px rgba(15,179,165,.45);

  /* Fonts */
  --font-ui:"Inter Tight", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-mono:"IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-serif:"Instrument Serif", Georgia, serif;
}

[data-theme="dark"] {
  --bg: var(--ink-950);
  --bg-2: #0b1220;
  --bg-3: #111a2e;
  --ink: #f1f5f9;
  --ink-2: #cbd5e1;
  --ink-3: #94a3b8;
  --ink-4: #64748b;
  --rule: #1e293b;
  --rule-2: #334155;
  --accent: var(--teal-400);
  --accent-ink: var(--teal-300);
  --accent-bg: #0d3b36;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 15px;
  line-height: 1.55;
}

a { color: inherit; text-decoration: none; }

.serif {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.005em;
}
.mono {
  font-family: var(--font-mono);
}

/* Container */
.wrap { max-width: 1360px; margin: 0 auto; padding: 0 48px; }
@media (max-width: 768px) { .wrap { padding: 0 24px; } }

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklab, var(--bg), transparent 8%);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--rule);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px;
}
.nav-left { display: flex; align-items: center; gap: 40px; }
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 600; letter-spacing: -0.025em; font-size: 20px;
  color: var(--ink);
}
.logo .logo-mark {
  width: 34px; height: 34px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #27D3C0, #0AA89B);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.22), 0 4px 12px -4px rgba(15,179,165,.55);
}
.logo .logo-mark svg { width: 22px; height: 22px; display: block; }
.logo em {
  font-family: var(--font-ui);
  font-style: normal;
  font-weight: 400;
  color: var(--teal-600);
}

.nav-links { display: flex; gap: 4px; }
.nav-links a {
  padding: 8px 14px;
  font-size: 14px; color: var(--ink-2);
  border-radius: var(--r-md);
  transition: background 0.15s, color 0.15s;
}
.nav-links a:hover { background: var(--ink-100); color: var(--ink); }
.nav-links a.active { color: var(--teal-700); background: var(--teal-50); }

.nav-right { display: flex; align-items: center; gap: 8px; }
.lang-toggle {
  display: inline-flex; align-items: center; padding: 4px;
  background: var(--ink-100); border: 1px solid var(--rule);
  border-radius: var(--r-pill); font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.06em;
}
.lang-toggle button {
  background: transparent; border: none; padding: 4px 10px;
  font-family: inherit; font-size: inherit; letter-spacing: inherit;
  color: var(--ink-3); cursor: pointer; border-radius: var(--r-pill);
}
.lang-toggle button.on { background: var(--paper); color: var(--ink); box-shadow: var(--e-1); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  font-family: var(--font-ui); font-weight: 500; font-size: 14px;
  border: 1px solid transparent; border-radius: var(--r-md);
  cursor: pointer; line-height: 1;
  white-space: nowrap;
  transition: transform .08s ease, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--teal-600); color: #fff; box-shadow: var(--e-teal); }
.btn.primary:hover { background: var(--teal-700); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule-2); }
.btn.ghost:hover { background: var(--ink-100); }
.btn.lg { padding: 14px 22px; font-size: 15px; border-radius: var(--r-lg); }
.btn.sm { padding: 7px 12px; font-size: 13px; }

/* Sections */
section { padding: 96px 0; }
section.flush { padding: 0; }
section + section { border-top: 1px solid var(--rule); }

.eyebrow {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--teal-700);
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-ui); font-weight: 600;
  color: var(--ink); letter-spacing: -0.02em;
}
h1 { font-size: clamp(44px, 6vw, 72px); line-height: 1.02; letter-spacing: -0.03em; }
h2 { font-size: clamp(32px, 4vw, 48px); line-height: 1.05; letter-spacing: -0.025em; }
h3 { font-size: 24px; line-height: 1.2; }
/* Hero italic serif is an accent — ONLY the hero h1 gets the editorial italic.
   Other headings keep the teal color for emphasis but stay in the sans family. */
h1 em {
  font-family: var(--font-serif); font-style: italic;
  font-weight: 400; color: var(--teal-600);
  letter-spacing: -0.015em;
}
h2 em, h3 em, h4 em {
  font-family: inherit; font-style: normal;
  font-weight: inherit; color: var(--teal-700);
  letter-spacing: 0;
}
/* Opt-in: editorial italic accent for a handful of marquee phrases */
h2 em.em-accent, h3 em.em-accent {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--teal-600);
  letter-spacing: -0.015em;
}
p { margin: 0; color: var(--ink-3); }

/* Section header row */
.section-head {
  display: grid; grid-template-columns: 1fr 2fr;
  gap: 48px;
  padding-bottom: 32px; margin-bottom: 48px;
  border-bottom: 1px solid var(--rule);
}
.section-head .meta { display: flex; flex-direction: column; gap: 8px; }
.section-head .eyebrow { margin-bottom: 4px; }
@media (max-width: 768px) {
  .section-head { grid-template-columns: 1fr; gap: 20px; }
}

/* Hero */
.hero {
  padding: 100px 0 120px;
  background:
    radial-gradient(900px 480px at 85% -10%, rgba(45,227,213,.18), transparent 60%),
    radial-gradient(700px 400px at 8% 110%, rgba(15,109,100,.12), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--rule);
  position: relative; overflow: hidden;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  background: var(--teal-50); color: var(--teal-800);
  border: 1px solid var(--teal-200);
  border-radius: var(--r-pill);
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase;
  margin-bottom: 28px;
}
.hero-eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--teal-500);
  box-shadow: 0 0 0 4px rgba(45,227,213,.25);
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(45,227,213,.25); }
  50% { box-shadow: 0 0 0 8px rgba(45,227,213,.08); }
}
.hero h1 { max-width: 14ch; margin-bottom: 24px; }
.hero .lede {
  font-size: 19px; line-height: 1.55; color: var(--ink-2);
  max-width: 56ch; margin-bottom: 40px;
}
.hero-ctas { display: flex; gap: 12px; margin-bottom: 48px; }
.hero-grid {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 80px;
  align-items: center;
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 60px; }
}

/* Stat row */
.stat-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  border-top: 1px solid var(--rule);
  margin-top: 56px; padding-top: 32px;
}
.stat { padding: 0 24px; border-right: 1px solid var(--rule); }
.stat:first-child { padding-left: 0; }
.stat:last-child { padding-right: 0; border-right: none; }
.stat .n {
  font-family: var(--font-ui);
  font-size: 40px; font-weight: 600;
  letter-spacing: -0.02em; color: var(--ink);
  line-height: 1; margin-bottom: 8px;
}
.stat .n em {
  font-family: inherit; font-style: normal;
  font-weight: inherit; color: var(--teal-700);
}
.stat .lbl {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-4);
}

/* Trust bar */
.trust-bar {
  padding: 32px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  display: flex; align-items: center; gap: 48px;
  flex-wrap: wrap; justify-content: center;
}
.trust-bar .label {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-4);
}
.trust-logo {
  font-family: var(--font-ui); font-size: 18px; font-weight: 500;
  color: var(--ink-3); letter-spacing: -0.01em;
  opacity: 0.75;
}

/* Card / cell */
.cell {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--e-1);
}

/* Footer */
footer {
  padding: 80px 0 48px;
  background: var(--ink-950);
  color: #cbd5e1;
}
footer .cols {
  display: grid;
  grid-template-columns: 1.8fr 1fr 1fr 1fr 1.4fr;
  gap: 40px;
  align-items: start;
}
footer ul { list-style: none; margin: 0; padding: 0; }
footer li { margin: 0; }
footer h4, footer h5 {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--teal-300); margin: 0 0 16px; font-weight: 600;
}
footer a { color: #e2e8f0; display: block; padding: 4px 0; font-size: 14px; }
footer a:hover { color: var(--teal-300); }
footer .logo { color: #f8fafc; display: inline-flex; }
footer .logo em { color: var(--teal-400); }
footer p { color: #94a3b8; }
footer .bottom {
  margin-top: 64px; padding-top: 32px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.1em; color: rgba(255,255,255,0.5);
}

/* AI section (04) — assistant identity is violet */
#ai .eyebrow { color: #4f46e5; }
#ai .em-accent { color: #4f46e5; }

/* Utils */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 500;
}
.chip .dt { width: 6px; height: 6px; border-radius: 50%; }
.chip.teal { background: var(--teal-100); color: var(--teal-800); }
.chip.teal .dt { background: var(--teal-600); }
.chip.slate { background: var(--ink-100); color: var(--ink-700); }
.chip.slate .dt { background: var(--ink-500); }
.chip.amber { background: #fef3c7; color: #78350f; }
.chip.amber .dt { background: var(--warn); }
.chip.danger { background: var(--danger-50); color: var(--danger-900); }
.chip.danger .dt { background: var(--danger); }

/* Hero phone container */
.phone-wrap {
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.phone-wrap::before {
  content: ''; position: absolute; inset: -40px;
  background: radial-gradient(closest-side, rgba(45,227,213,.18), transparent 70%);
  z-index: 0;
}
.phone-wrap > * { position: relative; z-index: 1; }

/* ───────────────────────────────────────────────────────────
   MOBILE — all multi-col grids stack, sections tighten,
   nav collapses, hero scales down
   ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .wrap { padding: 0 20px; }

  /* Nav: drop links + sign in, keep logo + lang + demo */
  .nav-inner { height: 60px; }
  .nav-links { display: none; }
  .nav-right .btn.ghost { display: none; }
  .nav-right { gap: 6px; }
  .nav-right .btn.primary { padding: 9px 14px; font-size: 13px; }
  .lang-toggle { padding: 3px; }
  .lang-toggle button { padding: 3px 8px; font-size: 10px; }
  .logo { font-size: 18px; }
  .logo .logo-mark { width: 30px; height: 30px; }
  .logo .logo-mark svg { width: 19px; height: 19px; }

  /* Section rhythm */
  section { padding: 56px 0 !important; }
  .section-head {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 32px;
    padding-bottom: 24px;
  }
  .section-head p { font-size: 15px; }
  h1 { font-size: clamp(34px, 9vw, 48px) !important; }
  h2 { font-size: clamp(26px, 6.5vw, 34px) !important; }
  h3 { font-size: 20px; }

  /* HERO */
  .hero { padding: 48px 0 64px !important; }
  .hero-grid {
    grid-template-columns: 1fr !important;
    gap: 40px;
  }
  .hero h1 { max-width: 100%; }
  .hero .lede { font-size: 16px; margin-bottom: 28px; }
  .hero-ctas { flex-wrap: wrap; gap: 10px; margin-bottom: 32px; }
  .hero-ctas .btn.lg { padding: 12px 18px; font-size: 14px; }

  /* Phone visual: smaller scale */
  .phone-wrap { transform: scale(0.78); transform-origin: top center; }

  /* Stat row → 2x2 grid */
  .stat-row {
    grid-template-columns: 1fr 1fr;
    gap: 24px 0;
    margin-top: 40px;
    padding-top: 24px;
  }
  .stat { padding-right: 0; border-right: none; }
  .stat .n { font-size: 32px; }

  /* Force inline-styled multi-col grids to 1 col */
  section .wrap > div[style*="grid-template-columns: repeat(2"],
  section .wrap > div[style*="grid-template-columns: repeat(3"],
  section .wrap > div[style*="grid-template-columns: repeat(4"],
  section .wrap > div[style*="grid-template-columns: 1fr 1fr"],
  section .wrap > div[style*="grid-template-columns: 1.1fr 1fr"],
  section .wrap > div[style*="grid-template-columns: 1.15fr 1fr"],
  section .wrap > div[style*="grid-template-columns: 1.2fr 1fr 1fr"],
  section .wrap > div[style*="grid-template-columns: 1.3fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Drop the vertical separator on cards once stacked */
  section .wrap div[style*="border-right: 1px solid"] {
    border-right: none !important;
  }

  /* Comparison table — keep 3-col layout (criterion, TypeMed, WhatsApp) — instead, hide the eyebrow row and let each row stack */
  #compare .wrap > div > div[style*="grid-template-columns: 1.3fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    padding: 18px 18px !important;
    gap: 8px !important;
  }
  /* Hide the header row of comparison on mobile */
  #compare .wrap > div > div[style*="grid-template-columns: 1.3fr 1fr 1fr"]:first-child {
    display: none !important;
  }
  /* Add row labels via ::before for the second/third cells */
  #compare .wrap > div > div[style*="grid-template-columns: 1.3fr 1fr 1fr"]:not(:first-child) > div:nth-child(1) {
    font-size: 16px !important; font-weight: 600; padding-bottom: 6px;
    border-bottom: 1px solid var(--rule); margin-bottom: 4px;
  }
  #compare .wrap > div > div[style*="grid-template-columns: 1.3fr 1fr 1fr"]:not(:first-child) > div:nth-child(2)::before {
    content: 'TypeMed · '; color: var(--teal-700); font-weight: 600; margin-right: 4px;
    font-family: var(--font-mono); font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  }
  #compare .wrap > div > div[style*="grid-template-columns: 1.3fr 1fr 1fr"]:not(:first-child) > div:nth-child(3)::before {
    content: 'WhatsApp · '; color: var(--ink-4); font-weight: 600; margin-right: 4px;
    font-family: var(--font-mono); font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  }

  /* Pricing cards: drop minHeight, restore borders */
  #pricing .wrap > div > div[style] { min-height: 0 !important; }
  #pricing .wrap > div > div[style*="border-right"] { border-bottom: 1px solid var(--rule); }

  /* Calculator */
  #calculator .wrap > div[style*="grid-template-columns: 1fr 1fr"] {
    gap: 32px !important;
  }
  #calculator div[style*="padding: 40px"] { padding: 24px !important; }

  /* CTA */
  #cta .wrap > div[style*="grid-template-columns: repeat(3"] > div {
    padding-left: 0 !important; padding-right: 0 !important;
    padding-top: 24px !important;
  }

  /* Workflow stat banner */
  #workflows .wrap > div[style*="background: var(--ink)"] {
    padding: 20px 22px !important;
  }

  /* Footer → 2 cols */
  footer .cols {
    grid-template-columns: 1fr 1fr;
    gap: 28px;
  }
  footer .cols > div:first-child { grid-column: 1 / -1; }
  footer .bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  /* Compliance certifications wrap */
  section[id] .wrap > div[style*="background: var(--bg-2)"][style*="padding"] {
    padding: 20px !important;
    gap: 16px !important;
  }

  /* Hero stats → 2×2 grid (they otherwise collapse to 4 tall rows) */
  .hero-stats {
    grid-template-columns: 1fr 1fr !important;
    gap: 26px 20px !important;
    margin-top: 44px !important;
    padding-top: 26px;
  }
  .hero-stats > div {
    padding: 0 !important;
    border-right: none !important;
  }
  .hero-stats > div > div:first-child { font-size: 32px !important; }

  /* Product tour: more breathing room once tabs + phone stack */
  #product .wrap > div[style*="grid-template-columns: 1fr 1fr"] { gap: 36px !important; }
  #product button[style*="padding: 22px 24px"] { padding: 18px 18px !important; }

  /* Legal pages (termeni/confidentialitate/dpa/dpia): tighten number gutter */
  .wrap > div > div[style*="grid-template-columns: 80px 1fr"] {
    grid-template-columns: 40px 1fr !important;
    gap: 14px !important;
  }

  /* Bordered card groups (AI advantages / how-it-works / security arch):
     drop inner separators and cap card heights once stacked */
  section .wrap div[style*="grid-template-columns: repeat(3"] > div[style*="min-height"],
  section .wrap div[style*="grid-template-columns: repeat(2"] > div[style*="min-height"] {
    min-height: 0 !important;
  }

  /* Contact form: sidebar stacks under the form with a gap */
  #root .wrap > div[style*="grid-template-columns: 1.3fr 1fr"] { gap: 40px !important; }
}

/* Tiny phones */
@media (max-width: 420px) {
  .stat-row, .hero-stats { grid-template-columns: 1fr !important; }
  .phone-wrap { transform: scale(0.7); }
  h1 { font-size: clamp(30px, 9vw, 38px) !important; }
  /* Chat bubbles use more of the width on very small screens */
  main div[style*="justify-content: flex-start"] > div[style*="max-width: 78%"],
  main div[style*="justify-content: flex-end"] > div[style*="max-width: 78%"] {
    max-width: 88% !important;
  }
}

/* Guard against accidental horizontal scroll on phones.
   Use overflow-x: clip (not hidden) — `hidden` forces the computed
   overflow-y to `auto`, which turns <body> into its own scroll
   container and produces phantom white space below the footer. */
@media (max-width: 900px) {
  html, body { overflow-x: clip; }
  img, video { max-width: 100%; height: auto; }
}
