/* ==========================================================================
   jonashaude.de – Layout, Komponenten, Animationen
   Farben/Schriften/Abstände kommen aus tokens.css. Hier keine festen Farbwerte.
   ========================================================================== */

/* ---------- Grundlagen ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }

h1, h2, h3, p { margin: 0; }

a { color: var(--c-petrol); }
a:hover { color: var(--c-petrol-dark); }

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

::selection { background: var(--c-petrol); color: var(--c-surface); }

.mono { font-family: var(--font-mono); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.skip-link {
  position: absolute; left: var(--gutter); top: -4rem; z-index: 10;
  padding: 0.75rem 1rem; border-radius: var(--radius-s);
  background: var(--c-ink); color: var(--c-surface);
  font-family: var(--font-mono); font-size: var(--fs-small);
}
.skip-link:focus { top: 1rem; }

.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Kopfzeile ---------- */
.site-header {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--c-bg) 85%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.site-header .container {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--space-1) var(--space-3);
  padding-block: var(--space-2);
}

.logo {
  display: inline-flex; align-items: center; min-height: 2.75rem;
  font-family: var(--font-mono); font-weight: 700; font-size: 0.9375rem;
  color: var(--c-ink); text-decoration: none;
}
.logo span { color: var(--c-petrol); }
.logo:hover { color: var(--c-ink); }

.nav { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.nav a {
  font-family: var(--font-mono); font-size: var(--fs-small);
  color: var(--c-muted); text-decoration: none;
  padding: 0.75rem;
  transition: color 0.2s ease;
}
.nav a:hover { color: var(--c-ink); }
.nav a.nav-accent { color: var(--c-himbeer); }

/* ---------- Hero ---------- */
.hero { padding-block: var(--space-6) calc(var(--space-section) + var(--radius-sheet)); }

.prompt {
  font-family: var(--font-mono); font-size: 0.9375rem;
  color: var(--c-muted); margin-bottom: var(--space-2);
}
.prompt .user { color: var(--c-petrol); }
.prompt .path { color: var(--c-himbeer); }

.hero-title {
  font-family: var(--font-mono);
  font-size: var(--fs-hero);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.04em;
  color: var(--c-ink);
}

/* Schreibmaschinen-Effekt: 16 Zeichen „IT'ler auf'm Bau“ */
.type {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  vertical-align: bottom;
  width: 0;
  border-right: 0.08em solid var(--c-himbeer);
  padding-right: 0.14em;
  animation:
    type 1.6s steps(16) 0.3s forwards,
    caret 0.8s step-end infinite;
}
/* Breite = 16 Zeichen abzüglich Laufweite (16 × 0.04em) + Innenabstand + Cursor (box-sizing: border-box) */
@keyframes type { to { width: calc(16ch - 0.64em + 0.14em + 0.08em); } }
@keyframes caret { 50% { border-color: transparent; } }

.hero-out {
  margin-top: var(--space-4);
  font-family: var(--font-mono); font-size: 0.9375rem; line-height: 2;
  color: var(--c-muted);
}
.hero-out p { opacity: 0; animation: appear 0.01s forwards; }
.hero-out p:nth-child(1) { animation-delay: 2s; }
.hero-out p:nth-child(2) { animation-delay: 2.3s; }
.hero-out p:nth-child(3) { animation-delay: 2.6s; }
.hero-out p:nth-child(4) { animation-delay: 2.9s; }
.hero-out .arrow { color: var(--c-petrol); }
.hero-out strong { color: var(--c-ink); font-weight: 700; }
.hero-out .status { color: var(--c-himbeer); }
@keyframes appear { to { opacity: 1; } }

.cursor {
  display: inline-block; width: 0.6em; height: 1.1em; vertical-align: -0.2em;
  background: var(--c-himbeer);
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: var(--space-5);
  align-items: center;
  margin-top: var(--space-6);
}

.lead { font-size: var(--fs-lead); line-height: 1.6; max-width: 34rem; }
.lead strong { color: var(--c-ink); }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: var(--space-4); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  min-height: 3rem; padding: 0 1.375rem;
  border-radius: var(--radius-s);
  font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-small);
  text-decoration: none;
  transition: transform 0.15s ease, background-color 0.2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary { background: var(--c-ink); color: var(--c-surface); }
