/* ==========================================================================
   Metro Hospital — styles.css (mobile-first)
   ========================================================================== */

:root {
  --brand: #1B3F94;
  --brand-light: #1E7BC8;
  --brand-dark: #16337A;
  --brand-darker: #122A63;
  --brand-soft: #EFF4FC;
  --brand-border: #BFD3F2;
  --red: #DC2626;
  --red-dark: #B91C1C;
  --red-soft: #FEF2F2;
  --ink: #0F172A;
  --text: #334155;
  --muted: #475569;
  --border: #E2E8F0;
  --surface: #FFFFFF;
  --tint: #F8FAFC;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mobile-bar-height: 64px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem; /* 17px */
  line-height: 1.6;
  color: var(--text);
  background: var(--surface);
  padding-bottom: calc(var(--mobile-bar-height) + env(safe-area-inset-bottom, 0px));
}

h1, h2, h3 {
  color: var(--ink);
  line-height: 1.2;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 5vw + 0.5rem, 3.25rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.6rem, 2.5vw + 1rem, 2.25rem); letter-spacing: -0.01em; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; height: auto; display: block; }
address { font-style: normal; margin-bottom: 0.75em; }

a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-dark); }

/* Clear, consistent keyboard focus */
:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
  border-radius: 4px;
}

.sprite { position: absolute; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem; top: -4rem;
  z-index: 200;
  padding: 0.75rem 1rem;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-sm);
  transition: top 0.15s;
}
.skip-link:focus { top: 1rem; color: #fff; }

.container {
  width: 100%;
  max-width: 1160px;
  margin-inline: auto;
  padding-inline: 1rem;
}

.icon {
  width: 1.25em; height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.7rem 1.25rem;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn-lg { min-height: 54px; padding: 0.85rem 1.5rem; font-size: 1.0625rem; }
.btn-block { width: 100%; }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }

.btn-emergency { background: var(--red); color: #fff; }
.btn-emergency:hover { background: var(--red-dark); color: #fff; }
.btn-emergency:focus-visible { outline-color: var(--red-dark); }

.btn-outline { background: #fff; color: var(--brand); border-color: var(--brand); }
.btn-outline:hover { background: var(--brand-soft); color: var(--brand-dark); }

.btn[disabled] { opacity: 0.75; cursor: progress; }

.link-button {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link-button:hover { color: var(--brand-dark); }

/* ---------- Utility bar ---------- */
.utility-bar {
  background: var(--brand-darker);
  color: #fff;
  font-size: 0.9375rem;
}
.utility-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  padding-block: 0.5rem;
}
.utility-phone, .utility-hours {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  color: #fff;
}
.utility-phone { text-decoration: none; min-height: 32px; }
.utility-phone:hover { color: #fff; text-decoration: underline; }
.utility-bar :focus-visible { outline-color: #fff; }
.utility-hours .divider { margin-inline: 0.35rem; opacity: 0.6; }

/* ---------- Header / navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  min-height: 68px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  text-decoration: none;
}
.brand img { width: 60px; height: 46px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-hi { font-size: 1.25rem; font-weight: 700; color: var(--red); }
.brand-name { font-size: 0.8125rem; font-weight: 700; color: var(--red); letter-spacing: 0.08em; text-transform: uppercase; }

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px; height: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-size: 1.2rem;
  cursor: pointer;
}
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-open { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }

.primary-nav {
  display: none;
  flex-basis: 100%;
  padding-bottom: 1rem;
}
.primary-nav.is-open { display: block; }
.primary-nav ul { display: flex; flex-direction: column; }
.primary-nav li a {
  display: block;
  padding: 0.8rem 0.25rem;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
}
.primary-nav li a:hover { color: var(--brand); }
.nav-cta { width: 100%; margin-top: 1rem; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(180deg, var(--brand-soft) 0%, #fff 100%);
  padding-block: 2.5rem 3rem;
}
.hero-inner { display: grid; gap: 2rem; }
.eyebrow {
  margin-bottom: 0.75rem;
  color: var(--brand);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.lead { font-size: 1.1875rem; max-width: 38em; }
.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-block: 1.5rem;
}
.trust-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  font-weight: 600;
  color: var(--ink);
}
.trust-list li { display: inline-flex; align-items: center; gap: 0.45rem; }
.trust-list .icon { color: var(--brand-light); }

.hero-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}
.hero-card h2 { font-size: 1.25rem; }
.hero-card dl { margin: 0 0 1.25rem; }
.hero-card dl > div { padding-block: 0.75rem; border-bottom: 1px solid var(--border); }
.hero-card dt { font-size: 0.875rem; color: var(--muted); }
.hero-card dd { margin: 0; font-weight: 600; color: var(--ink); }
.hero-card-phone {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--red);
  text-decoration: none;
}
.hero-card-phone:hover { color: var(--red-dark); text-decoration: underline; }

/* ---------- Sections ---------- */
.section { padding-block: 3.5rem; }
.section-tint { background: var(--tint); }
.section-head { max-width: 44rem; margin-bottom: 2rem; }
.section-head p:last-child { margin-bottom: 0; }

/* ---------- Department cards ---------- */
.card-grid, .facility-grid, .doctor-grid { display: grid; gap: 1.25rem; }

.card {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.card:hover { border-color: var(--brand-border); box-shadow: var(--shadow); }
.card p { flex: 1; }

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 48px; height: 48px;
  margin-bottom: 1rem;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 1.25rem;
}
.card-icon-emergency, .card-emergency .card-icon { background: var(--red-soft); color: var(--red); }
.card-emergency { border-color: #FECACA; }
.card-emergency:hover { border-color: #FCA5A5; }

.card-link {
  display: inline-block;
  padding-block: 0.4rem;
  font-weight: 600;
  text-decoration: none;
}
.card-link:hover { text-decoration: underline; }
.card-link-emergency { color: var(--red-dark); }
.card-link-emergency:hover { color: var(--red-dark); }

/* ---------- Doctors ---------- */
.doctor-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.doctor-card img { width: 100%; height: 180px; object-fit: cover; }
.doctor-body { display: flex; flex-direction: column; flex: 1; padding: 1.25rem; }
.doctor-body h3 { margin-bottom: 0.25rem; }
.doctor-qual { margin-bottom: 0.25rem; color: var(--muted); font-size: 0.9375rem; }
.doctor-specialty { margin-bottom: 0.75rem; color: var(--brand-dark); font-weight: 600; }
.doctor-timing {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  font-size: 0.9375rem;
}
.doctor-timing .icon { margin-top: 0.2em; color: var(--brand-light); }
.badge {
  align-self: flex-start;
  margin-bottom: 0.6rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  color: var(--brand-dark);
  font-size: 0.8125rem;
  font-weight: 700;
}

/* ---------- Facilities ---------- */
.facility {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}
.facility p { margin: 0; }

.visit-guide { display: grid; gap: 1.25rem; margin-top: 2rem; }
.visit-block {
  padding: 1.5rem;
  border-radius: var(--radius);
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
}
.visit-block h3 { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
.visit-block h3 .icon { color: var(--brand); }
.check-list li {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
  color: var(--ink);
}
.check-list li:last-child { margin-bottom: 0; }
.check-list .icon { margin-top: 0.2em; color: var(--brand-light); }

/* ---------- Appointment ---------- */
.appointment-inner { display: grid; gap: 2rem; }

.emergency-note {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border: 1px solid #FECACA;
  border-left: 4px solid var(--red);
  border-radius: var(--radius-sm);
  background: var(--red-soft);
}
.emergency-note h3 { color: var(--red-dark); }
.emergency-note p { color: var(--ink); }

.form-panel {
  padding: 1.5rem 1.25rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.form-hint { font-size: 0.9375rem; color: var(--muted); }
.req { color: var(--red-dark); font-weight: 700; }
.optional { color: var(--muted); font-weight: 400; }

.field { margin-bottom: 1.1rem; }
.field-row { display: grid; gap: 0 1rem; }

.field label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--ink);
  font-weight: 600;
}

.field input[type="text"],
.field input[type="tel"],
.field input[type="date"],
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.65rem 0.8rem;
  border: 1.5px solid #94A3B8;
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font: inherit;
}
.field textarea { resize: vertical; }
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 1px;
  border-color: var(--brand);
}
.field [aria-invalid="true"] { border-color: var(--red-dark); background: var(--red-soft); }

.input-prefix { display: flex; }
.input-prefix > span {
  display: inline-flex;
  align-items: center;
  padding-inline: 0.8rem;
  border: 1.5px solid #94A3B8;
  border-right: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: var(--tint);
  color: var(--muted);
  font-weight: 600;
}
.input-prefix input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.field-hint { margin: 0.3rem 0 0; font-size: 0.9rem; color: var(--muted); }
.field-error { margin: 0.3rem 0 0; font-size: 0.9375rem; font-weight: 600; color: var(--red-dark); }
.field-error:empty { display: none; }

.field-check {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 0.75rem;
  align-items: start;
}
.field-check input {
  width: 22px; height: 22px;
  margin: 0.2rem 0 0;
  accent-color: var(--brand);
}
.field-check label { margin: 0; font-weight: 400; color: var(--text); }
.field-check .field-error { grid-column: 2; }

.form-alert {
  margin-bottom: 1.25rem;
  padding: 0.9rem 1rem;
  border: 1px solid #FECACA;
  border-left: 4px solid var(--red);
  border-radius: var(--radius-sm);
  background: var(--red-soft);
  color: var(--ink);
  font-weight: 500;
}
.form-alert a { color: var(--red-dark); font-weight: 700; }

.spinner {
  display: none;
  width: 1.1em; height: 1.1em;
  border: 2.5px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.is-loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Confirmation card */
.confirmation { text-align: center; }
.confirmation:focus { outline: none; }
.confirmation-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px; height: 56px;
  margin-bottom: 1rem;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 1.5rem;
}
.reference {
  margin-block: 1.25rem;
  padding: 1rem;
  border: 2px dashed var(--brand);
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--ink);
}
.reference strong {
  display: block;
  font-size: 1.75rem;
  letter-spacing: 0.08em;
  color: var(--brand-dark);
  font-variant-numeric: tabular-nums;
}
.summary { margin: 0 0 1.5rem; text-align: left; }
.summary > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.6rem;
  border-bottom: 1px solid var(--border);
}
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 600; color: var(--ink); text-align: right; overflow-wrap: anywhere; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; gap: 2rem; }
.contact-item { display: flex; gap: 1rem; margin-bottom: 1.5rem; }
.contact-item h3 { margin-bottom: 0.35rem; }
.contact-item p { margin-bottom: 0.25rem; }
.contact-item .card-icon { margin-bottom: 0; }
.contact-item a[href^="tel:"] { font-weight: 600; white-space: nowrap; }

.map-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  padding: 2rem 1.5rem;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  background: var(--brand-soft);
  text-align: center;
}
.map-card-pin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px; height: 64px;
  margin-bottom: 1rem;
  border-radius: 50%;
  background: #fff;
  color: var(--red);
  font-size: 1.75rem;
  box-shadow: var(--shadow);
}
.map-card p { max-width: 26em; color: var(--ink); }
.map-card-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; margin-top: 0.5rem; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink);
  color: #CBD5E1;
  padding-top: 3rem;
  font-size: 1rem;
}
.site-footer h2 { color: #fff; font-size: 1.0625rem; margin-bottom: 0.75rem; letter-spacing: 0; }
.site-footer a, .site-footer .link-button { color: #fff; }
.site-footer a:hover, .site-footer .link-button:hover { color: #BFDBFE; }
.site-footer :focus-visible { outline-color: #BFDBFE; }
.site-footer li { margin-bottom: 0.25rem; }
.site-footer li a, .site-footer li .link-button { display: inline-block; padding-block: 0.3rem; }
.footer-grid { display: grid; gap: 2rem; }
.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
}
/* The logo's dark blue ring needs a light tile to stay visible on the dark footer */
.footer-brand img {
  width: 68px; height: 52px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: #fff;
}
.footer-brand .brand-text span:last-child { font-size: 0.875rem; letter-spacing: 0.08em; text-transform: uppercase; }
.footer-services { color: #fff; font-size: 0.875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.footer-bottom {
  margin-top: 2rem;
  padding-block: 1.25rem;
  border-top: 1px solid #334155;
  font-size: 0.9375rem;
}
.footer-bottom p { margin: 0; }

/* ---------- Sticky mobile action bar ---------- */
.mobile-bar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 90;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #fff;
  box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.15);
}
.mobile-bar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: var(--mobile-bar-height);
  padding-inline: 0.5rem;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}
