/* ui-style-dark-panel-grid v1.1. Tokens as in website_skogvoll_com_builder/css/tokens.css,
   plus chart tokens. Shared by every page on vidar.skogvoll.com (moved from website_goatcounter_builder 2026-11-16). */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(../fonts/inter-normal-400-800-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(../fonts/inter-normal-400-800-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #FAF7F2;
  --surface: #FFFFFF;
  --surface-hover: #F2EDE4;
  --border: rgba(20, 16, 10, 0.10);
  --border-strong: rgba(20, 16, 10, 0.18);
  --accent: #C1710B;
  --accent-grad: linear-gradient(135deg, #F2A65A, #F6C89A);
  --text: #1A1714;
  --text-muted: #6B6355;
  --success: #16A34A;
  --danger: #DC2626;
  --radius: 18px;
  --radius-sm: 10px;
  --radius-pill: 9999px;

  /* Chart chrome */
  --grid: #ECE7DE;
  --axis: #C9C1B3;

  /* One fixed colour per site, never by rank (dataviz reference palette, slots 1-6). */
  --s-aiskilltrees: #2a78d6;
  --s-laeremedki: #eb6834;
  --s-skolesim: #1baf7a;
  --s-skogvoll: #eda100;
  --s-tavela: #e87ba4;
  --s-underkappa: #008300;
  --s-all: #8E8678;
}

html[data-theme="dark"] {
  --bg: #0A0908;
  --surface: #141210;
  --surface-hover: #1B1814;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.20);
  --accent: #E8A15E;
  --text: #F5F3EF;
  --text-muted: #9AA0B4;
  --success: #22C55E;
  --danger: #EF5350;
  --grid: #24211D;
  --axis: #3A3631;
  --s-aiskilltrees: #3987e5;
  --s-laeremedki: #d95926;
  --s-skolesim: #199e70;
  --s-skogvoll: #c98500;
  --s-tavela: #d55181;
  --s-underkappa: #008300;
  --s-all: #8A8F9E;
}

html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}

button, a { font: inherit; color: inherit; }
a { text-decoration: none; }
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; top: -100px; left: 1rem;
  background: var(--accent); color: #14100A;
  padding: 0.6rem 1rem; border-radius: 8px; font-weight: 600; z-index: 100;
}
.skip-link:focus { top: 1rem; }

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 16px;
  max-width: 1200px; margin: 0 auto; padding: 24px 16px 8px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px;
  border-radius: var(--radius-sm); background: var(--accent-grad); color: #14100A; font-weight: 800;
}
.updated { margin-left: auto; font-size: 14px; color: var(--text-muted); }
.theme-toggle {
  display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: var(--radius-pill); border: 1px solid var(--border);
  background: var(--surface); cursor: pointer;
}
.theme-toggle:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

main { max-width: 1200px; margin: 0 auto; padding: 8px 16px 64px; display: grid; gap: 16px; }

/* Page head: back link, title, and the period filter that scopes everything below */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.page-head h1 { font-size: 32px; font-weight: 800; line-height: 1.2; margin-right: auto; }
.back {
  font-size: 14px; color: var(--text-muted);
  border-radius: 4px; width: fit-content; flex-basis: 100%;
}
.back:hover { color: var(--accent); }
.back[hidden] { display: none; }
.detail { display: grid; gap: 16px; }
.detail[hidden] { display: none; }

/* Overview: equal site cards, the whole card is the link. Was a fixed 2 x 2
   for four sites; from five (tavela.se, 2026-10-27) it is 3 across on a
   laptop, 2 on a tablet, 1 on a phone (the 600px rule below). */
.site-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (min-width: 1024px) { .site-grid { grid-template-columns: repeat(3, 1fr); } }
.site-grid[hidden] { display: none; }
.site-card {
  display: grid; gap: 4px; padding: 24px; min-width: 0; align-content: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color 0.15s, background 0.15s;
}
.site-card:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.site-card:hover .site-arrow { color: var(--accent); transform: translateX(3px); }
.site-card:focus-visible { outline-offset: 2px; border-radius: var(--radius); }
.site-name { font-weight: 600; color: var(--text); }
.site-arrow { margin-left: auto; font-size: 18px; color: var(--text-muted); transition: transform 0.15s; }
.site-value { font-size: 48px; font-weight: 800; line-height: 1.1; margin-top: 8px; }
.site-unit { font-size: 14px; color: var(--text-muted); }
.spark-wrap { position: relative; margin-top: 28px; }
.spark { display: block; width: 100%; height: 56px; }
.spark-peak {
  position: absolute; bottom: 100%; margin-bottom: 2px;
  font-size: 12px; font-weight: 600; line-height: 1; color: var(--text-muted);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* The column for today: the day isn't over, so it breathes slowly instead of
   standing still. Without motion it is just paler, and the tooltip and table say it. */
@keyframes pending { 50% { opacity: 0.5; } }
.bar.pending, .spark-bar.pending { animation: pending 2.4s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .bar.pending, .spark-bar.pending { animation: none; opacity: 0.6; }
}
.seg {
  display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px;
  border: 1px solid var(--border); border-radius: 22px; background: var(--surface);
}
.seg button {
  border: 0; background: transparent; cursor: pointer;
  padding: 6px 14px; border-radius: var(--radius-pill); font-size: 14px; color: var(--text-muted);
  display: inline-flex; align-items: center; gap: 8px;
}
.seg button:hover { background: var(--surface-hover); color: var(--text); }
.seg button[aria-checked="true"] { background: var(--text); color: var(--bg); font-weight: 600; }
.swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; }