.btn--primary:hover { color: var(--c-surface); }
.btn--primary .arrow { color: var(--c-code-accent); }
.btn--accent { background: var(--c-himbeer); color: #fff; }
.btn--accent:hover { color: #fff; }
.btn--ghost { border: 1px solid var(--c-line-strong); color: var(--c-ink); }
.btn--ghost:hover { color: var(--c-ink); background: var(--c-surface); }

/* ---------- Fenster (Terminal-Rahmen) ---------- */
.window {
  border: 1px solid var(--c-line);
  border-radius: var(--radius-m);
  background: var(--c-surface);
  overflow: hidden;
}
.window-bar {
  display: flex; justify-content: space-between; gap: var(--space-2);
  padding: 0.75rem 1.125rem;
  border-bottom: 1px solid var(--c-line);
  background: var(--c-bg-alt);
  font-family: var(--font-mono); font-size: 0.75rem; color: var(--c-muted);
}
.window-bar .live { color: var(--c-himbeer-strong); }

/* ---------- Scan-Animation (Punktwolke + Laser) ---------- */
.scan { position: relative; height: 21rem; padding: 2.25rem 2.5rem 1.75rem; }
.scan-inner { position: relative; height: 100%; }
.scan-building {
  position: absolute; inset: 0;
  clip-path: polygon(0% 100%, 0% 46%, 22% 46%, 22% 22%, 38% 6%, 54% 22%, 54% 46%,
                     62% 46%, 62% 30%, 100% 30%, 100% 100%);
}
.scan-dots, .scan-hot { position: absolute; inset: 0; background-size: 10px 10px; }
.scan-dots {
  opacity: 0.3;
  background-image: radial-gradient(circle, var(--c-petrol) 1.3px, transparent 1.7px);
}
.scan-hot {
  background-image: radial-gradient(circle, var(--c-himbeer) 1.6px, transparent 2px);
  animation: scan-reveal 5s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}
.scan-laser {
  position: absolute; left: -6%; right: -6%; height: 2px;
  background: var(--c-himbeer);
  box-shadow: 0 0 14px 2px var(--c-himbeer-glow);
  animation: scan-sweep 5s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}
@keyframes scan-reveal {
  0%   { clip-path: inset(0 0 100% 0); }
  70%  { clip-path: inset(0 0 0 0); }
  100% { clip-path: inset(0 0 0 0); opacity: 0; }
}
@keyframes scan-sweep {
  0%       { top: 0; opacity: 1; }
  70%      { top: 100%; opacity: 1; }
  75%, 100% { top: 100%; opacity: 0; }
}

/* ---------- Abschnitte als übereinanderliegende Flächen ---------- */
.sheet {
  position: relative;
  margin-top: calc(var(--radius-sheet) * -1);
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  background: var(--c-bg);
  padding-block: var(--space-section) calc(var(--space-section) + var(--radius-sheet));
}
.sheet--alt { background: var(--c-bg-alt); }

.cmd {
  font-family: var(--font-mono); font-size: 0.9375rem;
  color: var(--c-muted); margin-bottom: var(--space-2);
}

.section-title {
  font-family: var(--font-mono);
  font-size: var(--fs-h2);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.04em;
  color: var(--c-ink);
  max-width: 62rem;
  margin-bottom: var(--space-5);
}
.section-title em { font-style: normal; color: var(--c-himbeer); }

/* ---------- Karten ---------- */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-m);
  padding: 1.75rem;
  transition: transform 0.3s var(--ease-spring), border-color 0.3s ease;
}
.card:hover { transform: translateY(-4px); border-color: var(--c-petrol); }

