/* -------------------------------------------------- YLEISET -------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: 'Montserrat', sans-serif; background-color: #f7f9fb; color: #1a1a1a; }
img { max-width: 100%; display: block; }
section { padding: 60px 20px; max-width: 1100px; margin: auto; }
h2 { text-align: center; margin-bottom: 40px; color: #1f4e79; font-size: 3rem; }

/* -------------------------------------------------- NAVIGAATIO -------------------------------------------------- */
.nav {
  background-color: #1f4e79;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 14px 30px;
}
.nav a { color: white; text-decoration: none; margin: 0 18px; font-weight: 600; font-size: 1.1rem; }
.nav a:hover { opacity: 0.7; }

.location-bar {
  background-color: #163d61;
  color: rgba(255,255,255,0.85);
  text-align: center;
  padding: 6px 20px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.logo img {
  height: 60px;
  width: auto;
}

/* -------------------------------------------------- HERO -------------------------------------------------- */
.hero {
  position: relative;
  height: 85vh;
  background-image: url('nettisivut.jpg');
  background-size: cover;
  background-position: center 35%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: white;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(31,78,121,0.65), rgba(0,0,0,0.45));
}
.hero-content { position: relative; z-index: 2; }
.hero-content h1 { font-size: 3rem; margin-bottom: 10px; }
.hero-content p { font-size: 1.25rem; margin-bottom: 20px; }
.cta-btn {
  background-color: #1f4e79;
  color: white;
  padding: 14px 32px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 1.3rem;
  font-weight: 700;
}
.cta-btn:hover { transform: translateY(-3px); }

/* -------------------------------------------------- PALVELUT -------------------------------------------------- */
.services { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 25px; }
.service-box {
  background: white;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  overflow: hidden;
  text-align: center;
  padding-bottom: 20px;
  transition: transform 0.25s ease;
}
.service-box:hover { transform: translateY(-6px); }
.service-img {
  height: 260px;
  background-size: cover;
  background-position: center;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
}
.service-title { font-size: 1.4rem; font-weight: 700; color: #0a4d8c; margin: 14px 0; }

/* Palvelukohtaiset kuvasäädöt */
.service-box.yksilo .service-img { background-position: center 45%; }
.service-box.pienryhma .service-img { background-position: center 45%; }
.service-box.yritys .service-img { background-position: center 65%; }
.service-img-svg { background: white; display: flex; align-items: center; justify-content: center; padding: 10px; }

/* -------------------------------------------------- MIKSI VALITA -------------------------------------------------- */
/* Desktop / yleiset säännöt */
.miksi-valita-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
}
.miksi-box {
  background: white;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  overflow: hidden;
  text-align: center;
  padding-bottom: 20px;
  transition: transform 0.25s ease;
  flex: 1 1 22%;
  max-width: 22%;
  box-sizing: border-box;
}
.miksi-box:hover { transform: translateY(-6px); }
.miksi-img { height: 180px; background-size: cover; background-position: center; border-radius: 8px; }
.miksi-box p {
  color: #003399;
  font-weight: 700;
  font-size: 1.2rem;
  text-align: center;
  margin-top: 8px;
}

/* -------------------------------------------------- REFERENSSIT -------------------------------------------------- */
.ref-img {
  width: 100%;
  height: 250px;
  background-size: cover;
  background-position: center;
  border-radius: 8px;
}
.referenssit-grid {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: nowrap;
}
.ref-box {
  background: #ffffff;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  width: 23%;
  box-sizing: border-box;
}
.ref-name {
  color: #1e6bd6;
  font-weight: 700;
  text-align: center;
  font-size: 1.1rem;
  margin-bottom: 10px;
}
.ref-box p:not(.ref-name) {
  font-style: italic;
  text-align: center;
  line-height: 1.5;
}

/* -------------------------------------------------- PALVELUT – HOVER -------------------------------------------------- */

.service-img {
  position: relative;
  width: 100%;
  height: 260px;
  background-size: cover;
  background-position: center;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
}


/* Hover-info kuvan päällä */
.hover-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255,255,255,0.92);
  padding: 14px 18px;
  font-size: 1rem;
  color: #0a4d8c;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
  white-space: normal;
}

