/* ==========================================================================
   MedPark, mobile-first enhancement layer
   Added 2026-09-01. Loaded AFTER styles.css and responsive.css so it can
   correct mobile problems without touching the 76 KB legacy stylesheet.

   Brand: turquoise #12C0C6, dark navy #0A2A4A, white. Per the MedPark brand
   guideline. Emergency red is a semantic signal colour, not a brand colour,
   and is set to an accessible value.

   Base is mobile. Anything desktop-only sits inside a min-width query.
   ========================================================================== */

:root {
  --mp-turquoise: #12C0C6;
  --mp-turquoise-dark: #0E9AA0;   /* passes 4.5:1 with white text */
  --mp-navy: #0A2A4A;
  --mp-white: #FFFFFF;

  /* Semantic. Plain `red` (#FF0000) with white text is only 3.99:1 and fails
     WCAG AA. This darker red passes and still reads as emergency. */
  --mp-emergency: #C1121F;
  --mp-emergency-hover: #A00E19;

  --mp-tap: 44px;                 /* Apple HIG minimum touch target */
  --mp-focus: 3px;
}

/* --------------------------------------------------------------------------
   1. Stop horizontal scroll. The most common mobile defect.

   Root cause on this site: styles.css sets box-sizing: border-box in only 7
   places, not globally. Any element with width:100% plus padding therefore
   overflows the viewport by exactly its padding. Applying border-box globally
   fixes it, but only inside the mobile query, so the desktop layout that was
   tuned around content-box is left exactly as it is.
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  *, *::before, *::after { box-sizing: border-box; }

  /* Nothing may be wider than the screen. */
  .med-container,
  .med-hero-content-box,
  .med-header-inner,
  .med-header-buttons,
  .med-hero-buttons,
  .med-nav,
  section, header, footer, main, article, aside, div {
    max-width: 100%;
  }

  /* Legacy nav forbids wrapping, which pushes the page wide. */
  .med-nav,
  .med-nav a,
  .med-header-buttons,
  .med-header-buttons a { white-space: normal; }

  .med-header-inner {
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }

  .med-hero-content-box { padding: 20px 16px; }
}

html, body {
  max-width: 100%;
  overflow-x: hidden;
}

img, video, iframe, table, pre, svg {
  max-width: 100%;
}

img, video {
  height: auto;
}

/* --------------------------------------------------------------------------
   2. Readable text. 16px minimum stops iOS auto-zooming form fields.
   -------------------------------------------------------------------------- */
