:root {
  --bg: #f6f7f5;
  --panel: #ffffff;
  --panel-2: #eef0ec;
  --ink: #20241f;
  --ink-dim: #5b6158;
  --line: #d8dcd3;
  --accent: #6d28d9;
  --accent-2: #a3168a;
  --accent-2-contrast: #ffffff;
  --added-bg: #e6f4ea;
  --added-fg: #1a7f37;
  --removed-bg: #fdecea;
  --removed-fg: #b3261e;
  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 6px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181c;
    --panel: #1a1f24;
    --panel-2: #20262c;
    --ink: #e6e8e3;
    --ink-dim: #9aa39c;
    --line: #2c333a;
    --accent: #b794f6;
    --accent-2: #ef8de3;
    --accent-2-contrast: #241522;
    --added-bg: #0f2a1a;
    --added-fg: #4fd97a;
    --removed-bg: #2e1414;
    --removed-fg: #ff8a80;
  }
}
:root[data-theme="dark"] {
  --bg: #14181c; --panel: #1a1f24; --panel-2: #20262c; --ink: #e6e8e3; --ink-dim: #9aa39c;
  --line: #2c333a; --accent: #b794f6; --accent-2: #ef8de3; --accent-2-contrast: #241522;
  --added-bg: #0f2a1a; --added-fg: #4fd97a; --removed-bg: #2e1414; --removed-fg: #ff8a80;
}
:root[data-theme="light"] {
  --bg: #f6f7f5; --panel: #ffffff; --panel-2: #eef0ec; --ink: #20241f; --ink-dim: #5b6158;
  --line: #d8dcd3; --accent: #6d28d9; --accent-2: #a3168a; --accent-2-contrast: #ffffff;
  --added-bg: #e6f4ea; --added-fg: #1a7f37; --removed-bg: #fdecea; --removed-fg: #b3261e;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.55;
  font-size: 16px;
}
a { color: var(--accent); }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 24px; }

/* Tab bar nav */
.tabbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.tabbar-inner { max-width: 860px; margin: 0 auto; display: flex; align-items: stretch; justify-content: space-between; }
.tabs-scroll { display: flex; overflow-x: auto; overflow-y: hidden; min-width: 0; }
.tab {
  font-family: var(--mono); font-size: 13px; color: var(--ink-dim);
  padding: 12px 18px; border-right: 1px solid var(--line); text-decoration: none;
  white-space: nowrap; position: relative; transition: color .15s ease, background-color .15s ease;
}
.tab:hover:not(.active) { color: var(--accent-2); background: var(--panel-2); }
.tab.active { color: var(--ink); background: var(--bg); }
.tab.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent);
}
.tab .dot { display:inline-block; width:6px; height:6px; border-radius:50%; background: var(--accent); margin-right:8px; opacity:.85; }

.controls { display: flex; align-items: center; flex-shrink: 0; }

.hamburger {
  display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; margin-left: 6px; flex-shrink: 0;
  border: none; background: transparent; color: var(--ink);
  cursor: pointer; border-radius: 6px;
}
.hamburger:hover { background: var(--panel-2); }
.hamburger:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.hamburger svg { width: 20px; height: 20px; }
.hamburger .icon-close { display: none; }
.hamburger.is-open .icon-burger { display: none; }
.hamburger.is-open .icon-close { display: block; }

@media (max-width: 720px) {
  .hamburger { display: flex; }
  .tabbar-inner { position: relative; flex-wrap: nowrap; }
  .tabs-scroll {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch;
    background: var(--panel); border-bottom: 1px solid var(--line);
    max-height: 0; overflow: hidden; overflow-y: hidden;
    box-shadow: 0 12px 24px -12px rgba(0,0,0,.25);
    transition: max-height .28s ease;
  }
  .tabs-scroll.is-open { max-height: 70vh; overflow-y: auto; }
  .tabs-scroll .tab {
    border-right: none; border-bottom: 1px solid var(--line);
    padding: 16px 20px; font-size: 14px;
  }
  .tabs-scroll .tab.active::after { bottom: auto; top: 0; left: 0; right: auto; width: 3px; height: 100%; }
}

.lang-switch { display: flex; align-items: center; gap: 6px; padding: 0 14px; flex-shrink: 0; border-left: 1px solid var(--line); }
.lang-switch button {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .04em; font-weight: 700;
  padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: transparent;
  color: var(--ink-dim); cursor: pointer; line-height: 1; transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.lang-switch button:hover { color: var(--ink); border-color: var(--ink-dim); }
.lang-switch button.active { background: var(--accent-2); border-color: var(--accent-2); color: var(--accent-2-contrast); }
.lang-switch button:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.theme-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; margin: 0 12px; flex-shrink: 0;
  border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--ink-dim);
  cursor: pointer; transition: color .15s ease, border-color .15s ease;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-dim); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* file panel */
.file { margin: 48px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.file-head {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--mono); font-size: 12px; color: var(--ink-dim);
  padding: 9px 16px; border-bottom: 1px solid var(--line); background: var(--panel-2);
}
.file-body { padding: 32px clamp(20px, 4vw, 48px); }
.comment { font-family: var(--mono); font-size: 13px; color: var(--ink-dim); margin: 0 0 6px; }
.comment .kw { color: var(--accent); }

