/* Raundæmi — institutional EU fact-checker
   Default palette is Paper (white surface, cobalt accent). Navy / Stone /
   Forest are still defined and switchable from the design-tool Tweaks panel.
   See layout.js for the (now Paper-defaulted) theme bootstrap. */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@300;400;500;600;700;800;900&family=Geist+Mono:wght@400;500&display=swap');

[data-palette="navy"] {
  --bg: #03050a;
  --bg-2: #0a1020;
  --surface: #1c2740;
  --surface-2: #283555;
  --line: rgba(255,255,255,0.14);
  --line-strong: rgba(255,255,255,0.32);
  --text: #ffffff;
  --text-2: #d8dde8;
  --muted: #8a93a7;
  --muted-2: #5b6378;
  --accent: #ffc857;
  --accent-2: #ff7849;
  --accent-ink: #1a1100;
  --link: #ffd97a;
  --true: #2bd97f;
  --mostly: #f5cf2e;
  --misleading: #ff9b1c;
  --false: #ff5546;
  --true-bg: rgba(43,217,127,0.14);
  --mostly-bg: rgba(245,207,46,0.16);
  --misleading-bg: rgba(255,155,28,0.16);
  --false-bg: rgba(255,85,70,0.16);
  --halo: radial-gradient(ellipse at 30% 0%, rgba(255,200,87,0.22) 0%, transparent 55%), radial-gradient(ellipse at 80% 30%, rgba(255,120,73,0.12) 0%, transparent 50%);
}

[data-palette="stone"] {
  --bg: #ffffff;
  --bg-2: #f5f2ea;
  --surface: #ffffff;
  --surface-2: #f5f2ea;
  --line: rgba(0,0,0,0.18);
  --line-strong: rgba(0,0,0,0.42);
  --text: #000000;
  --text-2: #1a1a1a;
  --muted: #555044;
  --muted-2: #7a7464;
  --accent: #b8331c;
  --accent-2: #1e3a8a;
  --accent-ink: #ffffff;
  --link: #b8331c;
  --true: #15693c;
  --mostly: #b8870c;
  --misleading: #c4640f;
  --false: #9a1e17;
  --true-bg: rgba(21,105,60,0.12);
  --mostly-bg: rgba(184,135,12,0.13);
  --misleading-bg: rgba(196,100,15,0.13);
  --false-bg: rgba(154,30,23,0.12);
  --halo: radial-gradient(ellipse at 20% 0%, rgba(184,51,28,0.10) 0%, transparent 55%), radial-gradient(ellipse at 85% 20%, rgba(30,58,138,0.08) 0%, transparent 50%);
}

[data-palette="forest"] {
  --bg: #050d0a;
  --bg-2: #0a1814;
  --surface: #1f3a2e;
  --surface-2: #2c4d3f;
  --line: rgba(255,255,255,0.14);
  --line-strong: rgba(255,255,255,0.34);
  --text: #ffffff;
  --text-2: #dde1d6;
  --muted: #95a89c;
  --muted-2: #5e7066;
  --accent: #ffb547;
  --accent-2: #2bd97f;
  --accent-ink: #1a1100;
  --link: #ffc870;
  --true: #2bd97f;
  --mostly: #f5cf2e;
  --misleading: #ff9b1c;
  --false: #ff5546;
  --true-bg: rgba(43,217,127,0.14);
  --mostly-bg: rgba(245,207,46,0.16);
  --misleading-bg: rgba(255,155,28,0.16);
  --false-bg: rgba(255,85,70,0.16);
  --halo: radial-gradient(ellipse at 25% 0%, rgba(255,181,71,0.18) 0%, transparent 55%), radial-gradient(ellipse at 80% 35%, rgba(43,217,127,0.10) 0%, transparent 50%);
}

:root, [data-palette="paper"] {
  --bg: #ffffff;
  --bg-2: #f5f2ea;
  --surface: #ffffff;
  --surface-2: #f5f2ea;
  --line: rgba(0,0,0,0.18);
  --line-strong: rgba(0,0,0,0.42);
  --text: #000000;
  --text-2: #1a1a1a;
  --muted: #555;
  --muted-2: #888;
  --accent: #1c3edc;
  --accent-2: #ff5722;
  --accent-ink: #ffffff;
  --link: #1c3edc;
  --true: #126a36;
  --mostly: #b8870c;
  --misleading: #c4640f;
  --false: #a8201a;
  --true-bg: rgba(18,106,54,0.10);
  --mostly-bg: rgba(184,135,12,0.13);
  --misleading-bg: rgba(196,100,15,0.13);
  --false-bg: rgba(168,32,26,0.10);
  --halo: radial-gradient(ellipse at 20% 0%, rgba(28,62,220,0.08) 0%, transparent 55%), radial-gradient(ellipse at 85% 30%, rgba(255,87,34,0.06) 0%, transparent 50%);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Geist', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.005em;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: var(--halo);
  z-index: 0;
}