body {
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

input, select, textarea, button {
  font-size: 16px;
  font-family: inherit;
}

/* --------------------------------------------------------------------------
   3. Touch targets. Anything tappable gets a real 44px area.
   -------------------------------------------------------------------------- */
a.med-btn,
button,
.med-nav a,
.med-header a,
input[type="submit"],
input[type="button"] {
  min-height: var(--mp-tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;      /* removes the legacy 300ms tap delay */
}

.med-nav a {
  padding: 12px 14px;
}

/* Keep adjacent targets from being mis-tapped. */
.med-hero-buttons,
.med-header-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* --------------------------------------------------------------------------
   4. Visible focus. Never remove it; a hospital site must be keyboard usable.
   -------------------------------------------------------------------------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: var(--mp-focus) solid var(--mp-turquoise);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   5. Emergency call action. The most important control on the site.
   Overrides the inline `background-color: red` in the markup.
   -------------------------------------------------------------------------- */
.med-btn[href*="wa.me"],
.med-btn-emergency {
  background-color: var(--mp-emergency) !important;
  border-color: var(--mp-emergency) !important;
  color: var(--mp-white) !important;
  font-weight: 700;
  padding-inline: 20px;
}

.med-btn[href*="wa.me"]:hover,
.med-btn[href*="wa.me"]:focus-visible,
.med-btn-emergency:hover {
  background-color: var(--mp-emergency-hover) !important;
  border-color: var(--mp-emergency-hover) !important;
}

/* --------------------------------------------------------------------------
   6. Bottom contact: floating WhatsApp pill only, on every screen size.
   The three-button sticky bar was removed 2026-09-01 at the user's request:
   mobile now matches desktop.
   -------------------------------------------------------------------------- */
.mp-callbar { display: none !important; }

.mp-float-wa {
  min-height: var(--mp-tap);
  touch-action: manipulation;
  box-shadow: 0 8px 22px rgba(10, 42, 74, .32) !important;
}

.mp-float-wa:hover,
.mp-float-wa:focus-visible { filter: brightness(1.06); }

@media (max-width: 767px) {
  /* Sits above the iOS home indicator, and stays clear of page content. */
  .mp-float-wa {
    padding: 12px 18px !important;
    font-size: 15px !important;
    margin-bottom: env(safe-area-inset-bottom, 0);
  }
  body { padding-bottom: 12px; }
}

/* --------------------------------------------------------------------------
   6b. Mobile header: one compact row, logo left and burger right.

   The markup already contains a full mobile drawer (#mobileMenu) with the nav,
   DE/PL, Book Appointment, Call, the hotline and the email. The top bar was
   also rendering DE, PL and both buttons stacked full-width, which duplicated
   the drawer and pushed the hero most of a screen down. Those live in the
   drawer on mobile.
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .med-header .med-container { padding-inline: 14px; }

  .med-header-inner {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 60px;
  }

  .med-logo { flex: 0 0 auto; }
  .med-logo img { max-height: 44px; width: auto; }

  /* Duplicated by the drawer. */
  .med-nav,
  .med-header-buttons { display: none !important; }

  .burger-btn {
    display: flex !important;
    order: 9;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: var(--mp-tap);
    height: var(--mp-tap);
    padding: 0;
    font-size: 26px;
    line-height: 1;
    color: var(--mp-white);
    background: transparent;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
  }

  .burger-btn:active { background: rgba(255, 255, 255, .16); }

  /* Drawer items need real touch targets too. */
  .mobile-nav a,
  .mobile-buttons a {
    min-height: var(--mp-tap);
    display: flex;
    align-items: center;
    padding: 12px 16px;
  }

  .mobile-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  .mobile-hospitals-contact a { font-weight: 700; }
}

/* --------------------------------------------------------------------------
   7. Hero banner. Video on every screen size, sized explicitly so it always
   fills its box and stays centred. The source is 16:9 landscape, so on a tall
   phone it is cropped left and right rather than letterboxed.
   -------------------------------------------------------------------------- */
.med-hero-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
  isolation: isolate;

  /* Height: tall enough to read on a phone, capped so it never eats the page. */
  min-height: 78svh;
  background-image: url("/videos/hero-poster.jpg");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}

@supports not (min-height: 78svh) {
  .med-hero-wrapper { min-height: 78vh; }
}

@media (min-width: 768px)  { .med-hero-wrapper { min-height: 72vh; } }
@media (min-width: 1280px) { .med-hero-wrapper { min-height: 78vh; max-height: 860px; } }

/* The video sits behind everything, filling the box exactly. */
.med-hero-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  max-width: none;

  /* styles.css centres this with the old top:50%/left:50% + translate(-50%,-50%)
     hack. Setting top/left to 0 without cancelling the transform shifted the
     video up and left by half its size, which showed as a visible seam across
     the banner. object-fit: cover does the centring now, so the transform goes. */
  transform: none;

  object-fit: cover;          /* fills, never squashes, never letterboxes */
  object-position: center center;
  display: block;
  z-index: 0;
  pointer-events: none;
}

.med-hero-overlay { z-index: 1; }

.med-hero {
  position: relative;
  z-index: 2;
  padding: 40px 16px 48px;
  display: flex;
  align-items: center;
  min-height: inherit;
}

@media (min-width: 768px) { .med-hero { padding: 64px 0; } }