.hover-intro {
  display: block;
  font-weight: 700;
  font-size: 1.05rem;
  color: #0a4d8c;
  margin-bottom: 8px;
  line-height: 1.3;
}
.hover-list {
  margin: 0;
  padding-left: 18px;   /* vasen sisennys listalle */
  color: #0a4d8c;
  line-height: 1.4;
}
.hover-list li {
  margin-bottom: 6px;
  list-style: disc;     /* tai 'circle' tai 'square' */
}

/* Hover näkyy vain desktopissa */
@media (min-width: 769px) {
  .service-box:hover .hover-info {
    opacity: 1;
    transform: translateY(0);
  }
}

/* -------------------------------------------------- MINUSTA -------------------------------------------------- */
.minusta-container { display: flex; gap: 40px; flex-wrap: wrap; align-items: center; }
.minusta-image img { width: 70%; max-width: 280px; border-radius: 10px; display: block; margin: 0 auto; }
.minusta-text { flex: 1; max-width: 600px; line-height: 1.6; font-size: 1.05rem; }
.minusta-text h3 { margin-top: 20px; margin-bottom: 10px; }
.filosofia { font-style: italic; line-height: 1.6; margin-bottom: 20px; font-size: 1.05rem; }

/* -------------------------------------------------- YHTEISTYÖKUMPPANIT -------------------------------------------------- */
.partners-section { background: #f5f7fa; text-align: center; padding: 60px 20px; }

/* MAKSUTAVAT */
#maksutavat { background: #fff; text-align: center; padding: 50px 20px; }
.maksutavat-container { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.maksutavat-text { font-size: 1.3rem; font-weight: 700; color: #1f4e79; }
.epassi-logo { width: 120px; border-radius: 10px; transition: opacity 0.2s; }
.epassi-logo:hover { opacity: 0.85; }
.partners-list {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 30px;
  flex-wrap: wrap;
}
.partner-box {
  width: 32%;
  text-align: center;
}
.partner-box img {
  width: 100%;
  height: auto;
  max-height: 140px;
  object-fit: contain;
  display: block;
  margin: 0 auto 10px auto;
}
.partner-box:nth-child(2) p { display: block; margin-top: 8px; line-height: 1.4; }
.partner-box:nth-child(3) {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
}
.partner-box:nth-child(3) .team-urhola-title {
  color: #1e6bd6;
  font-weight: 700;
  font-size: 1.1rem;
  text-align: center;
  margin-bottom: 8px;
}
/* YHTEISTYÖKUMPPANIT DESKTOP – ISOMMAT LOGOT JA LEVEÄMMÄT BOKSIT */
.partners-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 50px;
    justify-items: center;
    align-items: start;
    max-width: 1200px;
    margin: 0 auto;
}

.partner-box {
    width: 100%;
    max-width: 350px;   /* kasvatettu 320px → 350px */
    text-align: center;
}

.partner-box img {
    width: 100%;
    max-width: 300px;   /* kasvatettu 180px → 300px */
    height: auto;
    object-fit: contain;
    margin-bottom: 10px;
}



/* -------------------------------------------------- YHTEYDENOTTO -------------------------------------------------- */
.contact-form { max-width: 500px; margin: auto; display: flex; flex-direction: column; gap: 15px; }
.contact-form input, .contact-form textarea {
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
}
.contact-form button {
  background-color: #1f4e79;
  color: white;
  padding: 14px;
  border: none;
  border-radius: 6px;
}
#yhteydenotto {
    padding: 40px 20px 120px 20px;
    display: block;
}

/* -------------------------------------------------- FOOTER -------------------------------------------------- */
footer { 
   background-color: #1f4e79; 
   color: white; 
   text-align: center; 
   padding: 30px 20px; 
   margin-top: 40px;
}
/* POPUP YLEINEN TYYLI — KORJATTU JA YHDISTETTY */
.popup-overlay {
  position: fixed !important;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 99999 !important;
  padding: 20px;
}

.popup-box {
  background: #fff;
  width: 100%;
  max-width: 440px;
  padding: 28px 28px 24px 28px;
  border-radius: 14px;
  text-align: left;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  position: relative;
  z-index: 100000 !important;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.popup-close {
  position: absolute;
  top: 14px;
  right: 18px;
  font-size: 1.8rem;
  cursor: pointer;
  color: #666;
  line-height: 1;
}
.popup-close:hover { color: #000; }

#popupTitle {
  color: #0a4d8c;
  font-weight: 700;
  font-size: 1.5rem;
  margin-bottom: 16px;
  padding-right: 24px;
  line-height: 1.3;
  border-bottom: 2px solid #e0e8f0;
  padding-bottom: 12px;
}

#popupText {
  font-size: 1.05rem;
  line-height: 1.7;
  color: #222;
  text-align: left;
  white-space: pre-line !important;
  word-wrap: break-word;
}

.popup-intro {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0a4d8c;
  margin-bottom: 14px !important;
  line-height: 1.4;
}

/* Tekstin perusasettelu popupissa */
.popup-box p,
.popup-box #popupText {
  text-align: left;
  margin: 0 0 10px 0;
  line-height: 1.7;
  white-space: pre-line;
  word-wrap: break-word;
}

