/* ============================================================
   Xtra Xray — shared design system
   Editorial medical aesthetic
   ============================================================ */

:root {
  /* ============================================================
     XTRA XRAY — STRICT BRAND PALETTE
     Only three colours: Crimson Red · Navy · White.
     Everything else is an opacity step of navy on white.
     ============================================================ */

  /* Navy — sole foreground colour */
  --ink:        #172244;                          /* brand navy — headlines, primary text */
  --ink-2:      rgba(23, 34, 68, 0.86);           /* body copy */
  --ink-mute:   rgba(23, 34, 68, 0.55);           /* meta / labels / muted */

  /* Paper — sole background colour */
  --paper:      #ffffff;
  --paper-2:    rgba(23, 34, 68, 0.04);           /* card surface (navy at 4%) */
  --paper-3:    rgba(23, 34, 68, 0.08);           /* hover / divider surface */

  /* Rules */
  --rule:       rgba(23, 34, 68, 0.14);
  --rule-soft:  rgba(23, 34, 68, 0.07);

  /* Crimson — sole accent */
  --coral:      #C8102E;                          /* brand red — CTAs, brand mark, X letters */
  --coral-dk:   #9F0B22;                          /* hover / pressed */

  /* Legacy aliases (kept for compatibility; resolve to the same brand colours) */
  --cyan:       rgba(23, 34, 68, 0.55);
  --cyan-deep:  #172244;
  --cyan-glow:  rgba(23, 34, 68, 0.45);
  --sage:       rgba(23, 34, 68, 0.30);

  /* Type */
  --display: "Playfair Display", "Iowan Old Style", Georgia, serif;
  --sans:    "Work Sans", "Söhne", "Helvetica Neue", system-ui, sans-serif;
  --mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Layout */
  --maxw: 1320px;
  --pad-x: clamp(20px, 4vw, 56px);
  --radius: 20px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

::selection { background: var(--ink); color: var(--paper); }

/* ============================================================
   TYPE SYSTEM
   ============================================================ */

.display {
  font-family: var(--display);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.015em;
}
.display-xl  { font-size: clamp(56px, 9.5vw, 168px); }
.display-lg  { font-size: clamp(48px, 7vw, 112px); }
.display-md  { font-size: clamp(40px, 5vw, 80px); }
.display-sm  { font-size: clamp(32px, 4vw, 56px); }

.sans-h2 {
  font-family: var(--sans);
  font-weight: 500;
  font-size: clamp(28px, 3.2vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

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

.lede {
  font-size: clamp(18px, 1.5vw, 22px);
  line-height: 1.45;
  color: var(--ink-2);
  max-width: 60ch;
}

.italic-serif {
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
}

/* ============================================================
   LAYOUT
   ============================================================ */

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad-x);
}

.bleed { width: 100%; padding: 0 var(--pad-x); }

.rule { height: 1px; background: var(--rule); width: 100%; }

.section { padding: clamp(80px, 10vw, 160px) 0; }
.section-tight { padding: clamp(56px, 7vw, 96px) 0; }

/* ============================================================
   TOP NAV
   ============================================================ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 18px var(--pad-x);
  max-width: var(--maxw);
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: none;
  line-height: 1;
}
.brand-svg {
  width: 50px;
  height: 22px;
  display: block;
  flex-shrink: 0;
}
.brand-name { color: var(--ink); }
.brand-name .x { color: var(--coral); }
.brand:hover .brand-svg .pin { transform-origin: center bottom; animation: pinBounce 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
.brand:hover .brand-svg .pin.r { animation-delay: 0.08s; }
@keyframes pinBounce {
  0% { transform: translateY(0); }
  40% { transform: translateY(-3px); }
  100% { transform: translateY(0); }
}

.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
}
.nav-links a {
  display: inline-block;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  border-radius: 999px;
  transition: background 0.15s;
}
.nav-links a:hover { background: var(--paper-3); }
.nav-links a.active {
  background: var(--ink);
  color: var(--paper);
}

.nav-cta {
  display: flex;
  align-items: center;
  gap: 16px;
}
.phone-link {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-2);
  display: flex; align-items: center; gap: 8px;
}
.phone-link .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #2ecc71;
  box-shadow: 0 0 0 4px rgba(46, 204, 113, 0.15);
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border-radius: 999px;
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--ink);
  color: var(--paper);
}
.btn-primary:hover { background: var(--ink-2); }
.btn-primary .arrow { transition: transform 0.2s; }
.btn-primary:hover .arrow { transform: translateX(4px); }

.btn-accent {
  background: var(--coral);
  color: #fff8f3;
}
.btn-accent:hover { background: var(--coral-dk); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule);
}
.btn-ghost:hover { background: var(--paper-2); }

.btn-lg { padding: 18px 28px; font-size: 15px; }

/* ============================================================
   CHIPS, BADGES
   ============================================================ */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-2);
}
.chip-cyan {
  background: rgba(61, 127, 184, 0.1);
  border-color: rgba(61, 127, 184, 0.2);
  color: var(--cyan-deep);
}
.chip-sage {
  background: rgba(174, 192, 163, 0.25);
  border-color: rgba(108, 130, 95, 0.3);
  color: #3d4a36;
}
.chip-coral {
  background: rgba(214, 90, 63, 0.1);
  border-color: rgba(214, 90, 63, 0.25);
  color: var(--coral-dk);
}

