/* =========================================
   🧭 RESET & OGÓLNE USTAWIENIA
========================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Barlow', sans-serif;
}

html, body {
  height: 100%;
  color: #fff;
  background-color: #ffffff;
}

html {
  scroll-behavior: smooth;
}

section[id] {
  scroll-margin-top: 20px;
}


/* =========================================
   🌊 TŁO WIDEO / OBRAZ
========================================= */
.hero {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
  /* Keep static and video aligned by default */
  --hero-pos-x: left;
  --hero-pos-y: top;
}

.hero video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--hero-pos-x, left) var(--hero-pos-y, top);
  z-index: 1;
  backface-visibility: hidden;
  will-change: opacity;
}

/* Statyczne tło po zakończeniu filmu */
.hero::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("images/fala2.png");
  background-size: cover;
  background-position: var(--hero-pos-x, left) var(--hero-pos-y, top);
  opacity: 1;
  transition: none;
  z-index: 0;
  backface-visibility: hidden;
  will-change: opacity;
}

.hero.show-background::after {
  opacity: 1;
}

header {
  position: relative;
  z-index: 10000;
  isolation: isolate;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

main,
footer {
  position: relative;
  z-index: 1;
}

/* Ensure main content doesn't interfere with mobile menu */
.site-content {
  position: relative;
  z-index: 1;
}

/* =========================================
   🧢 NAGŁÓWEK I NAWIGACJA
========================================= */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 30px 60px;
  color: #ebe154;
}

/* Logo */
.logo {
  text-align: center;
}

.logo h1,
.logo span {
  font-weight: 700;
  color: #ebe154;
  text-shadow:
    0 4px 10px rgba(0, 0, 0, 0.7),
    0 -1px 5px rgba(255, 255, 255, 0.4);
  transition: transform 0.3s ease, text-shadow 0.3s ease;
}

.logo h1 {
  font-size: 100px;
}

.logo span {
  display: block;
  font-size: 75px;
}

.logo h1:hover,
.logo span:hover {
  transform: translateY(-5px);
  text-shadow:
    0 8px 20px rgba(0, 0, 0, 0.65),
    0 -2px 8px rgba(255, 255, 255, 0.6);
}

/* Nawigacja */
nav ul {
  list-style: none;
  display: flex;
  gap: 40px;
}

nav a {
  position: relative;
  color: #ebe154;
  font-weight: 700;
  font-size: 40px;
  text-decoration: none;
  transition: all 0.3s ease;
  text-shadow:
    0 3px 8px rgba(0, 0, 0, 0.5),
    0 -1px 4px rgba(255, 255, 255, 0.3);
}

/* Podkreślenie */
nav a::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 100%;
  height: 2px;
  background: #ebe154;
  transform: scaleX(1);
  transform-origin: left;
  transition: transform 0.3s ease;
}

nav a:hover {
  color: #ffffff;
  transform: translateY(-5px);
  text-shadow:
    0 8px 20px rgba(0, 0, 0, 0.6),
    0 -2px 8px rgba(255, 255, 255, 0.6);
}

nav a:hover::after {
  transform: scaleX(1.1);
}

/* =========================================
   ⚓ STOPKA / IKONY
========================================= */
footer {
  position: fixed;
  bottom: 30px;
  right: 40px;
  display: flex;
  gap: 20px;
}

.icon {
  background: rgba(255, 255, 255, 0.15);
  padding: 10px 14px;
  border-radius: 50%;
  text-decoration: none;
  color: white;
  font-size: 22px;
  transition: 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 55px;
  height: 55px;
  overflow: hidden;
}

.icon:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: translateY(-4px);
}

.icon img {
  width: 40px;
  height: auto;
  display: block;
  filter: brightness(0) invert(1);
  transition: transform 0.3s ease, filter 0.3s ease;
}