main { position: relative; z-index: 1; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3, h4 {
  font-family: 'Geist', system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.05;
  color: var(--text);
  margin: 0 0 0.4em;
  text-wrap: balance;
}

h1 { font-size: clamp(2.4rem, 5.5vw, 4.6rem); font-weight: 700; letter-spacing: -0.045em; line-height: 0.98; }
h2 { font-size: clamp(1.8rem, 3.4vw, 2.8rem); font-weight: 600; letter-spacing: -0.035em; line-height: 1.05; }
h3 { font-size: 1.4rem; font-weight: 600; line-height: 1.15; letter-spacing: -0.025em; }
h4 { font-weight: 600; letter-spacing: -0.015em; }

/* Italic emphasis keeps the Instrument Serif accent for editorial moments */
h1 em, h2 em, h3 em, .hero h1 em, .ital-serif {
  font-family: 'Instrument Serif', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
}

em, .italic { font-style: italic; }

p { text-wrap: pretty; margin: 0 0 1em; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

.mono {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.82em;
  letter-spacing: 0.01em;
}

/* ---------- Layout ---------- */

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 32px;
}

.container.narrow { max-width: 820px; }
.container.wide { max-width: 1480px; }

@media (max-width: 720px) {
  .container { padding: 0 20px; }
}

/* ---------- Top bar ---------- */

.topbar {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 72px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: 'Geist', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand em { font-style: italic; color: var(--accent); font-family: 'Instrument Serif', serif; font-weight: 400; }

.brand-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateY(-6px);
}

.brand-tag {
  font-family: 'Geist Mono', monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  border-left: 1px solid var(--line-strong);
  padding-left: 14px;
  margin-left: 6px;
}

.nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
  align-items: center;
}

.nav a {
  color: var(--text-2);
  font-size: 0.92rem;
  padding: 8px 14px;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.nav a.is-active { color: var(--text); background: var(--surface); }

.nav-cta {
  margin-left: 10px;
  padding: 9px 16px;
  background: var(--accent);
  color: var(--accent-ink) !important;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.92rem;
}
.nav-cta:hover { filter: brightness(1.08); text-decoration: none !important; }

/* ---------- Nav dropdowns ---------- */

.nav-group { position: relative; }

.nav-group-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--text-2);
  background: transparent;
  border: 0;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-group-btn:hover { background: var(--surface); color: var(--text); }
.nav-group.is-active > .nav-group-btn { color: var(--text); background: var(--surface); }

.nav-caret {
  font-size: 0.62rem;
  line-height: 1;
  opacity: 0.65;
  transition: transform 0.15s;
}
.nav-group:hover .nav-caret,
.nav-group.is-open .nav-caret { transform: rotate(180deg); }

