/*
  Tiedosto: style.css
  Idea: Perustyylit + mobiilinavigaatio selkeasti ryhmiteltyna.
  Oppimismuistisääntö: samaan valitsimeen vain yksi perusblokki,
  jotta ei synny vahingossa ristiriitaisia duplikaatteja.
*/

/* 1) Sivun yleiset perusasetukset */
body {
  font-family: Arial, sans-serif; /* Helppo perusfontti */
  margin: 0; /* Poistaa selaimen oletusmarginaalin */
  padding: 0; /* Poistaa selaimen oletuspaddingin */
  line-height: 1.6; /* Parempi luettavuus tekstille */
  background: #f9f9f9; /* Vaalea tausta koko sivulle */
}

header,
footer {
  background: #003366; /* Tumma sininen palkki */
  color: white; /* Kontrasti taustaa vasten */
  padding: 1rem;
  text-align: center;
}

/* 2) Desktop-navigaatio */
nav ul {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: flex;
  justify-content: center;
  gap: 1rem;
}

nav a {
  color: white;
  text-decoration: none;
  font-weight: bold;
  padding: 0.3rem 0.6rem;
}

nav a:hover {
  background: #0055aa;
  border-radius: 4px;
}

/* 3) Sisaltolohkot */
section {
  max-width: 800px;
  margin: 2rem auto;
  padding: 1rem;
  background: white;
}

.gallery-section {
  max-width: 1120px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
  padding: 20px;
}

.gallery-item {
  position: relative;
  cursor: pointer;
  overflow: hidden;
  border-radius: 8px;
  background: #000;
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.gallery-item:hover img,
.gallery-item:focus-within img {
  transform: scale(1.05);
}

.caption {
  position: absolute;
  bottom: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  text-align: center;
  padding: 8px 5px;
  font-size: 1rem;
}

.lightbox {
  display: none;
  justify-content: center;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  flex-direction: column;
  padding: 10px;
}

.lightbox.open {
  display: flex;
}

.lightbox-img {
  max-width: 90%;
  max-height: 80%;
  margin-bottom: 10px;
  border-radius: 5px;
}

.lightbox-caption {
  color: #fff;
  text-align: center;
  font-size: 1.2rem;
}

.close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 40px;
  color: #fff;
  cursor: pointer;
}

.prev,
.next {
  position: absolute;
  top: 50%;
  font-size: 50px;
  color: #fff;
  cursor: pointer;
  user-select: none;
  padding: 0 10px;
  transform: translateY(-50%);
}

.prev {
  left: 10px;
}

.next {
  right: 10px;
}

article {
  border: 1px solid #ddd;
  padding: 1rem;
  margin-bottom: 1rem;
  background: #fdfdfd;
}

/* 6) Vaihe 8: Yhteystietosivun Google Maps -upotus */
.map-wrapper {
  margin: 1.25rem 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.map-wrapper iframe {
  width: 100%;
  min-height: 320px;
  border: 0;
}

/* 7) Yhteystietosivun lomakkeen yhtenainen ulkoasu */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.contact-card {
  background: #f7fbff;
  border: 1px solid #d8e7f5;
  border-radius: 10px;
  padding: 1rem;
}

.contact-card h3 {
  margin-top: 0;
  color: #003366;
}

.contact-card address {
  margin: 0;
  font-style: normal;
}

.contact-card a {
  color: #0055aa;
  font-weight: bold;
}

.contact-form {
  display: grid;
  gap: 0.6rem;
}

.contact-form label {
  font-weight: 600;
  color: #163955;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.7rem 0.75rem;
  border: 1px solid #b6cde3;
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: #0055aa;
  outline: 2px solid rgba(0, 85, 170, 0.2);
  outline-offset: 1px;
}

.contact-form textarea {
  resize: vertical;
  min-height: 120px;
}

.contact-form button {
  justify-self: start;
  padding: 0.7rem 1.2rem;
  border: none;
  border-radius: 8px;
  background: #003366;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.contact-form button:hover,
.contact-form button:focus {
  background: #0055aa;
  outline: none;
}

/* 4) Vaihe 3: Mobiilivalikon osat (piilossa desktopilla) */
.hamburger {
  display: none;
  width: 44px;
  height: 44px;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  margin: 0.75rem auto 0;
  padding: 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
}

.hamburger span {
  display: block;
  height: 3px;
  background-color: #fff;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.mobile-nav {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: #003366;
  padding: 6.5rem 0 1rem;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-20px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}

.mobile-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-nav ul li {
  padding: 0;
}

.mobile-nav ul li a {
  color: #fff;
  text-decoration: none;
  font-weight: bold;
  display: block;
  padding: 0.9rem 1.25rem;
}

.mobile-nav ul li a:hover,
.mobile-nav ul li a:focus {
  background: #0055aa;
  outline: none;
}

.mobile-nav.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* 5) Responsiivisuus: alle 768px */
@media (max-width: 768px) {
  /* Piilotetaan desktopin navigaatio pienilla naytoilla */
  nav ul {
    display: none;
  }

  /* Naytetaan hamburger vain mobiilinakymaan */
  .hamburger {
    display: flex;
  }

  /* Auki-tilassa viivoista muodostuu rasti */
  .hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }

  .hamburger.active span:nth-child(2) {
    opacity: 0;
  }

  .hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
  }

  /* Mobiilivalikon linkkilista pystyrakenteeseen */
  .mobile-nav ul {
    display: block;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 15px;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 10px;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }
}

/* Desktopilla mobiilivalikko pidetaan kokonaan pois kaytosta */
@media (min-width: 769px) {
  .mobile-nav {
    display: none;
  }
}