.mobile-bar-btn:hover { color: #fff; }
.mobile-bar-btn:focus-visible { outline: 3px solid var(--ink); outline-offset: -4px; }
.mobile-bar-emergency { background: var(--red); }
.mobile-bar-book { background: var(--brand); }

/* ---------- Modals ---------- */
.modal {
  width: min(640px, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  color: var(--text);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.3);
}
.modal[open] { display: flex; flex-direction: column; }
.modal::backdrop { background: rgba(15, 23, 42, 0.6); }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 1.35rem; }
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--tint);
  color: var(--ink);
  font-size: 1.1rem;
  cursor: pointer;
}
.modal-close:hover { background: var(--border); }
.modal-body { padding: 1.25rem; overflow-y: auto; }
.modal-body h3 { margin-top: 1.25rem; font-size: 1.0625rem; }
.modal-body p:last-child { margin-bottom: 0; }
.modal-foot { padding: 1rem 1.25rem; border-top: 1px solid var(--border); text-align: right; }

/* ==========================================================================
   Tablet (>= 640px)
   ========================================================================== */
@media (min-width: 640px) {
  .container { padding-inline: 1.5rem; }
  .hero-actions { flex-direction: row; flex-wrap: wrap; }
  .card-grid, .facility-grid, .doctor-grid, .visit-guide { grid-template-columns: repeat(2, 1fr); }
  .field-row { grid-template-columns: 1fr 1fr; }
  .form-panel { padding: 2rem; }
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
}

