/* Innovationshus Haslev — "Patina-konsol" theme.
   LCARS structural grammar (flat colour blocks, no shadows, pill end-caps,
   numbered panels) + Star Trek's transparent-computer values + solarpunk
   warmth, rendered in the house's own paper-and-patina palette — not a
   literal sci-fi skin. See compass_artifact_wf-90ef657d…md §2-3.
   Self-contained: system font stack only, no external requests (matches CSP
   and the brief's carbon budget — no webfont downloads to fetch/render). */

:root {
  /* ---- Patina-konsol raw palette (brief §3, contrast-checked) ---- */
  --paper:      #E6E7E1;
  --paper-2:    #EFEFEA;
  --paper-sink: #DADBD3;
  --ink:        #0E1A18;
  --line:       #C4C6BC;
  --verdigris:  #4E8C7D;  /* large text / UI borders only — never body text */
  --patina:     #2E5A50;  /* text-safe green, ≈6.3:1 on paper */
  --patina-deep:#1E3E37;
  --brass:      #A8802F;  /* decorative frame / large only — never body text */
  --brass-ink:  #6E5310;  /* text-safe brass, ≈4.9:1 on paper */
  --rust:       #8A4530;  /* text-safe warm accent, ≈5.6:1 on paper */
  --amber:      #B8781E;
  --canary-bg:  #FFF6D6;
  --sky-cool:   #2C6E8F;  /* telemetry/focus accent, ≈4.6:1 on paper */
  --ok:      #2E5A50;
  --warn:    #8A5A00;
  --danger:  #8A2E22;
  --info:    #2C6E8F;
  --ai-tint: #F3ECFB;     /* AI-generated-content surface (EU AI Act Art.50) */
  --ai-line: #6D4E8C;
  --font-display: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-body: Georgia, "Iowan Old Style", Cambria, "Times New Roman", serif;
  --font-mono: ui-monospace, "IBM Plex Mono", "SFMono-Regular", "Cascadia Mono", Consolas, monospace;

  /* ---- Semantic aliases used throughout the existing components ---- */
  --fg: var(--ink);
  --fg-muted: #4B5652;
  --bg: var(--paper);
  --bg-raised: var(--paper-2);
  --accent: var(--rust);
  --accent-ink: #ffffff;
  --accent-soft: var(--canary-bg);
  --forest: var(--patina);
  --border: var(--line);
  --border-strong: var(--brass);
  --focus: var(--sky-cool);
  --shadow: none; /* LCARS: flat colour blocks, no drop shadows */
  --radius: 4px;       /* --radius-panel from the brief — soft, not rounded-corporate */
  --radius-sm: 4px;
  --radius-pill: 999px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

body {
  font-family: var(--font-body);
  color: var(--fg);
  background: var(--bg);
  margin: 0;
  line-height: 1.6;
  font-size: 1.05rem;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

/* LCARS-derived numbered-panel identifier — decorative, honest nod to the
   org's §-numbered, N1–N4-numbered world (brief §2.3/§4). Use sparingly. */
.panel-id {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  background: var(--paper-sink);
  border-radius: var(--radius-pill);
  padding: 0.15rem 0.6rem;
  margin-bottom: 0.5rem;
}
h1 { font-size: clamp(1.9rem, 3.2vw, 2.6rem); margin: 0 0 0.5rem; }
h2 { font-size: 1.5rem; margin-top: 2.25rem; border-bottom: 2px solid var(--border); padding-bottom: 0.4rem; }
h3 { font-size: 1.15rem; }

p { color: var(--fg); }
p + p { margin-top: 0.9rem; }

a { color: var(--accent); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { color: #8f3d22; }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--forest);
  color: #fff;
  padding: 0.6rem 1.2rem;
  z-index: 100;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; top: 0; }

/* ── Header / nav ─────────────────────────────────────────────── */
header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(251, 248, 243, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
header nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
}
header nav ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
header nav ul li a {
  display: inline-block;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--fg);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
}
header nav ul li a:hover { background: var(--accent-soft); color: var(--accent); }

.brand {
  font-weight: 800;
  font-size: 1.2rem;
  text-decoration: none;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.brand::before {
  content: "";
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--accent), var(--forest));
}
.brand:hover { color: var(--accent); }

/* ── Layout ───────────────────────────────────────────────────── */
main {
  max-width: 46rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  min-height: 60vh;
}

footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  font-size: 0.88rem;
  color: var(--fg-muted);
}
footer p { max-width: 72rem; margin: 0 auto; }
footer a { color: var(--fg-muted); }
footer a:hover { color: var(--accent); }

/* ── Hero (forside) ──────────────────────────────────────────── */
.hero {
  margin: -2.5rem -1.5rem 2.5rem;
  padding: 3rem 1.5rem;
  background:
    radial-gradient(circle at 15% 20%, rgba(181, 80, 46, 0.14), transparent 55%),
    radial-gradient(circle at 85% 0%, rgba(47, 93, 78, 0.14), transparent 50%),
    var(--bg-raised);
  border-bottom: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
}
.hero h1 { margin-bottom: 0.75rem; }
.hero p { font-size: 1.15rem; color: var(--fg-muted); max-width: 38rem; }

