/* =====================================================================
   School Weather Dashboard – felles stilark
   Glassmorphism, mørk modus som standard, lys modus som valg.
   Skolens farger kommer fra config/site.json via --primary og --secondary.
   ===================================================================== */

/* ---------- Designvariabler ---------- */
:root {
  --primary: #2563eb;
  --secondary: #60a5fa;
  --primary-rgb: 37, 99, 235;
  --secondary-rgb: 96, 165, 250;

  --bg: #0a1020;
  --bg-2: #101a30;
  --text: #e9eefb;
  --text-muted: #a3b2cf;
  --text-faint: #71819f;
  --card: rgba(255, 255, 255, 0.06);
  --card-hover: rgba(255, 255, 255, 0.09);
  --card-strong: rgba(255, 255, 255, 0.11);
  --card-solid: #141e34;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --grid: rgba(255, 255, 255, 0.08);
  --input-bg: rgba(255, 255, 255, 0.07);

  --ok: #34d399;
  --warn: #fbbf24;
  --error: #f87171;
  --info: #60a5fa;

  --c-temp: #fb923c;
  --c-temp-min: #60a5fa;
  --c-humidity: #38bdf8;
  --c-dew: #22d3ee;
  --c-wind: #4ade80;
  --c-gust: #bef264;
  --c-dir: #facc15;
  --c-rain: #60a5fa;
  --c-pressure: #a78bfa;
  --c-uv: #f472b6;
  --c-solar: #fbbf24;
  --c-air: #2dd4bf;
  --c-soil: #a3e635;
  --c-lightning: #fde047;

  --radius: 20px;
  --radius-sm: 12px;
  --gap: 18px;
  --blur: 18px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  color-scheme: dark;
}

/* Lys modus: valgt manuelt, eller "auto" når systemet bruker lyst tema */
:root[data-theme="light"] {
  --bg: #eef3fb;
  --bg-2: #dfe8f6;
  --text: #0f1b33;
  --text-muted: #4a5b7a;
  --text-faint: #6c7c99;
  --card: rgba(255, 255, 255, 0.62);
  --card-hover: rgba(255, 255, 255, 0.78);
  --card-strong: rgba(255, 255, 255, 0.85);
  --card-solid: #ffffff;
  --border: rgba(15, 27, 51, 0.10);
  --border-strong: rgba(15, 27, 51, 0.18);
  --shadow: 0 12px 34px rgba(15, 27, 51, 0.12);
  --grid: rgba(15, 27, 51, 0.08);
  --input-bg: rgba(255, 255, 255, 0.9);
  --ok: #059669;
  --warn: #b45309;
  --error: #dc2626;
  --info: #2563eb;
  --c-temp: #ea580c;
  --c-temp-min: #2563eb;
  --c-humidity: #0284c7;
  --c-dew: #0891b2;
  --c-wind: #16a34a;
  --c-gust: #65a30d;
  --c-dir: #ca8a04;
  --c-rain: #2563eb;
  --c-pressure: #7c3aed;
  --c-uv: #db2777;
  --c-solar: #d97706;
  --c-air: #0d9488;
  --c-soil: #4d7c0f;
  --c-lightning: #a16207;
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --bg: #eef3fb;
    --bg-2: #dfe8f6;
    --text: #0f1b33;
    --text-muted: #4a5b7a;
    --text-faint: #6c7c99;
    --card: rgba(255, 255, 255, 0.62);
    --card-hover: rgba(255, 255, 255, 0.78);
    --card-strong: rgba(255, 255, 255, 0.85);
    --card-solid: #ffffff;
    --border: rgba(15, 27, 51, 0.10);
    --border-strong: rgba(15, 27, 51, 0.18);
    --shadow: 0 12px 34px rgba(15, 27, 51, 0.12);
    --grid: rgba(15, 27, 51, 0.08);
    --input-bg: rgba(255, 255, 255, 0.9);
    --ok: #059669;
    --warn: #b45309;
    --error: #dc2626;
    --info: #2563eb;
    --c-temp: #ea580c;
    --c-temp-min: #2563eb;
    --c-humidity: #0284c7;
    --c-dew: #0891b2;
    --c-wind: #16a34a;
    --c-gust: #65a30d;
    --c-dir: #ca8a04;
    --c-rain: #2563eb;
    --c-pressure: #7c3aed;
    --c-uv: #db2777;
    --c-solar: #d97706;
    --c-air: #0d9488;
    --c-soil: #4d7c0f;
    --c-lightning: #a16207;
    color-scheme: light;
  }
}

