:root {
  --porcelain: #eef3f1;
  --paper: #f7faf8;
  --mist: #c5d4cf;
  --oxide: #143844;
  --oxide-deep: #0c2a33;
  --brass: #c4923a;
  --brass-soft: #e7d3a4;
  --pulse: #2f7a6d;
  --ink: #1a2428;
  --muted: #5a6b70;
  --line: rgba(20, 56, 68, 0.12);
  --white: #ffffff;
  --danger: #9b2c2c;
  --radius-lg: 1.75rem;
  --header-h: 4.5rem;
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Source Serif 4", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --shadow: 0 24px 60px rgba(20, 56, 68, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--porcelain);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

h1,
h2,
h3,
.display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

p {
  margin: 0 0 1rem;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.wrap {
  width: min(1180px, calc(100% - 2.5rem));
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--oxide);
  color: var(--paper);
  padding: 0.6rem 1rem;
  z-index: 80;
}

.skip:focus {
  top: 1rem;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--porcelain) 86%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(1180px, calc(100% - 2.5rem));
  margin-inline: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--oxide);
}

.brand svg {
  width: 2.1rem;
  height: 2.1rem;
  color: var(--pulse);
}

.brand strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.brand span {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.nav a {
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 0.92rem;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  color: var(--oxide);
}

.nav a[aria-current="page"],
.nav a:hover {
  background: var(--white);
}

.header-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--oxide);
  color: var(--paper);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 0.92rem;
  padding: 0.7rem 1rem;
  border-radius: 999px;
}

.header-cta:hover {
  background: var(--oxide-deep);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 999px;
  cursor: pointer;
}

.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  display: block;
  width: 1rem;
  height: 1.5px;
  background: var(--oxide);
  position: relative;
  margin: auto;
}

.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav-toggle span::before { top: -5px; }
.nav-toggle span::after { top: 5px; }

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 2.5rem;
  align-items: center;
  padding: 3.5rem 0 2.5rem;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--pulse);
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: clamp(2.6rem, 5.4vw, 4.6rem);
  color: var(--oxide);
  margin: 0 0 1.1rem;
  max-width: 11ch;
}

.lede {
  font-size: 1.2rem;
  color: var(--muted);
  max-width: 38ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.6rem 0 1.4rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 1rem;
  padding: 0.9rem 1.2rem;
  border-radius: 999px;
}

.btn-primary {
  background: var(--brass);
  color: var(--oxide-deep);
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-ghost {
  background: transparent;
  color: var(--oxide);
  box-shadow: inset 0 0 0 1px var(--mist);
}

.hours-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.8rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  padding: 0.85rem 1rem;
}

.hours-chip b {
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.hours-chip span {
  color: var(--muted);
  font-size: 0.95rem;
}

.scope-stage {
  position: relative;
  min-height: 34rem;
}

.port {
  position: absolute;
  margin: 0;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 8px solid var(--paper);
}

.port img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.port-lg {
  width: min(78%, 28rem);
  aspect-ratio: 1;
  top: 1rem;
  left: 0;
}

.port-md {
  width: min(42%, 15rem);
  aspect-ratio: 1;
  right: 0;
  top: 0;
  border-color: color-mix(in srgb, var(--brass-soft) 70%, white);
}

.port-sm {
  width: min(28%, 10rem);
  aspect-ratio: 1;
  right: 12%;
  bottom: 1.5rem;
}

.ecg {
  position: absolute;
  left: -6%;
  right: -4%;
  bottom: 18%;
  width: 112%;
  height: 72px;
  color: var(--pulse);
  pointer-events: none;
}

.ecg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: draw 2.4s 0.4s ease forwards;
}

@keyframes draw {
  to { stroke-dashoffset: 0; }
}

/* Metrics */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 1rem 0 4rem;
}

.metric {
  background: var(--paper);
  padding: 1.3rem 1.2rem;
}

.metric b {
  display: block;
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--oxide);
  letter-spacing: -0.04em;
}

.metric span {
  color: var(--muted);
  font-size: 0.98rem;
}