/* ==========================================================================
   Desktop (>= 960px)
   ========================================================================== */
@media (min-width: 960px) {
  body { padding-bottom: 0; }
  .mobile-bar { display: none; }

  .nav-toggle { display: none; }
  .header-inner { flex-wrap: nowrap; }
  .primary-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-basis: auto;
    padding-bottom: 0;
  }
  .primary-nav ul { flex-direction: row; gap: 0.25rem; }
  .primary-nav li a { padding: 0.6rem 0.8rem; border-bottom: 0; border-radius: var(--radius-sm); }
  .primary-nav li a:hover { background: var(--brand-soft); }
  .nav-cta { width: auto; margin-top: 0; }

  .hero { padding-block: 4.5rem; }
  .hero-inner { grid-template-columns: 1.5fr 1fr; align-items: center; gap: 3rem; }

  .section { padding-block: 5rem; }
  .card-grid { grid-template-columns: repeat(3, 1fr); }
  .facility-grid, .doctor-grid { grid-template-columns: repeat(4, 1fr); }

  .appointment-inner { grid-template-columns: 1fr 1.25fr; gap: 3rem; align-items: start; }
  .appointment-intro { position: sticky; top: 6rem; }

  .contact-grid { grid-template-columns: 1fr 1.25fr; }
}

/* Respect users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .spinner { animation-duration: 1.5s !important; animation-iteration-count: infinite !important; }
}

@media print {
  .utility-bar, .site-header, .mobile-bar, .map-card-actions, .hero-actions { display: none; }
  body { padding-bottom: 0; }
}