/* ============================================================
   CARDS
   ============================================================ */

.card {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 32px;
}

/* Make big cards inherit the global radius token. Small chips keep their own. */
.svc-card, .why-card, .test-card, .channel, .hours-card, .contact-form,
.book-card, .summary, .success-card, .equipment-img, .map-visual, .opt-card {
  border-radius: var(--radius);
}

/* ============================================================
   X-RAY VIEWER MOTIF
   ============================================================ */

.xray-frame {
  position: relative;
  background: #050d18;
  border-radius: 6px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.5),
    0 30px 60px -20px rgba(15, 50, 79, 0.35),
    inset 0 0 60px rgba(111, 180, 232, 0.08);
}
.xray-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(1.05) brightness(1.02);
}
.xray-frame .xray-label {
  position: absolute;
  bottom: 12px; left: 14px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--cyan-glow);
  text-transform: uppercase;
  z-index: 2;
  text-shadow: 0 0 8px rgba(0,0,0,0.6);
}
.xray-frame .xray-id {
  position: absolute;
  top: 12px; left: 14px;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--cyan-glow);
  z-index: 2;
}
.xray-frame::after {
  /* hides patient name strip cleanly — fallback when no .xray-mask div present */
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 20%;
  min-height: 70px;
  background: linear-gradient(to top, #050d18, #050d18 70%, transparent);
  z-index: 1;
}
/* Real-div equivalent — bulletproof, used inside the frame */
.xray-frame > .xray-mask {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 22%;
  min-height: 70px;
  background: linear-gradient(to top, #050d18, #050d18 68%, transparent);
  z-index: 1;
  pointer-events: none;
}

/* ============================================================
   FOOTER
   ============================================================ */

.footer {
  background: var(--ink);
  color: var(--paper);
  padding: 80px 0 32px;
  margin-top: 80px;
}
.footer a { color: var(--paper); opacity: 0.78; }
.footer a:hover { opacity: 1; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 64px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.footer-grid h4 {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 18px;
}
.footer-grid ul { list-style: none; display: grid; gap: 10px; font-size: 14px; }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}
.footer .display { color: var(--paper); }

@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .nav-links { display: none; }
  .phone-link span.label { display: none; }
}

/* ============================================================
   UTILS
   ============================================================ */

.flex { display: flex; }
.grid { display: grid; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.gap-8 { gap: 32px; }
.gap-12 { gap: 48px; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mt-12 { margin-top: 48px; }
.mt-16 { margin-top: 64px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.text-mute { color: var(--ink-mute); }
.text-ink-2 { color: var(--ink-2); }
.font-mono { font-family: var(--mono); }

.hover-lift { transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.hover-lift:hover { transform: translateY(-4px); }

/* Subtle scanline ambient on hero backgrounds (used sparingly) */
.scanlines::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    transparent 0,
    transparent 3px,
    rgba(15, 20, 24, 0.015) 3px,
    rgba(15, 20, 24, 0.015) 4px
  );
}

/* ============================================================
   MOBILE OVERRIDES
   Breakpoint tokens (for human reference; CSS uses numeric values):
     --bp-md: 900px   tablet & narrow desktop
     --bp-sm: 640px   phone (landscape & smaller)
     --bp-xs: 380px   extra-narrow phones (iPhone SE)
   Everything below is additive — desktop ≥900px is unchanged.
   ============================================================ */

/* --- hamburger toggle --- */
.m-nav-toggle {
  display: none;
  width: 44px; height: 44px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 12px;
  cursor: pointer;
  padding: 0;
}
.m-nav-toggle .m-nav-bar {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
body.menu-open .m-nav-toggle .m-nav-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.menu-open .m-nav-toggle .m-nav-bar:nth-child(2) { opacity: 0; }
body.menu-open .m-nav-toggle .m-nav-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* --- nav drawer + backdrop --- */
.m-nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(23, 34, 68, 0.45);
  z-index: 90;
  opacity: 0;
  transition: opacity 0.22s ease;
}
.m-nav-backdrop.open { opacity: 1; }
.m-nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(86vw, 360px);
  height: 100dvh;
  background: var(--paper);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: -8px 0 24px rgba(23, 34, 68, 0.12);
  padding-top: env(safe-area-inset-top, 0);
}
.m-nav-drawer.open { transform: translateX(0); }
.m-nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px;
  border-bottom: 1px solid var(--rule);
}
.m-nav-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.m-nav-close {
  width: 40px; height: 40px;
  font-size: 28px;
  line-height: 1;
  color: var(--ink);
  border-radius: 50%;
  background: var(--paper-2);
}
.m-nav-list {
  list-style: none;
  margin: 0;
  padding: 12px 0;
  flex: 1;
  overflow-y: auto;
}
.m-nav-list li { margin: 0; }
.m-nav-list a {
  display: flex;
  align-items: center;
  min-height: 56px;
  padding: 16px 24px;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--ink);
  border-bottom: 1px solid var(--rule-soft);
}
.m-nav-list a:active { background: var(--paper-2); }
.m-nav-foot {
  border-top: 1px solid var(--rule);
  padding: 20px 24px calc(20px + env(safe-area-inset-bottom, 0));
  display: grid;
  gap: 10px;
}
.m-nav-foot-cta {
  display: block;
  padding: 14px 18px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  background: var(--coral);
  color: #fff8f3;
  border-radius: 999px;
}
.m-nav-foot-cta.secondary {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--rule);
}
body.menu-open { overflow: hidden; }