/* Reduced motion gets the still frame instead of the loop. */
@media (prefers-reduced-motion: reduce) {
  .med-hero-video { display: none !important; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

.med-hero h1 {
  font-size: clamp(26px, 7vw, 46px);
  line-height: 1.15;
  text-wrap: balance;
}

.med-subtitle {
  font-size: clamp(15px, 4vw, 19px);
  line-height: 1.5;
  max-width: 34ch;
}

@media (min-width: 768px) { .med-subtitle { max-width: 52ch; } }

/* The hero text sits over a bright photograph, so it needs a scrim. */
.med-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(10, 42, 74, .62) 0%,
    rgba(10, 42, 74, .46) 45%,
    rgba(10, 42, 74, .72) 100%
  );
  pointer-events: none;
}

.med-hero-content-box {
  background: rgba(10, 42, 74, .55);
  backdrop-filter: blur(2px);
  border-radius: 14px;
}

/* --------------------------------------------------------------------------
   7b. Language switcher. DE and PL were turquoise-on-blue in the hero, well
   under 4.5:1 and easy to miss. German and Polish visitors are a core market,
   so the switcher has to be findable. Text labels, not flags: a flag is a
   country, not a language.
   -------------------------------------------------------------------------- */
.med-lang-btn {
  color: var(--mp-white) !important;
  font-weight: 700;
  letter-spacing: .04em;
  border: 1.5px solid rgba(255, 255, 255, .55);
  border-radius: 999px;
  padding: 8px 12px !important;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background-color .18s ease, border-color .18s ease;
}

.med-lang-btn:hover,
.med-lang-btn:focus-visible {
  background: var(--mp-white);
  color: var(--mp-navy) !important;
  border-color: var(--mp-white);
}

/* Inside the mobile drawer the ground is light, so invert. */
@media (max-width: 767px) {
  .mobile-buttons .med-lang-btn {
    color: var(--mp-navy) !important;
    border-color: var(--mp-navy);
  }
  .mobile-buttons .med-lang-btn:hover {
    background: var(--mp-navy);
    color: var(--mp-white) !important;
  }
}

/* --------------------------------------------------------------------------
   8. Patient video testimonials.

   Rewritten 2026-09-01. All six source videos are PORTRAIT phone footage
   (1080x1920 and one 4K 2160x3840). The previous rule forced aspect-ratio 16/9
   with object-fit: cover, which cropped the patient out of frame and looked
   broken. Cards are now 9:16, which is what the footage actually is, laid out
   as a snap-scrolling rail. Sources were also re-encoded at CRF 21 rather than
   28, because faces need the bitrate.
   -------------------------------------------------------------------------- */
.med-stories { padding-block: 40px; }

.med-stories-head { text-align: center; margin-bottom: 22px; }

.med-stories-head h2 {
  margin: 0 0 6px;
  color: var(--mp-navy);
  font-size: clamp(22px, 5vw, 32px);
  line-height: 1.2;
  text-wrap: balance;
}

.med-stories-head p {
  margin: 0;
  color: #4A5C68;
  font-size: 15px;
}

.med-stories-shell {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* The rail: horizontal, snapping, keyboard scrollable. */
.med-stories-rail {
  list-style: none;
  margin: 0;
  padding: 4px 2px 14px;
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  flex: 1 1 auto;
}

.med-stories-rail::-webkit-scrollbar { height: 6px; }
.med-stories-rail::-webkit-scrollbar-thumb {
  background: #C7D4DE; border-radius: 999px;
}

.med-story-card {
  position: relative;
  flex: 0 0 auto;
  width: 76vw;
  max-width: 280px;
  aspect-ratio: 9 / 16;          /* matches the real footage */
  scroll-snap-align: center;
  border-radius: 16px;
  overflow: hidden;
  background: var(--mp-navy);
  box-shadow: 0 6px 22px -10px rgba(10, 42, 74, .45);
  transition: transform .22s ease, box-shadow .22s ease;
}

@media (min-width: 768px) {
  .med-story-card { width: 240px; scroll-snap-align: start; }
  .med-story-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 30px -12px rgba(10, 42, 74, .55);
  }
}

