/* ambulyn.css — Ambulyn design language */
/* Pairs with Pico CSS v2. Never use Bootstrap, Tailwind, or any other framework. */

/* ============================================================
   CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
  --amb-primary:       #0f4c81;
  --amb-primary-dark:  #0a3560;
  --amb-accent:        #7ec8f4;
  --amb-light:         #e8f1fb;

  /* Clinical color semantics — used everywhere consistently */
  --color-success:     #2d8a4e;
  --color-success-bg:  #e8f5ee;
  --color-success-border: #2d8a4e;

  --color-warning:     #b45309;
  --color-warning-bg:  #fef3c7;
  --color-warning-border: #b45309;

  --color-danger:      #b91c1c;
  --color-danger-bg:   #fee2e2;
  --color-danger-border: #b91c1c;

  --color-empty:       #9ca3af;
  --color-info:        #1d4ed8;

  /* Typography */
  --font-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;

  /* Spacing */
  --section-pad: 3rem 2rem;
  --max-width: 720px;
}

/* ============================================================
   BASE OVERRIDES
   ============================================================ */
body {
  font-family: var(--font-base);
  color: #1a1a2e;
  background: #fff;
}

h1, h2, h3 { font-weight: 500; }

a {
  color: var(--amb-primary);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

/* ============================================================
   PAGE ROUTING (single-file SPA)
   ============================================================ */
.page { display: none; }
.page.active { display: block; }

/* ============================================================
   NAVIGATION
   ============================================================ */
.amb-nav {
  background: var(--amb-primary);
  padding: 0.85rem 1.25rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.amb-nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
}

.nav-logo:hover { text-decoration: none; }

.nav-icon { width: 28px; height: 28px; flex-shrink: 0; }

.nav-wordmark {
  color: #fff;
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.nav-accent { color: var(--amb-accent); }

/* Desktop nav — visible above 600px */
.nav-desktop {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-desktop a {
  color: #b8d8f0;
  font-size: 0.87rem;
  text-decoration: none;
}

.nav-desktop a:hover { color: #fff; text-decoration: none; }

.nav-cta {
  color: var(--amb-accent) !important;
  font-weight: 500 !important;
}

/* Hamburger button — hidden above 600px */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  width: 32px;
  height: 32px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.hamburger span {
  display: block;
  width: 20px;
  height: 1.5px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

.hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Mobile dropdown menu */
.nav-mobile {
  display: none;
  flex-direction: column;
  background: #0a3560;
  border-top: 0.5px solid rgba(255,255,255,0.12);
  padding: 0.5rem 0;
}

.nav-mobile.open { display: flex; }

.nav-mobile a {
  color: #b8d8f0;
  font-size: 0.92rem;
  padding: 0.75rem 1.25rem;
  text-decoration: none;
  border-bottom: 0.5px solid rgba(255,255,255,0.06);
}

.nav-mobile a:last-child { border-bottom: none; }
.nav-mobile a:hover { color: #fff; background: rgba(255,255,255,0.05); }
.nav-mobile .nav-cta { color: var(--amb-accent) !important; font-weight: 500; }

/* Responsive breakpoint */
@media (max-width: 600px) {
  .nav-desktop { display: none; }
  .hamburger { display: flex; }
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  background: var(--amb-primary);
  padding: 4rem 2rem 5rem;
  text-align: center;
}

.hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.eyebrow {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  color: var(--amb-accent);
}

.eyebrow-dark { color: var(--amb-primary); }

.hero h1 {
  color: #fff;
  font-size: 2.3rem;
  line-height: 1.25;
  margin: 0 auto 1.25rem;
  max-width: 580px;
}

.hero h1 em {
  color: var(--amb-accent);
  font-style: normal;
}

.hero-sub {
  color: #b8d8f0;
  font-size: 1rem;
  line-height: 1.7;
  max-width: 500px;
  margin: 0 auto 2.25rem;
}

.cta-wrap {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.btn-hero {
  background: var(--amb-accent);
  color: var(--amb-primary);
  border: none;
  padding: 0.75rem 1.75rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-hero:hover { background: #9fd6f8; }

.btn-ghost {
  background: transparent;
  color: #fff;
  border: 1.5px solid rgba(255,255,255,0.35);
  padding: 0.75rem 1.75rem;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: border-color 0.15s;
}

.btn-ghost:hover { border-color: rgba(255,255,255,0.65); }

/* ============================================================
   SCENARIO CARD (hero)
   ============================================================ */
.scenario-card {
  background: #fff;
  border: 0.5px solid #dde3ea;
  border-radius: 12px;
  padding: 1.75rem;
  max-width: 600px;
  margin: 0 auto;
  text-align: left;
}

.scenario-tag {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--color-warning);
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.scenario-card p { font-size: 0.92rem; line-height: 1.7; color: #1a1a2e; }

.scenario-name { color: var(--amb-primary); }

.scenario-divider {
  border: none;
  border-top: 0.5px solid #dde3ea;
  margin: 0.9rem 0;
}

.resolution { display: flex; gap: 0.65rem; align-items: flex-start; }

.res-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--amb-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.res-icon i { color: var(--amb-primary); font-size: 14px; }

.res-text { font-size: 0.88rem; line-height: 1.65; color: #1a1a2e; }

.res-highlight { color: var(--color-success); }

/* ============================================================
   SECTIONS
   ============================================================ */
.section {
  padding: var(--section-pad);
}

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.section h2 {
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 0.6rem;
}

.section-sub {
  text-align: center;
  color: #5f6b7a;
  font-size: 0.92rem;
  line-height: 1.7;
  margin-bottom: 2rem;
}

/* ============================================================
   HOW IT WORKS
   ============================================================ */
.how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
}

.how-card {
  background: #f8f9fb;
  border-radius: 12px;
  padding: 1.25rem;
  border: 0.5px solid #e2e8f0;
}

.how-num {
  display: block;
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--amb-primary);
  margin-bottom: 0.4rem;
}

.how-card h3 { font-size: 0.92rem; font-weight: 500; margin-bottom: 0.35rem; }

.how-card p { font-size: 0.83rem; color: #5f6b7a; line-height: 1.6; }

/* ============================================================
   FEATURES
   ============================================================ */
.features {
  background: #f8f9fb;
  padding: var(--section-pad);
}

.features .section-inner { max-width: var(--max-width); margin: 0 auto; }

.features h2 { text-align: center; font-size: 1.5rem; margin-bottom: 0.4rem; }

.feat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.9rem;
  margin-top: 2rem;
}

.feat-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem;
  border: 0.5px solid #e2e8f0;
}

.feat-card i {
  font-size: 20px;
  color: var(--amb-primary);
  margin-bottom: 0.6rem;
  display: block;
}

.feat-card h3 { font-size: 0.9rem; font-weight: 500; margin-bottom: 0.3rem; }

.feat-card p { font-size: 0.82rem; color: #5f6b7a; line-height: 1.6; }

/* ============================================================
   STATS BAR
   ============================================================ */
.stat-bar {
  background: var(--amb-primary);
  padding: 2.25rem 2rem;
}

.stat-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.5rem;
  text-align: center;
}

.stat-num {
  display: block;
  font-size: 1.9rem;
  font-weight: 500;
  color: #fff;
}

.stat-label {
  display: block;
  font-size: 0.8rem;
  color: #b8d8f0;
  margin-top: 0.25rem;
  line-height: 1.45;
}

/* ============================================================
   WAITLIST FORM
   ============================================================ */
.waitlist-section {
  padding: 3.5rem 2rem;
}

.waitlist-inner {
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
}

.waitlist-inner h2 { font-size: 1.5rem; margin-bottom: 0.4rem; }

.waitlist-inner > p {
  color: #5f6b7a;
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 1.75rem;
}

.wl-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.wl-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wl-field label {
  font-size: 0.82rem;
  font-weight: 500;
  color: #374151;
}

.required { color: var(--color-danger); }

.optional {
  color: #9ca3af;
  font-weight: 400;
  font-size: 0.78rem;
}

.wl-field input,
.wl-field select {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 0.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.92rem;
  background: #fff;
  color: #1a1a2e;
  transition: border-color 0.15s;
}

.wl-field input:focus,
.wl-field select:focus {
  border-color: var(--amb-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.12);
}

.wl-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.wl-submit {
  background: var(--amb-primary);
  color: #fff;
  border: none;
  padding: 0.8rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  margin-top: 4px;
  transition: background 0.15s;
}

.wl-submit:hover:not(:disabled) { background: var(--amb-primary-dark); }

.wl-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.wl-note {
  font-size: 0.75rem;
  color: #9ca3af;
  text-align: center;
  margin-top: 0.25rem;
}

.wl-error {
  display: none;
  background: var(--color-danger-bg);
  border: 0.5px solid var(--color-danger-border);
  border-radius: 8px;
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
  color: #7f1d1d;
  margin-top: 4px;
}

.wl-success {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-success-bg);
  border: 0.5px solid var(--color-success-border);
  border-radius: 10px;
  padding: 1.75rem;
}

.wl-success i {
  font-size: 2rem;
  color: var(--color-success);
}

.wl-success p {
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-success);
  margin: 0;
}

.wl-success small {
  font-size: 0.85rem;
  color: #3b6d11;
  line-height: 1.5;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  border-top: 0.5px solid #e2e8f0;
  padding: 1.25rem 2rem;
  text-align: center;
}

.site-footer p { font-size: 0.8rem; color: #9ca3af; }

.site-footer a {
  color: var(--amb-primary);
  margin: 0 0.4rem;
  font-size: 0.8rem;
}

.footer-brand { color: var(--amb-primary); font-weight: 500; }

/* ============================================================
   LEGAL PAGES
   ============================================================ */
.legal-page { padding: 2.5rem 2rem; }

.legal-inner {
  max-width: 600px;
  margin: 0 auto;
}

.legal-inner h1 { font-size: 1.6rem; margin-bottom: 0.25rem; }

.legal-date {
  font-size: 0.82rem;
  color: #9ca3af;
  margin-bottom: 1.75rem;
  display: block;
}

.legal-inner h2 {
  font-size: 1rem;
  font-weight: 500;
  margin: 1.75rem 0 0.5rem;
  color: #1a1a2e;
}

.legal-inner p {
  font-size: 0.9rem;
  line-height: 1.75;
  color: #374151;
}

.legal-inner ul {
  padding-left: 1.25rem;
  margin-top: 0.4rem;
}

.legal-inner ul li {
  font-size: 0.9rem;
  line-height: 1.7;
  color: #374151;
  margin-bottom: 0.3rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--amb-primary);
  margin-bottom: 1.5rem;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
}

.back-link:hover { text-decoration: underline; }

/* ============================================================
   CONTACT PAGE
   ============================================================ */
.contact-card {
  background: #f8f9fb;
  border-radius: 12px;
  padding: 0.25rem 1.25rem;
  border: 0.5px solid #e2e8f0;
  margin: 1.5rem 0;
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.75rem 0;
  border-bottom: 0.5px solid #e2e8f0;
}

.contact-row:last-child { border-bottom: none; }

.contact-row i {
  color: var(--amb-primary);
  font-size: 18px;
  width: 22px;
  flex-shrink: 0;
}

.contact-row span { font-size: 0.9rem; color: #1a1a2e; }

/* ============================================================
   VAULT COMPLETENESS INDICATOR
   (used in the patient portal — included here for consistency)
   ============================================================ */
.vault-blocks { display: inline-flex; gap: 4px; align-items: center; }

.vault-block {
  display: inline-block;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 4px;
  background: var(--color-empty);
  opacity: 0.3;
}

.vault-block.complete {
  background: var(--color-success);
  opacity: 1;
}

/* ============================================================
   STALENESS FLAG COMPONENTS
   (used in the patient portal and emergency view)
   ============================================================ */
.staleness-amber {
  background: var(--color-warning-bg);
  border-left: 4px solid var(--color-warning);
  border-radius: 0;
  padding: 0.5rem 1rem;
  font-size: 0.88rem;
  color: #78350f;
}

.staleness-red {
  background: var(--color-danger-bg);
  border-left: 4px solid var(--color-danger);
  border-radius: 0;
  padding: 0.5rem 1rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: #7f1d1d;
}

/* ============================================================
   EMERGENCY VIEW OVERRIDES
   Apply .emergency-view to <body> or wrapper on the ER page
   ============================================================ */
.emergency-view {
  font-size: var(--font-emergency-body, 1.1rem);
}

.emergency-view .critical-value {
  font-size: 1.4rem;
  font-weight: 500;
}

.emergency-view .layer1-card {
  background: #fff;
  border: 0.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 0.75rem;
}

.emergency-view .allergy-severe { color: var(--color-danger); font-weight: 500; }
.emergency-view .allergy-moderate { color: var(--color-warning); }
.emergency-view .allergy-mild { color: #374151; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
  .hero h1 { font-size: 1.7rem; }
  .wl-row { grid-template-columns: 1fr; }
  .nav-links { gap: 0.85rem; }
  .amb-nav { padding: 0.75rem 1rem; }
  .hero { padding: 2.5rem 1rem 3.5rem; }
  .section { padding: 2.5rem 1rem; }
  .stat-inner { grid-template-columns: 1fr; }
}
