/* =====================================================================
   Andreas Hammers · Portfolio
   1. Design-Tokens       6. Skills / Projekte
   2. Basis & Reset       7. Kontakt
   3. Utilities           8. Footer & Back-to-top
   4. Header & Navigation 9. Bewegung
   5. Hero                10. Responsive (Handy / Tablet / Desktop)
   ===================================================================== */

/* ---------- 1. Design-Tokens ---------- */
:root {
  --accent:        #1fe0a8;
  --accent-strong: #14c894;
  --accent-soft:   rgba(31, 224, 168, 0.12);
  --accent-glow:   rgba(31, 224, 168, 0.28);
  --blue:          #5b9dff;

  --bg:            #0b0f14;
  --bg-alt:        #0e141b;
  --surface:       #121a23;
  --surface-2:     #17212c;
  --border:        #223040;
  --border-strong: #2f4054;

  --text:          #e7eef7;
  --text-muted:    #93a4b8;
  --text-dim:      #6b7c90;

  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body:    "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --radius:    14px;
  --radius-sm: 9px;
  --radius-lg: 22px;

  --shadow:    0 18px 40px -22px rgba(0, 0, 0, 0.85);
  --shadow-lg: 0 28px 60px -28px rgba(0, 0, 0, 0.9);

  --container: 1140px;
  --header-h: 68px;

  /* Mindestgröße antippbarer Elemente (WCAG 2.5.5 / Apple HIG) */
  --tap: 44px;
  /* Unter 16px springt Safari auf iOS beim Fokussieren in den Zoom-Modus */
  --input-fs: 1rem;
  /* Seitenränder, werden auf kleinen Geräten kleiner */
  --gutter: 24px;
  /* Sicherheitsabstände (Notch, Home-Indicator); 0 auf Geräten ohne */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  --ease: cubic-bezier(0.22, 0.75, 0.3, 1);
}

[data-theme="light"] {
  --accent:        #0aa47a;
  --accent-strong: #068463;
  --accent-soft:   rgba(10, 164, 122, 0.1);
  --accent-glow:   rgba(10, 164, 122, 0.22);
  --blue:          #2563eb;

  --bg:            #ffffff;
  --bg-alt:        #f6f8fa;
  --surface:       #ffffff;
  --surface-2:     #f2f5f8;
  --border:        #e1e7ee;
  --border-strong: #cbd5e0;

  --text:          #0f1a24;
  --text-muted:    #4d5f72;
  --text-dim:      #6b7c90;

  --shadow:    0 14px 32px -22px rgba(15, 26, 36, 0.45);
  --shadow-lg: 0 24px 50px -26px rgba(15, 26, 36, 0.4);
}

/* ---------- 2. Basis & Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--safe-t) + 16px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  /* clip statt hidden: verhindert horizontales Wippen, macht den Body aber
     nicht zum Scroll-Container – sonst würde position: sticky am Header brechen. */
  overflow-x: hidden;
  overflow-x: clip;
  /* Lange E-Mails, Dateinamen oder URLs nicht aus dem Raster laufen lassen */
  overflow-wrap: break-word;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}

/* Menü offen: Hintergrund einfrieren. Auf iOS reicht overflow:hidden nicht,
   dort wird die Position von js/main.js gesetzt und beim Schließen zurückgespielt. */
body.is-nav-open {
  position: fixed;
  inset-inline: 0;
  width: 100%;
  overflow: hidden;
}

img, svg { display: block; max-width: 100%; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }

/* Touch-Geräte bekommen die Zeigeregeln von :hover – sonst "klebt" der
   Effekt nach dem Tippen. */