.card-tag { font-family: var(--font-mono); font-size: var(--fs-tiny); color: var(--c-himbeer); }
.card-tag--petrol { color: var(--c-petrol); }

.card h3 {
  font-family: var(--font-mono); font-size: var(--fs-h3); font-weight: 700;
  color: var(--c-ink); margin: 0.75rem 0 0.625rem;
}

.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }

/* ---------- Baustellen (Text + Code-Fenster) ---------- */
.levers { display: grid; gap: var(--space-2); }

.lever {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-4);
}
.lever h3 { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; margin-top: 0.75rem; }

.code {
  margin: 0;
  border-radius: 0.875rem;
  background: var(--c-code-bg);
  overflow: hidden;
  font-family: var(--font-mono);
}
.code figcaption {
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--c-code-line);
  font-size: 0.75rem; color: var(--c-code-muted);
}
.code pre {
  margin: 0; padding: 1.125rem 1.25rem;
  font: inherit; font-size: var(--fs-small); line-height: 1.75;
  color: var(--c-code-text);
  white-space: pre; overflow-x: auto;
}
.code .c { color: var(--c-code-muted); }
.code .s { color: var(--c-code-string); }
.code .r { color: var(--c-code-accent); }

.section-intro { max-width: 46rem; margin: calc(var(--space-2) * -1) 0 var(--space-4); font-size: var(--fs-lead); }
.section-intro .mono { display: block; margin-top: 0.5rem; color: var(--c-himbeer-strong); font-size: 0.9em; white-space: nowrap; }

/* ---------- Werdegang ---------- */
.facts {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2); margin: 0 0 var(--space-5);
}
.facts .fact-hl { border-top-color: var(--c-himbeer); }
.facts .fact-hl dt { color: var(--c-himbeer); }
@media (max-width: 72rem) {
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.facts div { border-top: 2px solid var(--c-ink); padding-top: var(--space-2); }
.facts dt {
  font-family: var(--font-mono); font-weight: 800; letter-spacing: -0.03em;
  font-size: clamp(1.75rem, 3.6vw, 3rem); color: var(--c-ink); line-height: 1.1;
}
.facts dd { margin: 0.375rem 0 0; color: var(--c-muted); }

.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--c-line); }
.timeline li {
  position: relative;
  display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: var(--space-3);
  padding: 0 0 var(--space-4) var(--space-4);
}
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: 0.35em;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--c-bg); border: 2px solid var(--c-petrol);
}
.timeline li.is-now::before { background: var(--c-himbeer); border-color: var(--c-himbeer); }
.timeline li.is-ai::before { background: var(--c-petrol); }
.timeline li.is-ai h3 { color: var(--c-petrol); }
.timeline .when { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--c-petrol); padding-top: 0.15em; }
.timeline h3 { font-family: var(--font-mono); font-size: 1.0625rem; font-weight: 700; color: var(--c-ink); margin-bottom: 0.25rem; }

.stack {
  display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.5rem 1rem;
  margin: var(--space-3) 0 0; padding: 1.25rem 1.5rem;
  border: 1px solid var(--c-line); border-radius: var(--radius-m); background: var(--c-surface);
  font-family: var(--font-mono); font-size: 0.9375rem; color: var(--c-ink);
}
.stack dt { color: var(--c-muted); }
.stack dd { margin: 0; }

/* Keine einzelnen Wörter allein in der letzten Zeile */
h1, h2, h3, .facts dd { text-wrap: balance; }
p, dd { text-wrap: pretty; }

/* ---------- Projekte (zum Wischen) ---------- */
.section-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end;
  gap: var(--space-3); margin-bottom: var(--space-4);
}
.section-head .section-title { margin-bottom: 0; }

.project-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2);
}
.project-grid > li { display: flex; }
.project-grid > li.is-featured { grid-column: span 2; }

.project {
  display: flex; flex-direction: column; justify-content: flex-start; gap: var(--space-2);
  width: 100%; min-height: 11rem;
  padding: 1.5rem;
}
.project h3 {
  font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.4rem);
  font-weight: 800; letter-spacing: -0.03em; line-height: 1.15;
  overflow-wrap: anywhere;
}

