/* General reset and typography */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #fdfdfd;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Navigation bar */
header {
  background-color: #024E76;
  color: #fff;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header .logo {
  font-size: 1.5rem;
  font-weight: bold;
}

nav ul {
  /* Now using main-menu for top-level list; other lists use dropdown styling */
  list-style: none;
  display: flex;
  gap: 1.5rem;
}

nav ul li a {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s;
}

nav ul li a:hover {
  opacity: 0.8;
}

/* Dropdown menu for kalkulatory */
nav ul.main-menu {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

nav ul.main-menu li {
  position: relative;
}

nav ul.main-menu li .dropdown {
  /* Menu podręczne jest domyślnie ukryte. Pojawi się na hover (desktop) lub gdy
     element nadrzędny ma klasę open (kliknięcie na mobile). */
  display: none;
  position: absolute;
  top: 100%;
  /* Ustawiamy dropdown przy prawej krawędzi elementu menu, dzięki czemu
     na dużych ekranach lista nie wychodzi poza okno i jest łatwiej dostępna. */
  right: 0;
  left: auto;
  transform: none;
  background-color: #024E76;
  padding: 0.5rem 0;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  z-index: 1000;
  min-width: 200px;
  max-width: 90vw;
}

/* Pokaż dropdown na hover (desktop) lub gdy dodana klasa open (mobile). */
nav ul.main-menu li:hover .dropdown,
nav ul.main-menu li.open .dropdown {
  display: block;
}

nav ul.main-menu li .dropdown li {
  margin: 0;
}

nav ul.main-menu li .dropdown li a {
  color: #fff;
  padding: 0.5rem 1rem;
  display: block;
  white-space: nowrap;
}

/* Wskaźnik (strzałka) przy pozycji menu „Kalkulatory”. Używa pseudoelementu ::after. */
nav ul.main-menu li.menu-item-has-children > a::after {
  content: '\25BC'; /* czarna strzałka w dół */
  margin-left: 0.3rem;
  font-size: 0.7rem;
  display: inline-block;
  transition: transform 0.2s ease;
}

/* Obrócona strzałka po otwarciu podmenu (kliknięcie) lub gdy najechane myszą. */
nav ul.main-menu li.menu-item-has-children.open > a::after,
nav ul.main-menu li.menu-item-has-children:hover > a::after {
  transform: rotate(180deg);
}

nav ul.main-menu li .dropdown li a:hover {
  background-color: #01334f;
}

/* Hero section */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1rem;
  text-align: center;
  /* Tło z kalkulatorem i półprzezroczystą warstwą sprawiającą, że tekst jest czytelny */
  /* Lżejsze tło w formacie JPEG zmniejsza rozmiar strony i poprawia Core Web Vitals */
  background: linear-gradient(rgba(255,255,255,0.85), rgba(255,255,255,0.85)), url('hero-optimized.jpg') no-repeat center center/cover;
  color: #024E76;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.2rem;
  max-width: 700px;
  margin-bottom: 2rem;
  color: #0A2F49;
}

.hero .cta {
  background-color: #FF7A59;
  color: #fff;
  padding: 0.8rem 1.5rem;
  border: none;
  border-radius: 4px;
  text-decoration: none;
  font-weight: bold;
  transition: background-color 0.2s;
}

.hero .cta:hover {
  background-color: #e56648;
}

/* Main content container */
.container {
  width: 90%;
  max-width: 1100px;
  margin: 0 auto;
  flex: 1;
  padding: 2rem 1rem;
}

/* Features cards */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.card {
  background-color: #fff;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  padding: 1.5rem;
  text-align: center;
  transition: transform 0.2s;
}

.card:hover {
  transform: translateY(-5px);
}

.card h3 {
  margin-bottom: 0.5rem;
}

.card p {
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.card a {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  background-color: #024E76;
  color: #fff;
  border-radius: 4px;
  text-decoration: none;
  transition: background-color 0.2s;
}

.card a:hover {
  background-color: #01334f;
}

/* Calculator forms */
.calc-form {
  background-color: #fff;
  padding: 2rem;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  max-width: 600px;
  margin: 0 auto;
}

/* Zapobiega powiększaniu widoku na urządzeniach mobilnych przy wpisywaniu danych.
   Ustaw font-size na co najmniej 16px dla wszystkich pól formularzy. */
input, select {
  font-size: 16px;
}

/* Responsive styles for mobile devices */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: flex-start;
  }
  nav ul.main-menu {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }
  /* Na urządzeniach mobilnych hover nie jest dostępny. Dropdown będzie
     wyświetlany tylko wtedy, gdy rodzic ma klasę open (dodawaną po kliknięciu).
     Dlatego nie ustawiamy display: block, zachowujemy ukrycie. Przesuwamy menu
     na pozycję statyczną i usuwamy efekt cienia, aby lista wpasowała się w
     kolumnowy układ. */
  nav ul.main-menu li .dropdown {
    position: static;
    transform: none;
    margin-left: 1rem;
    box-shadow: none;
  }
  .hero {
    padding: 3rem 1rem;
    background-position: center;
  }
  .features {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .calc-form {
    max-width: 100%;
    padding: 1.5rem;
  }
}

.calc-form h2 {
  margin-bottom: 1rem;
  color: #024E76;
}

.calc-form label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
}

.calc-form input, .calc-form select {
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  /* Zapobiega powiększaniu widoku na urządzeniach mobilnych przy klikaniu w pola
     formularzy. Ustawienie font-size na minimum 16px (1rem) jest zalecane
     dla Safari na iOS, aby nie uruchamiać automatycznego zoomowania. */
  font-size: 1rem;
}

.calc-form button {
  background-color: #FF7A59;
  color: #fff;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.2s;
}

.calc-form button:hover {
  background-color: #e56648;
}

.result {
  margin-top: 1rem;
  font-size: 1.1rem;
  font-weight: bold;
  color: #024E76;
}

/* Tables used in some kalkulatory (e.g. amortyzacja) */
.calc-form table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.calc-form table th,
.calc-form table td {
  border: 1px solid #ccc;
  padding: 0.5rem;
  text-align: center;
}

.calc-form table thead {
  background-color: #f0f7fa;
}

/* Blog list */
.blog-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.blog-post {
  background-color: #fff;
  border-radius: 6px;
  padding: 1.5rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.blog-post h3 {
  margin-bottom: 0.5rem;
  color: #024E76;
}

.blog-post p {
  font-size: 0.9rem;
  color: #555;
}

/* Stylowanie zawartości artykułów (pliki w folderze posts) */
/* Stylowanie zawartości artykułów i wpisów blogowych */
main.container h1 {
  font-size: 2rem;
  margin-top: 0;
  margin-bottom: 1rem;
  color: #024E76;
  border-bottom: 2px solid #eee;
  padding-bottom: 0.5rem;
}
main.container h2 {
  font-size: 1.5rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: #024E76;
}
main.container h3 {
  font-size: 1.25rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: #024E76;
}
main.container p {
  margin-bottom: 1rem;
  line-height: 1.6;
}
main.container img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1rem auto;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* Footer */
footer {
  background-color: #024E76;
  color: #fff;
  text-align: center;
  padding: 1rem 0;
  margin-top: auto;
}

@media (max-width: 600px) {
  .hero h1 {
    font-size: 2rem;
  }
  .hero p {
    font-size: 1rem;
  }
}