/* Party Map blog – tokens and components. Katso style-guide.md. */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;800&family=Source+Serif+4:opsz,wght@8..60,400;8..60,500;8..60,600;8..60,700&display=swap');

:root {
  /* typografia: skaala 1.125, perus 1.15rem */
  --fs-xs: 0.81rem;
  --fs-s: 0.91rem;
  --fs-m: 1.02rem;
  --fs-base: 1.15rem;
  --fs-lede: 1.29rem;
  --fs-sub: 1.32rem;
  --fs-h3: 1.64rem;
  --fs-h2: 1.85rem;
  --fs-h1: 2.63rem;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Inter", -apple-system, sans-serif;

  /* värit */
  --ink: #222c36;
  --ink-strong: #16283b;
  --brand: #1f4e79;
  --brand-deep: #16324f;
  --muted: #5b6673;
  --surface-1: #f2e9db;
  --surface-2: #ece1cd;
  --line: #e3d9c6;

  /* sivun tausta: lämmin liuku ylhäältä kermanvalkoiseen.
     Tasainen vaihtoehto: aseta --page-top samaksi kuin --page. */
  --page: #faf6ef;
  --page-top: #f3e8d5;
}

/* --- Perustypografia --- */
body {
  font-family: var(--serif);
  font-size: var(--fs-base);
  line-height: 1.75;
  color: var(--ink);
  background-color: var(--page);
  /* Vierivä liuku, pehmennetty ease-out-portain: ilman väliportaita
     kahden pisteen liu'un loppuun jää näkyvä raja (Mach band). */
  background-image: linear-gradient(
    180deg,
    rgba(243, 232, 213, 1) 0,
    rgba(243, 232, 213, 0.83) 160px,
    rgba(243, 232, 213, 0.58) 320px,
    rgba(243, 232, 213, 0.32) 480px,
    rgba(243, 232, 213, 0.12) 640px,
    rgba(243, 232, 213, 0) 800px);
  background-repeat: no-repeat;
}
#title-block-header {
  margin-top: 3rem;
  margin-bottom: 2.6rem;
}
.quarto-title-meta {
  margin-top: 2rem;
}
h1.title {
  font-family: var(--serif);
  font-size: var(--fs-h1);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--brand-deep);
}
p.subtitle {
  font-family: var(--serif);
  font-size: var(--fs-sub);
  font-weight: 600;
  color: var(--brand-deep);
  line-height: 1.35;
  text-wrap: balance;
  margin-top: 0.5rem;
}
h2 {
  font-family: var(--serif);
  font-size: var(--fs-h2);
  font-weight: 700;
  line-height: 1.2;
  text-wrap: balance;
  color: var(--ink-strong);
  margin-top: 3rem;
  border-bottom: none !important;
}
h2::before {
  content: "";
  display: block;
  width: 3rem;
  height: 5px;
  background: var(--brand);
  margin-bottom: 0.7rem;
}
h3 {
  font-family: var(--serif);
  font-size: var(--fs-h3);
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink-strong);
}
.lead p {
  font-size: var(--fs-lede);
  line-height: 1.55;
  font-weight: 500;
  color: var(--brand-deep);
}
.lead p:first-child::first-line {
  font-weight: 700;
}
a { color: var(--brand); }
nav[role="doc-toc"] a,
#TOC a {
  color: var(--ink);
}
.sidebar nav[role="doc-toc"] ul > li > a.active,
.sidebar nav[role="doc-toc"] ul > li > ul > li > a.active,
nav[role="doc-toc"] a.active,
#TOC a.active {
  color: var(--brand) !important;
  border-left-color: var(--brand);
}
#toc-title { color: var(--ink-strong); }
.figure-caption, .quarto-float-caption {
  font-family: var(--sans);
  font-size: var(--fs-xs);
  line-height: 1.4;
  color: var(--muted);
}
.callout, .quarto-title-meta {
  font-family: var(--sans);
}


/* --- Numerolaatat --- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.8rem;
  margin: 1.6rem 0;
}
.stat-tile {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--surface-1);
  border-radius: 10px;
  padding: 1rem 0.9rem;
  text-align: center;
}
.stat-tile .num {
  display: block;
  font-family: var(--serif);
  font-size: clamp(1.46rem, 4vw, 2.08rem);
  font-weight: 700;
  line-height: 1.1;
  color: var(--brand);
  white-space: nowrap;
}
.stat-tile .num.pitka {
  font-size: clamp(1.15rem, 3.4vw, 1.64rem);
}
.stat-tile .lbl {
  display: block;
  font-family: var(--sans);
  font-size: var(--fs-xs);
  line-height: 1.4;
  color: var(--muted);
  margin-top: 0.45rem;
}

/* --- Vuosisanat --- */
.year-strip {
  margin: 1rem 0 1.4rem;
  font-family: var(--sans);
}
.year-strip p {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.4rem;
  margin: 0;
}
.year-strip .chip {
  display: inline-block;
  height: 2.1rem;
  line-height: 2.1rem;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 0 0.8rem;
  font-size: var(--fs-s);
  white-space: nowrap;
}
.year-strip .chip b { color: var(--brand); }

/* --- Puolue- ja sanalaatat --- */
.party-chip {
  display: inline-block;
  font-family: var(--sans);
  padding: 0.05rem 0.6rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85em;
  color: #fff;
  white-space: nowrap;
}
.word-row {
  margin: 0.55rem 0;
}
.word-row p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.4rem;
  margin: 0;
}
.word-row .party-chip,
.word-row .w {
  display: inline-block;
  height: 2.1rem;
  line-height: 2.1rem;
  font-size: var(--fs-s);
  padding: 0 0.8rem;
  border-radius: 999px;
}
.word-row .party-chip {
  min-width: 4.6rem;
  text-align: center;
}
.word-row .w {
  font-family: var(--sans);
  background: var(--surface-2);
  white-space: nowrap;
}
.word-row .w i { color: var(--muted); font-size: 0.88em; }

/* --- Kausinapit (HTML; Plotlyn SVG-napit eivät tottele sivun tyylejä) --- */
.term-buttons {
  display: flex;
  gap: 0.4rem;
  margin: 0.4rem 0 0.2rem;
}
.term-buttons button {
  font-family: var(--sans);
  font-size: var(--fs-s);
  font-weight: 600;
  padding: 0.35rem 0.95rem;
  border: 1.5px solid transparent;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--brand-deep);
  cursor: pointer;
}
.term-buttons button:hover {
  background: var(--surface-1);
}
.term-buttons button.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.term-buttons button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* --- Menetelmälaatikko: Quarton sinisen oletuksen tilalle talon tyyli --- */
div.callout.callout-note {
  border: none;
  border-left: 5px solid var(--brand);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: var(--fs-m);
  line-height: 1.55;
  padding: 1.1rem 1.5rem 1.2rem;
}
div.callout.callout-note .callout-header {
  background: transparent;
  color: var(--brand-deep);
  font-family: var(--sans);
  font-weight: 600;
  padding: 0;
  margin-bottom: 0.5rem;
}
div.callout.callout-note .callout-body-container,
div.callout.callout-note .callout-body {
  padding: 0;
}
div.callout.callout-note .callout-body > :last-child,
div.callout.callout-note .callout-body p:last-child {
  margin-bottom: 0;
}
div.callout.callout-note .callout-icon-container,
div.callout.callout-note .callout-icon {
  display: none;
}
div.callout.callout-note .callout-title-container {
  margin-left: 0;
}