/* Sections */
.section {
  padding: 4.2rem 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.section-head h2 {
  font-size: clamp(2rem, 3.5vw, 3rem);
  color: var(--oxide);
  margin: 0;
  max-width: 16ch;
}

.section-head p {
  max-width: 36ch;
  color: var(--muted);
  margin: 0;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  padding: 1.4rem;
  text-decoration: none;
  display: block;
  min-height: 100%;
}

.card:hover {
  border-color: color-mix(in srgb, var(--pulse) 35%, var(--line));
}

.card h3 {
  margin: 0.4rem 0 0.6rem;
  font-size: 1.35rem;
  color: var(--oxide);
}

.card p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.icon-dot {
  width: auto;
  min-width: 2.8rem;
  height: 1.7rem;
  padding: 0 0.55rem;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: color-mix(in srgb, var(--pulse) 12%, white);
  color: var(--pulse);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: stretch;
}

.panel {
  background: var(--oxide);
  color: var(--paper);
  border-radius: 1.8rem;
  padding: 2rem;
  min-height: 22rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.panel.light {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
}

.panel h2,
.panel h3 {
  color: inherit;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  margin: 0.4rem 0 0.8rem;
}

.panel p {
  color: color-mix(in srgb, var(--paper) 78%, transparent);
}

.panel.light p {
  color: var(--muted);
}

.port-inline {
  width: min(100%, 18rem);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 0 0 auto;
  border: 8px solid color-mix(in srgb, white 18%, transparent);
}

.panel.light .port-inline {
  border-color: var(--paper);
  box-shadow: var(--shadow);
}

.list-plain {
  list-style: none;
  padding: 0;
  margin: 0;
}

.list-plain li {
  padding: 0.7rem 0;
  border-bottom: 1px solid color-mix(in srgb, white 14%, transparent);
}

.panel.light .list-plain li {
  border-bottom-color: var(--line);
}

/* Team */
.team {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (min-width: 960px) {
  .team {
    grid-template-columns: repeat(4, 1fr);
  }
}

.person {
  background: var(--paper);
  border-radius: 1.5rem;
  padding: 1.4rem;
  border: 1px solid var(--line);
}

.avatar {
  width: 4.2rem;
  height: 4.2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--oxide);
  color: var(--brass-soft);
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin-bottom: 1rem;
}

.person h3 {
  margin: 0 0 0.2rem;
  font-size: 1.25rem;
  color: var(--oxide);
}

.person p {
  color: var(--muted);
  margin: 0;
}

/* Page hero */
.page-hero {
  padding: 3.2rem 0 1.5rem;
}

.page-hero h1 {
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  color: var(--oxide);
  margin: 0 0 1rem;
  max-width: 16ch;
}

.rules {
  counter-reset: rule;
  display: grid;
  gap: 1rem;
}

.rule {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.2rem;
  background: var(--paper);
  border-radius: 1.5rem;
  padding: 1.4rem;
  border: 1px solid var(--line);
}

.rule::before {
  counter-increment: rule;
  content: counter(rule, decimal-leading-zero);
  font-family: var(--font-mono);
  color: var(--brass);
  font-size: 0.9rem;
  padding-top: 0.35rem;
}

.rule h2 {
  margin: 0 0 0.5rem;
  font-size: 1.4rem;
  color: var(--oxide);
}

.gallery {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1rem;
}

.gallery .port {
  position: relative;
  width: 100%;
  border: 0;
}

.contact-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 1.2rem;
}

.contact-card {
  background: var(--oxide-deep);
  color: var(--paper);
  border-radius: 1.8rem;
  padding: 1.8rem;
}

.contact-card a {
  color: var(--brass-soft);
}

.hours-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}

.hours-table th,
.hours-table td {
  text-align: left;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
}

.hours-table th {
  font-weight: 500;
  color: var(--muted);
  width: 42%;
}

.map {
  width: 100%;
  min-height: 28rem;
  border: 0;
  border-radius: 1.8rem;
  filter: saturate(0.7) contrast(1.05);
}

.note {
  background: color-mix(in srgb, var(--brass) 14%, white);
  border-radius: 1.2rem;
  padding: 1rem 1.1rem;
  font-size: 1rem;
}

.footer {
  background: var(--oxide-deep);
  color: color-mix(in srgb, var(--paper) 82%, transparent);
  padding: 3rem 0 2rem;
  margin-top: 3rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2rem;
}

.footer a {
  color: var(--brass-soft);
  text-decoration: none;
}

.footer h2,
.footer .brand strong {
  color: var(--paper);
}

.footer small {
  display: block;
  margin-top: 2rem;
  color: color-mix(in srgb, var(--paper) 50%, transparent);
}

