/* Hackviz — storskjerm (1080p+) og mobil. Immersive Zone-tema (indigo).
   Fonter self-hostes (CSP: font-src faller tilbake til 'self'). */

@font-face {
  font-family: "Fira Code";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/firacode-400.woff2") format("woff2");
}
@font-face {
  font-family: "Fira Code";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/firacode-600.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/inter-400.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/inter-600.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/inter-700.woff2") format("woff2");
}

:root {
  --bg: #111424;        /* dypeste bakgrunn */
  --panel: #1a1e30;     /* panelbakgrunn */
  --border: #2a304d;    /* rammer/skiller */
  --text: #9ba3c9;      /* standardtekst */
  --dim: #6b73a0;       /* dempet tekst/tid */
  --heading: #7d95ff;   /* blå overskrifter */
  --accent: #4a69ff;    /* lysere blå aksent */
  --green: #4ade80;     /* logg/suksess */
  --yellow: #fbbf24;    /* varsel */
  --red: #f87171;       /* feil */
  --mono: "Fira Code", "Cascadia Code", "Consolas", monospace;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
}

body { display: flex; flex-direction: column; }

/* Skreddersydd scrollbar i panelene */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* Fasebanner */
#phase-banner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.8rem 1.4rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
#phase-text { flex: 1; min-width: 0; }
#phase-title {
  font-size: clamp(1.1rem, 2.6vw, 2.2rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--heading);
}
#phase-desc {
  color: var(--text);
  opacity: 0.8;
  font-family: var(--sans);
  font-size: clamp(0.8rem, 1.5vw, 1.15rem);
}
#phase-progress-wrap {
  width: 22vw;
  max-width: 360px;
  height: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
#phase-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(74, 105, 255, 0.7);
  transition: width 0.8s ease;
}
#qr {
  width: clamp(56px, 7vw, 104px);
  height: auto;
  image-rendering: pixelated;
  background: #fff;
  padding: 4px;
  border: 2px solid var(--border);
  border-radius: 8px;
}

/* Hovedlayout: kontor + feed side ved side, stables på mobil */
#layout {
  flex: 1;
  display: flex;
  gap: 0.9rem;
  padding: 0.9rem;
  min-height: 0;
}
#office-wrap {
  flex: 2.2;
  min-width: 0;
  background: #e9ecf2;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
#office { image-rendering: pixelated; width: 100%; height: 100%; }

#feed-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
#code-section, #activity-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
#code-section { flex: 1.2; }
#feed-wrap h2 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--heading);
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: rgba(17, 20, 36, 0.5);
}
#code-feed, #activity-feed {
  flex: 1;
  overflow: hidden;
  padding: 0.8rem 0.9rem;
}
#code-feed {
  font-size: clamp(0.65rem, 1.1vw, 0.85rem);
  line-height: 1.45;
}

/* Kodefeed */
.feed-entry { margin-bottom: 0.8rem; animation: slide-in 0.4s ease; }
.feed-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--heading);
  font-size: 0.85em;
  font-weight: 600;
}
.feed-meta time { color: var(--dim); font-weight: 400; margin-left: auto; }
.feed-avatar {
  width: 1.4em;
  height: 1.4em;
  image-rendering: pixelated;
  border-radius: 3px;
  flex-shrink: 0;
}
.feed-code {
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--green);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.35rem 0.55rem;
  margin-top: 0.25rem;
  max-height: 9em;
  overflow: hidden;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.1);
}

/* Aktivitetsfeed (menneskelesbar, Inter) */
#activity-feed { font-family: var(--sans); }
.act-entry {
  margin-bottom: 0.4rem;
  animation: slide-in 0.4s ease;
  font-size: clamp(0.72rem, 1.15vw, 0.92rem);
  line-height: 1.4;
  display: flex;
  gap: 0.5rem;
}
.act-entry time { color: var(--dim); flex-shrink: 0; font-family: var(--mono); }
.act-text { color: var(--text); }
.act-lifecycle .act-text { color: var(--yellow); }
.act-phase .act-text { color: var(--heading); }
.act-status .act-text { color: var(--green); }

@keyframes slide-in {
  from { transform: translateY(-8px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* Statuslinje */
#statusbar {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  padding: 0.4rem 1.4rem;
  background: var(--panel);
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--dim);
}
.conn-ok::before { content: "● "; color: var(--green); }
.conn-bad::before { content: "● "; color: var(--red); }
.statusbar-links { margin-left: auto; }
.statusbar-links a { color: var(--accent); text-decoration: none; }
.statusbar-links a:hover { text-decoration: underline; }

/* Mobil: stable vertikalt, QR skjules (du er jo allerede her) */
@media (max-width: 800px) {
  #layout { flex-direction: column; }
  #office-wrap { flex: 1.4; min-height: 40vh; }
  #feed-wrap { flex: 1; min-height: 30vh; }
  #qr { display: none; }
  #phase-progress-wrap { display: none; }
}

/* Dokumentsider (/manual). Ingen inline-stil, alt her av hensyn til CSP. */
.doc {
  max-width: 880px;
  margin: 0 auto;
  padding: 2rem 1.4rem 4rem;
  line-height: 1.6;
}
.doc-nav { display: flex; justify-content: space-between; margin-bottom: 1.5rem; }
.doc-nav a { color: var(--accent); text-decoration: none; font-size: 0.9rem; }
.doc-nav a:hover { text-decoration: underline; }
.doc h1 { color: var(--heading); font-size: 1.8rem; margin-bottom: 0.6rem; }
.doc h2 {
  margin: 2rem 0 0.6rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 1.25rem;
}
.doc h3 { margin: 1.3rem 0 0.4rem; font-size: 1.05rem; color: var(--green); }
.doc p, .doc li { color: var(--text); }
.doc-lead { color: var(--dim); font-size: 1.05rem; }
.doc ul { margin: 0.4rem 0 0.4rem 1.4rem; }
.doc code {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  font-size: 0.9em;
  color: var(--yellow);
}
.doc-code {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 0.8rem 1rem;
  margin: 0.5rem 0 1rem;
  overflow-x: auto;
  white-space: pre;
  color: var(--green);
  font-size: 0.85rem;
  line-height: 1.45;
}
.doc-chips { list-style: none; margin-left: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.doc-chips li { margin: 0; }
.doc a { color: var(--accent); }