/* Listat popupissa */
.popup-box ul,
.popup-box .hover-list {
  margin: 8px 0 12px 1.4em;
  padding: 0;
  list-style-position: outside;
  color: #222;
  line-height: 1.7;
}

.popup-box li,
.popup-box .hover-list li {
  margin-bottom: 8px;
  font-size: 1.05rem;
  display: list-item;
}
.popup-box ul { list-style-type: disc; }

/* Näkyvyysluokka JS:lle */
.popup-overlay.show { display: flex !important; }

/* --- Mobiili: piilota hover-info yhdellä selkeällä säännöllä --- */
@media (max-width: 768px) {
  .service-box .hover-info {
    display: none !important;
    pointer-events: none;
    opacity: 0 !important;
    transform: translateY(20px) !important;
  }

  /* Säilytä rakenne, mutta älä pakota hoverin näkyvyyttä vaikka .active olisi olemassa */
  .service-img.active .hover-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1;
    pointer-events: none;
    /* EI display:block; EI opacity:1; EI transform:translateY(0); */
  }

  /* Mobiilimuutos .service-img:lle */
  .service-img { height: 100px; background-position: center 70%; border-radius: 10px 10px 0 0; }
}

/* Jos haluat pallon sijaan yhdenmukaisen tyyliin: */
.popup-box ul { list-style-type: disc; }

/* Varmistus: keskitys ei pakota tekstiä yhteen riviin */
.popup-box { text-align: left; }

/* Säilytä sulkupainikkeen sijoittelu (ei muuta tekstiä) */
.popup-close { float: right; }

/* -------------------------------------------------- MOBIILIKORJAUS YHDISTETTY -------------------------------------------------- */
@media (max-width: 768px) {

  /* Navigaatio */
  .nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
  }
  .nav a {
    font-size: 0.9rem;
    margin: 0;
    padding: 6px 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
  }

  /* Hero-osio */
  .hero {
    height: 70vh;
    min-height: 480px;
    background-position: center 30%;
    padding: 20px 10px;
  }
  .hero-content h1 {
    font-size: 1.6rem;
    line-height: 1.3;
  }
  .hero-content p {
    font-size: 1rem;
    margin-bottom: 16px;
  }
  .cta-btn {
    font-size: 1rem;
    padding: 10px 22px;
  }

  /* PALVELUT MOBIILI */
.services {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    justify-items: center;
    align-items: start;
    padding: 10px 0;
}

.service-box {
    width: 95%;
    max-width: 180px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    text-align: center;
    padding-bottom: 10px;
}

.service-img {
    height: 100px;
    background-size: cover;
    background-position: center 70%;
    background-repeat: no-repeat;
    border-radius: 10px 10px 0 0;
    overflow: hidden;
}

.service-title {
    font-size: 0.76rem;
    margin: 6px 4px;
    font-weight: 700;
    color: #0a4d8c;
    line-height: 1.3;
    word-break: break-word;
    text-align: center;
}