/* ---------- Grunnoppsett ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Skjulte elementer skal alltid være skjult, også når en klasse setter display */
[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* Bakgrunn med skolens farger (fast lag gir bedre ytelse enn background-attachment) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1100px 620px at 8% -12%, rgba(var(--primary-rgb), 0.38), transparent 62%),
    radial-gradient(900px 560px at 108% 4%, rgba(var(--secondary-rgb), 0.26), transparent 60%),
    radial-gradient(800px 600px at 50% 120%, rgba(var(--primary-rgb), 0.18), transparent 60%),
    linear-gradient(165deg, var(--bg) 0%, var(--bg-2) 100%);
}

img,
svg,
canvas {
  max-width: 100%;
}

a {
  color: var(--secondary);
  text-underline-offset: 3px;
}

:root[data-theme="light"] a {
  color: var(--primary);
}

h1,
h2,
h3,
h4 {
  line-height: 1.2;
  margin: 0 0 0.5em;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(1.6rem, 2.5vw + 1rem, 2.4rem); }
h2 { font-size: clamp(1.25rem, 1vw + 1rem, 1.6rem); }
h3 { font-size: 1.1rem; }

p {
  margin: 0 0 1em;
}

code,
pre,
kbd {
  font-family: var(--mono);
  font-size: 0.92em;
}

code {
  background: var(--card-strong);
  padding: 0.1em 0.4em;
  border-radius: 6px;
}

pre {
  background: rgba(0, 0, 0, 0.35);
  color: #e5edff;
  padding: 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  border: 1px solid var(--border);
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
}

.skip-link:focus {
  left: 12px;
}

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

.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  vertical-align: -0.2em;
}

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: 0.875rem; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

/* ---------- Glass ---------- */
.glass,
.card {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(140%);
  backdrop-filter: blur(var(--blur)) saturate(140%);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass,
  .card {
    background: var(--card-solid);
  }
}

/* ---------- Topp og meny ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px max(16px, env(safe-area-inset-left)) 10px max(16px, env(safe-area-inset-right));
  border-width: 0 0 1px;
  border-radius: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  height: 42px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  flex: none;
}

.brand-icon {
  width: 42px;
  height: 42px;
  padding: 8px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  flex: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-school {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-title {
  font-weight: 700;
  font-size: 1.08rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.site-nav {
  position: sticky;
  top: 63px;
  z-index: 19;
  padding: 8px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
  background: rgba(var(--primary-rgb), 0.05);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.site-nav::-webkit-scrollbar {
  display: none;
}

.site-nav ul {
  display: flex;
  gap: 6px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
  max-width: 1400px;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  font-weight: 500;
  font-size: 0.95rem;
  transition: background 0.2s, color 0.2s;
}

.site-nav a:hover {
  background: var(--card-hover);
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.9), rgba(var(--secondary-rgb), 0.85));
  color: #fff;
}

/* ---------- Knapper og skjema ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--card-strong);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
}

.btn:hover {
  background: var(--card-hover);
  border-color: var(--secondary);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-danger {
  border-color: rgba(248, 113, 113, 0.5);
  color: var(--error);
}

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.9rem;
}

.btn-icon {
  width: 44px;
  padding: 0;
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--border);
}

.segmented button {
  min-height: 38px;
  padding: 6px 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
}

.segmented button:hover {
  color: var(--text);
}

.segmented button[aria-pressed="true"] {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label,
.field .label {
  font-weight: 600;
  font-size: 0.92rem;
}

.field .hint {
  font-size: 0.82rem;
  color: var(--text-faint);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="file"],
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
}

input[type="color"] {
  width: 64px;
  height: 44px;
  padding: 4px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--input-bg);
  cursor: pointer;
}

select option {
  color: #0f1b33;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.station-select {
  min-height: 40px;
  width: auto;
  max-width: 200px;
  padding: 6px 10px;
}

/* ---------- Innhold ---------- */
.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px max(16px, env(safe-area-inset-left)) 40px max(16px, env(safe-area-inset-right));
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.page-header h1 {
  margin-bottom: 4px;
}

.page-header .lead {
  margin: 0;
  color: var(--text-muted);
  max-width: 70ch;
}

