/* ---------------------------------------------------------------
   SUJUVA PoC — custom.css
   Pohjataan sujuva.info OceanWP-teeman väreihin
--------------------------------------------------------------- */

/* Typografia */
body {
  font-family: "Open Sans", sans-serif;
  font-size: 15px;
  line-height: 1.8;
  color: #4a4a4a;
}

h2, h3, .h3, h4, .h4 {
    opacity: .9;
    margin-top: 1.5rem;
    margin-left: 1rem;
}

/* date */
.ohje-paivamaara {
  font-size: 0.9rem;
  color: #888;
  margin-top: -0.5rem;
  margin-bottom: 1rem;
  margin-left: 1rem;
}

/* ---- Hero-kuva --------------------------------------------- */
.ohje-hero {
  margin: 0 0 1.25rem;
  padding: 0;
}
.ohje-hero__kuva {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}
.ohje-hero__credit {
  font-size: 11px;
  color: #888;
  margin-top: 0.25rem;
  text-align: right;
}

/* ---- Hero-galleria (useampi kuva) -------------------------- */
.ohje-hero-galleria {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.ohje-hero-galleria .ohje-hero {
  margin-bottom: 0;
}
/* 2 kuvaa: rinnakkain */
.ohje-hero-galleria--2 {
  grid-template-columns: 1fr 1fr;
}
/* 3 tai 4 kuvaa: 2 per rivi */
.ohje-hero-galleria--3,
.ohje-hero-galleria--4 {
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 600px) {
  .ohje-hero-galleria--2,
  .ohje-hero-galleria--3,
  .ohje-hero-galleria--4 {
    grid-template-columns: 1fr;
  }
}

/* ---- Lightbox-kuva ----------------------------------------- */
#ohje-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.82);
  z-index: 99999;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.ohje-hero__teksti {
  margin-top: 0.35rem;
  padding-left: 1rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #555;
  text-align: left;
}

#ohje-lightbox.open { 
  display: flex; 
}

#ohje-lightbox img {
  max-width: 92vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
  cursor: default;
}

#ohje-lightbox__close {
  /* Napin selainoletusten nollaus – jotta ulkoasu säilyy ennallaan */
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;

  /* Alkuperäiset arvot säilytetty */
  position: fixed;
  top: 1rem;
  right: 1.25rem;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  opacity: .85;
}

/* Hover: pieni korostus (valinnainen, korvaa aiemman span-käytöksen) */
#ohje-lightbox__close:hover {
  opacity: 1;
}

/* Näppäimistöfokus näkyväksi – keskeinen saavutettavuudelle */
#ohje-lightbox__close:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
  border-radius: 4px;
  opacity: 1;
}

.ohje-hero a.ohje-lb { 
  display: block; 
  cursor: zoom-in; 
}

/* ---- Intro-teksti ------------------------------------------ */
.ohje-intro {
  font-size: 0.95rem;
  color: #555;
  margin: 0 0 1rem;
  line-height: 1.6;
}

/* ---- Sisällysluettelo (TOC) --------------------------------- */
.ohje-toc {
  background: #f0f9fe;
  border-left: 4px solid #2c5c8f;
  border-radius: 4px;
  padding: 0.75rem 1rem 0.75rem 1.25rem;
  margin-bottom: 1.5rem;
  margin-left: 1rem;
  display: inline-block;
  min-width: 220px;
  max-width: 100%;
}
.ohje-toc__otsikko {
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #2c5c8f;
  margin-bottom: 0.4rem;
}
.ohje-toc__lista {
  list-style: none;
  margin: 0;
  padding-left: 0;
}
.ohje-toc__lista li {
  list-style: none;
  font-size: 0.88rem;
  line-height: 1.7;
  padding-left: 0.1rem;
}
.ohje-toc__lista a {
  color: #1e2732;
  text-decoration: none;
}
.ohje-toc__lista a:hover {
  color: #2c5c8f;
  text-decoration: underline;
}

/* ---- Navigaatiopalkki ---------------------------------------- */
.navbar {
  background-color: #2c5c8f !important;
  border-bottom: 0px solid #0d8bbf;
}
.navbar-brand, .navbar-nav .nav-link {
  color: #fff !important;
  font-weight: 600;
}
.navbar-nav .nav-link:hover {
  color: #e8f8ff !important;
}

