/* =========================
 *  Design Tokens + Theme
 * ========================= */
:root {
  color-scheme: light dark;
  --bg: #f6f7fb;
  --panel-1: rgba(255,255,255,0.70);
  --panel-2: rgba(255,255,255,0.52);
  --panel-3: rgba(255,255,255,0.36);
  --line: rgba(0,0,0,0.14);
  --text: #0b0b0c;
  --muted: #5f6368;
  --chip: #eef1f7;
  --shadow: 0 10px 30px rgba(20,24,40,0.08);
  --accent: #1e6fff;
  --ink-rgb: 11,11,12;
}

[data-theme="dark"] {
  --bg: #0c0d10;
  --panel-1: rgba(24,26,34,0.90);
  --panel-2: rgba(24,26,34,0.70);
  --panel-3: rgba(24,26,34,0.52);
  --line: rgba(255,255,255,0.12);
  --text: #e9eaee;
  --muted: #b9bdc6;
  --chip: #171a22;
  --shadow: 0 16px 40px rgba(0,0,0,0.45);
  --accent: #7fb0ff;
  --ink-rgb: 235,238,245;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0c0d10;
    --panel-1: rgba(24,26,34,0.90);
    --panel-2: rgba(24,26,34,0.70);
    --panel-3: rgba(24,26,34,0.52);
    --line: rgba(255,255,255,0.12);
    --text: #e9eaee;
    --muted: #b9bdc6;
    --chip: #171a22;
    --shadow: 0 16px 40px rgba(0,0,0,0.45);
    --accent: #7fb0ff;
    --ink-rgb: 235,238,245;
  }
}

/* =========================
 *  Base
 * ========================= */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--bg);
  transition: background-color .25s ease, color .25s ease;
}

/* Links – Akzentfarbe, keine Unterstreichung */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color .2s ease, opacity .2s ease;
}
a:hover,
a:focus-visible { opacity: 0.8; }

/* =========================
 *  Layout Container
 * ========================= */
.container {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}
.container::after {
  content: "";
  display: block;
  height: clamp(72px, 12vh, 220px);
}

/* =========================
 *  Header & Cards
 * ========================= */
