/* Suomen kukkakärpäset – shared stylesheet
   Style A ("Niitty"): meadow green header, light green ground,
   Merriweather headings, Source Sans 3 body text.
   The Tunnistus section adds style B ("Määritysopas") for its content area:
   see the "Tunnistus" part near the end. */

/* ---------- Fonts (self-hosted, SIL Open Font License) ---------- */

@font-face { font-family: "Merriweather"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/merriweather-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Merriweather"; font-weight: 400; font-style: italic; font-display: swap; src: url("../fonts/merriweather-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Merriweather"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/merriweather-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/source-sans-3-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 400; font-style: italic; font-display: swap; src: url("../fonts/source-sans-3-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/source-sans-3-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/source-sans-3-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/source-serif-4-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 400; font-style: italic; font-display: swap; src: url("../fonts/source-serif-4-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/source-serif-4-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 600; font-style: italic; font-display: swap; src: url("../fonts/source-serif-4-latin-600-italic.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/source-serif-4-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }

/* ---------- Colours and basics ---------- */

:root {
  --vihrea: #23452c;          /* header, footer, buttons */
  --vihrea-linkki: #2b5a35;
  --vihrea-tumma: #173a20;
  --vihrea-vaalea: #cfe3cf;
  --pohja: #f3f6f0;           /* page ground */
  --kaista: #e3ecdf;          /* section band */
  --kaista-raja: #cfdccb;
  --keltainen: #f2c230;       /* hoverfly yellow accent */
  --keltainen-vaalea: #fbf3d4;
  --teksti: #1d261f;
  --teksti-2: #46524a;
  --viiva: #d6ded3;
  --leveys: 1140px;
  --otsikkofontti: "Merriweather", Georgia, serif;
  --leipafontti: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--pohja);
  color: var(--teksti);
  font-family: var(--leipafontti);
  font-size: 17px;
  line-height: 1.6;
}

img { max-width: 100%; height: auto; }

a { color: var(--vihrea-linkki); text-underline-offset: 0.15em; }
a:hover { color: var(--vihrea-tumma); }
a:focus-visible { outline: 3px solid var(--keltainen); outline-offset: 2px; }

.leveys { max-width: var(--leveys); margin: 0 auto; padding-left: 24px; padding-right: 24px; }

.ohita {
  position: absolute; left: -9999px; top: 0;
  background: var(--keltainen); color: var(--vihrea); padding: 8px 12px; z-index: 10;
}
.ohita:focus { left: 8px; top: 8px; }

/* ---------- Header ---------- */

