/* Ilta-Wiki – iltapäivälehden ulkoasu Wikipedia-sisällölle */

:root {
  --paper: #ffffff;
  --bg: #e4e4e2;
  --ink: #14120f;
  --red: #d4111e;
  --link: #16509b;
  --muted: #6b6b6b;
  --rule: #dcdcd8;

  --wrap: 1080px;
  --head: "Archivo Narrow", "Arial Narrow", Arial, sans-serif;
  --ui: Archivo, "Helvetica Neue", Arial, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.5;
}

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

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 2px;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 12px;
}

/* ---------------------------------------------------------- otsikkopalkki */

.masthead {
  background: var(--ink);
  color: #fff;
}

.masthead__inner {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.logo {
  font-family: var(--ui);
  font-weight: 800;
  font-size: 30px;
  letter-spacing: -0.035em;
  text-decoration: none;
  color: #fff;
}

.logo span { color: var(--red); }

.masthead__date {
  font-size: 13px;
  color: #b3b3b3;
}

.topics {
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topics__inner {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-top: 9px;
  padding-bottom: 9px;
}

.topics__inner::-webkit-scrollbar { display: none; }

.topics__item {
  font-family: var(--ui);
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  text-decoration: none;
  color: var(--ink);
}

.topics__item.is-active { color: var(--red); }

/* ------------------------------------------------------------- rakenne */

.page { padding-top: 14px; padding-bottom: 40px; }

.page__cols { display: grid; gap: 28px; }

@media (min-width: 900px) {
  .page__cols { grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; }
}

/* ---------------------------------------------------------------- lööppi */

.kicker {
  display: inline-block;
  font-family: var(--ui);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--red);
  margin-bottom: 4px;
}

.hero {
  background: var(--paper);
  margin-bottom: 14px;
}

.hero__link { text-decoration: none; display: block; }

.hero__media { margin: 0; }

.hero__media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }

.hero__text { padding: 14px 16px 18px; }

.hero__head {
  font-family: var(--head);
  font-weight: 700;
  font-size: clamp(28px, 7vw, 46px);
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin: 2px 0 8px;
}

.hero__link:hover .hero__head,
.hero__link:focus-visible .hero__head { text-decoration: underline; }

.hero__lead {
  margin: 0;
  font-size: 16px;
  color: #33312d;
  max-width: 62ch;
}

/* ----------------------------------------------------------------- kortit */

.cards {
  display: grid;
  gap: 2px;
  background: var(--rule);
  border-top: 2px solid var(--rule);
  border-bottom: 2px solid var(--rule);
}

@media (min-width: 560px) { .cards { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .cards { grid-template-columns: repeat(3, 1fr); } }

.card { background: var(--paper); }

.card__link {
  display: block;
  text-decoration: none;
  padding: 0 0 16px;
  height: 100%;
}

.card__media { margin: 0 0 10px; }

.card__media img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }

.card .kicker, .card__head, .card__lead { padding-left: 12px; padding-right: 12px; }

.card__head {
  font-family: var(--head);
  font-weight: 700;
  font-size: 21px;
  line-height: 1.1;
  margin: 0 0 6px;
}

.card__link:hover .card__head,
.card__link:focus-visible .card__head { text-decoration: underline; }

.card__lead {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.kicker--section { color: var(--red); }

/* -------------------------------------------------------------- listaus */

.stream { background: var(--paper); margin-top: 14px; padding: 4px 12px 8px; }

.stream__title, .rail__title, .also__title {
  font-family: var(--ui);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--ink);
  border-bottom: 3px solid var(--red);
  padding-bottom: 6px;
  margin: 12px 0 4px;
}

.row { border-bottom: 1px solid var(--rule); }

.row:last-child { border-bottom: 0; }

.row__link {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  text-decoration: none;
  padding: 12px 0;
}

.row__head {
  font-family: var(--head);
  font-weight: 700;
  font-size: 19px;
  line-height: 1.12;
  margin: 0;
}