.icon:hover img {
  transform: scale(1.1);
  filter: brightness(0) invert(1) drop-shadow(0 0 6px #ebe154);
}

.icon.yt:hover {
  background: rgba(255, 0, 0, 0.4);
}

.icon.phone:hover {
  background: rgba(235, 225, 84, 0.4);
}

.icon.mail:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* =========================================
   📄 SEKCJE STRON: O NAS, PORTFOLIO, KONTAKT
========================================= */
.text-section,
.onas-section {
  min-height: 100vh;
  padding: 88px 10%;
  color: white;
  text-align: center;
  background: linear-gradient(
    to bottom, 
    rgba(0, 0, 0, 0.1) 0%,
    rgba(0, 0, 0, 0.6) 25%,
    rgba(0, 0, 0, 0.75) 100%
  );
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  position: relative;
  z-index: 1;
  /* Create isolation only when menu is NOT open */
}


/* Nagłówki sekcji */
.text-section h2,
.onas-section h2 {
  font-size: 60px;
  color: #ebe154;
  margin-bottom: 30px;
}

/* Paragrafy */
.text-section p,
.onas-section p {
  font-size: 22px;
  line-height: 1.7;
  margin-bottom: 20px;
}

/* Portfolio */
.portfolio-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 30px;
  margin-top: 40px;
}

.portfolio-grid .item {
  background: rgba(255, 255, 255, 0.1);
  padding: 20px 40px;
  border-radius: 12px;
  font-weight: 600;
}

/* =========================================
   🖥️ PROGRAMY TELEWIZYJNE – większa czcionka i lepsza czytelność
========================================= */
#programy p {
  font-size: 26px;
  line-height: 1.9;
  max-width: 900px;
  margin: 0 auto 25px;
  text-align: center;
}

#programy h3 {
  font-size: 58px;
  margin-bottom: 50px;
  color: #ebe154;
}

/* =========================================
   📱 RESPONSYWNOŚĆ – TABLETY I TELEFONY
========================================= */

/* Ekrany do 1024px (np. iPad poziomo) */
@media (max-width: 1024px) {
  header {
    flex-direction: column;
    align-items: center;
    padding: 20px 30px;
  }

  .logo h1 {
    font-size: 70px;
  }

  .logo span {
    font-size: 50px;
  }

  nav a {
    font-size: 28px;
  }
}

/* Ekrany do 768px (np. iPad pionowo, małe laptopy) */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    gap: 10px;
  }

  .logo h1 {
    font-size: 50px;
  }

  .logo span {
    font-size: 36px;
  }

  nav ul {
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
  }

  nav a {
    font-size: 22px;
  }

  .onas-section {
    padding: 60px 8%;
  }

  .text-section p {
    font-size: 18px;
  }

  footer {
    bottom: 20px;
    right: 20px;
  }

  .icon {
    width: 45px;
    height: 45px;
  }

  .icon img {
    width: 28px;
  }
}

/* While menu is open, prevent background interaction */
@media (max-width: 768px) {
  body.menu-open {
    overflow: hidden;
  }
  body.menu-open .text-section,
  body.menu-open .onas-section {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    z-index: 1;
  }
  body.menu-open .hero {
    z-index: 0;
  }
}

/* Ekrany do 480px (telefony) */
@media (max-width: 480px) {
  .logo h1 {
    font-size: 36px;
  }

  .logo span {
    font-size: 28px;
  }

  nav ul {
    flex-direction: column;
    align-items: center;
    gap: 15px;
  }

  nav a {
    font-size: 20px;
  }

  .onas-section {
    padding: 40px 6%;
  }

  .onas-section h2 {
    font-size: 36px;
  }

  .onas-section p {
    font-size: 16px;
  }

  footer {
    right: 10px;
    bottom: 10px;
    gap: 10px;
  }

  .icon {
    width: 38px;
    height: 38px;
  }

  .icon img {
    width: 24px;
  }
}

/* =========================================
   🍔 MENU MOBILNE – dopracowana wersja
========================================= */

/* Ukryj ikonę na dużych ekranach */
.menu-toggle {
  display: none;
  font-size: 40px;
  color: #ebe154;
  cursor: pointer;
  transition: transform 0.3s ease;
}

/* Efekt kliknięcia */
.menu-toggle.active {
  transform: rotate(90deg);
}