h1, h2 { font-family: var(--sans); text-wrap: balance; margin: 0; }
h1 { font-size: clamp(32px, 5vw, 52px); font-weight: 700; letter-spacing: -0.02em; }
h1 .kw { color: var(--accent); }
h2 { font-size: clamp(22px, 3vw, 28px); font-weight: 700; letter-spacing: -0.01em; margin-bottom: 18px; }
p { max-width: 62ch; }
.lede { font-size: 18px; color: var(--ink-dim); max-width: 56ch; }

/* text + image pairing (used in Über mich) */
.media-row { display: flex; gap: 28px; align-items: flex-start; flex-wrap: wrap; margin-top: 8px; }
.media-row-text { flex: 1 1 340px; min-width: 0; margin: 0; }
.portrait-card {
  flex: 0 0 170px; width: 170px; margin: 0;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); overflow: hidden;
}
.portrait-card .file-head { font-size: 11px; padding: 8px 12px; }
.portrait-card img { display: block; width: 100%; height: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
@media (max-width: 640px) {
  .media-row { flex-direction: column-reverse; }
  .portrait-card { width: 130px; flex-basis: auto; }
  .portrait-card .file-head span + span { display: none; }
}

.cursor { display:inline-block; width:3px; height:1em; background:var(--accent); vertical-align:-0.15em; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* scroll-reveal */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

/* about grid */
.about-grid { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 8px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 16px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 14.5px; }
.kv:last-child { border-bottom: none; }
.kv dt { font-family: var(--mono); color: var(--ink-dim); }
.kv dd { margin: 0; }

/* diff */
.diff { font-family: var(--mono); font-size: 13.5px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.dline { display: flex; gap: 14px; padding: 3px 16px; white-space: pre-wrap; opacity: 0; transform: translateX(-8px); transition: opacity .4s ease, transform .4s ease; }
.file.is-visible .dline { opacity: 1; transform: none; }
.dline:nth-child(1) { transition-delay: .05s; }
.dline:nth-child(2) { transition-delay: .09s; }
.dline:nth-child(3) { transition-delay: .13s; }
.dline:nth-child(4) { transition-delay: .17s; }
.dline:nth-child(5) { transition-delay: .21s; }
.dline:nth-child(6) { transition-delay: .25s; }
.dline:nth-child(7) { transition-delay: .29s; }
.dline:nth-child(8) { transition-delay: .33s; }
.dline:nth-child(9) { transition-delay: .37s; }
.dline:nth-child(10) { transition-delay: .41s; }
.dline:nth-child(11) { transition-delay: .45s; }
.dline:nth-child(12) { transition-delay: .49s; }
.dline .no { color: var(--ink-dim); opacity: .5; width: 2ch; text-align: right; flex-shrink: 0; user-select: none; }
.dline.ctx { color: var(--ink); }
.dline.hdr { color: var(--ink-dim); padding-top: 14px; }
.dline.hdr:not(:first-child) { border-top: 1px solid var(--line); margin-top: 6px; }
.dline.add { background: var(--added-bg); color: var(--added-fg); }
.dline.del { background: var(--removed-bg); color: var(--removed-fg); }
.dline .sign { width: 1ch; flex-shrink:0; opacity:.8; }

/* references */
.refs { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.ref-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; background: var(--panel-2); transition: border-color .15s ease, transform .15s ease; }
.ref-card:hover { border-color: var(--accent-2); transform: translateY(-3px); }
.ref-card .k { font-family: var(--mono); font-size: 11px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .06em; }
.ref-card .v { margin-top: 6px; }
.ref-card a { font-weight: 600; text-decoration: none; }
.ref-card a:hover { text-decoration: underline; }
.ref-card .desc { color: var(--ink-dim); font-size: 13.5px; margin-top: 4px; }

/* contact terminal */
.term { font-family: var(--mono); font-size: 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel-2); padding: 20px 22px; }
.term .row { padding: 5px 0; }
.term .prompt { color: var(--accent); margin-right: 10px; }
.term a { text-decoration: none; }
.term a:hover { text-decoration: underline; }

footer {
  font-family: var(--mono); font-size: 12px; color: var(--ink-dim);
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 14px 24px; border-top: 1px solid var(--line); background: var(--panel);
}
footer a { color: var(--ink-dim); margin-left: 14px; text-decoration: none; }
footer a:hover { color: var(--ink); }

section { scroll-margin-top: 56px; }

/* simple pages (impressum / datenschutz) */
.simple-header {
  position: sticky; top: 0; z-index: 20; background: var(--panel); border-bottom: 1px solid var(--line);
}
.simple-header .in { max-width: 860px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; }
.back-link { font-family: var(--mono); font-size: 13px; color: var(--ink-dim); text-decoration: none; }
.back-link:hover { color: var(--accent-2); }
.legal { font-size: 15px; line-height: 1.7; }
.legal h1 { font-size: clamp(26px, 4vw, 36px); margin-bottom: 28px; }
.legal h2 { font-size: 18px; margin: 32px 0 12px; }
.legal h3 { font-family: var(--mono); font-size: 13.5px; color: var(--ink-dim); text-transform: none; margin: 20px 0 8px; }
.legal p { max-width: 72ch; margin: 0 0 16px; }
.legal ul { max-width: 72ch; margin: 0 0 16px; padding-left: 22px; }
.legal li { margin-bottom: 6px; }
