/* styles.css — Siikasää
 *
 * Light mode. No framework. No CSS preprocessor. Order is roughly:
 *   1. resets and root variables
 *   2. layout containers
 *   3. status / data-source UI
 *   4. day grid
 *   5. detail panel
 *   6. score legend / banners
 *   7. responsive overrides
 */

:root {
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: #fafbfc;
  color: #1a1a1a;
  margin: 0;
  padding: 0;
  font-size: 14px;
  line-height: 1.5;
}

.container { max-width: 960px; margin: 0 auto; padding: 16px; }

h1 { font-size: 22px; margin: 0 0 4px; font-weight: 600; color: #0a3d62; }
.subtitle { color: #555; font-size: 13px; margin-bottom: 16px; }

/* --- Site nav (top of every page) --- */

.site-nav {
  display: flex;
  gap: 6px;
  margin: 0 0 14px;
  padding: 4px;
  background: #eef2f6;
  border-radius: 8px;
  width: fit-content;
}
.site-nav a {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.site-nav a:hover { color: #0a3d62; }
.site-nav a.active {
  background: #0a3d62;
  color: white;
}

/* --- Tabs (research page) --- */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid #d6e0ea;
  margin-bottom: 18px;
}
.tab-button {
  appearance: none;
  background: transparent;
  border: none;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
}
.tab-button:hover { color: #0a3d62; }
.tab-button.active {
  color: #0a3d62;
  border-bottom-color: #0a3d62;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* --- Article-style content (research / methodology pages) --- */

.article {
  font-size: 14px;
  line-height: 1.65;
  color: #1f2937;
}
.article h2 { font-size: 18px; color: #0a3d62; margin: 28px 0 8px; }
.article h2:first-child { margin-top: 0; }
.article h3 { font-size: 15px; color: #0a3d62; margin: 20px 0 6px; }
.article p { margin: 8px 0; }
.article ul, .article ol { margin: 8px 0 8px 22px; padding: 0; }
.article li { margin: 3px 0; }
.article code {
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12.5px;
}
.article pre {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 10px 12px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.5;
}
.article table {
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 13px;
  width: 100%;
}
.article th, .article td {
  border: 1px solid #e2e8f0;
  padding: 6px 10px;
  text-align: left;
  vertical-align: top;
}
.article th {
  background: #f0f4f8;
  font-weight: 600;
  color: #0a3d62;
}
.article tbody tr:nth-child(even) { background: #fafbfc; }
.article blockquote {
  border-left: 3px solid #0a3d62;
  background: #f0f4f8;
  margin: 10px 0;
  padding: 8px 14px;
  color: #334155;
  font-style: italic;
}
.lang-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 6px;
  background: #e2e8f0;
  color: #475569;
  letter-spacing: 0.4px;
  vertical-align: middle;
}

/* --- Status / data sources --- */

.status-bar {
  background: #f0f4f8;
  border: 1px solid #d6e0ea;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  background: #0a3d62;
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}

.data-sources {
  background: #eff6fc;
  border: 1px solid #c9deec;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 12px;
}
.data-sources h3 { margin: 0 0 6px; font-size: 13px; color: #0a3d62; }
.data-sources .row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  align-items: stretch;
  margin-top: 6px;
}

.source-card {
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.source-card:hover { border-color: #94a3b8; }
.source-card .name { font-weight: 600; color: #0a3d62; font-size: 11px; }
.source-card .value { font-size: 18px; font-weight: 700; color: #0a3d62; margin: 2px 0; }
.source-card .trend { font-size: 11px; color: #64748b; }
.source-card.selected {
  border-color: #0a3d62;
  background: #f0f7fc;
  box-shadow: 0 0 0 2px rgba(10,61,98,0.1);
}

.override-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #cbd5e1;
}
.override-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.override-row label {
  font-weight: 600;
  font-size: 12px;
  color: #0a3d62;
}
.override-row input[type=range] {
  flex: 1;
  min-width: 140px;
  max-width: 260px;
  accent-color: #0a3d62;
}
.override-row input[type=number] {
  width: 62px;
  padding: 4px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 13px;
}
.override-row .value-badge {
  font-size: 16px;
  font-weight: 700;
  color: #0a3d62;
  min-width: 54px;
}

/* --- Day grid --- */

.days-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(125px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.day-card {
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border: 1px solid transparent;
  color: white;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.day-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.day-card.selected { outline: 3px solid #0a3d62; outline-offset: 2px; }

.day-card .day-label { font-size: 12px; font-weight: 600; opacity: 0.95; }
.day-card .day-date { font-size: 11px; opacity: 0.8; }
.day-card .day-score { font-size: 32px; font-weight: 700; line-height: 1; margin: 4px 0; }
.day-card .day-verdict {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.95;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.day-card .day-summary { font-size: 11px; opacity: 0.85; margin-top: 2px; }
.day-card .penalty-flag {
  font-size: 10px;
  opacity: 0.95;
  margin-top: 3px;
  background: rgba(0,0,0,0.18);
  padding: 2px 5px;
  border-radius: 3px;
  display: inline-block;
}

/* --- Detail panel --- */

.detail-panel {
  background: #fff;
  border: 1px solid #d6e0ea;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eef2f6;
  gap: 10px;
  flex-wrap: wrap;
}
.detail-header h2 { margin: 0; font-size: 18px; color: #0a3d62; }
.detail-header .big-score { font-size: 22px; font-weight: 700; color: #0a3d62; }

.score-formula {
  background: #f8fafc;
  border-radius: 6px;
  padding: 8px 12px;
  margin: 8px 0 12px;
  font-size: 12px;
  color: #475569;
}
.score-formula strong { color: #0a3d62; }

.factors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.factor {
  background: #f8fafc;
  border-left: 3px solid #0a3d62;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 12px;
}
.factor.critical {
  border-left-color: #e63946;
  background: #fef2f2;
}
.factor .label {
  font-weight: 600;
  color: #333;
  display: flex;
  justify-content: space-between;
  gap: 6px;
}
.factor .label .w { font-size: 10px; color: #888; font-weight: 500; }
.factor .value { color: #555; margin: 2px 0; font-size: 13px; }
.factor .bar-wrap {
  background: #e2e8f0;
  border-radius: 3px;
  height: 6px;
  margin-top: 4px;
  overflow: hidden;
}
.factor .bar { height: 100%; border-radius: 3px; }
.factor .reason {
  font-size: 11px;
  color: #666;
  margin-top: 3px;
  font-style: italic;
}

.section-title { font-size: 13px; font-weight: 600; color: #0a3d62; margin: 14px 0 6px; }

.penalty-alert {
  background: #fef2f2;
  border-left: 4px solid #e63946;
  padding: 10px 12px;
  border-radius: 4px;
  margin: 10px 0;
  font-size: 12px;
  color: #991b1b;
}

/* --- Banners and legend --- */

.verdict-banner {
  padding: 14px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.5;
}
.verdict-banner.great { background: #d4edda; border: 1px solid #a7d7b5; color: #155724; }
.verdict-banner.good  { background: #d1ecf1; border: 1px solid #abd7e2; color: #0c5460; }
.verdict-banner.okay  { background: #fff3cd; border: 1px solid #f0d97d; color: #856404; }
.verdict-banner.bad   { background: #f8d7da; border: 1px solid #f1b8bc; color: #721c24; }

.legend {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: #666;
  margin-top: 4px;
  flex-wrap: wrap;
}
.legend span { display: flex; align-items: center; gap: 4px; }
.legend .swatch { width: 12px; height: 12px; border-radius: 3px; }

.meta-footer {
  font-size: 11px;
  color: #888;
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px solid #eee;
}

/* --- Responsive --- */

@media (max-width: 640px) {
  .day-card .day-score { font-size: 26px; }
}
