:root {
  --bg: #0f1113;
  --panel: #171a1d;
  --border: #2a2f33;
  --text: #e6e0d4;
  --text-soft: #d8d2c7;
  --text-muted: #888;
  --caption: #a7a094;
  --meta: #8a8478;
  --accent: #c8a75a;
  --accent-hover: #e0c878;
  --active: #a88b52;
  --side-active-bg: #2a2f33;
  --button-bg: #2a2f33;
  --button-text: #e6e0d4;
  --font-main: Georgia, serif;
}

body {
  margin: 0;
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
}

.site-header {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  min-height: 84px;
  padding: 0 16px;
  position: relative;
  overflow: hidden;
}

.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.18;
  pointer-events: none;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}

.site-header::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(255,255,255,0.03),
    rgba(0,0,0,0.10)
  );
}

.header-left,
.header-right {
  width: 160px;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 1;
}

.header-left {
  justify-content: flex-start;
}

.header-right {
  justify-content: flex-end;
}

.header-inner {
  flex: 1;
  text-align: center;
  position: relative;
  z-index: 1;
}

.branding h1 {
  margin: 0;
}

.branding .tagline {
  margin: 0;
}

.back-home {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  border: none;
  border-bottom: none;
  box-shadow: none;
  outline: none;
  background: transparent;
}

.back-home:hover,
.back-home:focus,
.back-home:active,
.back-home:visited {
  text-decoration: none;
  border: none;
  border-bottom: none;
  box-shadow: none;
  outline: none;
  background: transparent;
}