.section {
  margin-top: 32px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.grid {
  display: grid;
  gap: var(--gap);
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }

.card {
  position: relative;
  padding: 22px;
  border-radius: var(--radius);
  min-width: 0;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.card-title .icon {
  width: 22px;
  height: 22px;
}

.card h2,
.card h3 {
  margin-top: 0;
}

/* ---------- Målekort på dashboardet ---------- */
.metric {
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.25s, background 0.25s;
}

.metric:hover {
  transform: translateY(-3px);
  background: var(--card-hover);
}

.metric-head {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.metric-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(var(--accent-rgb, var(--primary-rgb)), 0.16);
  color: var(--accent, var(--secondary));
  flex: none;
}

.metric-icon .icon {
  width: 24px;
  height: 24px;
}

.metric-value {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 6px;
  font-size: clamp(2.2rem, 2.2vw + 1.4rem, 3.2rem);
  font-weight: 750;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--accent, var(--text));
  font-variant-numeric: tabular-nums;
}

.metric-unit {
  font-size: 0.42em;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0;
}

.metric-sub {
  min-height: 1.4em;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.metric.is-missing .metric-value {
  color: var(--text-faint);
}

.accent-temp { --accent: var(--c-temp); --accent-rgb: 251, 146, 60; }
.accent-humidity { --accent: var(--c-humidity); --accent-rgb: 56, 189, 248; }
.accent-wind { --accent: var(--c-wind); --accent-rgb: 74, 222, 128; }
.accent-dir { --accent: var(--c-dir); --accent-rgb: 250, 204, 21; }
.accent-rain { --accent: var(--c-rain); --accent-rgb: 96, 165, 250; }
.accent-pressure { --accent: var(--c-pressure); --accent-rgb: 167, 139, 250; }
.accent-uv { --accent: var(--c-uv); --accent-rgb: 244, 114, 182; }
.accent-solar { --accent: var(--c-solar); --accent-rgb: 251, 191, 36; }
.accent-air { --accent: var(--c-air); --accent-rgb: 45, 212, 191; }
.accent-soil { --accent: var(--c-soil); --accent-rgb: 163, 230, 53; }
.accent-lightning { --accent: var(--c-lightning); --accent-rgb: 253, 224, 71; }
.accent-time { --accent: var(--text); --accent-rgb: var(--secondary-rgb); }

.metric-value.is-text {
  font-size: clamp(1.6rem, 1.4vw + 1.2rem, 2.3rem);
}

.compass {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  display: grid;
  place-items: center;
}

.compass::before {
  content: "N";
  position: absolute;
  top: -2px;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-faint);
}

.compass .icon {
  width: 28px;
  height: 28px;
  color: var(--c-dir);
}

.compass [data-compass] {
  transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* UV-farger etter WHO */
.uv-low { color: #4ade80; }
.uv-moderate { color: #facc15; }
.uv-high { color: #fb923c; }
.uv-very-high { color: #f87171; }
.uv-extreme { color: #c084fc; }

/* ---------- Status og merker ---------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 0.9rem;
  color: var(--text-muted);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-faint);
  flex: none;
}

.dot-ok { background: var(--ok); box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.18); }
.dot-warning { background: var(--warn); box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.18); }
.dot-error { background: var(--error); box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.18); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid currentColor;
  white-space: nowrap;
}

.badge-ok { color: var(--ok); }
.badge-warning { color: var(--warn); }
.badge-error { color: var(--error); }
.badge-muted { color: var(--text-faint); }
.badge-info { color: var(--info); }

.alert {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 18px;
  margin-bottom: 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
}

.alert .icon {
  margin-top: 2px;
}

.alert p:last-child {
  margin-bottom: 0;
}

.alert-info { border-color: rgba(96, 165, 250, 0.45); }
.alert-info .icon { color: var(--info); }
.alert-warning { border-color: rgba(251, 191, 36, 0.5); }
.alert-warning .icon { color: var(--warn); }
.alert-error { border-color: rgba(248, 113, 113, 0.5); }
.alert-error .icon { color: var(--error); }
.alert-success { border-color: rgba(52, 211, 153, 0.5); }
.alert-success .icon { color: var(--ok); }

.estimate-banner {
  border-width: 2px;
  border-style: dashed;
  font-weight: 600;
}

/* ---------- Grafer ---------- */
.chart-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chart-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chart-header h2,
.chart-header h3 {
  margin: 0;
}

.chart-box {
  position: relative;
  height: 300px;
  width: 100%;
}

.chart-box.tall { height: 380px; }
.chart-box.short { height: 220px; }
.chart-box.square { height: min(420px, 80vw); }

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--text-faint);
  padding: 20px;
}

/* ---------- Tabeller ---------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

table.data th,
table.data td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

table.data th {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

table.data td.num,
table.data th.num {
  text-align: right;
  white-space: nowrap;
}

table.data tbody tr:hover {
  background: var(--card-hover);
}

table.data tr.is-highlight td {
  background: rgba(var(--primary-rgb), 0.14);
}

/* ---------- Nøkkeltall ---------- */
.kv {
  display: grid;
  grid-template-columns: minmax(120px, max-content) 1fr;
  gap: 8px 18px;
  margin: 0;
}

.kv dt {
  color: var(--text-muted);
}

.kv dd {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.big-number {
  font-size: clamp(1.8rem, 1.5vw + 1.2rem, 2.6rem);
  font-weight: 750;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.record-card .big-number {
  margin: 4px 0;
}

/* ---------- Modulfliser ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 14px;
}

.tile {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 18px;
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  transition: transform 0.2s, background 0.2s;
}

.tile:hover {
  transform: translateY(-3px);
  background: var(--card-hover);
}

.tile .metric-icon {
  width: 42px;
  height: 42px;
}

.tile strong {
  display: block;
  margin-bottom: 2px;
}

.tile span {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ---------- Tekstsider (undervisning) ---------- */
.prose {
  max-width: 78ch;
}

.prose h2 {
  margin-top: 1.6em;
}

.prose h3 {
  margin-top: 1.3em;
}

.prose ul,
.prose ol {
  padding-left: 1.3em;
}

.prose li {
  margin-bottom: 0.35em;
}

.fact {
  padding: 14px 16px;
  border-left: 4px solid var(--secondary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: rgba(var(--secondary-rgb), 0.10);
  margin: 12px 0;
}

.topic-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
}

.chip:hover {
  border-color: var(--secondary);
}

details.solution {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-strong);
  background: rgba(var(--primary-rgb), 0.06);
}

details.solution summary {
  cursor: pointer;
  font-weight: 700;
}

.live-value {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 12px;
  background: var(--card-strong);
  font-weight: 700;
  font-size: 1.2rem;
}

/* ---------- Tomme tilstander og innlasting ---------- */
.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty .icon {
  width: 42px;
  height: 42px;
  margin-bottom: 10px;
  color: var(--text-faint);
}

.skeleton {
  color: transparent !important;
  background: linear-gradient(90deg, var(--card) 25%, var(--card-strong) 50%, var(--card) 75%);
  background-size: 200% 100%;
  border-radius: 8px;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* ---------- Bunn ---------- */
.site-footer {
  padding: 24px 16px 36px;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.9rem;
}

.site-footer a {
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
  margin-top: 8px;
}

/* ---------- Innlogging ---------- */
.auth-card {
  max-width: 420px;
  margin: 40px auto;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-menu form {
  margin: 0;
}

.user-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ---------- Kioskmodus (?kiosk=1) for enkle infoskjermer ---------- */
body.kiosk {
  cursor: none;
}

body.kiosk .site-nav,
body.kiosk .header-actions,
body.kiosk .tiles-section,
body.kiosk .footer-links {
  display: none;
}

body.kiosk .metric-value {
  font-size: clamp(2.6rem, 3.2vw + 1rem, 5rem);
}

/* ---------- Mobil ---------- */
@media (max-width: 760px) {
  .site-nav {
    top: 57px;
  }

  .brand-logo,
  .brand-icon {
    height: 36px;
  }

  .brand-icon {
    width: 36px;
    padding: 6px;
  }

  .brand-school {
    display: none;
  }

  .user-name {
    display: none;
  }

  .container {
    padding-top: 16px;
  }

  .card {
    padding: 16px;
  }

  .grid-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .metric-head {
    font-size: 0.9rem;
  }

  .metric-icon {
    width: 36px;
    height: 36px;
    border-radius: 11px;
  }

  .compass {
    width: 42px;
    height: 42px;
    top: 12px;
    right: 12px;
  }

  .compass .icon {
    width: 22px;
    height: 22px;
  }

  .chart-box {
    height: 250px;
  }

  .kv {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .kv dd {
    margin-bottom: 8px;
  }
}

@media (max-width: 380px) {
  .grid-cards {
    grid-template-columns: 1fr;
  }
}

/* ---------- Store skjermer og TV ---------- */
@media (min-width: 2200px) {
  html {
    font-size: 125%;
  }

  .container {
    max-width: 2000px;
  }
}

/* ---------- Tilgjengelighet ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  body::before,
  .site-nav,
  .header-actions,
  .site-footer {
    display: none;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ccc;
    background: #fff;
    color: #000;
  }
}
