/* ============================================================
   Textnyheter – stilren textnyhetssida anpassad för äldre läsare
   ============================================================ */

:root {
  --paper: #faf6ef;
  --card: #fffdf8;
  --ink: #1c1b18;
  --ink-soft: #555047;
  --hairline: #d9d2c3;
  --accent: #15497a;
  --focus: #c85000;

  --inrikes: #15497a;
  --utrikes: #8a2b3d;
  --ekonomi: #1e5e3f;
  --sport: #a3541a;

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --display: "Playfair Display", Georgia, serif;
  --ui: "Inter", -apple-system, "Segoe UI", sans-serif;

  --max-col: 47rem;
}

/* Hög kontrast: rent svart på vitt, hårdare linjer */
html.high-contrast {
  --paper: #ffffff;
  --card: #ffffff;
  --ink: #000000;
  --ink-soft: #1a1a1a;
  --hairline: #000000;
  --accent: #00318a;
  --inrikes: #00318a;
  --utrikes: #7a0022;
  --ekonomi: #00522b;
  --sport: #8a3c00;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.25rem;          /* 20 px som lägsta nivå */
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Tillgänglighet ---------- */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -130%);
  z-index: 100;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--ui);
  font-weight: 600;
  padding: 0.8rem 1.4rem;
  border-radius: 0 0 12px 12px;
  text-decoration: none;
  transition: transform 0.15s ease;
}
.skip-link:focus { transform: translate(-50%, 0); }

:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Sidhuvud ---------- */

.masthead {
  text-align: center;
  padding: 2.4rem 1rem 1.6rem;
  border-bottom: 4px double var(--ink);
}

.dateline {
  margin: 0 0 0.4rem;
  font-family: var(--ui);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.site-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(2.8rem, 8vw, 4.6rem);
  line-height: 1.05;
  letter-spacing: 0.01em;
}

.tagline {
  margin: 0.6rem 0 0;
  font-family: var(--ui);
  font-weight: 500;
  font-size: 1rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------- Verktygsrad (textstorlek + kontrast) ---------- */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline);
  box-shadow: 0 1px 10px rgba(28, 27, 24, 0.06);
}

.toolbar-inner {
  max-width: var(--max-col);
  margin: 0 auto;
  padding: 0.65rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}

.text-controls {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.toolbar-label {
  font-family: var(--ui);
  font-weight: 700;
  font-size: 1rem;
}

.text-level {
  font-family: var(--ui);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink-soft);
  min-width: 6.2em;
  text-align: center;
}

/* ---------- Knappar ---------- */

.btn {
  font-family: var(--ui);
  font-weight: 700;
  font-size: 1.05rem;
  min-height: 48px;
  min-width: 48px;
  padding: 0.45rem 1rem;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn:hover { background: var(--ink); color: var(--paper); }

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.btn:disabled:hover { background: var(--card); color: var(--ink); }

.btn-square { font-size: 1.2rem; }

.btn[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

/* ---------- Ämnesknappar ---------- */

.categories {
  border-bottom: 1px solid var(--hairline);
}

.categories-inner {
  max-width: var(--max-col);
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.cat-btn {
  font-family: var(--ui);
  font-weight: 700;
  font-size: 1.05rem;
  min-height: 48px;
  padding: 0.45rem 1.3rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.cat-btn:hover,
.cat-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

/* ---------- Rubriklista (förstasidan) ---------- */

.headline-section {
  max-width: var(--max-col);
  margin: 0 auto;
  padding: 1.4rem 1rem 2.5rem;
}

.headline-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.headline-btn {
  display: block;
  width: 100%;
  text-align: left;
  font-family: inherit;
  color: var(--ink);
  background: var(--card);
  border: 2px solid var(--hairline);
  border-radius: 14px;
  padding: 1.1rem 1.3rem;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.headline-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(28, 27, 24, 0.10);
}

html.high-contrast .headline-btn { border-color: var(--ink); }

.headline-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-bottom: 0.55rem;
}

.headline-text {
  display: block;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.22;
  text-wrap: balance;
}

.headline-cta {
  display: inline-block;
  margin-top: 0.6rem;
  font-family: var(--ui);
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent);
}

.headline-btn:hover .headline-cta { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Tillbaka-knapp i artikelvyn ---------- */

.back-btn { margin-bottom: 1.6rem; }
.story > .back-btn:last-child { margin-bottom: 0; margin-top: 1.8rem; }

/* ---------- Artiklar ---------- */

.story {
  max-width: var(--max-col);
  margin: 0 auto;
  padding: 2.4rem 1rem;
  border-bottom: 1px solid var(--hairline);
}

.story-top {
  margin: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.kicker {
  font-family: var(--ui);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ffffff;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
}

.kicker-inrikes { background: var(--inrikes); }
.kicker-utrikes { background: var(--utrikes); }
.kicker-ekonomi { background: var(--ekonomi); }
.kicker-sport   { background: var(--sport); }

.meta {
  font-family: var(--ui);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.story h2 {
  margin: 0.9rem 0 0.6rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.7rem, 4.5vw, 2.35rem);
  line-height: 1.18;
  text-wrap: balance;
}

.lead {
  margin: 0 0 1rem;
  font-weight: 600;
  font-size: 1.12em;
}

.body p { margin: 0 0 1em; }
.body p:last-child { margin-bottom: 0; }

.story-actions {
  margin-top: 1.4rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem 1.4rem;
}

.source-link {
  font-family: var(--ui);
  font-weight: 600;
  font-size: 1rem;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
  padding: 0.5rem 0;
}

.source-link:hover { color: var(--ink); }

html.high-contrast .source-link { color: var(--accent); }

/* ---------- Till toppen ---------- */

#toTop {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  z-index: 30;
  box-shadow: 0 4px 16px rgba(28, 27, 24, 0.22);
}

/* ---------- Sidfot ---------- */

.site-footer {
  max-width: var(--max-col);
  margin: 0 auto;
  padding: 2.4rem 1rem 3.5rem;
  border-top: 4px double var(--ink);
  font-size: 1rem;
}

.footer-title {
  font-family: var(--display);
  font-size: 1.5rem;
  margin: 0 0 0.6rem;
}

.footer-sources { color: var(--ink-soft); }

.site-footer a {
  color: var(--accent);
  font-weight: 600;
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
}

/* ---------- Mindre skärmar ---------- */

@media (max-width: 560px) {
  .toolbar-inner { justify-content: center; }
  .story { padding: 1.8rem 1rem; }
}
