/* =========================
   styles.css v2 (Nousiainen.eu)
   - Ei tuplia
   - Komponentit erikseen
   - Sivukohtaiset override:t body-luokilla
   ========================= */


/* =========================
   1) Base: reset + typografia
   ========================= */

*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body{
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #1a1d23;
  color: #f0f0f0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem;
}

h1{
  font-size: 2.5rem;
  margin: 0 0 0.5rem;
  color: #fff;
}

h2{
  margin: 0 0 1.25rem;
  font-weight: 600;
  color: #e9eef7;
}

p{
  margin: 0 0 1rem;
  font-size: 1.1rem;
  line-height: 1.7;
  color: #ccc;
}

a{
  color: #4ba3ff;
  text-decoration: none;
}

a:hover,
a:focus{ text-decoration: underline; }

:focus-visible{
  outline: 2px solid rgba(255,255,255,.35);
  outline-offset: 3px;
}

/* Ylätason peruskappaleet nätiksi */
body > p{
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

/* =========================
   2) Layout: page container
   ========================= */

.page{
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

/* =========================
   3) Logo + pienet elementit
   ========================= */

.logo{
  width: 140px;
  height: 140px;
  max-width: 30vw;
  margin-bottom: 1.5rem;
  object-fit: contain;
}

/* Kielen vaihtaja (jos käytössä) */
.language-switcher{
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.9rem;
}
.language-switcher a{
  margin-left: 10px;
  color: #f0f0f0;
}

/* =========================
   4) Sections (yleiskortit)
   ========================= */

.section{
  background: #2d3e50;
  border-radius: 10px;
  padding: 1.5rem;
  margin: 1.5rem auto;
  width: 100%;
  max-width: 900px;
  text-align: left;
  border: 1px solid #3b4250;
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
}

.section h2,
.section h3{
  margin-top: 0;
  color: #fff;
}

/* =========================
   5) Lists
   ========================= */

.list-block{
  list-style-type: none;
  padding: 0;
  margin: 0 0 1rem 0;
}

.list-block li{
  margin-bottom: 0.8rem;
  color: #ccc;
}

.list-block li strong,
p strong{ color: #fff; }

/* Tavalliset ul/ol: pidetään järkevinä defaultteina */
ul, ol{
  margin: 0 0 1rem;
  padding-left: 1.25rem;
  text-align: left;
}

/* =========================
   6) Links / nav “links”
   ========================= */

.links,
.links a{ display: flex; }

.links{
  flex-direction: column;
  gap: 1rem;
  margin-top: 2rem;
  width: 100%;
  max-width: 400px;
}

.links a{
  background: #2d3e50;
  border-radius: 10px;
  padding: 1rem;
  font-size: 1.05rem;
  transition: background 0.3s;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #f0f0f0;
  text-decoration: none;
}

.links a:hover{ background: #4b6a88; }

/* Footer-links (etusivu / pikalinkit) */
nav.links.links-footer{
  margin-top: 3rem;
  max-width: 900px;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 0.8rem;
  justify-items: center;
}
nav.links.links-footer a{
  width: 100%;
  max-width: 320px;
  font-size: 0.95rem;
  padding: 0.7rem 1rem;
}

/* =========================
   7) Card grid + cards
   ========================= */

.card-grid{
  display: grid;
  gap: 1.25rem;
  margin-top: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-items: stretch;
}

@media (min-width: 1280px){
  .card-grid{
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* “Card” komponentti (käytetään sekä section.card että article.card) */
.card{
  border-radius: 14px;
  padding: 1.4rem 1.5rem;
  background: #252f3b;
  border: 1px solid #3b4250;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
  color: #f0f0f0;
}

.card h3, .card h4{
  margin-top: 0;
  margin-bottom: 0.6rem;
  color: #fff;
}

.card p:last-child{ margin-bottom: 0; }

.card a{ color: #4ba3ff; }

/* Jos käytät “card-wide” koko rivin levyiseksi */
.card-wide{ grid-column: 1 / -1; }

/* =========================
   8) Page helpers (footer / note)
   ========================= */

.page-note{
  margin-top: 2rem;
  font-size: 0.95rem;
  color: #cbd5f5;
  text-align: center;
}

.page-footer{
  font-size: 0.9rem;
  color: #777;
  text-align: center;
  margin-top: 0.75rem;
}

/* =========================
   9) Hero (etusivu)
   ========================= */

.hero-section{
  max-width: 760px;
  margin: 2.5rem auto 0;
}

.hero-section h3{ text-align: center; }
.hero-section p{ text-align: left; }

.hero-cta{
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.hero-cta .button{ min-width: 210px; }

/* =========================
   10) CV Modal
   ========================= */

.modal{
  position: fixed;
  inset: 0;
  display: none;
  z-index: 9999;
}

.modal.is-open{ display: block; }

.modal__overlay{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.7);
}

.modal__dialog{
  position: relative;
  width: min(1000px, calc(100% - 2rem));
  height: min(85vh, 900px);
  margin: 6vh auto;
  background: #0f1115;
  color: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  display: flex;
  flex-direction: column;
}

.modal__header,
.modal__footer{
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  background: rgba(255,255,255,.03);
}

.modal__title{
  font-size: 1rem;
  margin: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal__close{
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  padding: .25rem .5rem;
}

.modal__body{ flex: 1; padding: 0; }

.modal__pdf{
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #111;
}

/* Kun modal auki, estä taustan scroll */
body.modal-open{ overflow: hidden; }

/* =========================
   11) YouTube teaser + video modal (case-esimerkit)
   ========================= */

.youtube-wrapper{
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
  border-radius: 12px;
  margin: .75rem 0;
  cursor: pointer;
}

.youtube-wrapper img,
.youtube-wrapper iframe{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
}

.youtube-wrapper img{
  object-fit: cover;
  transition: transform .2s ease;
}

.youtube-wrapper:hover img{ transform: scale(1.02); }

.video-modal{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
}

.video-modal.is-open{ display: block; }

.video-modal__backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(2px);
}

.video-modal__dialog{
  position: relative;
  width: min(1000px, calc(100vw - 2rem));
  margin: 8vh auto 0;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
}

.video-modal__close{
  position: absolute;
  top: .5rem;
  right: .5rem;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 28px;
  line-height: 42px;
  cursor: pointer;
  z-index: 2;
}

.video-modal__close:hover{ background: rgba(255,255,255,.2); }

.video-modal__frame{
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.video-modal__frame iframe{
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* =========================
   12) Error pages
   ========================= */

body.error-body{
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  background: radial-gradient(circle at top, #111827, #020617 55%);
  color: #e5e7eb;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.error-card{
  background: #020617;
  border-radius: 18px;
  border: 1px solid #1f2937;
  padding: 2.4rem 2.3rem 2rem;
  max-width: 640px;
  width: 100%;
  box-shadow: 0 22px 55px rgba(15, 23, 42, 0.85);
  text-align: left;
}

.error-badge{
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.85);
  color: #fbbf24;
  margin-bottom: 1.3rem;
}

.error-badge-dot{
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #fbbf24;
}

.error-title{
  font-size: 2rem;
  margin: 0 0 0.8rem;
}

.error-lead{
  margin: 0 0 1rem;
  line-height: 1.6;
}

.error-muted{
  color: #9ca3af;
  font-size: 0.95rem;
  margin: 0 0 1.4rem;
}

.error-actions{
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.error-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.3rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  color: inherit;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}

.error-btn:focus-visible{
  outline: 2px solid #fbbf24;
  outline-offset: 2px;
}

.error-btn-primary{
  background: #fbbf24;
  border-color: #fbbf24;
  color: #0b1120;
}

.error-btn-primary:hover{
  background: #f59e0b;
  border-color: #f59e0b;
  transform: translateY(-1px);
}

.error-btn-ghost{
  background: rgba(15, 23, 42, 0.7);
  border-color: #374151;
  color: #e5e7eb;
}

.error-btn-ghost:hover{
  background: #111827;
  border-color: #4b5563;
  transform: translateY(-1px);
}

/* =========================
   13) Sivukohtaiset tyylit
   - tärkein juttu: rajaa keskitykset
   ========================= */

/* esittely.html: keskitetty “henkilöesittely” */
.page-esittely .section{
  text-align: center;
}

.page-esittely .section p{
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.page-esittely .section ul,
.page-esittely .section .list-block{
  display: inline-block;
  text-align: left;
  margin: 0.75rem auto 0;
  padding-left: 1.2rem;
}

.page-esittely .profile{
  margin: 1rem 0 1rem;
  text-align: center;
}

.page-esittely .profile-img{
  width: min(240px, 60vw);
  height: auto;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.08);
}

.page-esittely .lead{
  max-width: 720px;
  margin: 1rem auto 0;
  text-align: center;
}

/* it-osaaja: ei “keskitys”-overrideja */
.page-it .page{
  max-width: 980px;
}

.page-it .section{
  text-align: left;
  max-width: none;
  margin: 1.25rem 0;
}

.page-it h1,
.page-it h2{ text-align: center; }

.page-it .card-grid{
  grid-template-columns: repeat(2, minmax(280px, 1fr));
}

@media (max-width: 900px){
  .page-it .card-grid{ grid-template-columns: 1fr; }
}

/* projektit: leveämpi, vasemmalle luettavuus */
.page-projektit .page{
  max-width: 1100px;
}

.page-projektit .section{
  text-align: left;
  max-width: none;
  margin: 1.5rem 0;
}

.page-projektit .page-intro{
  max-width: 900px;
  margin: 0.75rem auto;
  text-align: left;
  font-size: 1.05rem;
  line-height: 1.7;
}

.page-projektit .card-grid{
  grid-template-columns: repeat(2, minmax(280px, 1fr));
}

@media (max-width: 900px){
  .page-projektit .card-grid{ grid-template-columns: 1fr; }
  .page-projektit .card-wide{ grid-column: auto; }
}

/* =========================
   14) Responsiivisuus
   ========================= */

@media (max-width: 768px){
  body{ padding: 1.25rem; }

  h1{ font-size: 2rem; }

  p{ font-size: 1rem; }

  .links a{ padding: 0.75rem; }

  .logo{
    width: 100px;
    height: 100px;
  }

  .section{
    padding: 1.25rem;
    margin: 1.25rem auto;
  }

  nav.links.links-footer{
    grid-template-columns: 1fr;
  }
  nav.links.links-footer a{
    max-width: 420px;
  }
}
/* ESITTELY: kuva + hero-tekstit keskelle */
.page-esittely .hero{
  text-align: center;
}

.page-esittely .profile{
  margin: 1rem 0 1rem;
  text-align: center;
}

.page-esittely .profile-img{
  width: min(320px, 70vw);
  height: auto;              /* TÄMÄ estää venymisen */
  aspect-ratio: auto;        /* varmistus */
  display: block;
  margin: 0 auto;
  border-radius: 999px;
  object-fit: cover;         /* jos haluat “täyttää” kehyksen */
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.08);
}

/* Teksti ennen sectioneita oikeasti keskelle */
.page-esittely .hero-bullets,
.page-esittely .quicknav,
.page-esittely .lead{
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

/* Hero-bulletit keskelle mutta luettavaksi vasemmalta */
.page-esittely .hero-bullets{
  display: inline-block;
  text-align: left;
  padding-left: 1.2rem;
}
.meta { opacity: .75; font-size: .95rem; margin-top: .25rem; }
.card p:last-child { margin-top: 0.75rem; }
/* Headerin teksti irti reunasta + sama linja muun sisällön kanssa */
.site-header .container{
  max-width: 920px;     /* sama kuin .content */
  margin: 0 auto;       /* keskelle */
  padding: 0 18px;      /* “turvamarginaali” vasen/oikea */
  box-sizing: border-box;
}