@media (hover: none) {
  a:hover { color: inherit; }
  a.contact__value:hover { color: var(--text); }
  .nav__list a:hover { color: var(--text-muted); background: none; }
  .nav__list a.is-active:hover { color: var(--accent); }
  .btn:hover { transform: none; }
  .btn--primary:hover { background: var(--accent); color: #06251c; }
  .btn--ghost:hover { border-color: var(--border-strong); color: var(--text); background: transparent; }
  .card:hover { transform: none; box-shadow: none; }
  .card:hover::before { opacity: 0; }
  .timeline__item:hover .timeline__content { transform: none; box-shadow: none; }
  .social:hover { color: var(--text-muted); border-color: var(--border); transform: none; }
  .code-window:hover { transform: perspective(1200px) rotateY(-5deg) rotateX(2deg); }
  .icon-btn:hover { color: var(--text-muted); border-color: var(--border); }
  .link-arrow:hover span { transform: none; }
  .footer__nav a:hover { color: var(--text-muted); }
  .to-top:hover { color: var(--text-muted); }
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 600;
  /* Lange Komposita wie "Anwendungsentwicklung" dürfen umbrechen */
  overflow-wrap: break-word;
  hyphens: auto;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

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

/* ---------- 3. Utilities ---------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: max(var(--gutter), var(--safe-l)) max(var(--gutter), var(--safe-r));
}

.section { padding: clamp(64px, 9vw, 108px) 0; }
.section--alt { background: var(--bg-alt); }

/* Ankerziele landen nicht unter der klebenden Kopfzeile.
   Erledigt allein scroll-padding-top am <html> (siehe oben) – das gilt auch für
   scrollIntoView() aus dem Skript. Ein zusätzliches scroll-margin-top würde
   sich aufaddieren und den Abschnitt um die doppelte Kopfzeilenhöhe
   nach unten rücken. Deshalb hier bewusst keine zweite Regel. */

.section__head { max-width: 640px; margin-bottom: clamp(36px, 5vw, 60px); }

.section__title { font-size: clamp(1.75rem, 5.4vw, 2.6rem); }

.section__intro {
  margin-top: 14px;
  color: var(--text-muted);
  font-size: clamp(1rem, 2.4vw, 1.05rem);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 200;
  padding: 12px 18px;
  background: var(--accent);
  color: var(--bg);
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; top: 0; }

.grid { display: grid; gap: clamp(16px, 2.4vw, 20px); }
/* min() verhindert Überlauf, wenn der Viewport schmaler ist als die Spalten-Mindestbreite */
.grid--skills   { grid-template-columns: repeat(auto-fit, minmax(min(255px, 100%), 1fr)); }
.grid--projects { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }

/* Tags / Chips */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin-top: 18px;
}
.tags li {
  max-width: 100%;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tags--sm li { font-size: 0.72rem; padding: 4px 9px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 12px 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  cursor: pointer;
  white-space: nowrap;
  /* Verhindert die graue Markierung beim Antippen in iOS */
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
  transition: transform 0.2s var(--ease), background-color 0.2s var(--ease),
              border-color 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn--primary {
  background: var(--accent);
  color: #06251c;
  box-shadow: 0 10px 26px -12px var(--accent-glow);
}
.btn--primary:hover {
  background: var(--accent-strong);
  color: #06251c;
  transform: translateY(-2px);
}
.btn--primary:active { transform: scale(0.97); }
.btn--ghost {
  border-color: var(--border-strong);
  color: var(--text);
  background: transparent;
}
.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}
.btn--sm { padding: 9px 18px; font-size: 0.86rem; }
.btn--block { width: 100%; }

.icon-btn {
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.icon-btn:hover { color: var(--accent); border-color: var(--border-strong); }
.icon-btn .icon { width: 20px; height: 20px; }

/* Theme-Icons je nach Schema */
.icon--sun { display: none; }
[data-theme="light"] .icon--sun  { display: block; }
[data-theme="light"] .icon--moon { display: none; }

/* ---------- 4. Header & Navigation ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding-top: var(--safe-t);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background-color 0.3s var(--ease);
}
/* Ohne Unterstützung für color-mix: ansonsten ginge der Header-Kontrast verloren */
@supports not (background: color-mix(in srgb, #000 82%, transparent)) {
  .header { background: var(--bg); }
}
.header.is-scrolled { border-bottom-color: var(--border); }

.header__inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.header__progress {
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--blue));
  transition: width 0.1s linear;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--text); }
.brand__mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 10px;
  background: linear-gradient(140deg, var(--accent), var(--blue));
  color: #06251c;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.brand__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav { display: flex; align-items: center; gap: 28px; }
.nav__list {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav__list a {
  position: relative;
  display: block;
  padding: 8px 13px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.93rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.nav__list a:hover { color: var(--text); background: var(--surface-2); }
.nav__list a.is-active { color: var(--accent); }
.nav__list a.is-active::after {
  content: "";
  position: absolute;
  left: 13px;
  right: 13px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

/* Verdunklung hinter dem offenen Mobilmenü */
.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(4, 8, 12, 0.55);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}
.nav-backdrop.is-open { opacity: 1; }

.nav-toggle { display: none; }

.burger,
.burger::before,
.burger::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.25s var(--ease), opacity 0.2s var(--ease);
}
.burger::before, .burger::after { content: ""; position: absolute; }
.burger::before { transform: translateY(-6px); }
.burger::after  { transform: translateY(6px); }
.nav-toggle[aria-expanded="true"] .burger { background: transparent; }
.nav-toggle[aria-expanded="true"] .burger::before { transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .burger::after  { transform: rotate(-45deg); }

/* ---------- 5. Hero ---------- */
.hero {
  position: relative;
  padding: clamp(44px, 8vw, 104px) 0 clamp(56px, 9vw, 120px);
  overflow: hidden;
  /* Der Hero darf auf hohen Leuchtdichten nicht kompliziert wirken */
  isolation: isolate;
}

/* Dekorativer Hintergrund */
.hero__glow {
  position: absolute;
  top: clamp(-320px, -18vw, -220px);
  right: clamp(-260px, -14vw, -140px);
  width: clamp(340px, 52vw, 720px);
  height: clamp(340px, 52vw, 720px);
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 68%);
  filter: blur(28px);
  pointer-events: none;
  will-change: transform;
  animation: float 16s ease-in-out infinite;
}
.hero__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: clamp(38px, 6vw, 62px) clamp(38px, 6vw, 62px);
  mask-image: radial-gradient(ellipse 85% 65% at 50% 32%, #000 25%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 85% 65% at 50% 32%, #000 25%, transparent 78%);
  opacity: 0.45;
  pointer-events: none;
}

.hero__inner {
  position: relative;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: clamp(36px, 5vw, 64px);
  align-items: center;
}
/* Grid-Elemente sind sonst so breit wie ihr Inhalt. Ohne dieses min-width
   schiebt der <pre> (kein Zeilenumbruch) die Spalte über den Bildschirm
   hinaus, statt im Codeblock zu scrollen. */
.hero__visual { min-width: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: 100%;
  padding: 7px 15px 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text-muted);
}
.badge__dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  animation: pulse 2.4s ease-in-out infinite;
}