/* ---------- Kontakt ---------- */
.contact-title {
  font-family: var(--font-mono);
  font-size: var(--fs-h2-xl);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.045em;
  color: var(--c-ink);
}
.contact-title em { font-style: normal; color: var(--c-himbeer); }
.contact-title .cursor { margin-left: 0.1em; }

/* ---------- Fußzeile ---------- */
.site-footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0 var(--space-2);
  margin-top: var(--space-6);
  padding-top: 1.25rem;
  border-top: 1px solid var(--c-line);
  font-family: var(--font-mono); font-size: var(--fs-tiny); color: var(--c-muted);
}
.site-footer a { color: var(--c-muted); display: inline-block; padding-block: 0.75rem; }
.site-footer a:hover { color: var(--c-ink); }

/* Kontaktabschnitt endet ohne Überlappung */
.sheet--last { padding-bottom: var(--space-4); }

/* ---------- Rechtstexte (Impressum, Datenschutz) ---------- */
.prose { max-width: 46rem; padding-block: var(--space-6) var(--space-section); }
.prose h1 {
  font-family: var(--font-mono); font-size: var(--fs-h2); font-weight: 800;
  letter-spacing: -0.04em; color: var(--c-ink); margin-bottom: var(--space-4);
}
.prose h2 {
  font-family: var(--font-mono); font-size: 1.25rem; font-weight: 700;
  color: var(--c-ink); margin: var(--space-5) 0 var(--space-2);
}
.prose h3 { font-size: 1.0625rem; color: var(--c-ink); margin: var(--space-3) 0 var(--space-1); }
.prose p { margin-bottom: var(--space-2); }
.prose .todo { background: var(--c-bg-alt); border-radius: 6px; padding: 0 0.3em; color: var(--c-himbeer); }

/* ---------- Einblenden beim Scrollen (ohne JavaScript) ---------- */
@supports (animation-timeline: view()) {
  .reveal {
    animation: reveal linear both;
    animation-timeline: view();
    animation-range: entry 0% cover 30%;
  }
  @keyframes reveal {
    from { opacity: 0; transform: translateY(40px); }
    to   { opacity: 1; transform: none; }
  }
}

