html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans CJK SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
.container {
  width: 100%;            /* darf kleiner werden */
  max-width: 1200px;      /* bleibt begrenzt nach oben */
  margin: 0 auto;
  padding: 24px;
  box-sizing: border-box; /* verhindert horizontales Scrollen */
}
h1 {
  font-size: 1.8em;
  margin-bottom: 30px;
}
.index-gallery, .projects-grid, .works-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 40px;
}
@media (max-width: 800px) {
  .index-gallery, .projects-grid, .works-grid {
    grid-template-columns: 1fr;
  }
}
.card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
  text-decoration: none;
}
.card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  margin: 0;
  max-width: 100%;
}
.card:hover img {
  transform: scale(1.01);
}
.card .meta {
  position: absolute;
  left: 10px;
  bottom: 10px;
  background: rgba(255, 255, 255, 0.9);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 14px;
  color: #000;
}
.intro-img {
  width: 100%;
  display: block;
  margin-bottom: 40px;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}
.project-img {
  display: block;
  margin: 0 auto 20px auto;
  max-width: 1000px;
  width: 100%;
  height: auto;
}
.detail-img {
  display: block;
  margin: 0 auto 20px auto;
  max-width: 1000px;
  width: 100%;
  height: auto;
}
.header .topbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}
a, a:visited {
  color: inherit;
  text-decoration: none;
}
.header {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(6px);
  border-bottom: 1px solid var(--line);
  z-index: 10;
  padding: 20px 0;
}
.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  font-weight: 600;
  font-size: 1.2em;
  letter-spacing: 0.08em;
}
.nav {
  display: flex;
  gap: 24px;
  font-size: 1em;
}
.lang-toggle {
  display: flex;
  gap: 10px;
}
.lang-toggle .button {
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  background: #f0f0f0;
}
.works .works-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 1024px) {
  .works .works-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  .works .works-grid {
    grid-template-columns: 1fr;
  }
}
body.texts p {
  margin: 0 0 0.5em 0;
  line-height: 1.6;
}
body.texts .notes {
  border-top: 1px solid var(--line);
  margin-top: 3rem;
  padding-top: 2rem;
  font-size: 0.95rem;
  color: #444;
}
body.texts em {
  display: block;
  margin-left: 2em;
  margin-bottom: 1.4em;
  font-style: italic;
  color: #444;
  margin-top: 1em;
}
.work-preview {
  position: relative;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.work-preview-popup {
  position: absolute;
  display: block;
  background: #fff;
  border: 1px solid #aaa;
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  z-index: 2000;
  width: 220px;
  max-width: 50vw;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}
.work-preview-popup.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.work-preview-popup img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  object-fit: cover;
  transition: transform 0.25s ease;
}
.note {
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}
.note-tooltip {
  position: absolute;
  background: #fff;
  border: 1px solid #999;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.9em;
  line-height: 1.4;
  color: #111;
  max-width: 360px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease-in-out;
  overflow-wrap: break-word;
  word-wrap: break-word;
  white-space: normal;
}
.note-tooltip.visible {
  opacity: 1;
  pointer-events: auto;
}
.work-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  box-sizing: border-box;
  z-index: 3000;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.work-overlay.visible {
  opacity: 1;
}
.work-overlay iframe {
  width: 90%;
  height: 90%;
  border: none;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.6);
}
.work-overlay-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 28px;
  color: #fff;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}