.site-header,
.card {
  -webkit-backdrop-filter: saturate(120%) blur(8px);
  backdrop-filter: saturate(120%) blur(8px);
  background: var(--panel-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.site-header { padding: 22px 20px; }
.site-title  { margin: 0 0 8px; font-size: 1.8rem; letter-spacing: .2px; }
.site-subtitle { margin: 0; color: var(--muted); }
.card { padding: 16px; }

.card--inset {
  background: var(--panel-2);
  border-color: var(--line);
}
@supports (color: color-mix(in srgb, white, black)) {
  .card--inset { border-color: color-mix(in srgb, var(--line) 80%, transparent); }
}

/* =========================
 *  Navigation Chips
 * ========================= */
.site-nav { margin: 16px 0 12px; }

.site-nav .nav-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
}
.site-nav .nav-list a {
  display: inline-block;
  padding: 6px 10px;
  font-size: .9rem;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-3);
  text-decoration: none;
  color: var(--text);
  transition: background .2s ease, outline-color .2s ease, color .2s ease;
}
.site-nav .nav-list a:hover,
.site-nav .nav-list a:focus-visible {
  background: #fff;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
[data-theme="dark"] .site-nav .nav-list a:hover,
[data-theme="dark"] .site-nav .nav-list a:focus-visible { background: rgba(255,255,255,0.07); }
.site-nav .nav-list a.active { background: #fff; color: #111; }
[data-theme="dark"] .site-nav .nav-list a.active { background: rgba(255,255,255,0.10); color: var(--text); }

/* =========================
 *  Toolbar / Buttons / Chips
 * ========================= */
.toolbar { display: flex; justify-content: flex-end; margin-bottom: 10px; gap: 8px; }
.btn {
  border: 1px solid var(--line);
  background: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: filter .2s ease, background .2s ease, color .2s ease, border-color .2s ease;
}
.btn:hover { filter: brightness(0.98); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[data-theme="dark"] .btn { background: rgba(255,255,255,0.07); color: var(--text); }
[data-theme="dark"] .btn:hover { background: rgba(255,255,255,0.12); }

.chip {
  display: inline-block;
  padding: 6px 10px;
  background: var(--chip);
  border: 1px dashed var(--line);
  border-radius: 999px;
  color: inherit;
  text-decoration: none;
}
.chip:hover,
.chip:focus-visible {
  background: #fff;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
[data-theme="dark"] .chip { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .chip:hover,
[data-theme="dark"] .chip:focus-visible { background: rgba(255,255,255,0.12); }

/* =========================
 *  Grid
 * ========================= */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 780px) {
  .cards-grid { grid-template-columns: 1fr; }
}
body.compact .card { padding: 12px; }

/* =========================
 *  Canvas
 * ========================= */
#gameCanvas {
  display: block;
  width: 100%;
  border-radius: 10px;
  background:
    radial-gradient(circle at 1px 1px, rgba(0,0,0,0.05) 1px, transparent 1px) 0 0/8px 8px,
    linear-gradient(var(--panel-2), var(--panel-2));
}
[data-theme="dark"] #gameCanvas {
  background:
    radial-gradient(circle at 1px 1px, rgba(255,255,255,0.06) 1px, transparent 1px) 0 0/8px 8px,
    linear-gradient(#0f1116,#0f1116);
}

/* =========================
 *  Taschenlampen-Button
 * ========================= */
.lamp-btn {
  position: fixed;
  top: 14px;
  right: max(14px, env(safe-area-inset-right));
  z-index: 10000;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-1);
  box-shadow: var(--shadow);
  cursor: pointer;
  user-select: none;
  color: var(--text);
}
.lamp-btn:hover,
.lamp-btn:focus-visible {
  background: var(--panel-2);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.lamp-btn::before {
  content: "";
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='9' y='9' width='6' height='11' rx='2'/%3E%3Crect x='8' y='4' width='8' height='3' rx='1.2'/%3E%3Crect x='9' y='7' width='6' height='3' rx='1'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='9' y='9' width='6' height='11' rx='2'/%3E%3Crect x='8' y='4' width='8' height='3' rx='1.2'/%3E%3Crect x='9' y='7' width='6' height='3' rx='1'/%3E%3C/svg%3E") center/contain no-repeat;
}
@media (pointer: coarse) {
  .lamp-btn { width: 40px; height: 40px; }
}

/* =========================
 *  Utilities
 * ========================= */
.justify {
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow-wrap: break-word;
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

.portrait-container { position: relative; width: 300px; margin: auto; }
.portrait { width: 100%; display: block; }
.eye {
  position: absolute; width: 35px; height: 29px; background: #fff; border-radius: 50%;
  top: 134px; left: 100px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
#eye-right { left: 168px; }
.pupil { width: 15px; height: 15px; background: #000; border-radius: 50%; position: absolute; top: 12px; left: 12px; }

/* =========================
 *  Projects-Seite
 * ========================= */
.page-reference .cards-grid { grid-template-columns: 1fr; }
.page-reference .card { margin-bottom: 16px; }

/* Text + Bild */
.project-row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.project-row p {
  flex: 1;
  margin: 0;
  text-align: justify;
  hyphens: auto;
  line-height: 1.7;
  word-break: break-word;
}

/* Bild + Caption */
.project-figure { margin: 0 0 0 16px; text-align: center; }
.project-figure figcaption { margin-top: 4px; font-size: .8rem; color: var(--muted); line-height: 1.3; }
.project-image {
  width: 260px; height: auto; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line); box-shadow: var(--shadow);
}

/* TL;DR / Meta */
.keypoints { margin: 0; padding-left: 20px; line-height: 1.5; }
.keypoints li { margin: 4px 0; text-align: justify; }

.meta {
  display: flex; flex-wrap: wrap;
  gap: 8px; margin: 8px 0 12px; padding: 0;
  list-style: none;
}
.meta li {
  padding: 4px 8px;
  border: 1px dashed var(--line);
  border-radius: 999px;
  background: var(--chip);
  font-size: .82rem;
}

/* Details (Mehr/Weniger) – immer am Ende, keine Lücke */
.more {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: 12px;
  width: 100%;
  gap: 0;            /* verhindert Lücke zwischen summary und Inhalt */
}
.more summary {
  order: 2;
  align-self: center;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  padding: 6px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-3);
  transition: background .2s ease, color .2s ease;
  font-size: 0;      /* Screenreader behält Originaltext, sichtbarer Text via ::after */
}
.more summary::after { content: "Mehr Details"; font-size: 1rem; }
.more[open] summary { background: var(--accent); color: #fff; }
[data-theme="dark"] .more[open] summary { background: var(--accent); color: #0c0d10; }
.more[open] summary::after { content: "Weniger Details"; }

.more-body {
  order: 1;
  margin-top: 12px;
  line-height: 1.6;
  text-align: justify;
  hyphens: auto;
}
.more:not([open]) .more-body { display: none; }

/* Related Links */
.related-links {
  margin-top: 1.2rem;
  border-top: 1px dashed var(--line);
  padding-top: 0.8rem;
}
.related-links h5 {
  margin: 0 0 0.4rem;
  font-size: 0.9rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.related-links ul {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 0.4rem;
}
.related-links a { color: var(--accent); }
.related-links a:hover { opacity: 0.8; }

/* =========================
 *  Responsive
 * ========================= */
@media (max-width: 820px) {
  .project-row { flex-direction: column; align-items: center; }
  .project-figure { margin: 12px 0; }
  .project-image { width: 100%; max-width: 400px; }
}

/* Optional: Sticky-Bild auf großen Screens */
@media (min-width: 980px) {
  .project-figure { position: sticky; top: 24px; }
}

