/* =========================================================
   Medyczne Systemy Wirtualne – style strony powitalnej
   Plik zewnętrzny (bez stylów inline), żeby Content-Security-Policy
   mogła zostać ustawiona ściśle: style-src 'self'.
   ========================================================= */

/* ---------- Fonty hostowane lokalnie (bez Google Fonts – RODO) ----------
   Pliki woff2 pobiera narzedzia/pobierz-fonty.sh do public/fonts/.
   Gdy ich brak, strona używa fontu systemowego. */
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/plus-jakarta-sans-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/plus-jakarta-sans-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/plus-jakarta-sans-latin-ext-500-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/plus-jakarta-sans-latin-500-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../fonts/plus-jakarta-sans-latin-ext-800-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../fonts/plus-jakarta-sans-latin-800-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --navy: #0c1c47;
  --blue: #1463f3;
  --blue-deep: #0a4bd6;
  --ink: #1b2a45;
  --mist: #eaf2fb;
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--mist);
  -webkit-font-smoothing: antialiased;
}

/* ---------- HERO ----------
   Układ: tekst po lewej, animowany plaster heksagonów po prawej.
   Heksagony są osobnymi elementami HTML, więc na każdym ekranie są widoczne w całości.
   Wszystkie animacje to czysty CSS (bez JavaScriptu), animowane są tylko transform
   i opacity, a przy "ogranicz ruch" w systemie wszystko się zatrzymuje. */

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4vw;
  overflow: hidden;
  isolation: isolate;
  padding:
    max(2rem, env(safe-area-inset-top, 0px))
    max(6vw, calc((100vw - 1760px) / 2), env(safe-area-inset-right, 0px))
    max(2rem, env(safe-area-inset-bottom, 0px))
    max(7.4vw, calc((100vw - 1760px) / 2), env(safe-area-inset-left, 0px));
  background-color: var(--mist);
  background-image:
    linear-gradient(90deg, rgba(234, 242, 251, 0.55) 0%, rgba(234, 242, 251, 0.25) 38%, rgba(234, 242, 251, 0) 60%),
    url("../img/tlo-1672.jpg");
  background-image:
    linear-gradient(90deg, rgba(234, 242, 251, 0.55) 0%, rgba(234, 242, 251, 0.25) 38%, rgba(234, 242, 251, 0) 60%),
    image-set(url("../img/tlo-1672.webp") type("image/webp"), url("../img/tlo-1672.jpg") type("image/jpeg"));
  background-size: cover;
  background-position: center;
}

/* Lżejsze tło dla małych ekranów w poziomie */
@media (min-aspect-ratio: 1/1) and (max-width: 900px) {
  .hero {
    background-image:
      linear-gradient(90deg, rgba(234, 242, 251, 0.6) 0%, rgba(234, 242, 251, 0.3) 45%, rgba(234, 242, 251, 0) 65%),
      image-set(url("../img/tlo-960.webp") type("image/webp"), url("../img/tlo-1672.jpg") type("image/jpeg"));
  }
}

/* Subtelna siatka heksagonalna, powoli przesuwająca się w tle */
.hero__grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 60% 70% at 72% 50%, #000 0%, rgba(0, 0, 0, 0.35) 55%, transparent 80%);
  mask-image: radial-gradient(ellipse 60% 70% at 72% 50%, #000 0%, rgba(0, 0, 0, 0.35) 55%, transparent 80%);
}
.hero__grid::before {
  content: "";
  position: absolute;
  inset: -124.7px -216px;
  background-image: url("../img/hex-grid.svg");
  background-size: 108px 62.35px;
}

/* Miękka poświata za heksagonami */
.hero__glow {
  position: absolute;
  z-index: -1;
  width: 60vmax;
  height: 60vmax;
  right: -8vmax;
  top: 50%;
  margin-top: -30vmax;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(64, 145, 255, 0.35) 0%, rgba(64, 145, 255, 0.12) 40%, transparent 68%);
}

.hero__content {
  position: relative;
  z-index: 1;
  flex: 0 1 auto;
  max-width: min(40vw, 640px);
}

.hero__title {
  margin: 0;
  font-weight: 800;
  font-size: clamp(2.25rem, min(3.2vw, 7.5vh), 4.5rem);
  line-height: 1.14;
  letter-spacing: -0.02em;
  color: var(--navy);
}
.hero__title span {
  display: block;
  color: var(--blue);
  white-space: nowrap;
}