.work-overlay-close:hover {
  opacity: 1;
}
.work-preview-popup.show img {
  transform: scale(1.02);
}
.lang-toggle {
  text-align: right;
  font-size: 0.9em;
  margin-top: 0.5em;
}
.lang-toggle a {
  color: #555;
  text-decoration: none;
  margin: 0 4px;
}
.lang-toggle a:hover {
  text-decoration: underline;
}
.lang-toggle a.active {
  font-weight: bold;
  color: #000;
}
.lang-toggle .sep {
  color: #888;
}
body.texts.detail main, body.texts.detail main * {
  font-family: Georgia, "Times New Roman", "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", STSong, serif;
  line-height: 1.7;
  font-size: 1.05rem;
  word-spacing: 0.02em;
  letter-spacing: 0.005em;
  font-weight: normal;
}
body.texts.overview main, body.texts.overview main * {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans CJK SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
}
body.texts main {
  max-width: 900px;
  margin: 0 auto;
  padding: 80px 20px 120px 20px;
}
body.texts.detail main {
  max-width: 820px;
  line-height: 1.7;
  font-size: 1.05rem;
  word-spacing: 0.02em;
  letter-spacing: 0.005em;
}
body.texts.detail p {
  margin-bottom: 1.1em;
  text-align: justify;
  text-justify: inter-word;
}
body.texts.detail em {
  font-style: italic;
  color: #333;
}
body.texts.detail h2 {
  font-size: 1.6rem;
  line-height: 1.4;
  margin: 2.5rem 0 1rem 0;
  font-weight: 600;
  color: #222;
  font-family: Georgia, "Times New Roman", "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", STSong, serif;
}
body.texts.detail[lang="zh-CN"] main {
  line-height: 1.9;
  font-size: 1.02rem;
}
body.texts.detail[lang="zh-CN"] p {
  margin-bottom: 0.6em;
  text-align: justify;
  text-justify: inter-ideograph;
  text-indent: 2em;
}
body.texts.detail[lang="zh-CN"] main, body.texts.detail[lang="zh-CN"] main * {
  line-height: 1.9;
  font-size: 1.02rem;
  text-align: justify;
  text-justify: inter-ideograph;
  text-indent: 2em;
  color: #222;
}
body.texts.detail[lang="de"] main, body.texts.detail[lang="en"] main {
  line-height: 1.75;
  font-size: 1.08rem;
  word-spacing: 0.03em;
  letter-spacing: 0.005em;
  text-align: left;
  text-indent: 0;
}
body.texts.detail[lang="de"] p, body.texts.detail[lang="en"] p {
  margin-bottom: 1.2em;
}
body.texts a.underline {
  text-decoration: none;
  position: relative;
  color: inherit;
}
body.texts a.underline::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 1px;
  background-color: currentColor;
  opacity: 0.25;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