/* ── Cards / sections ─────────────────────────────────────────── */
.card, section.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  margin-top: 1.25rem;
  position: relative; /* anchors .ai-info-details in the corner, see below */
}

/* AI-transparency info icon in a card's corner (model/embedder/energy) —
   plain <details>, not a hover-only tooltip: works with keyboard/touch,
   same reasoning as every other expandable bit on this site. */
.ai-info-details {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
}
.ai-info-details summary {
  cursor: pointer;
  list-style: none;
  font-size: 1.1rem;
  line-height: 1;
}
.ai-info-details summary::-webkit-details-marker { display: none; }
.ai-info-details summary::marker { content: ""; }
.ai-info-panel {
  position: absolute;
  top: 1.75rem;
  right: 0;
  z-index: 10;
  width: 16rem;
  max-width: 70vw;
}
.ai-info-panel p { margin: 0.25rem 0; }

/* ── Notices ──────────────────────────────────────────────────── */
.flash {
  background: #fdf1e0;
  border: 1px solid #e3b56a;
  border-left: 4px solid #c8862a;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-sm);
}
/* AI-generated-content surface — a distinct, persistent visual treatment
   per EU AI Act Art.50 + vedtægter §10 stk.5, not a generic info box
   (brief §4: "give AI surfaces a distinct persistent visual treatment"). */
.ai-banner {
  background: var(--ai-tint);
  border: 1px solid var(--ai-line);
  border-left: 4px solid var(--ai-line);
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

/* GPU job completion toasts (gpu-job-queue.js) — floats above whatever
   page the user has moved to since asking an AI console a question, since
   the answer may finish long after they left that page. Same AI-surface
   tint as .ai-banner (a success toast is showing AI-generated content). */
#gpu-job-toasts {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  left: 1rem;
  z-index: 200;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.6rem;
  max-width: 24rem;
  margin-left: auto;
}
.gpu-job-toast {
  position: relative;
  background: var(--ai-tint);
  border: 1px solid var(--ai-line);
  border-left: 4px solid var(--ai-line);
  border-radius: var(--radius-sm);
  padding: 0.85rem 2rem 0.85rem 1rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}
.gpu-job-toast--failed {
  background: #fdf1e0;
  border-color: #e3b56a;
  border-left-color: #c8862a;
}
.gpu-job-toast-title { font-weight: 600; margin: 0 0 0.5rem; }
.gpu-job-toast .button { margin: 0; display: inline-block; }
.gpu-job-toast-dismiss {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  background: transparent;
  color: var(--fg-muted);
  border: none;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0.3rem 0.5rem;
  margin: 0;
  cursor: pointer;
}
.gpu-job-toast-dismiss:hover { background: transparent; color: var(--fg); }
@media (max-width: 40rem) {
  #gpu-job-toasts { left: 0.6rem; right: 0.6rem; max-width: none; }
}

/* ── Forms ────────────────────────────────────────────────────── */
label { display: block; font-weight: 600; margin-top: 1.1rem; font-size: 0.95rem; }
input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%;
  max-width: 28rem;
  padding: 0.55rem 0.7rem;
  margin-top: 0.35rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg-raised);
  color: var(--fg);
}
input:hover, textarea:hover, select:hover { border-color: var(--accent); }