/* Tylko dla mniejszych ekranów */
@media (max-width: 768px) {
  /* 🔹 Pokazuj ikonę */
  .menu-toggle {
    display: block;
    position: fixed;
    top: 25px;
    right: 40px;
    z-index: 999999;
  }

  /* 🔹 Ukryj menu domyślnie */
  .main-nav ul {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.96);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    padding: 30px 0;
    transform: translateY(-100%);
    opacity: 0;
    transition: all 0.4s ease;
    z-index: 999998;
    will-change: transform, opacity;
  }

  /* 🔹 Po aktywacji (kliknięcie hamburgera) */
  .main-nav.active ul {
    transform: translateY(0);
    opacity: 1;
  }

  /* 🔹 Styl linków w menu mobilnym */
  .main-nav a {
    font-size: 32px;
    color: #ebe154;
    text-decoration: none;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
  }

  .main-nav a:hover {
    color: #fff;
  }

  /* 🔹 Układ nagłówka w pionie */
  header {
    flex-direction: column;
    align-items: center;
  }
}

/* Ensure mobile menu overlays subpage content */
@media (max-width: 768px) {
  /* Force all subpage content below menu */
  body.subpage .text-section,
  body.subpage .onas-section,
  body.subpage .portfolio-section,
  body.subpage .portfolio-page,
  body.subpage .site-content,
  body.subpage main {
    position: relative;
    z-index: 1 !important;
  }
  
  /* Ensure menu stays on top */
  body.subpage .main-nav ul {
    z-index: 999998 !important;
  }
  
  body.subpage .menu-toggle {
    z-index: 999999 !important;
  }
}

/* =========================================
   🪶 WERSJE PODSTRON: O NAS / KONTAKT / PORTFOLIO
========================================= */
body.subpage header {
  padding: 20px 40px;
}

body.subpage .logo h1 {
  font-size: 70px;
}

body.subpage .logo span {
  font-size: 45px;
}

body.subpage nav a {
  font-size: 26px;
}

/* Lekkie przyciemnienie tła wideo */
body.subpage .hero::after {
  /* Static image only, no darkening */
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("images/fala2.png");
  background-size: cover;
  background-position: var(--hero-pos-x, left) var(--hero-pos-y, top);
  z-index: 0;
}

/* =========================================
   🎬 PORTFOLIO Z KATEGORIAMI
========================================= */

.portfolio-buttons {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-top: 40px;
  flex-wrap: wrap;
}

.portfolio-buttons button {
  background: rgba(235, 225, 84, 0.2);
  border: 2px solid #ebe154;
  color: #ebe154;
  font-size: 24px;
  font-weight: 600;
  padding: 14px 28px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.portfolio-buttons button:hover {
  background: #ebe154;
  color: #000;
  transform: translateY(-3px);
}

.portfolio-section {
  padding: 100px 10%;
  text-align: center;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.4) 0%,
    rgba(0, 0, 0, 0.7) 100%
  );
  position: relative;
  z-index: 1;
}

.portfolio-section h3 {
  font-size: 48px;
  color: #ebe154;
  margin-bottom: 40px;
}

/* 🎥 Miniatury wideo */
.portfolio-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 40px;
}

.video-thumb {
  position: relative;
  width: 360px;
  height: 203px;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.video-thumb:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 25px rgba(235, 225, 84, 0.4);
}

.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.play-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 50px;
  color: #ebe154;
  text-shadow: 0 0 12px rgba(0,0,0,0.9);
  pointer-events: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.video-thumb:hover .play-button {
  transform: translate(-50%, -50%) scale(1.15);
  opacity: 0.9;
}

.video-thumb iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: none;
}

.video-thumb.active img,
.video-thumb.active .play-button {
  display: none;
}

.video-thumb.active iframe {
  display: block;
}

/* =========================================
   🧢 DODATKOWA POPRAWA RESPONSYWNOŚCI NAGŁÓWKA
========================================= */