.notice {
  padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); font-size: 14px;
}

/* Bento grid: KPI tiles uniform, the trend panel wide, two equal panels below */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tile, .panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.tile { padding: 20px; display: grid; gap: 4px; }
.tile-label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-muted); }
.tile-value { font-size: 32px; font-weight: 700; line-height: 1.2; }
.tile-delta { font-size: 14px; color: var(--text-muted); }
.tile-delta .up { color: var(--success); font-weight: 600; }
.tile-delta .down { color: var(--danger); font-weight: 600; }
.tile-error { font-size: 14px; color: var(--danger); }

.panel { padding: 20px; min-width: 0; }
.panel-head { margin-bottom: 12px; }
.panel h2 { font-size: 20px; font-weight: 700; }
.panel-sub { font-size: 14px; color: var(--text-muted); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; color: var(--text-muted); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: inherit; font-size: 12px; fill: var(--text-muted); font-variant-numeric: tabular-nums; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .hover-band { fill: var(--surface-hover); }
.chart .hit { fill: transparent; cursor: pointer; }

/* Horizontal bar lists: value at the tip, label above the bar */
.bars { list-style: none; display: grid; gap: 10px; }
.bars li { display: grid; gap: 4px; padding: 2px 4px; border-radius: 6px; }
.bars li:hover { background: var(--surface-hover); }
.bar-label { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.bar-name { overflow-wrap: anywhere; }
.bar-name small { color: var(--text-muted); margin-right: 6px; }
.bar-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.bar-track { height: 8px; }
.bar-fill { height: 8px; border-radius: 0 4px 4px 0; min-width: 2px; }
.empty, .hidden-note { font-size: 14px; color: var(--text-muted); }
.hidden-note { margin-top: 12px; }

.table-view { margin-top: 12px; font-size: 14px; }
.table-view summary { cursor: pointer; color: var(--text-muted); width: fit-content; }
.table-scroll { overflow-x: auto; margin-top: 8px; }
table { border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 4px 12px 4px 0; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { font-weight: 600; }

.tooltip {
  position: fixed; z-index: 50; pointer-events: none;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 8px 12px; font-size: 13px; min-width: 160px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
}
.tooltip .tt-title { color: var(--text-muted); margin-bottom: 4px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; }
.tooltip .tt-row i { width: 10px; height: 10px; border-radius: 2px; }
.tooltip .tt-row b { font-variant-numeric: tabular-nums; min-width: 3ch; }
.tooltip .tt-row span { color: var(--text-muted); }

@media (max-width: 600px) {
  .topbar { flex-wrap: wrap; }
  .updated { order: 3; width: 100%; margin-left: 0; }
  .theme-toggle { margin-left: auto; }
  .tile-value { font-size: 28px; }
  .site-grid { grid-template-columns: 1fr; }
  .site-value { font-size: 40px; }
  .page-head h1 { font-size: 24px; }
}

/* ---- vidar.skogvoll.com: innlogging og forside (lagt til 2026-11-16) ---- */
a.brand { border-radius: var(--radius-sm); }
.auth { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 14px; }
.auth-name { color: var(--text-muted); }
.btn {
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  padding: 8px 16px; border-radius: var(--radius-pill); font-size: 14px; font-weight: 600;
}
.btn:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.btn-primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-primary:hover { background: var(--text); opacity: 0.88; }
.login-panel { display: grid; gap: 12px; justify-items: start; max-width: 480px; padding: 24px; }
.login-panel[hidden], .notice[hidden] { display: none; }
.app-head { display: flex; align-items: center; gap: 8px; }
.app-desc { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.app-card.is-soon { opacity: 0.6; }
.app-card.is-soon:hover { border-color: var(--border); background: var(--surface); }
.soon {
  margin-left: auto; font-size: 12px; font-weight: 600; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 2px 10px;
}
.notice .btn { margin-left: 8px; }
.updated + .auth { margin-left: 0; }