.med-story-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;             /* fills the card, no letterboxing */
  background: var(--mp-navy);
  border-radius: inherit;
}

/* Play affordance over the poster. Hidden once the video is playing. */
.med-story-play {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(10,42,74,.10) 0%, rgba(10,42,74,.42) 100%);
  transition: opacity .2s ease;
}

.med-story-play-icon {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .92);
  color: var(--mp-navy);
  font-size: 20px;
  padding-left: 4px;             /* optically centres the triangle */
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
  transition: transform .18s ease, background-color .18s ease;
}

.med-story-play:hover .med-story-play-icon,
.med-story-play:focus-visible .med-story-play-icon {
  background: var(--mp-turquoise);
  color: #fff;
  transform: scale(1.07);
}

.med-story-play:focus-visible {
  outline: var(--mp-focus) solid var(--mp-turquoise);
  outline-offset: -4px;
}

.med-story-card.is-playing .med-story-play {
  opacity: 0;
  pointer-events: none;
}

/* Rail arrows. Touch devices swipe instead. */
.med-stories-nav {
  flex: 0 0 auto;
  width: var(--mp-tap);
  height: var(--mp-tap);
  border-radius: 50%;
  border: 1px solid #C7D4DE;
  background: #fff;
  color: var(--mp-navy);
  font-size: 15px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease;
}

.med-stories-nav:hover {
  background: var(--mp-navy);
  color: #fff;
  border-color: var(--mp-navy);
}

@media (min-width: 768px) {
  .med-stories-nav { display: inline-flex; }
}

@media (prefers-reduced-motion: reduce) {
  .med-stories-rail { scroll-behavior: auto; }
  .med-story-card, .med-story-play-icon { transition: none; }
}

/* --------------------------------------------------------------------------
   9. Media and layout guards for narrow screens.
   -------------------------------------------------------------------------- */
.med-container {
  width: 100%;
  padding-inline: 16px;
  margin-inline: auto;
}

@media (min-width: 768px)  { .med-container { padding-inline: 24px; max-width: 720px; } }
@media (min-width: 1024px) { .med-container { max-width: 960px; } }
@media (min-width: 1280px) { .med-container { max-width: 1200px; } }

/* Anything laid out in a row should wrap rather than overflow. */
.med-hero-buttons,
.med-header-inner,
.med-features,
.med-nav {
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   10. Forms. A patient filling this in may be in a hurry or in pain.
   -------------------------------------------------------------------------- */
input, select, textarea {
  width: 100%;
  min-height: var(--mp-tap);
  padding: 12px 14px;
  border: 1px solid #C7D4DE;
  border-radius: 8px;
  background: #fff;
  color: #12212E;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--mp-turquoise);
  outline: var(--mp-focus) solid rgba(18, 192, 198, .35);
  outline-offset: 0;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   11. Print. Someone at a hotel desk may print the contact page.
   -------------------------------------------------------------------------- */
@media print {
  .mp-callbar, .med-hero-video, video { display: none !important; }
  body { padding-bottom: 0; }
}

/* --------------------------------------------------------------------------
   12. Directions link under each branch map. Added 2026-09-01 with the official
   Business Profile embeds. A map is orientation; a directions link is the action.
   -------------------------------------------------------------------------- */
.mp-directions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  min-height: var(--mp-tap);
  padding: 11px 20px;
  border-radius: 999px;
  background: var(--mp-navy);
  color: #fff !important;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  touch-action: manipulation;
  transition: background-color .18s ease, transform .18s ease;
}

.mp-directions:hover,
.mp-directions:focus-visible {
  background: var(--mp-turquoise-dark);
  transform: translateY(-2px);
}

.hospital-map iframe { display: block; width: 100%; }