.otsake { background: var(--vihrea); color: #fff; }
.otsake-rivi {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 32px; padding-top: 16px; padding-bottom: 16px;
}
.logo { color: #fff; text-decoration: none; display: flex; flex-direction: column; }
.logo:hover { color: #fff; }
.logo-nimi { font-family: var(--otsikkofontti); font-size: 22px; font-weight: 700; line-height: 1.2; }
.logo-ala { font-size: 14px; letter-spacing: 0.06em; color: var(--vihrea-vaalea); }

.paavalikko ul { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px; }
.paavalikko a {
  display: block; padding: 10px 12px; border-radius: 6px;
  color: #fff; text-decoration: none; font-weight: 600;
}
.paavalikko a:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.paavalikko a[aria-current] { background: rgba(255, 255, 255, 0.16); box-shadow: inset 0 -3px 0 var(--keltainen); }
.paavalikko a.kieli { background: var(--keltainen); color: var(--vihrea); font-weight: 700; }
.paavalikko a.kieli:hover { background: #f6d05a; }

/* ---------- Section band: breadcrumb, section name, page tabs ---------- */

.osiokaista { background: var(--kaista); border-bottom: 1px solid var(--kaista-raja); }
.osiokaista .leveys { padding-top: 22px; display: flex; flex-direction: column; gap: 6px; }
.murupolku { margin: 0; font-size: 15px; color: var(--teksti-2); }
.osio-nimi { margin: 0; font-family: var(--otsikkofontti); font-size: 32px; font-weight: 700; line-height: 1.25; }
.osiovalikko ul { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 2px; }
.osiovalikko a {
  display: block; padding: 11px 16px 9px; border-radius: 8px 8px 0 0;
  text-decoration: none; font-weight: 600; border-bottom: 4px solid transparent;
}
.osiovalikko a:hover { background: rgba(255, 255, 255, 0.5); }
.osiovalikko a[aria-current="page"] { background: var(--pohja); color: var(--teksti); font-weight: 700; border-bottom-color: var(--keltainen); }
.osiokaista .leveys:not(:has(.osiovalikko)) { padding-bottom: 20px; }

/* ---------- Page content ---------- */

.sivu { padding-top: 32px; padding-bottom: 56px; overflow-wrap: break-word; }
.sivu::after { content: ""; display: table; clear: both; }

.sivu h1, .sivu h2, .sivu h3 { font-family: var(--otsikkofontti); line-height: 1.3; margin: 1.4em 0 0.5em; }
.sivu h1 { font-size: 28px; margin-top: 0; }
.sivu h2 { font-size: 22px; }
.sivu h3 { font-size: 18px; }
.sivu > :first-child { margin-top: 0; }

p { margin: 0 0 1em; }
.sivu p, .sivu li { max-width: 78ch; }

hr { border: 0; border-top: 1px solid var(--viiva); margin: 1.8em 0; clear: both; }
blockquote { margin: 0 0 1em 2em; }

.iso { font-size: 1.15em; }
.huomio { color: #b00020; }
.keskelle { text-align: center; }
img.oikealle { float: right; margin: 0 0 1em 1.5em; }
img.vasemmalle { float: left; margin: 0 1.5em 1em 0; }

.sarakkeet { display: flex; gap: 32px; align-items: flex-start; }
.sarake { flex: 1 1 0; min-width: 0; }
.sarakkeet > .sarake:first-child { flex-grow: 2; }

/* Data tables */
.taulukko-kehys {
  overflow-x: auto; margin: 0 0 1.5em;
  background: #fff; border-radius: 12px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  max-width: max-content;
}
table.taulukko { border-collapse: collapse; }
table.taulukko td, table.taulukko th {
  padding: 8px 16px; border-bottom: 1px solid #e6ece3; vertical-align: top; text-align: left;
}
table.taulukko tr:last-child td { border-bottom: 0; }
table.taulukko td.keskelle { text-align: center; }

/* Buttons */
.nappi {
  display: inline-block; padding: 12px 18px; border-radius: 8px;
  background: var(--vihrea); color: #fff; text-decoration: none; font-weight: 600;
}
.nappi:hover { background: var(--vihrea-tumma); color: #fff; }
.nappi.toissijainen { background: transparent; color: var(--vihrea); box-shadow: inset 0 0 0 2px var(--vihrea); }
.nappi.toissijainen:hover { background: #fff; color: var(--vihrea); }

/* ---------- Front page ---------- */

.sankari { position: relative; min-height: 340px; display: flex; align-items: flex-end; background: var(--vihrea); overflow: hidden; }
.sankari > img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 30%;
}
.sankari-teksti {
  position: relative; width: 100%; color: #fff;
  padding: 72px 0 32px;
  background: linear-gradient(0deg, rgba(20, 40, 25, 0.8), rgba(20, 40, 25, 0));
}
.sankari h1 { margin: 0 0 10px; font-family: var(--otsikkofontti); font-size: 40px; line-height: 1.2; max-width: 720px; }
.sankari p { margin: 0; font-size: 19px; max-width: 640px; color: #eef5ec; }

.etusivu-sisalto { padding-top: 40px; padding-bottom: 56px; display: flex; flex-direction: column; gap: 48px; }
.etusivu-sisalto h2 { font-family: var(--otsikkofontti); font-size: 26px; line-height: 1.3; margin: 0 0 16px; }

.kortit { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.kortti {
  background: #fff; border-radius: 12px; padding: 22px; text-decoration: none; color: var(--teksti);
  display: flex; flex-direction: column; gap: 8px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.kortti::before { content: ""; width: 36px; height: 6px; background: var(--keltainen); border-radius: 3px; }
.kortti:hover { color: var(--teksti); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12); }
.kortti-otsikko { font-family: var(--otsikkofontti); font-size: 20px; font-weight: 700; color: var(--vihrea); }
.kortti-teksti { color: var(--teksti-2); }

.kirjanosto {
  background: #fff; border-radius: 16px; padding: 32px;
  display: flex; flex-wrap: wrap; gap: 32px; align-items: center;
}
.kirjanosto img { width: 150px; height: auto; border-radius: 4px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); }
.kirjanosto-teksti { flex: 1 1 420px; }
.kirjanosto-teksti h2 { margin-bottom: 10px; }
.yla-otsikko { margin: 0 0 6px; font-size: 14px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #6b5300; }
.napit { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }

.lajilista {
  margin: 0; padding: 0; list-style: none;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 32px;
}
.lajilista li { padding: 12px 0; border-bottom: 1px solid var(--viiva); }

/* ---------- Species list (lajit.html) ---------- */

.lajihaku {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 20px;
  margin: 8px 0 20px;
}
.lajihaku-kentta { display: flex; flex-direction: column; gap: 4px; }
.lajihaku-kentta:first-child { flex: 1 1 300px; max-width: 460px; }
.lajihaku label { font-weight: 600; font-size: 15px; }
.lajihaku input, .lajihaku select {
  height: 46px; padding: 0 12px; font: inherit; color: var(--teksti);
  border: 1px solid #b9c7b5; border-radius: 8px; background: #fff;
}
.lajihaku input:focus, .lajihaku select:focus { outline: 3px solid var(--keltainen); outline-offset: 1px; border-color: var(--vihrea); }
.lajihaku-tulos { margin: 0 0 10px; color: var(--teksti-2); font-size: 15px; }

.lajitaulukko-kehys { max-width: none; overflow: visible; }
table.lajitaulukko { border-collapse: collapse; width: 100%; font-size: 16px; }
.lajitaulukko th, .lajitaulukko td { padding: 7px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid #e6ece3; }
.lajitaulukko thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--vihrea); color: #fff; font-weight: 600; white-space: nowrap;
}
.lajitaulukko .luku { text-align: right; font-variant-numeric: tabular-nums; }
.lajitaulukko .rivi-alaheimo th { background: var(--keltainen-vaalea); font-size: 14px; letter-spacing: 0.06em; padding-top: 10px; padding-bottom: 10px; }
.lajitaulukko .rivi-tribus th { background: var(--pohja); color: var(--teksti-2); font-size: 14px; font-weight: 600; }
.lajitaulukko .rivi-suku th { font-weight: 700; padding-top: 12px; }
.lajitaulukko .rivi-laji td:first-child { padding-left: 30px; }
.lajitaulukko .auktori { color: var(--teksti-2); font-size: 15px; }
.lajitaulukko tr[hidden] { display: none; }

abbr.ul {
  display: inline-block; min-width: 2.6em; padding: 1px 6px; border-radius: 4px;
  font-size: 13px; font-weight: 700; text-align: center; text-decoration: none; cursor: help;
  background: #e8ece6; color: #33403a;
}
abbr.ul-LC { background: #dcefd9; color: #1f4d25; }
abbr.ul-NT { background: #fbeec2; color: #6b4e00; }
abbr.ul-VU, abbr.ul-EN, abbr.ul-CR { background: #f9d9d4; color: #8a1c10; }
abbr.ul-RE { background: #2f2f2f; color: #fff; }

.fi-nimi { font-style: normal; font-weight: 400; color: #4a4842; }
.fi-nimi::before { content: "– "; }
.tyyli-opas .suku h3 .fi-nimi { font-size: 18px; margin-left: 4px; }
dl.maakunnat { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: 16px; }
dl.maakunnat dt { font-weight: 700; }
dl.maakunnat dd { margin: 0; }

.lahdetieto { font-size: 15px; color: var(--teksti-2); }
.selitteet { margin-top: 8px; }
.selitteet summary { cursor: pointer; font-weight: 600; }
.selitteet dl { margin: 10px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 20px; }
.selitteet dl div { display: flex; gap: 10px; align-items: center; }
.selitteet dt, .selitteet dd { margin: 0; }

/* ---------- Footer ---------- */

.alatunniste { background: var(--vihrea); color: #dbe9d9; font-size: 15px; }
.alatunniste-rivi { display: flex; flex-wrap: wrap; gap: 8px 40px; justify-content: space-between; padding-top: 28px; padding-bottom: 28px; }
.alatunniste p { margin: 0; }
.alatunniste a { color: #fff; }

/* =================================================================
   Tunnistus section – style B ("Määritysopas") for the content area.
   The header and section band stay in style A.
   ================================================================= */

.tyyli-opas .sisalto { background: #fff; }
.tyyli-opas .osiovalikko a[aria-current="page"] { background: #fff; }
.tyyli-opas .sivu {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 18px; color: #111;
}
.tyyli-opas .sivu a { color: #111; }
.tyyli-opas .sivu a:hover { color: #7a5c00; }
.tyyli-opas .sivu h1, .tyyli-opas .sivu h2, .tyyli-opas .sivu h3 { font-family: "Source Serif 4", Georgia, serif; }
.tyyli-opas .sivu h1 { font-size: 40px; line-height: 1.1; letter-spacing: -0.02em; font-weight: 700; }
.tyyli-opas .sivu h2 { font-size: 28px; }
.tyyli-opas hr { border-top-color: #e3e1da; }

/* Small mono labels ("Suvut A–Ö", "Suomalaiset lajit") */
.tyyli-opas .tarra {
  margin: 0 0 8px; font-family: "IBM Plex Mono", monospace; font-size: 13px; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase; color: #5a5850;
}

/* Genus index A–Ö */
.sukuhakemisto { margin: 8px 0 40px; }
.sukuhakemisto ul {
  margin: 0; padding: 0; list-style: none;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 16px;
  font-size: 16px; font-style: italic;
}
.sukuhakemisto a { display: block; padding: 4px 0; text-decoration: none; }
.sukuhakemisto a:hover { text-decoration: underline; }

/* One genus = one card */
.suku { border-top: 3px solid #111; padding-top: 18px; margin: 0 0 40px; scroll-margin-top: 16px; }
.suku-otsake { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 24px; }
.tyyli-opas .suku h3 { margin: 0 0 14px; font-size: 32px; font-style: italic; font-weight: 600; }
.suku-ylos { font-family: "IBM Plex Mono", monospace; font-size: 13px; color: #5a5850 !important; }
.suku-runko { display: flex; flex-wrap: wrap; gap: 8px 32px; align-items: flex-start; }
.suku-lajit { flex: 1 1 240px; background: #f7f5ef; padding: 18px 22px; }
.suku-lajit ul { margin: 0; padding: 0; list-style: none; font-size: 17px; }
.suku-lajit li { padding: 2px 0; }
.suku-teksti { flex: 2 1 360px; min-width: 0; }
.suku-teksti > :first-child { margin-top: 0; }

/* Eristalis key couplets */
.tyyli-opas blockquote { margin: 0 0 0.5em 1.5em; }
.tyyli-opas blockquote blockquote { margin-left: 1.5em; }

/* ---------- Narrow screens ---------- */

@media (max-width: 760px) {
  body { font-size: 16.5px; }
  .leveys { padding-left: 16px; padding-right: 16px; }
  .otsake-rivi { position: relative; padding-top: 12px; padding-bottom: 8px; gap: 8px; }
  .logo { padding-right: 96px; }
  /* English button sits next to the logo, the sections wrap below */
  .paavalikko li:has(.kieli) { position: absolute; top: 14px; right: 16px; }
  .paavalikko a.kieli { padding: 8px 12px; }
  .paavalikko ul { gap: 0; margin: 0 -8px; }
  .paavalikko a { padding: 10px 8px; }
  .osio-nimi { font-size: 26px; }
  .osiovalikko a { padding: 10px 12px 8px; }
  .sankari { min-height: 260px; }
  .sankari h1 { font-size: 30px; }
  .sankari p { font-size: 17px; }
  .kirjanosto { padding: 22px; }
  .sarakkeet { flex-direction: column; gap: 0; }
  .lajitaulukko-kehys { overflow-x: auto; }
  dl.maakunnat { grid-template-columns: 1fr; gap: 0; }
  dl.maakunnat dd { margin-bottom: 8px; }
  .sarake { width: 100%; }
  blockquote { margin-left: 1em; }
  img.oikealle, img.vasemmalle { float: none; display: block; margin: 0 0 1em; }
  .tyyli-opas .sivu h1 { font-size: 32px; }
  .tyyli-opas .suku h3 { font-size: 28px; }
  .tyyli-opas blockquote, .tyyli-opas blockquote blockquote { margin-left: 0.75em; }
}