.nav-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 210px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 14px 36px rgba(10, 25, 41, 0.16);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: 60;
}
.nav-group:hover .nav-menu,
.nav-group.is-open .nav-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-menu a {
  display: block;
  white-space: nowrap;
  padding: 9px 12px;
  border-radius: 6px;
  color: var(--text-2);
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.nav-menu a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-menu a.is-active { background: var(--surface-2); color: var(--text); }

@media (max-width: 880px) {
  .nav { display: none; }
  .nav-cta { display: inline-block; }
}

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

.footer {
  margin-top: 80px;
  border-top: 1px solid var(--line);
  padding: 40px 0 60px;
  color: var(--muted);
  font-size: 0.88rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
}
@media (max-width: 720px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
.footer h4 {
  font-family: 'Geist Mono', monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted-2);
  margin-bottom: 14px;
}
.footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.footer a { color: var(--text-2); }

/* ---------- Verdict system ---------- */

.verdict {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Geist Mono', monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid currentColor;
  white-space: nowrap;
  font-weight: 500;
}
.verdict::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.verdict[data-verdict="rett"]        { color: var(--true);       background: var(--true-bg); }
.verdict[data-verdict="ad-mestu"]    { color: var(--mostly);     background: var(--mostly-bg); }
.verdict[data-verdict="misvisandi"]  { color: var(--misleading); background: var(--misleading-bg); }
.verdict[data-verdict="rangt"]       { color: var(--false);      background: var(--false-bg); }
.verdict[data-verdict="ovist"]       { color: var(--muted);      background: rgba(138,160,180,0.10); }

.verdict-large {
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  padding: 10px 18px;
  border-radius: 6px;
  border-width: 1.5px;
}
.verdict-large::before { width: 10px; height: 10px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  letter-spacing: -0.005em;
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover { filter: brightness(1.08); color: var(--accent-ink); border-color: var(--accent); }
.btn-ghost { border-color: transparent; padding-left: 10px; padding-right: 10px; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.card-pad { padding: 28px; }

/* ---------- Hairline meta ---------- */

.meta {
  font-family: 'Geist Mono', monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.kicker {
  font-family: 'Geist Mono', monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin-bottom: 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.kicker::before {
  content: '';
  width: 18px;
  height: 1px;
  background: var(--accent);
}

.divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 32px 0;
}
.divider-strong { border-top: 1px solid var(--line-strong); }

/* ---------- Forms ---------- */

label.field { display: block; }
.field-label {
  display: block;
  font-family: 'Geist Mono', monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 8px;
}
.field-hint { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }

input[type="text"], input[type="url"], input[type="search"], textarea, select {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { min-height: 140px; font-family: 'Geist', sans-serif; resize: vertical; }

/* ---------- Tweaks panel ---------- */

.tweaks {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 300px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  z-index: 100;
  display: none;
}
.tweaks.is-open { display: block; }
.tweaks-title {
  font-family: 'Geist Mono', monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tweaks-close {
  background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0;
}
.tweaks-section { margin-bottom: 18px; }
.tweaks-section:last-child { margin-bottom: 0; }
.tweaks-section-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 8px;
}
.swatches { display: flex; gap: 8px; }
.swatch {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.swatch.is-active { border-color: var(--accent); }
.swatch::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: inherit;
}
.seg {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.seg button {
  flex: 1;
  background: transparent;
  border: 0;
  padding: 8px 10px;
  color: var(--text-2);
  font-size: 0.85rem;
  cursor: pointer;
}
.seg button.is-active { background: var(--surface-2); color: var(--text); }

/* ---------- Empty states ---------- */

.empty {
  text-align: center;
  padding: 60px 20px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}
.empty h3 { color: var(--text-2); font-family: 'Instrument Serif', serif; font-weight: 400; }

/* ---------- Loading spinner ---------- */

.spin {
  width: 16px; height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Sparkline / bar primitives ---------- */

.bar {
  display: flex;
  height: 12px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--line);
}
.bar > div { height: 100%; }
.bar > .b-rett       { background: var(--true); }
.bar > .b-ad-mestu   { background: var(--mostly); }
.bar > .b-misvisandi { background: var(--misleading); }
.bar > .b-rangt      { background: var(--false); }

/* ---------- Range slider ---------- */
/* Shared by the Reiknivél calculator (reiknivel.html) and its front-page
   preview (index.html). The track fills up to the thumb via --rk-fill. */

.rk-range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 8px; border-radius: 999px; outline: none; cursor: pointer;
  border: 1px solid var(--line);
  background: linear-gradient(to right,
    var(--accent) 0%, var(--accent) var(--rk-fill, 50%),
    var(--bg-2) var(--rk-fill, 50%), var(--bg-2) 100%);
}
.rk-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--bg);
  box-shadow: 0 2px 10px rgba(0,0,0,0.28); cursor: grab; transition: transform 0.1s;
}
.rk-range::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.1); }
.rk-range::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--bg);
  box-shadow: 0 2px 10px rgba(0,0,0,0.28); cursor: grab;
}
.rk-range::-moz-range-track { height: 8px; border-radius: 999px; background: transparent; }
.rk-range:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 40%, transparent); }
/* Larger thumb on touch devices for a comfortable drag target. */
@media (pointer: coarse) {
  .rk-range { height: 10px; }
  .rk-range::-webkit-slider-thumb { width: 32px; height: 32px; }
  .rk-range::-moz-range-thumb { width: 28px; height: 28px; }
}

/* ---------- Misc ---------- */

.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.78rem;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text-2);
}

.skel {
  background: linear-gradient(90deg, var(--surface), var(--surface-2), var(--surface));
  background-size: 200% 100%;
  animation: skel 1.6s ease-in-out infinite;
  border-radius: 4px;
}
@keyframes skel { 0% { background-position: 200% 0;} 100% { background-position: -200% 0; } }

.notice {
  padding: 14px 16px;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.92rem;
  border-radius: 0 6px 6px 0;
}
.notice.error { border-color: var(--false); }

/* ---------- Page hero ---------- */

.page-hero {
  padding-top: 60px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 40px;
}
.page-hero-narrow { padding-top: 40px; padding-bottom: 20px; }
.page-hero h1 { margin-bottom: 12px; }
.page-hero p.lede {
  font-family: 'Instrument Serif', serif;
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--text-2);
  max-width: 60ch;
}
