/* DM Sans — self-hosted (GDPR-compliant, no Google DNS lookup) */
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url('../fontit/dm-sans-normal-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url('../fontit/dm-sans-normal-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Sans';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('../fontit/dm-sans-italic-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'DM Sans';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('../fontit/dm-sans-italic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Source Serif 4 — self-hosted (GDPR-compliant, no Google DNS lookup) */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url('../fontit/source-serif-4-normal-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url('../fontit/source-serif-4-normal-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: italic;
  font-weight: 300 600;
  font-display: swap;
  src: url('../fontit/source-serif-4-italic-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: italic;
  font-weight: 300 600;
  font-display: swap;
  src: url('../fontit/source-serif-4-italic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --c-primary:       #015E38;
  --c-primary-hover: #026b41;
  --c-bg:            #f6f8f6;
  --c-surface:       #ffffff;
  --c-border:        #d8e4da;
  --c-text:          #1a2218;
  --c-muted:         #4a5e48;
  --font-body: 'Source Serif 4', Georgia, serif;
  --font-ui:   'DM Sans', system-ui, sans-serif;
}

/* Yleiset tyylit */
body {
  font-family: var(--font-body);
  line-height: 1.75;
  color: var(--c-text);
  background: var(--c-bg);
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

h1 {
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--c-primary);
  margin-top: 28px;
  letter-spacing: -0.01em;
}

h2 {
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--c-primary);
  letter-spacing: -0.01em;
}

h3 {
  font-family: var(--font-ui);
  font-weight: 500;
  color: var(--c-primary);
}

/* Kirjojen otsikot ovat semanttisesti h2 (h1 -> h3 olisi tasohyppy),
   mutta ne renderöidään h3:n kokoisina kirjakorttien sisällä. */
.book-content h2 {
  font-size: 1.17em;
  font-weight: 500;
  letter-spacing: normal;
  margin: 1em 0;
}

p {
  margin-top: 0;
  margin-bottom: 1em;
}

.lukemisaika {
  font-family: var(--font-ui);
  font-size: 0.82em;
  color: var(--c-muted);
  margin-top: -10px;
  margin-bottom: 28px;
}

/* Navigaatio */
main-navigation {
  display: block;
  min-height: 56px;
}

.simple-nav {
  background-color: #013d25;
  margin: 0 -20px 36px -20px;
  padding: 0 20px;
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  position: relative;
}

.nav-brand {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  margin-right: 20px;
  border-right: 1px solid rgba(255,255,255,0.12);
  padding-right: 20px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-logo-link {
  display: flex;
  align-items: center;
  padding: 10px 0;
  flex-shrink: 0;
  text-decoration: none;
}

.nav-logo {
  height: 30px;
  width: 30px;
  border-radius: 50%;
  object-fit: cover;
  /* nollaa globaali img-tyyli */
  margin: 0;
  border-top: none;
  background: transparent;
  max-width: none;
  box-shadow: 0 0 0 1.5px rgba(255,255,255,0.15);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.nav-logo-link:hover .nav-logo {
  transform: scale(1.10);
  box-shadow: 0 0 0 2.5px rgba(255,255,255,0.55), 0 2px 10px rgba(0,0,0,0.25);
  filter: brightness(1.08);
}

.nav-brand-teksti {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 10px 0;
}

.nav-site-name {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.95em;
  color: #ffffff;
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
  line-height: 1.2;
  transition: opacity 0.15s;
}

.nav-site-name:hover {
  opacity: 0.8;
  text-decoration: none;
}

.nav-tagline {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.70em;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.01em;
  white-space: nowrap;
  line-height: 1;
  pointer-events: none;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  padding-right: 150px;
}

.nav-links a {
  font-family: var(--font-ui);
  font-size: 0.82em;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  padding: 14px 9px;
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.nav-links a:hover {
  color: #ffffff;
  background: rgba(255,255,255,0.08);
  text-decoration: none;
}

.nav-links a.nav-kesken {
  color: rgba(255,255,255,0.35);
}

.nav-links a.nav-kesken::after {
  content: " 🚧";
  font-size: 0.8em;
}

.nav-paivitys {
  position: absolute;
  top: 8px;
  right: 20px;
  padding: 3px 0;
  font-family: var(--font-ui);
  font-size: 0.72em;
  color: rgba(255,255,255,0.45);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
  z-index: 2;
}

.nav-paivitys:hover {
  color: rgba(255,255,255,0.85);
  text-decoration: underline;
}

@media (max-width: 480px) {
  .nav-paivitys { font-size: 0.65em; right: 12px; }
  .nav-links { padding-right: 100px; }
}

.paivitys-merkinta {
  padding: 4px 0 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--c-border, #e2e8f0);
}

.paivitys-merkinta h2 {
  margin-bottom: 8px;
}

.paivitys-merkinta:last-of-type {
  border-bottom: none;
}

/* Erikoisluokat */
.fakta-laatikko {
  background-color: var(--c-surface);
  border-left: 4px solid var(--c-primary);
  padding: 16px 20px;
  margin: 24px 0;
  border-radius: 0 6px 6px 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.92em;
  font-family: var(--font-ui);
  background: var(--c-surface);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

@media (max-width: 700px) {
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

caption {
  caption-side: bottom;
  text-align: left;
  font-size: 0.82em;
  color: var(--c-muted);
  padding: 8px 0 0;
  font-family: var(--font-ui);
  font-style: italic;
}

th, td {
  border: 1px solid var(--c-border);
  padding: 10px 14px;
  text-align: left;
}

th {
  background-color: #eaf2ec;
  font-family: var(--font-ui);
  font-weight: 500;
  color: var(--c-primary);
}

.saasto {
  color: #1a8a50;
  font-weight: 600;
}

tr.rivi-null td     { background-color: #fff8e6; }
tr.rivi-orpo td     { background-color: #fff2f2; }
tr.rivi-sentinel td { background-color: #f2f6ff; }

/* Kokoero-vertailugraafi (faktataulu: granulariteetti ja muistikoko) */
.kokoero-graafi {
  margin: 22px 0 6px;
  font-family: var(--font-ui);
}
.kokoero-rivi {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
}
.kokoero-nimi {
  flex: 0 0 130px;
  font-size: 0.88em;
  font-weight: 600;
  color: var(--c-text);
}
.kokoero-track {
  flex: 1 1 auto;
  background: #eef2ef;
  border: 1px solid var(--c-border);
  border-radius: 4px;
  height: 26px;
  overflow: hidden;
}
.kokoero-bar {
  height: 100%;
  min-width: 5px;
  border-radius: 3px 0 0 3px;
}
.kokoero-arvo {
  flex: 0 0 132px;
  font-size: 0.88em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.kokoero-arvo strong { font-weight: 700; }
.kokoero-kerroin { color: var(--c-muted); font-size: 0.86em; }
@media (max-width: 600px) {
  .kokoero-nimi  { flex-basis: 92px; font-size: 0.8em; }
  .kokoero-arvo  { flex-basis: 104px; font-size: 0.8em; }
}

img {
  display: block;
  max-width: 88%;
  height: auto;
  margin: 32px auto;
  border-radius: 0 0 6px 6px;
  background: #fff;
  border-top: 3px solid var(--c-primary);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.09),
    0 1px 4px rgba(0, 0, 0, 0.05);
}

img.zoomattava {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: zoom-in;
}

img.zoomattava:hover {
  transform: translateY(-2px) scale(1.005);
  box-shadow:
    0 8px 32px rgba(1, 94, 56, 0.13),
    0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Figure + Mermaid */
figure {
  margin: 32px 0;
}

figcaption {
  font-family: var(--font-ui);
  font-size: 0.80em;
  color: var(--c-muted);
  text-align: center;
  margin-top: 10px;
  letter-spacing: 0.01em;
}

/* Kuvateksti — <p><em>Kuva:...</em></p> */
p:has(> em:only-child) {
  font-family: var(--font-ui);
  font-size: 0.80em;
  color: var(--c-muted);
  text-align: center;
  margin-top: -20px;
  margin-bottom: 28px;
  letter-spacing: 0.01em;
}

.dataneuvos-opinion {
  margin-top: 20px;
  padding: 16px 20px;
  background-color: #fdfbf0;
  border: 2px solid #C9A84C;
  border-radius: 6px;
}

.dataneuvos-opinion .opinion-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-weight: 600;
  color: #8B6914;
  margin-bottom: 8px;
  font-size: 0.88em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dataneuvos-opinion .opinion-label::before {
  content: "💬";
  font-size: 1em;
}

.dataneuvos-opinion p {
  margin: 0;
  color: #3d2e00;
  font-size: 0.93em;
  line-height: 1.65;
}

/* Koodiblokit */
pre {
  background: #f4f7fb;
  border: 1px solid #dce6f0;
  border-radius: 6px;
  padding: 14px 18px;
  overflow-x: auto;
  font-size: 0.82em;
  line-height: 1.65;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  color: #1a2a3a;
  margin: 12px 0 0;
}

code {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.88em;
  background: #f0f4fa;
  padding: 1px 5px;
  border-radius: 3px;
}

pre code {
  font-size: inherit;
  background: none;
  padding: 0;
  border-radius: 0;
}

/* Footer */
.sivusto-footer {
  margin-top: 64px;
  padding: 24px 0 16px;
  border-top: 1px solid var(--c-border);
  font-family: var(--font-ui);
  font-size: 0.84em;
  color: var(--c-muted);
  text-align: center;
  line-height: 1.9;
}

.sivusto-footer strong {
  color: var(--c-text);
}

.sivusto-footer a {
  color: var(--c-primary);
  text-decoration: none;
}

.sivusto-footer a:hover {
  text-decoration: underline;
}

.footer-linkit {
  margin-top: 6px;
}

.footer-logo-rivi {
  margin-bottom: 14px;
}

.footer-logo-link {
  display: inline-block;
  text-decoration: none;
}

.footer-logo {
  height: 44px;
  width: 44px;
  border-radius: 50%;
  object-fit: cover;
  /* nollaa globaali img-tyyli */
  margin: 0;
  border-top: none;
  background: transparent;
  max-width: none;
  opacity: 0.65;
  transition: opacity 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}

.footer-logo-link:hover .footer-logo {
  opacity: 1;
  transform: scale(1.08);
  box-shadow: 0 3px 12px rgba(1,94,56,0.25);
}

/* ── Splash screen ─────────────────────────────────────────── */
#sivusto-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #013d25;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  pointer-events: none;
}

#sivusto-splash.poistu {
  animation: splash-poistuu 0.55s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes splash-poistuu {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.04); }
}

.splash-logo-kehys {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.splash-logo {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  /* nollaa globaali img-tyyli */
  margin: 0;
  border-top: none;
  background: transparent;
  max-width: none;
  opacity: 0;
  animation: splash-logo-sisaan 0.55s cubic-bezier(0.34, 1.45, 0.64, 1) 0.1s forwards;
  position: relative;
  z-index: 2;
  box-shadow: 0 0 0 0 rgba(255,255,255,0);
}

@keyframes splash-logo-sisaan {
  0%   { opacity: 0; transform: scale(0.45); filter: blur(6px); }
  70%  { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: scale(1); filter: blur(0); }
}

/* Laajenevat renkaat */
.splash-rengas {
  position: absolute;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.5);
  opacity: 0;
  pointer-events: none;
}

.splash-rengas-1 {
  animation: rengas-laajenee 0.9s cubic-bezier(0.2, 0.6, 0.4, 1) 0.55s forwards;
}

.splash-rengas-2 {
  animation: rengas-laajenee 0.9s cubic-bezier(0.2, 0.6, 0.4, 1) 0.75s forwards;
}

.splash-rengas-3 {
  border-color: rgba(255,255,255,0.2);
  animation: rengas-laajenee 0.9s cubic-bezier(0.2, 0.6, 0.4, 1) 0.95s forwards;
}

@keyframes rengas-laajenee {
  0%   { transform: scale(1);    opacity: 0.55; }
  100% { transform: scale(2.6);  opacity: 0; }
}

/* Tekstit */
.splash-nimi {
  font-family: var(--font-ui);
  font-size: 1.05em;
  font-weight: 600;
  color: rgba(255,255,255,0);
  letter-spacing: 0.18em;
  text-transform: lowercase;
  opacity: 0;
  animation: splash-teksti-sisaan 0.45s ease 0.65s forwards;
}

.splash-alaotsikko {
  font-family: var(--font-body);
  font-size: 0.78em;
  font-style: italic;
  color: rgba(255,255,255,0);
  letter-spacing: 0.04em;
  opacity: 0;
  margin-top: -14px;
  animation: splash-teksti-sisaan 0.45s ease 0.85s forwards;
}

@keyframes splash-teksti-sisaan {
  0%   { opacity: 0; transform: translateY(10px); color: rgba(255,255,255,0); }
  100% { opacity: 1; transform: translateY(0);    color: rgba(255,255,255,0.7); }
}
/* ────────────────────────────────────────────────────────────── */

/* Termistö: highlight kun navigoidaan ankkerilla tai klikataan */
.termi:target,
.termi.highlighted {
  background-color: #fffbe6;
  border-left: 3px solid #e6ac00;
  padding-left: 10px;
  scroll-margin-top: 80px;
  transition: background-color 0.3s ease;
}

.termi[id] {
  cursor: pointer;
}

/* Tekijä- ja päivitystieto (E-E-A-T) */
.byline {
  font-family: var(--font-ui);
  font-size: 0.85em;
  color: var(--c-muted);
  margin: -0.4rem 0 1.8rem;
}
.byline a {
  color: var(--c-primary);
}

/* Kortit — etusivun "kortti"-ulkoasu, jaettu myös sisältösivujen "Katso myös" -lohkoon (kortit.js) */
.kortti-rivi {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}
.kortti {
  border: 1px solid var(--c-border);
  border-radius: 6px;
  padding: 16px 18px;
  text-decoration: none;
  color: inherit;
  display: block;
  background: var(--c-surface);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.kortti:hover {
  border-color: var(--c-primary);
  box-shadow: 0 4px 14px rgba(30,58,95,0.13);
  transform: translateY(-2px);
}
.kortti strong {
  display: block;
  font-family: var(--font-ui);
  color: var(--c-primary);
  margin-bottom: 6px;
  font-size: 0.97em;
  font-weight: 600;
}
.kortti span {
  font-size: 0.88em;
  color: var(--c-muted);
  line-height: 1.5;
}
/* Korttimerkit — sekä etusivulla että "Katso myös" -osioissa.
   Näiden on oltava täällä eikä index.html:n omassa style-lohkossa:
   kortit.js renderöi samat merkit artikkelisivuille. */
.kesken-badge,
.uutuus-badge {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.73em;
  border-radius: 4px;
  padding: 1px 7px;
  margin-bottom: 7px;
  align-self: flex-start;
}
.kesken-badge {
  background: #fff3cd;
  border: 1px solid #e0c060;
  color: #856404;
}
.uutuus-badge {
  font-weight: 600;
  background: #e3f2e6;
  border: 1px solid #4caf70;
  color: #1e6b38;
}

.kortti-tagit {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
}
.tagi {
  font-family: var(--font-ui);
  font-size: 0.70em;
  padding: 2px 8px;
  background: #eef1f8;
  color: var(--c-primary);
  border-radius: 10px;
}
.kortti-lukemisaika {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.72em;
  color: var(--c-muted);
  background: #eef1f8;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 2px 9px;
  margin-top: 10px;
}

/* "Katso myös" -lohko sisältösivujen lopussa */
.katso-myos {
  margin-top: 44px;
}
.katso-myos h2 {
  border-bottom: 2px solid var(--c-primary);
  padding-bottom: 6px;
  margin-bottom: 18px;
}