.hero__rule {
  width: clamp(56px, 4.8vw, 96px);
  height: 3px;
  margin: clamp(1.25rem, min(2.3vw, 4vh), 2.5rem) 0;
  border: 0;
  border-radius: 2px;
  background: var(--blue);
}

.hero__lead {
  margin: 0 0 clamp(1.5rem, min(2.3vw, 4.5vh), 2.5rem);
  font-size: clamp(1rem, min(1.42vw, 2.7vh), 1.6rem);
  line-height: 1.6;
  font-weight: 400;
  color: var(--ink);
}
.hero__lead span { display: block; }

.hero__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.9em;
  min-width: clamp(220px, 21.5vw, 400px);
  padding: clamp(0.95rem, min(1.35vw, 2.4vh), 1.4rem) 2.2em;
  border-radius: 999px;
  font-family: inherit;
  font-size: clamp(1rem, min(1.42vw, 2.7vh), 1.5rem);
  font-weight: 500;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(90deg, #2a74ff 0%, var(--blue) 45%, var(--blue-deep) 100%);
  box-shadow: 0 10px 28px -10px rgba(20, 99, 243, 0.6);
  transition: box-shadow .2s ease;
}
.hero__cta svg {
  width: 1.2em;
  height: 1.2em;
  flex: none;
  transition: transform .2s ease;
}
.hero__cta:hover { box-shadow: 0 14px 34px -10px rgba(20, 99, 243, 0.75); }
.hero__cta:hover svg { transform: translateX(4px); }
.hero__cta:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 4px;
}

/* ---------- Plaster heksagonów ----------
   Kafle płaskie u góry, 3 kolumny (2-3-2). Pozycje w % wymiarów pudełka. */
.honeycomb {
  position: relative;
  flex: none;
  width: min(46vw, calc(88vh / 1.02), 820px);
  width: min(46vw, calc(88dvh / 1.02), 820px);
  aspect-ratio: 100 / 102;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hex {
  position: absolute;
  width: 37%;
  aspect-ratio: 1 / 0.866;
}
.hex--szpital      { left: 31.5%;  top: 0.4%;  }
.hex--stomatologia { left: 1.53%;  top: 17.33%; }
.hex--laboratorium { left: 61.47%; top: 17.33%; }
.hex--pacjent      { left: 31.5%;  top: 34.3%; }
.hex--analiza      { left: 1.53%;  top: 51.25%; }
.hex--obrazowanie  { left: 61.47%; top: 51.25%; }
.hex--bezpieczenstwo { left: 31.5%; top: 68.2%; }

/* Warstwa unosząca się + poświata (drop-shadow podąża za kształtem heksagonu) */
.hex__float {
  position: relative;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 2px #fff) drop-shadow(0 0 3px rgba(190, 225, 255, 0.95)) drop-shadow(0 0 14px rgba(90, 165, 255, 0.9)) drop-shadow(0 0 34px rgba(40, 125, 255, 0.5)) drop-shadow(0 20px 30px rgba(12, 28, 71, 0.2));
}

/* Kształt heksagonu pochodzi z przezroczystości samego obrazka */
.hex__frame {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform .35s cubic-bezier(.2, .7, .2, 1);
}
.hex__img {
  display: block;
  width: 100%;
  height: 100%;
  transition: filter .35s ease;
}

/* Maski w kształcie danego kafla – dla błysku i pulsu */
.hex--szpital        { --hex-mask: url("../img/moduly/szpital-360.webp"); }
.hex--stomatologia   { --hex-mask: url("../img/moduly/stomatologia-360.webp"); }
.hex--laboratorium   { --hex-mask: url("../img/moduly/laboratorium-360.webp"); }
.hex--pacjent        { --hex-mask: url("../img/moduly/pacjent-360.webp"); }
.hex--analiza        { --hex-mask: url("../img/moduly/analiza-360.webp"); }
.hex--obrazowanie    { --hex-mask: url("../img/moduly/obrazowanie-360.webp"); }
.hex--bezpieczenstwo { --hex-mask: url("../img/moduly/bezpieczenstwo-360.webp"); }

/* Przebiegający błysk światła */
.hex__frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.5) 50%, transparent 60%) no-repeat;
  background-size: 300% 100%;
  background-position: 100% 0;
  -webkit-mask: var(--hex-mask) center / 100% 100% no-repeat;
  mask: var(--hex-mask) center / 100% 100% no-repeat;
  pointer-events: none;
}