/* Chatbot */
.meda-launcher {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  z-index: 50;
  width: 4.1rem;
  height: 4.1rem;
  border-radius: 50%;
  border: 6px solid var(--paper);
  background: var(--oxide);
  color: var(--brass-soft);
  box-shadow: var(--shadow);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.meda-launcher svg {
  width: 1.6rem;
  height: 1.6rem;
}

.meda-panel {
  position: fixed;
  right: 1.2rem;
  bottom: 5.6rem;
  z-index: 50;
  width: min(26rem, calc(100vw - 1.5rem));
  height: min(38rem, calc(100vh - 7.5rem));
  background: var(--paper);
  border-radius: 1.7rem;
  box-shadow: var(--shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
}

.meda-panel.open {
  display: flex;
}

.meda-head {
  background: var(--oxide);
  color: var(--paper);
  padding: 1rem 1.1rem 0.9rem;
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
}

.meda-head h2 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--paper);
}

.meda-head p {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: color-mix(in srgb, var(--paper) 72%, transparent);
}

.meda-close {
  background: transparent;
  border: 0;
  color: var(--paper);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

.meda-log {
  flex: 1;
  overflow: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  background:
    radial-gradient(circle at 100% 0, color-mix(in srgb, var(--brass) 10%, transparent), transparent 40%),
    var(--porcelain);
}

.bubble {
  max-width: 88%;
  padding: 0.75rem 0.9rem;
  border-radius: 1.1rem;
  font-size: 0.98rem;
  line-height: 1.45;
}

.bubble p { margin: 0 0 0.45rem; }
.bubble p:last-child { margin: 0; }

.bubble.bot {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--line);
  border-bottom-left-radius: 0.3rem;
}

.bubble.user {
  align-self: flex-end;
  background: var(--oxide);
  color: var(--paper);
  border-bottom-right-radius: 0.3rem;
}

.bubble a {
  color: var(--pulse);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1rem 0.7rem;
}

.chip {
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  font-family: var(--font-display);
  font-size: 0.82rem;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.chip.primary {
  background: var(--oxide);
  color: var(--paper);
  border-color: transparent;
}

.chip.danger {
  background: var(--danger);
  color: var(--paper);
  border-color: transparent;
}

.triage-card {
  margin-top: 0.35rem;
  padding: 0.75rem 0.8rem;
  border-radius: 0.9rem;
  border: 1px solid var(--line);
}

.triage-card .mono {
  color: inherit;
  margin-bottom: 0.45rem;
}

.triage-emergency {
  background: #f8e6e6;
  border-color: color-mix(in srgb, var(--danger) 35%, white);
}

.triage-today {
  background: #f6edd9;
  border-color: color-mix(in srgb, var(--brass) 45%, white);
}

.triage-routine {
  background: color-mix(in srgb, var(--pulse) 12%, white);
  border-color: color-mix(in srgb, var(--pulse) 28%, white);
}

.meda-note {
  font-size: 0.85rem;
  color: var(--muted);
}

.meda-form {
  display: flex;
  gap: 0.4rem;
  padding: 0.7rem;
  border-top: 1px solid var(--line);
  background: var(--white);
}

.meda-form input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.7rem 0.9rem;
  font: inherit;
  font-size: 0.95rem;
}

.meda-form button {
  border: 0;
  background: var(--brass);
  color: var(--oxide-deep);
  border-radius: 999px;
  padding: 0 1rem;
  font-family: var(--font-display);
  cursor: pointer;
}

.emergency {
  color: var(--danger);
  font-weight: 600;
}

@media (max-width: 960px) {
  .hero,
  .split,
  .cards,
  .team,
  .metrics,
  .contact-grid,
  .gallery,
  .footer-grid,
  .section-head {
    grid-template-columns: 1fr;
  }

  .nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--porcelain);
    flex-direction: column;
    padding: 0.8rem 1.2rem 1.2rem;
    border-bottom: 1px solid var(--line);
  }

  .nav.open { display: flex; }
  .nav-toggle { display: grid; }
  .header-inner {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
  }
  .header-cta {
    padding: 0.65rem 0.8rem;
    font-size: 0.82rem;
  }
  .scope-stage { min-height: 22rem; }
  .hero h1 { max-width: none; }
  .metrics { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .ecg path { animation: none; stroke-dashoffset: 0; }
  html { scroll-behavior: auto; }
}

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
}