.row__link:hover .row__head,
.row__link:focus-visible .row__head { text-decoration: underline; }

.row__media { margin: 0; flex: 0 0 104px; }

.row__media img { width: 104px; height: 70px; object-fit: cover; }

/* --------------------------------------------------------------- palsta */

.rail { background: var(--paper); padding: 4px 14px 16px; align-self: start; }

.rail__list { list-style: none; margin: 0; padding: 0; counter-reset: none; }

.rail__item {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
}

.rail__item:last-child { border-bottom: 0; }

.rail__rank {
  font-family: var(--head);
  font-weight: 700;
  font-size: 24px;
  color: var(--red);
  min-width: 24px;
  line-height: 1;
}

.rail__item a {
  text-decoration: none;
  font-family: var(--head);
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
}

.rail__item a:hover, .rail__item a:focus-visible { text-decoration: underline; }

.rail__views {
  display: block;
  font-family: var(--body);
  font-weight: 400;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* ------------------------------------------------------------ artikkeli */

.story {
  background: var(--paper);
  padding: 18px 16px 24px;
  margin-bottom: 18px;
}

@media (min-width: 720px) { .story { padding: 28px 40px 36px; } }

.story__head { max-width: 40rem; }

.story__title {
  font-family: var(--head);
  font-weight: 700;
  font-size: clamp(30px, 6vw, 44px);
  line-height: 1.03;
  letter-spacing: -0.015em;
  margin: 2px 0 12px;
}

.story__lead {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.45;
  margin: 0 0 16px;
}

.story__byline {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 8px 0;
  margin: 0 0 20px;
}

.story__author { font-weight: 700; color: var(--ink); }

.story__media { margin: 0 0 22px; }

.story__media img { width: 100%; max-height: 520px; object-fit: cover; }

.story__media figcaption,
.story__body figcaption,
.story__body .thumbcaption {
  font-size: 13px;
  color: var(--muted);
  padding-top: 6px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 8px;
}

.story__body {
  max-width: 38rem;
  font-size: 18px;
  line-height: 1.65;
}

.story__body p { margin: 0 0 18px; }

.story__body h2 {
  font-family: var(--head);
  font-weight: 700;
  font-size: 26px;
  line-height: 1.15;
  margin: 32px 0 10px;
}

.story__body h3 {
  font-family: var(--head);
  font-weight: 700;
  font-size: 20px;
  margin: 24px 0 8px;
}

.story__body a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }

.story__body ul, .story__body ol { padding-left: 22px; margin: 0 0 18px; }

.story__body li { margin-bottom: 6px; }

.story__body figure,
.story__body .thumb {
  margin: 22px 0;
  float: none !important;
  width: auto !important;
}

.story__body .thumbinner { width: auto !important; }

.story__body img { width: 100%; height: auto; }

.story__body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  margin: 0 0 22px;
  display: block;
  overflow-x: auto;
}

.story__body th, .story__body td {
  border: 1px solid var(--rule);
  padding: 6px 8px;
  text-align: left;
}

.story__body blockquote {
  margin: 0 0 18px;
  padding-left: 16px;
  border-left: 4px solid var(--red);
  font-style: italic;
}

.story__source {
  max-width: 38rem;
  margin: 28px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  color: var(--muted);
}

.story__source a { color: var(--link); }

.also { background: var(--paper); padding: 4px 12px 16px; }

/* ------------------------------------------------------------- muut */

.empty {
  background: var(--paper);
  padding: 40px 16px;
  text-align: center;
}

.backlink { color: var(--link); font-weight: 700; }

.foot {
  background: var(--ink);
  color: #bdbdbd;
  padding: 24px 0 32px;
  font-size: 13px;
}

.foot a { color: #fff; }

.foot p { margin: 0 0 8px; max-width: 60ch; }

.foot__meta { color: #7d7d7d; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