/* Podpis modułu – pojawia się po najechaniu kursorem */
.hex__label {
  position: absolute;
  left: 50%;
  bottom: 12%;
  padding: 0.35em 0.9em;
  border-radius: 999px;
  font-size: clamp(0.7rem, 0.85vw, 0.95rem);
  font-weight: 500;
  white-space: nowrap;
  color: #fff;
  background: rgba(12, 28, 71, 0.78);
  opacity: 0;
  transform: translate(-50%, 6px);
  transition: opacity .25s ease, transform .25s ease;
  pointer-events: none;
}

@media (hover: hover) {
  .hex:hover .hex__frame { transform: scale(1.05); }
  .hex:hover .hex__img { filter: brightness(1.08) saturate(1.1); }
  .hex:hover .hex__label { opacity: 1; transform: translate(-50%, 0); }
}

/* Puls „bicia serca” za centralnym heksagonem (pacjent) */
.hex--pacjent .hex__float::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(64, 145, 255, 0.55);
  -webkit-mask: var(--hex-mask) center / 100% 100% no-repeat;
  mask: var(--hex-mask) center / 100% 100% no-repeat;
  opacity: 0;
}

/* ---------- Animacje ---------- */
@media (prefers-reduced-motion: no-preference) {
  /* Tekst: spokojne wejście */
  .hero__content { animation: msw-rise .8s cubic-bezier(.2, .7, .2, 1) both .1s; }

  /* Heksagony składają się po kolei: od środka, dalej zgodnie z ruchem wskazówek zegara */
  .hex { animation: msw-hex-in .7s cubic-bezier(.2, .8, .25, 1.15) both; }
  .hex--pacjent      { animation-delay: .25s; }
  .hex--szpital      { animation-delay: .40s; }
  .hex--laboratorium { animation-delay: .50s; }
  .hex--obrazowanie  { animation-delay: .60s; }
  .hex--bezpieczenstwo { animation-delay: .70s; }
  .hex--analiza      { animation-delay: .80s; }
  .hex--stomatologia { animation-delay: .90s; }

  /* Delikatne unoszenie – każdy kafel w innym rytmie */
  .hex__float { animation: msw-float 7s ease-in-out infinite; will-change: transform; }
  .hex--szpital      .hex__float { animation-duration: 7.4s; animation-delay: -1.2s; }
  .hex--stomatologia .hex__float { animation-duration: 6.6s; animation-delay: -3.1s; }
  .hex--laboratorium .hex__float { animation-duration: 8.1s; animation-delay: -0.4s; }
  .hex--pacjent      .hex__float { animation-duration: 7.0s; animation-delay: -2.2s; }
  .hex--analiza      .hex__float { animation-duration: 7.8s; animation-delay: -4.6s; }
  .hex--obrazowanie  .hex__float { animation-duration: 6.9s; animation-delay: -5.3s; }
  .hex--bezpieczenstwo .hex__float { animation-duration: 7.6s; animation-delay: -1.8s; }

  /* Błysk światła co kilka sekund, kolejno przez kafle */
  .hex__frame::after { animation: msw-sweep 9s ease-in-out infinite; }
  .hex--szpital      .hex__frame::after { animation-delay: 1.6s; }
  .hex--laboratorium .hex__frame::after { animation-delay: 2.4s; }
  .hex--obrazowanie  .hex__frame::after { animation-delay: 3.2s; }
  .hex--bezpieczenstwo .hex__frame::after { animation-delay: 4.0s; }
  .hex--analiza      .hex__frame::after { animation-delay: 4.8s; }
  .hex--stomatologia .hex__frame::after { animation-delay: 5.6s; }
  .hex--pacjent      .hex__frame::after { animation-delay: 6.4s; }

  /* Puls za pacjentem */
  .hex--pacjent .hex__float::before { animation: msw-pulse 3.2s ease-out infinite 1.4s; }

  /* Siatka w tle płynie bardzo powoli (przesunięcie o 2 pełne kafle = zapętlenie bez szwu) */
  .hero__grid::before { animation: msw-grid 60s linear infinite; }

  /* Poświata „oddycha” */
  .hero__glow { animation: msw-breathe 8s ease-in-out infinite; }

  @keyframes msw-rise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
  }
  @keyframes msw-hex-in {
    from { opacity: 0; transform: scale(.6) translateY(24px); }
    to   { opacity: 1; transform: none; }
  }
  @keyframes msw-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-7px); }
  }
  @keyframes msw-sweep {
    0%        { background-position: 100% 0; }
    14%, 100% { background-position: 0% 0; }
  }
  @keyframes msw-pulse {
    0%   { opacity: .55; transform: scale(1); }
    100% { opacity: 0;   transform: scale(1.32); }
  }
  @keyframes msw-grid {
    from { transform: translate3d(0, 0, 0); }
    to   { transform: translate3d(-216px, -124.7px, 0); }
  }
  @keyframes msw-breathe {
    0%, 100% { opacity: .75; transform: scale(1); }
    50%      { opacity: 1;   transform: scale(1.06); }
  }
}