.hero__title {
  margin: 22px 0 0;
  font-size: clamp(2.05rem, 8.4vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.035em;
}
.hero__title-sub {
  display: block;
  margin-top: 10px;
  font-size: clamp(1.02rem, 3.6vw, 1.45rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  background: linear-gradient(100deg, var(--accent), var(--blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__lead {
  max-width: 52ch;
  margin-top: 20px;
  font-size: clamp(1rem, 2.6vw, 1.09rem);
  color: var(--text-muted);
}

.hero__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 32px;
  list-style: none;
  margin: 30px 0 0;
  padding: 0;
}
.hero__facts li { display: flex; flex-direction: column; gap: 1px; }
.hero__fact-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.hero__fact-value { font-size: 0.95rem; font-weight: 500; }

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

/* Code-Fenster */
.code-window {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-width: 100%;
  transform: perspective(1200px) rotateY(-5deg) rotateX(2deg);
  transition: transform 0.5s var(--ease);
}
.code-window:hover { transform: perspective(1200px) rotateY(0deg) rotateX(0deg); }

.code-window__bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.dot { width: 11px; height: 11px; flex: 0 0 auto; border-radius: 50%; }
.dot--red    { background: #ff5f57; }
.dot--yellow { background: #febc2e; }
.dot--green  { background: #28c840; }
.code-window__file {
  margin-left: 10px;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.code-window__body {
  margin: 0;
  padding: 20px;
  font-family: var(--font-mono);
  font-size: 0.79rem;
  line-height: 1.85;
  color: var(--text-muted);
  /* Waagerechtes Scrollen nur im Codeblock, nicht für die ganze Seite */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  tab-size: 2;
}
.code-window__body code { font: inherit; }

/* Syntax-Farben */
.c-k { color: #ff9ec4; }
.c-f { color: var(--blue); }
.c-t { color: #ffd479; }
.c-p { color: var(--accent); }
.c-b { color: #c39cff; }
.c-c { color: var(--text-dim); font-style: italic; }
[data-theme="light"] .c-k { color: #b3306e; }
[data-theme="light"] .c-f { color: #1d4ed8; }
[data-theme="light"] .c-t { color: #a15c00; }
[data-theme="light"] .c-p { color: var(--accent-strong); }
[data-theme="light"] .c-b { color: #6d28d9; }

/* ---------- Über mich ---------- */
.about {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: clamp(28px, 4vw, 52px);
  align-items: start;
}
.about__text p { color: var(--text-muted); }
.about__text p + p { margin-top: 16px; }

.about__card {
  position: sticky;
  top: calc(var(--header-h) + var(--safe-t) + 24px);
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
/* Hochformat-Porträt: das Foto ist 2:3, deshalb passt dieser Rahmen ohne
   Zuschneiden. Auf sehr schmalen Geräten wird der Rahmen schmaler. */
.about__avatar {
  width: min(220px, 60%);
  aspect-ratio: 2 / 3;
  margin-bottom: 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(140deg, var(--accent-soft), transparent);
  overflow: hidden;
}
.about__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.about__meta { display: grid; gap: 14px; margin: 0; }
.about__meta dt {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.about__meta dd { margin: 2px 0 0; font-size: 0.94rem; font-weight: 500; }

/* ---------- 6. Karten: Skills & Projekte ---------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(160deg, var(--accent-soft), transparent 55%);
  opacity: 0;
  transition: opacity 0.35s var(--ease);
  pointer-events: none;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.card:hover::before { opacity: 1; }
.card > * { position: relative; }

.card__title { font-size: 1.14rem; }
.card__kicker {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 8px;
}
.card__text { margin-top: 10px; color: var(--text-muted); font-size: 0.95rem; }
.card--project .tags { margin-top: auto; padding-top: 20px; }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 20px;
  min-height: 32px;
  font-size: 0.92rem;
  font-weight: 600;
}
.link-arrow span { transition: transform 0.25s var(--ease); }
.link-arrow:hover span { transform: translateX(5px); }

/* Timeline */
.timeline {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}
.timeline::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 7px;
  width: 1px;
  background: linear-gradient(var(--border-strong), var(--border));
}

.timeline__item { position: relative; padding-left: 42px; }
.timeline__marker {
  position: absolute;
  top: 26px;
  left: 0;
  width: 15px;
  height: 15px;
  border: 3px solid var(--bg-alt);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.section:not(.section--alt) .timeline__marker { border-color: var(--bg); }
.timeline__marker--muted {
  background: var(--bg);
  box-shadow: 0 0 0 1px var(--border-strong);
}

.timeline__content {
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.timeline__item:hover .timeline__content {
  transform: translateX(4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.timeline__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.timeline__date {
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 500;
}
.timeline__role { margin: 6px 0 8px; font-size: 1.15rem; }
.timeline__text { color: var(--text-muted); font-size: 0.95rem; }
.timeline__content .tags { margin-top: 14px; }

/* ---------- 7. Kontakt ---------- */
.contact {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: clamp(28px, 4vw, 48px);
  align-items: start;
}

.contact__list {
  list-style: none;
  margin: 0 0 30px;
  padding: 0;
  display: grid;
  gap: 20px;
}
.contact__list li { display: flex; flex-direction: column; gap: 3px; }
.contact__label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.contact__value {
  font-family: var(--font-display);
  font-size: clamp(1.02rem, 3.2vw, 1.12rem);
  font-weight: 500;
  color: var(--text);
  /* Lange Adressen auf schmalen Geräten umbrechen statt überstehen lassen */
  overflow-wrap: anywhere;
}
a.contact__value:hover { color: var(--accent); }

.socials { display: flex; flex-wrap: wrap; gap: 10px; }
.social {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.social:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.social svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }

/* Formular */
.form { padding: 28px; }
.form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field label {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
.field input,
.field select,
.field textarea {
  font-family: var(--font-body);
  font-size: var(--input-fs);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  /* Safari blendet sonst beim ersten Tippen ein eigenes Zoom-Feld ein */
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background-color 0.2s var(--ease);
}
.field textarea { resize: vertical; min-height: 130px; }
.field input::placeholder,
.field textarea::placeholder { color: var(--text-dim); }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] { border-color: #ff6b6b; }
.field select { appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 42px;
}
/* Pfeil des Auswahlfelds mit auf den Text zentrieren, wenn die Zeile höher wird */
@supports (padding: max(0px)) {
  .field select { background-position: calc(100% - 20px) calc(50% - 2px), calc(100% - 15px) calc(50% - 2px); }
}

.form__note {
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--text-dim);
  text-align: center;
}
.form__status {
  margin-top: 12px;
  font-size: 0.88rem;
  text-align: center;
  color: var(--accent);
  min-height: 1.4em;
}
.form__status.is-error { color: #ff6b6b; }

/* ---------- 8. Footer & Back-to-top ---------- */
.footer {
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  padding: 30px 0 calc(30px + var(--safe-b));
}
.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.footer__nav { display: flex; flex-wrap: wrap; gap: 12px 20px; }
.footer__nav a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--text-muted);
}
.footer__nav a:hover { color: var(--accent); }

.to-top {
  position: fixed;
  right: calc(16px + var(--safe-r));
  bottom: calc(16px + var(--safe-b));
  z-index: 90;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease),
              visibility 0.3s, color 0.2s var(--ease);
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { color: var(--accent); }
.to-top:active { transform: scale(0.94); }
.to-top svg { width: 20px; height: 20px; }

/* ---------- 9. Bewegung & Reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.65s var(--ease), transform 0.65s var(--ease);
  transition-delay: calc(var(--reveal-delay, 0) * 90ms);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.55; transform: scale(0.85); }
}
@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50%      { transform: translate3d(-26px, 26px, 0); }
}

/* ---------- 10. Responsive ----------
   Große Bildschirme  ≥ 1025px  volle Navigation
   Tablet           ≤ 1024px  Burger-Menü, einspaltiges Layout
   Handy            ≤  760px  kompakter, Vollbreite-Aktionen
   Sehr schmal      ≤  420px  kleinste Abstände
   Querformat      ≤  900px + max. 520px Höhe  kompakter Hero
   ------------------------------------------------------------------ */

/* --- Tablet & darunter: Navigation klappt ein --- */
@media (max-width: 1024px) {
  :root { --gutter: 22px; }

  /* position: absolute statt fixed: der Header ist sticky und damit der
     Bezugskasten. top: 100% setzt das Menü exakt an die Unterkante des
     Headers – unabhängig von Safe-Area, Fortschrittsbalken und Schriftgröße.
     (fixed wäre durch das backdrop-filter des Headers ohnehin nur relativ
     zu diesem.) */
  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: calc(100dvh - var(--header-h) - var(--safe-t));
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 14px max(var(--gutter), var(--safe-l)) calc(22px + var(--safe-b)) max(var(--gutter), var(--safe-r));
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    /* Bei sehr niedrigen Bildschirmen wird das Menü selbst scrollbar */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    transform: translateY(-10px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s var(--ease), transform 0.22s var(--ease), visibility 0.22s;
  }
  .nav.is-open { transform: translateY(0); opacity: 1; visibility: visible; }

  .nav__list { flex-direction: column; align-items: stretch; gap: 2px; }
  .nav__list a {
    display: flex;
    align-items: center;
    min-height: var(--tap);
    padding: 10px 12px;
    font-size: 1.02rem;
    white-space: normal;
  }
  .nav__list a.is-active::after { display: none; }
  .nav__list a.is-active { background: var(--accent-soft); }
  .nav__cta { margin-top: 14px; min-height: var(--tap); }

  .nav-toggle { display: grid; position: relative; }

  /* Einspaltig, aber mit Luft zwischen den Blöcken */
  .hero__inner,
  .about,
  .contact { grid-template-columns: 1fr; }

  .hero__inner { gap: clamp(32px, 7vw, 48px); }
  .about { gap: clamp(24px, 5vw, 36px); }
  .contact { gap: clamp(28px, 5vw, 40px); }

  .about__card { position: static; }

  /* Perspektive-Drehung braucht Platz und macht auf Touch ohnehin keinen Sinn */
  .code-window,
  .code-window:hover { transform: none; }
}

/* --- Handy --- */
@media (max-width: 760px) {
  :root { --header-h: 60px; --gutter: 18px; }

  .section { padding: clamp(52px, 12vw, 64px) 0; }
  .section__head { margin-bottom: clamp(28px, 7vw, 40px); }

  .hero { padding: clamp(36px, 9vw, 48px) 0 clamp(48px, 12vw, 64px); }

  .card,
  .timeline__content { padding: 20px; }

  .hero__facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
    gap: 16px 20px;
  }

  .hero__actions { margin-top: 28px; }

  .code-window__bar { padding: 11px 14px; }
  /* Der Codeblock ist breiter als der Bildschirm und wird seitlich
     scrollbar. Die 3D-Drehung ist auf kleinen Geräten abgeschaltet. */
  .code-window__body {
    padding: 16px 14px;
    font-size: 0.74rem;
    line-height: 1.75;
  }

  .form { padding: 20px; }
  .form__row { grid-template-columns: 1fr; gap: 0; }

  .contact__list { gap: 16px; margin-bottom: 24px; }
  .socials .social { flex: 1 1 auto; justify-content: center; }

  .footer { padding: 26px 0 calc(26px + var(--safe-b)); }
  .footer__inner { justify-content: flex-start; }

  /* Tags dürfen auf sehr schmalen Geräten umbrechen */
  .tags li { white-space: normal; }
}

/* --- Sehr schmale Geräte (Hochformat-Handys, kleine Fenster) --- */
@media (max-width: 420px) {
  :root { --gutter: 14px; }

  .hero__actions { flex-direction: column; align-items: stretch; }
  .hero__actions .btn { width: 100%; }

  .brand__text { display: none; }

  .timeline__item { padding-left: 32px; }
  .timeline::before { left: 5px; }
  .timeline__marker { width: 13px; height: 13px; border-width: 2.5px; }
  .timeline__content { padding: 18px 16px; }

  .card, .form, .about__card { padding: 18px 16px; }
  .about__avatar { width: min(180px, 55%); }

  .field input,
  .field select,
  .field textarea { padding: 11px 12px; }
  .field textarea { min-height: 120px; }
}

/* --- Handy im Querformat: weniger vertikale Höhe verschwenden --- */
@media (max-width: 900px) and (max-height: 520px) {
  .hero { padding: 28px 0 40px; }
  .hero__inner { gap: 24px; }
  .hero__title { margin-top: 14px; }
  .hero__lead { margin-top: 14px; }
  .hero__facts { margin-top: 20px; }
  .hero__actions { margin-top: 22px; }
  .hero__glow { animation: none; }
}

/* --- Tastatur- und Zeigergeräte: feinere-animationen nur, wo sinnvoll --- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .hero__glow { animation: none; }
}

/* --- Akkusparen: die teuersten Effekte auf kleinen Geräten abschalten ---
   Der Glow ist ein 700px-Blur, der auf jedem Frame neu berechnet wird. */
@media (max-width: 760px) {
  .hero__glow { animation: none; filter: blur(20px); }
}

/* --- Windows-High-Contrast --- */
@media (forced-colors: active) {
  .btn, .card, .icon-btn, .code-window, .timeline__content, .nav { border: 1px solid CanvasText; }
  .hero__glow, .hero__grid { display: none; }
  .nav__list a.is-active { outline: 2px solid Highlight; }
}

/* --- Datensparmodus: weiche Wischblenden deaktivieren --- */
@media (prefers-reduced-transparency: reduce) {
  .header { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--bg); }
  .nav-backdrop { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(0, 0, 0, 0.7); }
}

/* --- Große Antippen-Flächen auf Touch-Geräten ---
   Steht bewusst am Ende: überschreibt damit die kompakteren Höhen der
   Desktop-Regeln. Elemente, die im Fließtext stehen (Logo, Projektlink,
   Kontaktwerte, Footer-Links), bekommen auf dem Finger die vollen 44px. */
@media (pointer: coarse) {
  .brand { min-height: var(--tap); }
  .nav__list a { min-height: var(--tap); }
  .link-arrow { min-height: var(--tap); }
  .contact__value { display: inline-flex; align-items: center; min-height: var(--tap); }
  .footer__nav a { min-height: var(--tap); }
}