/* Näppäimistöfokus navbarissa – kirkas valkoinen rengas tummaa taustaa vasten */
.navbar .nav-link:focus-visible,
.navbar-brand:focus-visible,
.navbar .dropdown-toggle:focus-visible,
.navbar .dropdown-item:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
  border-radius: 3px;
  box-shadow: none;              /* nollaa Bootstrapin haalea box-shadow */
}

/* Auki olevan dropdown-valikon itemit ovat vaalealla pohjalla */
.dropdown-menu .dropdown-item:focus-visible {
  outline: 3px solid #2c5c8f;
  outline-offset: -2px;          /* sisään, ettei leikkaudu valikon reunaan */
  box-shadow: none;
}

.dropdown-item:hover .dropdown-text,
.dropdown-item:focus .dropdown-text,
.dropdown-item:focus-visible .dropdown-text,
.dropdown-item.active .dropdown-text {
  color: white;
}

/* ---- Suodatin-alue ------------------------------------------ */
.filter-area {
  background: #f0f9fe;
  border-left: 4px solid #2c5c8f;
  border-radius: 4px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
}
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.filter-label {
  font-weight: 700;
  font-size: 0.85rem;
  color: #555;
  margin: 0 0 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.filter-cb {
  font-weight: 400;
  font-size: 0.9rem;
  color: #333;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}
.filter-cb input[type="checkbox"] {
  accent-color: #2c5c8f;
  width: 15px;
  height: 15px;
}
.filter-reset {
  align-self: flex-end;
  margin-top: auto;
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  border: 1px solid #2c5c8f;
  border-radius: 4px;
  background: #fff;
  color: #2c5c8f;
  cursor: pointer;
}
.filter-reset:hover {
  background: #2c5c8f;
  color: #fff;
}

/* ---- Suodatettu (harmaa) ohjerivi --------------------------- */
.ohje-rivi-harmaa {
  color:#d5d5d5;
  border-left-color: #bababa;
}

.ohje-rivi-harmaa .ohje-lahde {
  color:#d5d5d5
}

/* ---- Aihepiirien otsikot ----------------------------------- */
.aihepiiri-otsikko {
  background-color: #2c5c8f;
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 4px;
  margin: 2rem 0 0.75rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

/* Ohipepiiri-lohko: selain voi ohittaa ruudun ulkopuolisen sisällön
   layout/paint-vaiheen → LCP nopeutuu merkittävästi pitkillä sivuilla */
.aihepiiri-lohko {
  content-visibility: auto;
  contain-intrinsic-size: 0 400px;
  margin-bottom: 2rem;
}

/* ---- Ohjelista --------------------------------------------- */
.ohje-rivi {
  padding: 0.25rem 0 0.25rem 1rem;
  border-left: 2px solid #d0eaf7;
  margin: 0 0 0.2rem;
  font-size: 14px;
  line-height: 1.6;
}
.ohje-rivi:hover {
  border-left-color: #2c5c8f;
  background: #f5fbff;
}

/* Bullet-lista */
.ohje-lista {
  list-style: disc;
  margin: 0 0 0.2rem 0;
  padding-left: 2.4rem;
}
.ohje-lista > .ohje-rivi {
  border-left: none;
  padding-left: 0;
}

/* Sisäkkäinen bullet-lista — käyttää vain tätä luokkaa (ei ohje-lista) */
.ohje-lista--sub {
  list-style: circle;
  margin: 0.2rem 0 0 0;
  padding-left: 1.4rem;
  margin-bottom: 0;
}
.ohje-lista--sub > .ohje-rivi {
  border-left: none;
  padding-left: 0;
}

/* Ei marginaalia ala-bulletin jälkeen seuraavaan saman tason bulletiin */
.ohje-lista > li:has(> .ohje-lista--sub) {
  margin-bottom: 0;
}

.ohje-valiotsikko {
  font-weight: 700;
  font-size: 0.95rem;
  color: #333;
  margin: 1rem 1rem 0.3rem;
}

.ohje-lahde {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 11px;
  color: #2c5c8f;
  font-weight: 600;
  opacity: 0.8;
  white-space: nowrap;
}

/* ---- Hakutulos-info ---------------------------------------- */
.tulos-info {
  color: #555;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  margin-left: 1rem;
  margin-top: 1rem;
}

/* ---- Etusivu — ohjekorttilista ------------------------------ */
.sivu-ohje-lista {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.sivu-ohje-kortti {
  background: #fff;
  border: 1px solid #dde8ee;
  border-top: 4px solid #2c5c8f;
  border-radius: 6px;
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: #333;
  display: block;
  transition: box-shadow 0.2s;
}

.sivu-ohje-kortti:hover {
  box-shadow: 0 4px 12px rgba(19,175,240,0.2);
  border-top-color: #0d8bbf;
}

.sivu-ohje-kortti h3 {
  font-size: 1rem;
  margin: 0 0 0.4rem;
  color: #2c5c8f;
}

.sivu-ohje-kortti p {
  margin: 0;
  font-size: 13px;
  color: #666;
}

/* ---- Yleinen sisältöalue ------------------------------------ */
.quarto-title { display: none; }
.page-columns .column-body { max-width: 1100px; }
#quarto-content>* { padding-top: 0 !important; }
#title-block-header { margin-block-end: 0rem; }

/* ---- 2-palsta layout: pieni rako headerin alle ------------- */
.ohje-layout {
  margin-top: 1.25rem;
}

/* ---- 2-palsta layout: sivupalkki + sisältö ----------------- */
/* !important tarvitaan koska Quarto lisää page-columns-luokan joka asettaa CSS-gridin */
.ohje-layout {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  gap: 1.5rem;
  margin-top: 1rem;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  /* Nollaa Quarton grid-sarakelogiikka */
  grid-column: 1 / -1 !important;
}
.ohje-sidebar {
  flex: 0 0 280px !important;
  width: 280px;
  order: 1;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  overflow-x: visible;
  padding-bottom: 2rem;
  padding-right: 10px;
  /* Estä Quarton grid asettamasta leveyttä */
  min-width: 0;
  max-width: 280px;
}
.ohje-content {
  flex: 1 1 auto !important;
  min-width: 0;
  order: 2;
}
@media (max-width: 900px) {
  .ohje-layout {
    flex-direction: column !important;
  }
  .ohje-sidebar {
    position: static;
    width: 100% !important;
    max-width: none;
    max-height: none;
    flex: none !important;
  }
}

/* ---- Chip-suodatinpainikkeet -------------------------------- */
.source-filter__group {
  padding: 0.9rem;
  border: 1px solid #cfd8dc;
  background: #fff;
}
.source-filter__group + .source-filter__group {
  margin-top: 0.75rem;
}
.source-filter__label {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  display: block;
  color: #1e2732;
}
.source-filter__buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.source-filter__chip {
  min-height: 40px;
  padding: 0.45rem 0.9rem;
  border: 1px solid #9fb3c8;
  border-radius: 0;
  background: #fff;
  color: #1e2732;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.4;
}
.source-filter__chip:hover {
  border-color: #2c5c8f;
  color: #2c5c8f;
}
.source-filter__chip[aria-pressed="true"] {
  background: #2c5c8f;
  border-color: #2c5c8f;
  color: #fff;
}
.source-filter__chip:focus-visible {
  outline: 3px solid #2c5c8f;
  outline-offset: 2px;
}
.source-filter__chip-label {
  display: block;
}
.source-filter__chip-help {
  display: none;
}
@media (max-width: 900px) {
  .source-filter__chip-help {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.8em;
    font-weight: 400;
    line-height: 1.3;
  }
}
#filter-reset {
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.5rem;
  background: #fff;
  border: 1px solid #2c5c8f;
  color: #2c5c8f;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
}
#filter-reset:hover {
  background: #2c5c8f;
  color: #fff;
}

/* ---- Tooltip (portal, fixed) -------------------------------- */
.portal-tooltip {
  position: fixed;
  background: #2c5c8f;
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 0;
  line-height: 1.3;
  font-size: 0.9em;
  font-weight: 400;
  max-width: 260px;
  white-space: normal;
  z-index: 2147483647;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

/* ── Etusivu: kuvat ja erottimet ────────────────────────────────────────── */
.etusivu-erotin {
  border: none;
  border-top: 1px solid #dee2e6;
  margin: 2rem 0;
}

.etusivu-hero {
  margin: 0 auto 1.5rem;
  max-width: 960px;
}

.etusivu-hero .ohje-hero__kuva {
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.etusivu-logot {
  margin: 0 auto;
  max-width: 960px;
  text-align: center;
}

.etusivu-logot__kuva {
  max-width: 100%;
  height: auto;
}

/* ── Etusivu: kaksipalstalayout ─────────────────────────────────────────── */

/* Etusivun pääotsikon väljyys */
.etusivu-teksti h1,
#title-block-header .title {
  margin-top: 2.5rem;
  margin-bottom: 2rem;
}

/* Pääotsikon väljyys (enemmän tilaa ylä- ja alapuolella) */
.etusivu-teksti h2 {
  column-span: all;          /* otsikko koko leveyteen, ei kapeaan palstaan */
  -webkit-column-span: all;
  margin-top: 2.5rem;
  margin-bottom: 2rem;
}

.etusivu-teksti {
  column-count: 2;
  column-gap: 2.5rem;
  column-rule: 1px solid #dee2e6;
}

/* Etusivun viimeinen yhteistyökappale koko leveydelle */
.etusivu-teksti .etusivu-nosto {
  column-span: all;
  -webkit-column-span: all;
  margin-top: 1.75rem;
  margin-bottom: 1rem;
}

.etusivu-nosto p {
  max-width: 960px;
  margin: 1.25rem auto 0;
  font-weight: 700;
  line-height: 1.65;
}

@media (max-width: 768px) {
  .etusivu-teksti {
    column-count: 1;
  }
}

.etusivu-teksti h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #2c5c8f;
  margin-top: 1.5rem;
  margin-bottom: 0.4rem;
  margin-left: 0;
  break-after: avoid;
}

.etusivu-teksti p {
  margin-bottom: 0.75rem;
  line-height: 1.65;
}

/* Etusivun kuvat/logot/erottimet spännäävät yli molempien palstojen */
.etusivu-teksti .etusivu-hero,
.etusivu-teksti .etusivu-logot,
.etusivu-teksti .etusivu-erotin {
  column-span: all;
  -webkit-column-span: all;
}

/* ---- Taulukot ----------------------------------------------- */
.ohje-suositusotsikko {
  font-style: italic;
  font-weight: 600;
  margin-top: 0.8rem;
  margin-bottom: 0.2rem;
  padding-left: 1rem;
  color: #2c5c8f;
}

.taulukko-lohko {
  margin-top: 2rem;
  overflow-x: auto;
}
.taulukko-otsikko {
  font-size: 0.9rem;
  color: #444;
  margin-bottom: 0.4rem;
}
.ohje-taulukko {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  line-height: 1.4;
}
.ohje-taulukko th {
  background: #2c5c8f;
  color: #fff;
  padding: 0.45rem 0.6rem;
  text-align: left;
  font-weight: 600;
  vertical-align: bottom;
  border: 1px solid #1e4070;
}
.ohje-taulukko td {
  padding: 0.35rem 0.6rem;
  border: 1px solid #d0d7e2;
  vertical-align: top;
}
.ohje-taulukko tbody tr:nth-child(even) td {
  background: #f2f6fb;
}
.ohje-taulukko tbody tr:hover td {
  background: #e3ecf7;
}
.ohje-taulukko__alaotsikko {
  background: #d6e4f5 !important;
  font-weight: 600;
  color: #1e2d4a;
  padding: 0.35rem 0.6rem;
}

/* ---- Saavutettavuus: näkymätön teksti ----------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ---- Saavutettavuus: alavalikon tekstin väri ----------------------- */
.dropdown-text {
  color: rgb(41, 41, 41);
}

.dropdown-item:hover .dropdown-text {
  color: white;
}

/* ---- Lähteet-taulukko: linkitetyt lähteet -------------------------- */
#lahde-taulu a {
  color: #0d7cb5;
  text-decoration: underline;
  text-decoration-style: dotted;
}
#lahde-taulu a:hover {
  color: #13aff0;
  text-decoration-style: solid;
}