/* ---------- Ekrany węższe niż 17:10 (laptopy 16:10, tablety poziomo) ---------- */
@media (min-aspect-ratio: 1/1) and (max-aspect-ratio: 17/10) {
  .hero { padding-left: max(6vw, env(safe-area-inset-left, 0px)); padding-right: 4vw; gap: 3vw; }
  .hero__content { max-width: 46vw; }
  .hero__title { font-size: clamp(2rem, min(3.7vw, 7vh), 3.75rem); }
  .honeycomb {
    width: min(44vw, calc(84vh / 1.02));
    width: min(44vw, calc(84dvh / 1.02));
  }
}

/* ---------- Pion: telefony i tablety w orientacji pionowej ----------
   Heksagony u góry, tekst pod nimi. */
@media (max-aspect-ratio: 1/1) {
  .hero {
    flex-direction: column;
    justify-content: center;
    gap: clamp(1.5rem, 4vh, 3rem);
    padding: max(1.5rem, env(safe-area-inset-top, 0px)) 1.5rem max(2rem, env(safe-area-inset-bottom, 0px));
    background-image:
      linear-gradient(0deg, rgba(234, 242, 251, 0.92) 0%, rgba(234, 242, 251, 0.75) 38%, rgba(234, 242, 251, 0.1) 62%),
      image-set(url("../img/tlo-960.webp") type("image/webp"), url("../img/tlo-1672.jpg") type("image/jpeg"));
    background-position: 30% center;
  }
  .hero__grid {
    -webkit-mask-image: radial-gradient(ellipse 80% 45% at 50% 30%, #000 0%, rgba(0, 0, 0, 0.3) 60%, transparent 85%);
    mask-image: radial-gradient(ellipse 80% 45% at 50% 30%, #000 0%, rgba(0, 0, 0, 0.3) 60%, transparent 85%);
  }
  .hero__glow { right: auto; left: 50%; top: 32%; margin-left: -30vmax; }
  .honeycomb {
    order: -1;
    width: min(84vw, 48vh, 520px);
    width: min(84vw, 48dvh, 520px);
  }
  .hero__content {
    max-width: 34rem;
    width: 100%;
    text-align: center;
  }
  .hero__title { font-size: clamp(2rem, min(8.2vw, 5vh), 3rem); }
  .hero__title span { white-space: normal; }
  .hero__rule { margin: 1rem auto; }
  .hero__lead {
    font-size: clamp(1rem, 3.9vw, 1.3rem);
    margin-bottom: 1.5rem;
  }
  .hero__cta {
    font-size: clamp(1rem, 4vw, 1.2rem);
    width: 100%;
    max-width: 360px;
  }
}

/* Bardzo niskie ekrany poziome (telefon obrócony) */
@media (min-aspect-ratio: 1/1) and (max-height: 480px) {
  .hero { padding-top: 1rem; padding-bottom: 1rem; }
  .hero__content { max-width: 50vw; }
  .hero__title { font-size: clamp(1.4rem, 3.6vw, 2rem); }
  .hero__rule { margin: 0.75rem 0; }
  .hero__lead { font-size: 0.95rem; margin-bottom: 1rem; line-height: 1.45; }
  .hero__cta { font-size: 0.95rem; min-width: 200px; padding: 0.75rem 1.75rem; }
  .honeycomb {
    width: min(42vw, calc(90vh / 1.02));
    width: min(42vw, calc(90dvh / 1.02));
  }
}

/* ---------- Strony błędów (404, 500, 503…) ---------- */
.error {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  background: var(--mist);
}
.error__box { max-width: 34rem; }
.error__code {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--blue);
}
.error__title {
  margin: 0;
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--navy);
}
.error__text {
  margin: 1rem 0 2rem;
  font-size: 1.05rem;
  line-height: 1.6;
}
.error .hero__cta { min-width: 0; font-size: 1rem; padding: 0.85rem 1.75rem; }
