:root {
  color-scheme: light dark;
  --ink: light-dark(#111, #eee);
  --bg: light-dark(#fff, #111);
  --line: light-dark(#e5e5e5, #222);
  --muted: light-dark(#737373, #8e8e8e);
  --accent: #1c36c3;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

/* Browser ohne light-dark() (vor 2024) */
@supports not (color: light-dark(#000, #fff)) {
  :root { --ink: #111; --bg: #fff; --line: #e5e5e5; --muted: #737373; }
  @media (prefers-color-scheme: dark) {
    :root { --ink: #eee; --bg: #111; --line: #222; --muted: #8e8e8e; }
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--bg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1.15rem;
  line-height: 1.7;
  hyphens: auto;
  -webkit-hyphens: auto;
  hyphenate-limit-chars: 8 3 3;
}

q { quotes: "„" "“" "‚" "‘"; }

a:any-link { color: inherit; }

.site-shell {
  max-width: 44rem;
  margin: 3.5rem auto 5rem;
  padding: 0 1.5rem;
  overflow-wrap: break-word;
}

.site-header { margin-bottom: 2.25rem; }

.site-title {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.site-title a:any-link { text-decoration: none; }

/* Strichzeichnung unten rechts am Seitenende */
body:has(.corner-art) {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.corner-art {
  margin-top: auto;
  align-self: flex-end;
  width: min(100%, 52rem);
  line-height: 0;
  pointer-events: none;
  user-select: none;
}
.corner-art img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
}

/* Beitragsliste */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li { margin-block: 1.35rem; }
.post-list a {
  text-decoration: none;
  display: block;
}
.post-list a:hover .post-title {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 4px;
}
.post-title {
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.4;
}
.post-date {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.9rem;
  color: var(--muted);
  font-family: var(--mono);
}

/* Beitragsseite */
.back {
  display: inline-block;
  margin-bottom: 1.75rem;
  font-size: 0.95rem;
  font-family: var(--mono);
  color: var(--muted);
  text-decoration: none;
}
.back:hover { color: var(--accent); text-decoration: underline; }

article h1 {
  font-size: 2.1rem;
  line-height: 1.25;
  margin: 0 0 0.65rem;
  letter-spacing: -0.02em;
}
article .post-date { margin-bottom: 2.25rem; }

.prose { font-size: 1.15rem; line-height: 1.75; }
.prose h2 {
  font-size: 1.5rem;
  margin-top: 2.25rem;
  margin-bottom: 0.85rem;
  line-height: 1.3;
}
.prose a:any-link {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 4px;
}
.prose img { max-width: 100%; height: auto; display: block; margin: 1.75rem auto; border-radius: 4px; }
.prose figure { margin: 1.75rem 0; }
.prose figure img { margin: 0 auto; }
.prose pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 1.15rem;
  background: light-dark(#f6f6f6, #181818);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 1rem;
}
.prose code { font-family: var(--mono); font-size: 0.95em; }
/* Video: wird erst nach Klick von YouTube geladen */
.video-facade { --v: #1c36c3; position: relative; aspect-ratio: 16 / 9; margin: 1.6rem 0; border: 1px solid var(--v); }
.prose .video-facade a, .video-facade a { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 1rem; color: var(--v); text-decoration: none; }
.video-facade a:hover .video-play, .video-facade a:focus-visible .video-play { background: var(--v); }
.video-facade a:hover .video-play::after, .video-facade a:focus-visible .video-play::after { border-left-color: #fff; }
.video-play { flex: none; width: 3.5rem; height: 3.5rem; border: 2px solid var(--v); border-radius: 50%; display: grid; place-items: center; }
.video-play::after { content: ""; margin-left: 0.3rem; border-style: solid; border-width: 0.6rem 0 0.6rem 1rem; border-color: transparent transparent transparent var(--v); }
.video-text { display: flex; flex-direction: column; gap: 0.25rem; font-weight: 600; }
.video-text small { font-weight: 400; font-size: 0.8em; color: var(--muted); }
@media (prefers-color-scheme: dark) { .video-facade { --v: #8ea0ff; } }
.video-facade iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.katex-display { font-size: 1.05em; margin: 1.6rem 0; overflow-x: auto; overflow-y: hidden; padding-block: 0.2rem; }

::selection { background: var(--accent); color: #fff; }

.skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link:focus { position: fixed; top: 1rem; left: 1rem; padding: .5rem; background: var(--accent); color: #fff; z-index: 1; }

/* ── Höhenmesser links (Aufzug-Stil) ── */
.depth {
  position: fixed;
  z-index: 10;
  top: 50%;
  left: 1.5rem;
  translate: 0 -50%;
  height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
  font: 0.65rem/1 var(--mono);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  pointer-events: none;
  user-select: none;
}

.depth-track {
  position: relative;
  flex: 1;
  width: 8.5rem;
  overflow: hidden;
  border-left: 1px solid var(--ink);
  mask-image: linear-gradient(transparent, #000 15%, #000 85%, transparent);
}

.depth-ticks {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--ink) 0 1px, transparent 1px),
    linear-gradient(var(--muted) 0 1px, transparent 1px);
  background-size: 16px 60px, 8px 12px;
  background-repeat: repeat-y;
  background-position: left 0 top 0, left 0 top 0;
}

.depth-labels span {
  position: absolute;
  left: 22px;
  translate: 0 -50%;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.depth-marker {
  position: absolute;
  top: 50%;
  left: 0;
  translate: 0 -50%;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 5px;
}
.depth-readout {
  display: flex;
  align-items: baseline;
  gap: 0.3em;
  padding: 0.45rem 0.85rem;
  background: var(--accent);
  border-right: 3px solid #5a76ff;
  color: #ffffff;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 18px rgba(28, 54, 195, 0.45);
}
.depth-value {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
}
.depth-unit {
  font-size: 0.82rem;
  font-weight: 600;
  opacity: 0.75;
  text-transform: none;
}
.depth-pointer {
  width: 20px;
  height: 3px;
  background: var(--accent);
  outline: 1px solid rgba(0, 0, 0, 0.25);
}

@media (max-width: 900px) {
  .depth { top: auto; bottom: 0.75rem; left: 0.5rem; translate: none; height: auto; }
  .depth-label, .depth-ticks, .depth-labels, .depth-pointer { display: none; }
  .depth-track { flex: none; width: auto; height: auto; overflow: visible; border: 0; mask-image: none; }
  .depth-marker { position: static; translate: none; }
  .depth-readout { padding: 0.35rem 0.6rem; }
  .depth-value { font-size: 1.15rem; }
  .depth-unit { font-size: 0.75rem; }
}

@media (max-width: 480px) {
  .site-shell { margin: 2rem 0.75rem; padding: 0 0.5rem; }
}

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