/* ---------- Kleine Bildschirme ---------- */
@media (max-width: 56rem) {
  .hero-grid, .grid-3, .lever { grid-template-columns: minmax(0, 1fr); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lever { gap: var(--space-3); }
  .timeline li { grid-template-columns: minmax(0, 1fr); gap: 0.25rem; padding-left: var(--space-3); }
  .scan { height: 16rem; padding: 1.5rem; }
  .lever { padding: var(--space-3); }
  .lever h3 { font-size: 1.375rem; }
  .card { padding: 1.375rem; }
  .code pre { font-size: 0.8125rem; padding: 1rem; }
  .hero { padding-top: var(--space-4); }
  .hero-grid { gap: var(--space-4); margin-top: var(--space-5); }
  .timeline li { padding-bottom: var(--space-3); }
}

/* ---------- Telefon: Kopfzeile nicht kleben lassen, Navigation als Wischzeile ---------- */
@media (max-width: 40rem) {
  .site-header { position: static; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .site-header .container { padding-block: var(--space-1) 0; }
  .nav { margin-inline: -0.55rem; row-gap: 0; }
  .nav a { white-space: nowrap; font-size: var(--fs-tiny); padding-inline: 0.55rem; }
  .hero-out { font-size: var(--fs-tiny); line-height: 1.9; }
  .lead { font-size: 1.0625rem; }
  .actions .btn { flex: 1 1 0; justify-content: center; }
  .actions .btn--accent { flex-basis: 100%; }
  .stack { grid-template-columns: minmax(0, 1fr); gap: 0.125rem; padding: 1rem 1.125rem; font-size: var(--fs-small); }
  .stack dt { text-align: left; }
  .stack dd { margin-bottom: 0.5rem; }
  .facts dt { font-size: 1.75rem; }
  .section-title { margin-bottom: var(--space-4); }
}

/* ---------- Weniger Bewegung, wenn gewünscht ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .type { width: auto; border-right: 0; }
  .hero-out p { opacity: 1; }
  .scan-hot { opacity: 0; }
  .scan-laser { display: none; }
}

/* Hauptkachel Scan4X: dunkel, mit Punktwolken-Raster */
.is-featured .project {
  position: relative; overflow: hidden;
  background: var(--c-code-bg); border-color: var(--c-code-bg); color: var(--c-code-text);
}
.is-featured .project::after {
  content: ""; position: absolute; inset: 0 0 0 55%;
  background-image: radial-gradient(circle, var(--c-code-string) 1.2px, transparent 1.6px);
  background-size: 10px 10px; opacity: 0.35;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 60%);
  mask-image: linear-gradient(90deg, transparent, #000 60%);
}
.is-featured .project > * { position: relative; z-index: 1; max-width: 32rem; }
.is-featured .project h3 { color: var(--c-surface); font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); }
.is-featured .card-tag { color: var(--c-code-accent); }
.is-featured .project:hover { border-color: var(--c-code-accent); }

/* Projektraster: Tablet zwei Spalten, Telefon eine */
@media (max-width: 64rem) {
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 40rem) {
  .project-grid { grid-template-columns: minmax(0, 1fr); }
  .project-grid > li.is-featured { grid-column: auto; }
  .project { min-height: 0; }
}

/* Werdegang: Befehl als Titel, echte Rolle darunter */
.timeline h3::before { content: "$ "; color: var(--c-muted); font-weight: 400; }
.timeline .role {
  font-family: var(--font-mono); font-size: var(--fs-tiny); color: var(--c-muted);
  margin: -0.125rem 0 0.375rem;
}
.timeline li.is-now .role { color: var(--c-himbeer); }
.timeline li.is-py h3::before { content: ">>> "; }

/* ---------- Hero: Jonas vor der Punktwolke ---------- */
figure.window { margin: 0; }
.scan--with-person { height: 26rem; padding: 2.25rem 2.5rem 0; }
.scan--with-person .scan-inner { width: 72%; height: 88%; margin-top: 2%; }
.person-photo {
  position: absolute; right: 2%; bottom: 0; z-index: 2;
  height: 92%; width: auto; max-width: none;
  filter: drop-shadow(0 10px 24px rgb(27 30 32 / 0.18));
  opacity: 0; transform: translateY(12px);
  animation: person-in 0.9s var(--ease-out) 0.4s forwards;
}
@keyframes person-in { to { opacity: 1; transform: none; } }
@media (max-width: 56rem) {
  .scan--with-person { height: 22rem; padding: 1.5rem 1.25rem 0; }
  .scan--with-person .scan-inner { width: 78%; }
}
@media (prefers-reduced-motion: reduce) { .person-photo { opacity: 1; transform: none; } }

/* Hero: Ausgabezeilen links neben dem Scan-Fenster */
.hero-grid { margin-top: var(--space-4); }
.hero-text .hero-out { margin: 0 0 var(--space-4); }

/* ---------- Sehr kleine Telefone (≤ 384 px) ---------- */
@media (max-width: 24rem) {
  .lever { padding: 1.125rem; }
  .lever .code { margin-inline: -1.125rem; border-radius: 0; }
  .code pre { font-size: 0.75rem; padding: 0.875rem 1.125rem; }
  .card { padding: 1.125rem; }
}

/* Scan4X-Kachel: Punktraster auf dem Handy nicht hinter dem Text */
@media (max-width: 40rem) { .is-featured .project::after { inset: 55% 0 0 45%; opacity: 0.25; } }

/* Große Bildschirme: Grundschrift minimal größer, damit Fließtext neben den großen Überschriften nicht verloren wirkt */
@media (min-width: 100rem) { html { font-size: 106.25%; } }