.back-home img {
  display: block;
  height: 30px;
  width: auto;
  opacity: 0.85;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.back-home img:hover {
  opacity: 1;
  transform: translateX(-2px);
}

h1 {
  margin: 0;
}

h2 {
  margin-top: 0;
  margin-bottom: 16px;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}

a:hover {
  color: var(--accent-hover);
  border-bottom-color: var(--accent-hover);
}

.tagline {
  font-size: 0.9em;
  color: var(--text-muted);
}

.lang-switch button {
  margin-left: 5px;
  background: var(--button-bg);
  color: var(--button-text);
  border: 1px solid transparent;
  padding: 5px 10px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.lang-switch button.active {
  outline: none;
  border-color: var(--accent);
  color: var(--accent);
}

.top-menu {
  display: flex;
  flex-wrap: wrap;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.top-menu-item {
  padding: 10px 15px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.top-menu-item:hover {
  background: color-mix(in srgb, var(--panel) 88%, var(--accent) 12%);
}

.top-menu-item.active {
  color: var(--active);
}

.layout {
  display: flex;
}

aside {
  width: 220px;
  background: var(--panel);
  min-height: 100vh;
  border-right: 1px solid var(--border);
}

.side-menu-item {
  padding: 10px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.side-menu-item:hover {
  background: color-mix(in srgb, var(--panel) 85%, var(--accent) 15%);
}

.side-menu-item.active {
  background: var(--side-active-bg);
}

main {
  flex: 1;
  padding: 20px;
}

.content-area p {
  margin-top: 0;
  max-width: 900px;
  color: var(--text-soft);
  white-space: pre-line;
  line-height: 1.65;
}

.text-block {
  max-width: 900px;
  margin-bottom: 24px;
  color: var(--text-soft);
  line-height: 1.65;
  white-space: pre-line;
}

.meta-text {
  display: block;
  color: var(--meta);
  font-size: 0.8rem;
  margin-top: 4px;
}

.image-gallery {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.image-gallery img {
  max-width: 300px;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
}

.image-block {
  margin: 28px 0;
}

.image-block img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
}

.image-full {
  max-width: 900px;
}

.image-medium {
  max-width: 600px;
}

.image-small {
  max-width: 360px;
}

.image-tiny {
  max-width: 200px;
}

.image-block figcaption {
  margin-top: 8px;
  color: var(--caption);
  font-size: 0.95rem;
  font-style: italic;
}

.placeholder-box {
  max-width: 900px;
  padding: 14px 16px;
  margin-top: 24px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  color: var(--text-muted);
  line-height: 1.6;
}

/* =========================
   Projekt-teman
   ========================= */

/* Nattlorden – neutral mörk */
body[data-theme="nattlorden"] {
  --bg: #0f1113;
  --panel: #171a1d;
  --border: #2a2f33;
  --text: #e6e0d4;
  --text-soft: #d8d2c7;
  --text-muted: #888;
  --caption: #a7a094;
  --meta: #8a8478;
  --accent: #c8a75a;
  --accent-hover: #e0c878;
  --active: #a88b52;
  --side-active-bg: #2a2f33;
  --button-bg: #2a2f33;
  --button-text: #e6e0d4;
}

/* Croonlius – svartvitt jazz/blues */
body[data-theme="croonlius"] {
  --bg: #111111;
  --panel: #1c1c1c;
  --border: #363636;
  --text: #e8e8e8;
  --text-soft: #d7d7d7;
  --text-muted: #a3a3a3;
  --caption: #bebebe;
  --meta: #9a9a9a;
  --accent: #bfbfbf;
  --accent-hover: #ffffff;
  --active: #ffffff;
  --side-active-bg: #2a2a2a;
  --button-bg: #2b2b2b;
  --button-text: #ededed;
  --font-main: "Playfair Display", serif;
}

/* Echæon – svart med neon */
body[data-theme="echaon"] {
  --bg: #0a0a0f;
  --panel: #14141c;
  --border: #25253a;
  --text: #e0def0;
  --text-soft: #d0cde0;
  --text-muted: #8b8aa3;
  --caption: #b3b1c7;
  --meta: #8e8cab;
  --accent: #3aa0ff;
  --accent-hover: #ff4da6;
  --active: #ff4da6;
  --side-active-bg: #1d1d29;
  --button-bg: #202031;
  --button-text: #ece9ff;
  --font-main: "Orbitron", sans-serif;
}

/* Khellendros – retrospel/blockfärg */
body[data-theme="khellendros"] {
  --bg: #101610;
  --panel: #1a231a;
  --border: #304330;
  --text: #d8e0d4;
  --text-soft: #ccd7c7;
  --text-muted: #8da08a;
  --caption: #a8b8a4;
  --meta: #83927f;
  --accent: #40e85a;
  --accent-hover: #4d8dff;
  --active: #ff5a5a;
  --side-active-bg: #243024;
  --button-bg: #243024;
  --button-text: #e6f0e2;
}

/* Threshold Canticle – svart och silver */
body[data-theme="threshold"] {
  --bg: #0b0b0b;
  --panel: #151515;
  --border: #3a3a3a;
  --text: #d7d7d7;
  --text-soft: #c9c9c9;
  --text-muted: #8f8f8f;
  --caption: #b5b5b5;
  --meta: #8d8d8d;
  --accent: #a8a8a8;
  --accent-hover: #ffffff;
  --active: #f0f0f0;
  --side-active-bg: #202020;
  --button-bg: #232323;
  --button-text: #e8e8e8;
}

/* HiFi / Tech – ljus teknisk grund */
body[data-theme="hifi"] {
  --bg: #ffffff;
  --panel: #f3f5f8;
  --border: #ccd5df;
  --text: #11161c;
  --text-soft: #27313b;
  --text-muted: #5f6b78;
  --caption: #4c5966;
  --meta: #66717d;
  --accent: #2a6cff;
  --accent-hover: #1149c9;
  --active: #000000;
  --side-active-bg: #e3e9f0;
  --button-bg: #dfe6ee;
  --button-text: #11161c;
  --font-main: Georgia, serif;
}

/* Övrigt – neutral */
body[data-theme="other"] {
  --bg: #121315;
  --panel: #1a1c20;
  --border: #2d3137;
  --text: #e5dfd4;
  --text-soft: #d7d1c6;
  --text-muted: #8d877c;
  --caption: #a9a295;
  --meta: #878174;
  --accent: #c8a75a;
  --accent-hover: #e0c878;
  --active: #a88b52;
  --side-active-bg: #262a30;
  --button-bg: #2a2f33;
  --button-text: #e6e0d4;
}

/* =========================
   Header-stilar per projekt
   ========================= */

/* Nattlorden */
.site-header.header-nattlorden::before {
  background-image:
    linear-gradient(90deg, rgba(200,167,90,0.05), transparent 25%, transparent 75%, rgba(200,167,90,0.05)),
    repeating-linear-gradient(
      90deg,
      transparent 0 24px,
      rgba(255,255,255,0.015) 24px 25px
    );
}

/* Croonlius */
.site-header.header-croonlius::before {
  background-image:
    radial-gradient(circle at center, rgba(255,255,255,0.08), transparent 55%),
    repeating-linear-gradient(
      90deg,
      rgba(255,255,255,0.02) 0 2px,
      transparent 2px 18px
    );
  opacity: 0.14;
}

/* Echæon */
.site-header.header-echaon::before {
  background-image: url("../assets/headers/echaon-header.png");
  background-size: cover;
  background-position: center;
  opacity: 0.22;
}

body[data-theme="echaon"] .top-menu-item.active {
  color: #00f0ff;
}

/* Khellendros */
.site-header.header-khellendros::before {
  background-image: url("../assets/headers/khellendros-header.png");
  background-size: cover;
  background-position: center;
  opacity: 0.50;
}

/* Threshold Canticle */
.site-header.header-threshold::before {
  background-image: url("../assets/headers/tc-header.png");
  background-size: cover;
  background-position: center;
  opacity: 0.26;
}

body[data-theme="threshold"] .top-menu-item.active {
  color: #c0c0c0;
}

/* HiFi / Tech */
.site-header.header-hifi::before {
  background-image:
    linear-gradient(90deg, rgba(42,108,255,0.10), transparent 18%, transparent 82%, rgba(42,108,255,0.10)),
    repeating-linear-gradient(
      90deg,
      rgba(0,0,0,0.035) 0 1px,
      transparent 1px 20px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(0,0,0,0.02) 0 1px,
      transparent 1px 20px
    );
  opacity: 0.18;
}

/* Övrigt */
.site-header.header-other::before {
  background-image:
    linear-gradient(90deg, rgba(200,167,90,0.04), transparent 30%, transparent 70%, rgba(200,167,90,0.04));
}

/* HiFi specialjusteringar */
body[data-theme="hifi"] .tagline {
  color: #4b5563;
}

body[data-theme="hifi"] .lang-switch button {
  background: #dfe6ee;
  color: #111;
}

body[data-theme="hifi"] .lang-switch button:hover {
  background: #d3dbe5;
}

body[data-theme="hifi"] .top-menu-item:hover,
body[data-theme="hifi"] .side-menu-item:hover {
  background: #ebf1f7;
}

body[data-theme="hifi"] .back-home img {
  filter: none;
}

body:not([data-theme="hifi"]) .back-home img {
  filter: brightness(0.9);
}