/* Palvelukohtaiset mobiilikuvat */
.service-box:nth-child(1) .service-img { background-size: 95%; background-position: center 20%; }
.service-box:nth-child(2) .service-img { background-size: 100%; background-position: center 40%; }
.service-box:nth-child(3) .service-img { background-size: cover; background-position: center 60%; }

/* Piilota hover-info mobiilissa */
.service-box .hover-info {
  display: none !important;
  pointer-events: none;
}
.service-img.active .hover-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1;
  pointer-events: none;
}


  /* MIKSI VALITA MEIDÄT MOBIILI 2x2 */
  .miksi-valita-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    justify-items: center;
    align-items: start;
    padding: 10px 0;
  }
  .miksi-box {
    width: 95%;
    max-width: 180px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    text-align: center;
    padding-bottom: 10px;
  }
  .miksi-img {
    height: 100px;
    background-size: cover;
    background-position: center 70%;
    border-radius: 10px 10px 0 0;
  }
  .miksi-box p {
    font-size: 0.9rem;
    margin: 6px 0;
    font-weight: 700;
    color: #0a4d8c;
  }
  .miksi-box:nth-child(4) { grid-column: auto; justify-self: auto; }
  .miksi-box:nth-child(1) .miksi-img { background-size: 95%; background-position: center 85%; }
  .miksi-box:nth-child(2) .miksi-img { background-size: cover; background-position: center 50%; }
  .miksi-box:nth-child(3) .miksi-img { background-size: cover; background-position: center 55%; }
  .miksi-box:nth-child(4) .miksi-img { background-size: cover; background-position: center 40%; }

  /* REFERENSSIT MOBIILI */
  .referenssit-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    justify-items: center;
    padding: 10px 0;
  }
  .ref-box {
    width: 80%;
    max-width: 320px;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    text-align: center;
    padding: 15px;
    overflow: hidden;
  }
  .ref-img {
    width: 100%;
    height: 160px;
    background-size: cover;
    background-position: center 60%;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    margin-bottom: 12px;
  }
  .ref-name {
    font-weight: 700;
    color: #0a4d8c;
    font-size: 1rem;
    margin-bottom: 8px;
    text-align: center;
  }
  .ref-box p {
    font-size: 0.95rem;
    line-height: 1.4;
    color: #333;
    margin-bottom: 8px;
  }
  .ref1 .ref-img { background-size: 100%; background-position: center 55%; }
  .ref2 .ref-img { background-size: 95%; background-position: center 60%; }
  .ref3 .ref-img { background-size: 85%; background-position: center 65%; }
  .ref4 .ref-img { 
    background-size: contain; 
    background-repeat: no-repeat;
    background-position: center;
}

  /* MINUSTA MOBIILI */
  .minusta-section { padding: 40px 20px; }
  .minusta-image img {
    width: 80%;
    max-width: 280px;
    border-radius: 10px;
    margin: 0 auto 20px auto;
    display: block;
  }
  .minusta-text { font-size: 1rem; line-height: 1.5; }
  .minusta-text p { margin-bottom: 14px; }
  .minusta-text ul { padding-left: 20px; }
  .minusta-text li { margin-bottom: 6px; }

  /* YHTEISTYÖKUMPPANIT MOBIILI */
  #yhteistyokumppanit h2 {
    font-size: 1.4rem;
    line-height: 1.3;
    margin-bottom: 25px;
    color: #1f4e79;
    text-align: center;
  }
  .partners-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
    padding: 0 10px;
  }
  .partner-box {
    width: 90%;
    max-width: 320px;
    text-align: center;
  }
  .partner-box img {
    width: 100%;
    max-width: 180px;
    height: auto;
    margin: 0 auto 10px auto;
    display: block;
    object-fit: contain;
  }
  .partner-box p {
    font-size: 0.95rem;
    line-height: 1.4;
    color: #1a1a1a;
    margin: 0 auto;
  }
  .partner-box h3,
  .partner-box .team-name {
    color: #0a4d8c;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 6px;
  }
  /* YHTEYDENOTTO MOBIILI */
  #yhteydenotto {
    padding: 40px 20px 120px 20px;
  }

  .contact-form {
    width: 90%;
    max-width: 360px;
    margin: 0 auto;
  }

  .contact-form button {
    width: 100%;
    margin-top: 10px;
  }
 }