/* --- bottom CTA bar (mobile only) --- */
.m-cta-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--rule);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0));
  gap: 8px;
}
.m-cta-bar .m-cta-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 56px;
  padding: 8px 4px;
  border-radius: 14px;
  background: var(--paper-2);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
}
.m-cta-bar .m-cta-btn.primary {
  background: var(--coral);
  color: #fff8f3;
}
.m-cta-bar .m-cta-btn:active {
  transform: translateY(1px);
}
.m-cta-bar .m-cta-btn svg { display: block; }

/* --- prevent CTA bar from covering content; hide on input focus --- */
@media (max-width: 640px) {
  body { padding-bottom: 84px; }
  body:has(input:focus, textarea:focus, select:focus) .m-cta-bar { display: none; }
}

/* --- show mobile chrome only on phones --- */
@media (max-width: 640px) {
  .m-nav-toggle { display: flex; }
  .m-cta-bar { display: flex; }
  .nav-cta .phone-link { display: none; }            /* drawer carries it */
  .nav-cta .btn { padding: 10px 16px; font-size: 13px; } /* shrink Book button */
  .topbar-inner { gap: 12px; padding: 12px var(--pad-x); }
  .brand-name { font-size: 15px; }
}

/* --- form input floor: prevent iOS focus-zoom --- */
@media (max-width: 640px) {
  input, select, textarea {
    font-size: max(16px, 1rem);
  }
}

/* --- touch-target floor --- */
@media (max-width: 640px) {
  .nav-links a,
  .step-pill,
  .review-row .edit,
  .chip[role="button"],
  button.chip {
    min-height: 44px;
  }
}

/* --- section padding floor reduction on phones --- */
@media (max-width: 640px) {
  .section { padding: 56px 0; }
  .section-tight { padding: 40px 0; }
}

/* --- footer mobile --- */
@media (max-width: 640px) {
  .footer { padding: 56px 0 calc(24px + env(safe-area-inset-bottom, 0)); margin-top: 56px; }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; padding-bottom: 40px; }
  .footer-grid ul { gap: 12px; }
  .footer-grid ul li a { display: inline-flex; min-height: 32px; align-items: center; }
  .footer-bottom { flex-direction: column; gap: 12px; text-align: center; align-items: center; }
}

/* --- safe-area for topbar (notch) --- */
@supports (padding: env(safe-area-inset-top)) {
  .topbar { padding-top: env(safe-area-inset-top, 0); }
}

/* --- reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
  .ticker-track { animation: none; }
  .hover-lift:hover { transform: none; }
}