button, .button {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1.25rem;
  transition: background-color 0.15s ease, transform 0.05s ease;
}
button:hover, .button:hover { background: #8f3d22; }
button:active, .button:active { transform: translateY(1px); }

/* ── Tables ───────────────────────────────────────────────────── */
.table-scroll { overflow-x: auto; margin-top: 1rem; }
.table-scroll table { margin-top: 0; }
table {
  border-collapse: collapse;
  width: 100%;
  margin-top: 1rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
th, td { padding: 0.6rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
th {
  background: var(--accent-soft);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--fg-muted);
}
tbody tr:hover { background: #faf4ec; }

code {
  background: var(--accent-soft);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.92em;
}

nav[aria-label="Sideindhold"] ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}
nav[aria-label="Sideindhold"] a {
  text-decoration: none;
  background: var(--accent-soft);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
}

/* Dark palette — brief §3's own dark-mode values. Semantic aliases (--fg,
   --bg, --accent, etc.) are `var(--ink)`/`var(--paper)`/etc. and resolve
   live against whichever of these wins the cascade, so only the raw
   Patina-konsol tokens need overriding here — not every alias. */
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0E1A18; --paper-2: #142622; --paper-sink: #0A1412;
    --ink: #E6E7E1; --line: #2A3C37;
    --verdigris: #7FB5A6; --patina: #A9D2C6; --patina-deep: #C7E5DC;
    --brass: #D8A94A; --brass-ink: #E4BE6A; --rust: #D98A6E;
    --sky-cool: #6FB2D6; --ok: #A9D2C6; --warn: #E4BE6A; --danger: #E4917E;
    --ai-tint: #241C33; --ai-line: #9B7FC2;
    --accent-ink: #0E1A18;
    --shadow: none;
  }
  header { background: rgba(14, 26, 24, 0.9); }
  .flash { background: #3a2f18; border-color: #7a5a24; }
  tbody tr:hover { background: #16302a; }
  a:hover { color: var(--rust); }
  button:hover, .button:hover { filter: brightness(1.15); }
}

:root[data-theme="dark"] {
  --paper: #0E1A18; --paper-2: #142622; --paper-sink: #0A1412;
  --ink: #E6E7E1; --line: #2A3C37;
  --verdigris: #7FB5A6; --patina: #A9D2C6; --patina-deep: #C7E5DC;
  --brass: #D8A94A; --brass-ink: #E4BE6A; --rust: #D98A6E;
  --sky-cool: #6FB2D6; --ok: #A9D2C6; --warn: #E4BE6A; --danger: #E4917E;
  --ai-tint: #241C33; --ai-line: #9B7FC2;
  --accent-ink: #0E1A18;
  --shadow: none;
}
:root[data-theme="light"] {
  --paper: #E6E7E1; --paper-2: #EFEFEA; --paper-sink: #DADBD3;
  --ink: #0E1A18; --line: #C4C6BC;
  --verdigris: #4E8C7D; --patina: #2E5A50; --patina-deep: #1E3E37;
  --brass: #A8802F; --brass-ink: #6E5310; --rust: #8A4530;
  --sky-cool: #2C6E8F; --ok: #2E5A50; --warn: #8A5A00; --danger: #8A2E22;
  --ai-tint: #F3ECFB; --ai-line: #6D4E8C;
  --accent-ink: #ffffff;
  --shadow: none;
}

/* ── System monitor + cookie audit (footer widgets) ─────────────── */
#systemforbrug-widget {
  margin-top: 1rem;
  font-size: 0.85rem;
}
#systemforbrug-widget summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.3rem 0;
}
#systemforbrug-widget[open] summary { margin-bottom: 0.5rem; }
.sf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.sf-grid > div {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  padding: 0.6rem 0.75rem;
}
.sf-grid h4 { margin: 0 0 0.3rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--fg-muted); }
.sf-grid p { margin: 0.15rem 0; }
.sf-note { font-size: 0.78rem; color: var(--fg-muted); font-style: italic; }
.sf-core { display: flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; margin: 0.15rem 0; }
.sf-core meter { flex: 1; height: 0.6rem; }
.sf-chart-controls { margin: 0.75rem 0 0.25rem; }
.sf-chart-controls button {
  background: var(--bg-raised);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  margin: 0;
}
#sf-chart-host svg { width: 100%; height: auto; max-width: 30rem; }
#sf-table { margin-top: 0.75rem; font-size: 0.8rem; }

/* ── /power-usage (full-page monitor) ────────────────────────────── */
#pu-chart-host svg, #pu-recent-chart-host svg { width: 100%; height: auto; max-width: 45rem; }
#pu-table { margin-top: 0.75rem; font-size: 0.85rem; }
pre.pu-code {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  padding: 0.75rem;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.5;
}
pre.pu-code code { background: none; padding: 0; }
#cookie-audit-btn {
  margin-top: 0.75rem;
  background: var(--bg-raised);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

/* ── Cookie audit modal ──────────────────────────────────────────── */
#cookie-audit-dialog {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius, 10px);
  padding: 0;
  max-width: 36rem;
  width: 92%;
  background: var(--bg);
  color: var(--fg);
}
#cookie-audit-dialog::backdrop { background: rgba(0,0,0,0.5); }
#cookie-audit-dialog .ca-header { padding: 1.25rem 1.5rem 0.5rem; }
#cookie-audit-dialog .ca-body { padding: 0 1.5rem 1.5rem; max-height: 60vh; overflow-y: auto; }
#cookie-audit-dialog .ca-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; gap: 0.75rem; justify-content: flex-end; }
.ca-score { font-size: 2rem; font-weight: 800; }
.ca-score.ca-good { color: var(--ok, #2E5A50); }
.ca-score.ca-warn { color: var(--warn, #8A5A00); }
.ca-score.ca-bad { color: var(--danger, #8A2E22); }
.ca-finding { border: 1px solid var(--border); border-left: 4px solid var(--border-strong); border-radius: var(--radius-sm, 6px); padding: 0.6rem 0.9rem; margin-bottom: 0.6rem; }
.ca-finding.ca-risk-hoej { border-left-color: var(--danger, #8A2E22); }
.ca-finding.ca-risk-mellem { border-left-color: var(--warn, #8A5A00); }
.ca-finding.ca-risk-lav { border-left-color: var(--ok, #2E5A50); }
.ca-risk-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; }
.ca-tabs { display: flex; gap: 0.5rem; margin: 0.75rem 0; }
.ca-tabs button[aria-selected="true"] { text-decoration: underline; }
pre.ca-raw { background: var(--bg-raised); border: 1px solid var(--border); padding: 0.75rem; overflow-x: auto; font-size: 0.78rem; }