/* Ekrany do 1200px – lekkie zmniejszenie nagłówka */
@media (max-width: 1200px) {
  .logo h1 {
    font-size: 80px;
  }

  .logo span {
    font-size: 55px;
  }

  nav a {
    font-size: 32px;
  }
}

/* Ekrany do 992px – logo nad menu */
@media (max-width: 992px) {
  header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .logo h1 {
    font-size: 65px;
  }

  .logo span {
    font-size: 55px;
  }

  nav ul {
    gap: 25px;
  }

  nav a {
    font-size: 26px;
  }
}

/* Ekrany do 768px – aktywacja hamburgera */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: center;
    padding: 15px 20px;
  }

  .logo h1 {
    font-size: 75px;
  }

  .logo span {
    font-size: 55px;
  }

  .main-nav a {
    font-size: 22px;
    text-shadow: none;
  }
}

/* Telefony do 480px – logo mniejsze */
@media (max-width: 480px) {
  .logo h1 {
    font-size: 46px;
  }

  .logo span {
    font-size: 36px;
  }

  .main-nav a {
    font-size: 20px;
  }
}

/* =========================================
   🌗 ŁAGODNE PRZEJŚCIE MIĘDZY STRONAMI
========================================= */

body {
  opacity: 0;
  transition: opacity 0.8s ease-in-out;
}

body.loaded {
  opacity: 1;
}