body.texts a.underline:hover::after {
  opacity: 0.9;
  transform: scaleX(1);
}
body.texts a.underline:hover {
  cursor: pointer;
}
body.texts.overview a.underline, body.texts.overview a.work-preview {
  color: #333;
  text-decoration-line: underline;
  text-decoration-color: rgba(0, 0, 0, 0.45);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: text-decoration-color 0.2s ease;
}
body.texts.overview a.underline:hover, body.texts.overview a.work-preview:hover {
  text-decoration-color: rgba(0, 0, 0, 0.9);
}
body.texts.detail main a, body.texts.detail main a:visited {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: #a13a2a;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: text-decoration-color 0.25s ease;
}
body.texts.detail main a:hover {
  text-decoration-color: #6f2119;
}
body.texts.detail main a.note {
  position: relative;
  text-decoration: none;
}
body.texts.detail main a.note::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.45em;
  border-bottom: 1px solid #a13a2a;
  pointer-events: none;
}
body.texts.detail header a, body.texts.detail nav a, header a, nav a {
  text-decoration: none;
}
body.texts.detail main a.note sup {
  text-underline-offset: 0.1em;
  vertical-align: super;
  text-decoration-thickness: 1px;
}
body.texts.detail header a, body.texts.detail footer a {
  text-decoration: none;
}
/* --- Sans-Serif Header Override for CV and Text Pages --- */
body.texts.detail header, body.texts.detail header *, body.texts.detail .nav, body.texts.detail .nav *, body.texts.detail .lang-toggle, body.texts.detail .lang-toggle * {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif !important;
}
/* --- Typografie-Schutz für Textseiten (stabil & intentional) --- */ /* --- Safari-Fix für chinesische Serif-Schriften --- */
@supports (-webkit-touch-callout: none) {
  body.texts.detail[lang="zh-CN"], body.texts.detail[lang="zh-CN"] * {
    font-family: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", STSong, serif !important;
  }
}
/* Einheitliches Erscheinungsbild für Textübersichtsseiten */
body.texts.overview .work-card a.underline {
  text-decoration: none;
}
body.texts.overview .work-card a.underline:hover {
  text-decoration: underline;
} /* === Font Architecture (modular, stable) === */ /* Header and navigation are always sans-serif (prevents jumps) */
header, header *, .nav, .nav *, .lang-toggle, .lang-toggle * {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif !important;
} /* Text & CV pages: apply serif only to content area */
body.texts.detail main, body.texts.detail main * {
  font-family: Georgia, "Times New Roman", "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", STSong, serif;
} /* Text overview (listing) pages: keep header links neat */
body.texts.overview header a.underline {
  text-decoration: none;
}
body.texts.overview header a.underline:hover {
  text-decoration: underline;
} /* Safari-specific fix (Chinese serif on content only) */
@supports (-webkit-touch-callout: none) {
  body.texts.detail[lang="zh-CN"] main, body.texts.detail[lang="zh-CN"] main * {
    font-family: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", STSong, serif;
  }
}
/* === End Font Architecture === */
/* --- Layout stability: prevent header reflow on page switch --- */
header, header * {
  font-family: "Helvetica Neue", Arial, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-display: swap;
  line-height: 1.1;
} /* === FINAL FONT & HEADER STRUCTURE (CLEAN) === */ /* 1. Global default font (sans-serif) */
html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
} /* 2. Header, navigation, and language toggle (unified sans-serif, no reflow) */
header, header *, .nav, .nav *, .lang-toggle, .lang-toggle * {
  font-family: "Helvetica Neue", Arial, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  line-height: 1.1;
} /* 3. Text and CV pages: serif content only in main */
body.texts.detail main, body.texts.detail main * {
  font-family: Georgia, "Times New Roman", "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", STSong, serif;
} /* 4. Safari fix for Chinese serif fonts (main only) */
@supports (-webkit-touch-callout: none) {
  body.texts.detail[lang="zh-CN"] main, body.texts.detail[lang="zh-CN"] main * {
    font-family: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", STSong, serif;
  }
} /* 5. Text overview (listing) pages: keep header links clean */
body.texts.overview header a.underline {
  text-decoration: none;
}
body.texts.overview header a.underline:hover {
  text-decoration: underline;
} /* === END FONT & HEADER STRUCTURE === */
/* --- Header Layout Stability (Fix for subtle reflow) --- */
header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px; /* fix the header height to lock line metrics */ line-height: 1.1;
} /* === LANG-TOGGLE: FIXED WIDTH FOR STABLE HEADER === */
.lang-toggle {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  text-align: right;
  font-size: 0.9em;
  margin-top: 0.5em;
  width: 180px; /* feste Breite verhindert Sprung */ min-width: 180px;
}
@media (max-width: 600px) {
  .lang-toggle {
    width: 140px;
    min-width: 140px;
  }
}
/* === END LANG-TOGGLE === */
/* --- Social Icon Styling --- */
.social-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid #b30000;
  padding-bottom: 1px;
}
.social-icon {
  width: 16px;
  height: 16px;
  opacity: 0.75;
  transition: opacity 0.2s ease;
}
.social-link:hover .social-icon {
  opacity: 1;
}
/* --- Responsive images --- */
img {
  max-width: 100%;
  height: auto;
}
/* --- Responsive Header --- */
@media (max-width: 600px) {
  header {
    height: auto;
    padding: 12px 0;
    flex-direction: column;
  }

  header .container {
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
  }

  .lang-toggle {
    margin-top: 4px;
    font-size: 0.9em;
    width: auto;
  }
}
/* ========================================================= */
/* === CV SECTION (Years + Indented Sub-Entries) =========== */
/* ========================================================= */

.cv-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Zweispaltiges Layout: links Jahr, rechts Text */
.cv-list li {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  column-gap: 1.5rem;
  align-items: flex-start;
  margin-bottom: 4px;
}

.cv-list .year {
  font-weight: 600;
}

.cv-list .desc {
  /* rechte Spalte */
}

/* dichterer vertikaler Rhythmus */
.cv-list li + li {
  margin-top: 2px;
}

/* ========================================================= */
/* === END CV SECTION ====================================== */
/* ========================================================= */
/* ===== Mobile refinements (Index hero + Lang toggle) ===== */

/* 1) Intro-Bild auf der Index-Seite: wieder dominant auf dem Handy */
@media (max-width: 768px) {
  .intro-img {
    width: 100%;
    height: 70vh;          /* 60–75vh sind gut; 70vh wirkt wie ein Intro */
    object-fit: cover;     /* füllt den Viewport, ohne Verzerrung */
    object-position: center center;
    display: block;
  }
}

/* 2) Sprachumschalter mittig unter dem Header zentrieren (nur mobil) */
@media (max-width: 768px) {
  .header .lang-toggle {
    position: relative;
    display: flex;
    justify-content: center;  /* mittig */
    margin-top: 10px;
  }
}