/* =========================================
   Mobile Hamburger Override (rebuild)
========================================= */
/* Draw a 3-bar hamburger regardless of inner text */
.menu-toggle {
  position: fixed;
  top: 25px;
  right: 25px;
  width: 32px;
  height: 22px;
  background: 
    linear-gradient(#ebe154,#ebe154) 0 0/100% 3px no-repeat,
    linear-gradient(#ebe154,#ebe154) 0 50%/100% 3px no-repeat,
    linear-gradient(#ebe154,#ebe154) 0 100%/100% 3px no-repeat;
  color: transparent;
  text-indent: -9999px;
  overflow: hidden;
  border: 0;
  cursor: pointer;
  z-index: 100001;
}

/* Show button only on small screens; keep hidden on larger */
@media (max-width: 768px) {
  .menu-toggle { display: block; }
}
@media (min-width: 769px) {
  .menu-toggle { display: none !important; }
}


/* =========================================
   Mobile Focused Fixes (final override)
========================================= */
@media (max-width: 768px) {
  /* Use dynamic viewport units for reliable full-screen sizing on mobile */
  .hero,
  .hero::after,
  .main-nav ul {
    height: 100dvh;
    min-height: 100svh;
  }

  /* Center static and video framing for phones */
  .hero::after {
    background-position: center top !important;
    background-size: cover !important;
  }
  .hero video {
    object-position: center top !important;
  }

  /* Ensure hamburger stays on top and in a consistent spot */
  .menu-toggle {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 100001 !important;
  }

  /* Force overlay menu to cover screen and sit above content */
  .main-nav ul {
    position: fixed !important;
    inset: 0 !important;
    height: 100dvh !important;
    background: rgba(0, 0, 0, 0.96) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 28px !important;
    padding: 30px 20px !important;
    transform: translateY(-100%) !important;
    opacity: 0 !important;
    transition: transform 0.35s ease, opacity 0.35s ease !important;
    z-index: 100000 !important;
  }

  .main-nav.active ul {
    transform: translateY(0) !important;
    opacity: 1 !important;
  }

  /* Prevent background scroll/interactions while menu is open */
  body.menu-open {
    overflow: hidden !important;
    touch-action: none;
  }
}

/* =========================================
   Home (index) Mobile: Inline Menu
   - Hide hamburger on home
   - Show simple menu under logo
   Applies only when body does NOT have .subpage
========================================= */
@media (max-width: 768px) {
  /* Hide hamburger on home page */
  body:not(.subpage) .menu-toggle {
    display: none !important;
  }

  /* Stack header elements and center */
  body:not(.subpage) header {
    flex-direction: column !important;
    align-items: center !important;
    gap: 12px !important;
    padding-top: 20px;
  }

  /* Keep nav visible inline (no overlay) */
  body:not(.subpage) .main-nav ul {
    position: static !important;
    inset: auto !important;
    width: auto !important;
    height: auto !important;
    background: transparent !important;
    transform: none !important;
    opacity: 1 !important;
    z-index: 1 !important;
    padding: 0 !important;
    margin: 6px 0 0 0 !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 18px !important;
  }

  /* Tweak link sizes for phones */
  body:not(.subpage) .main-nav a {
    font-size: 22px !important;
    text-shadow: 0 3px 8px rgba(0, 0, 0, 0.5) !important;
  }

  /* Avoid locking scroll since no overlay is used */
  body:not(.subpage).menu-open {
    overflow: auto !important;
    touch-action: auto !important;
  }
}

/* Home (index) phones: vertical stack */
@media (max-width: 480px) {
  body:not(.subpage) .main-nav ul {
    flex-direction: column !important;
    align-items: center !important;
    gap: 14px !important;
  }
  body:not(.subpage) .main-nav a {
    font-size: 30px !important;
  }
}

/* =========================================
   Home (index): Larger Logo + Menu
   Applies only when body does NOT have .subpage
========================================= */
/* Desktop and large screens */
@media (min-width: 993px) {
  body:not(.subpage) .logo h1 { font-size: 120px !important; }
  body:not(.subpage) .logo span { font-size: 90px !important; }
  body:not(.subpage) nav a { font-size: 46px !important; }
}

/* Tablets / small laptops */
@media (min-width: 769px) and (max-width: 992px) {
  body:not(.subpage) .logo h1 { font-size: 85px !important; }
  body:not(.subpage) .logo span { font-size: 62px !important; }
  body:not(.subpage) nav a { font-size: 32px !important; }
}

/* Large phones / small tablets */
@media (min-width: 481px) and (max-width: 768px) {
  body:not(.subpage) .logo h1 { font-size: 68px !important; }
  body:not(.subpage) .logo span { font-size: 52px !important; }
  body:not(.subpage) .main-nav a { font-size: 26px !important; }
}

/* Phones */
@media (max-width: 480px) {
  body:not(.subpage) .logo h1 { font-size: 60px !important; }
  body:not(.subpage) .logo span { font-size: 50px !important; }
  /* menu font size already bumped to 22px above */
}

/* =========================================
   Home (index) Mobile: Raise Menu Position
   Make menu sit higher under the logo
========================================= */
@media (max-width: 768px) {
  body:not(.subpage) header {
    padding-top: 10px !important;
    gap: 8px !important;
  }
  body:not(.subpage) .main-nav ul {
    margin-top: 0 !important;
  }
}

@media (max-width: 480px) {
  body:not(.subpage) header {
    padding-top: 6px !important;
    gap: 6px !important;
  }
  body:not(.subpage) .main-nav ul {
    margin-top: -12px !important;
  }
}

/* Home (index) phones: lower the logo a bit */
@media (max-width: 480px) {
  body:not(.subpage) .logo {
    margin-top: 24px !important;
  }
}

/* =========================================
   Home (index) phones: Center menu vertically
   Keep logo/header at top; center nav in viewport
========================================= */
@media (max-width: 480px) {
  body:not(.subpage) .main-nav {
    width: 100% !important;
  }

  body:not(.subpage) .main-nav ul {
    /* Place in normal flow under the logo */
    position: static !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    background: transparent !important;
    width: 100% !important;
    max-width: 90% !important;
    padding: 0 !important;
    /* Push menu below logo; restored original spacing */
    margin: 0vh auto 0 auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    z-index: 2 !important;
  }
}

/* =========================================
   Home (index) phones: Larger Footer Icons
   Slightly increase YouTube and Mail icons on phones
========================================= */
@media (max-width: 480px) {
  body:not(.subpage) footer .icon.yt,
  body:not(.subpage) footer .icon.mail {
    width: 64px !important;
    height: 64px !important;
    padding: 12px 12px !important;
  }

  body:not(.subpage) footer .icon.yt img,
  body:not(.subpage) footer .icon.mail img {
    width: 46px !important;
  }
}
