:root {
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --line: rgba(0, 0, 0, 0.08);
  --accent: #0071e3;
  --accent-text: #0066cc;
  --accent-btn: #0071e3;
  --on-accent: #ffffff;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --pad: clamp(1.75rem, 3.5vw, 2.75rem);
  --nav-bg: rgba(255, 255, 255, 0.72);
  --grad: linear-gradient(100deg, #0071e3 0%, #7d4cdb 50%, #e0457b 100%);
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.04), 0 12px 40px rgba(0, 0, 0, 0.06);
  --radius: 28px;
  --ease: cubic-bezier(0.25, 1, 0.5, 1);
  --gutter: max(1.375rem, calc((100vw - 980px) / 2));
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-alt: #161617;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --line: rgba(255, 255, 255, 0.1);
    --accent: #0a84ff;
    --accent-text: #2997ff;
    --accent-btn: #0a84ff;
    --on-accent: #ffffff;
    --accent-soft: rgba(10, 132, 255, 0.18);
    --nav-bg: rgba(22, 22, 23, 0.72);
    --grad: linear-gradient(100deg, #2997ff 0%, #a77bff 50%, #ff6b9a 100%);
    --shadow: none;
  }
}

:root[data-theme="dark"] {
  --bg: #000000;
  --bg-alt: #161617;
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #0a84ff;
  --accent-text: #2997ff;
  --accent-btn: #0a84ff;
  --on-accent: #ffffff;
  --accent-soft: rgba(10, 132, 255, 0.18);
  --nav-bg: rgba(22, 22, 23, 0.72);
  --grad: linear-gradient(100deg, #2997ff 0%, #a77bff 50%, #ff6b9a 100%);
  --shadow: none;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 52px;
}

body {
  font:
    100%/1.47 -apple-system,
    BlinkMacSystemFont,
    "SF Pro Text",
    system-ui,
    "Helvetica Neue",
    sans-serif;
  letter-spacing: -0.011em;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Navigation: translucent material, content scrolls underneath */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: transparent;
  transition:
    background-color 300ms var(--ease),
    box-shadow 300ms var(--ease);
}

.nav.is-scrolled {
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 1px 0 var(--line);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 var(--gutter);
}

.nav-brand {
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
  font-size: 0.8125rem;
  letter-spacing: -0.005em;
}

.nav-links a {
  color: var(--text-2);
  transition: color 150ms;
}

.nav-links a:hover {
  color: var(--text);
}

.nav-links a:not(.nav-cta) {
  position: relative;
  padding: 0.3rem 0;
}

.nav-links a:not(.nav-cta)::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transform: scaleX(0);
  transition: transform 300ms var(--ease);
}

.nav-links a.is-active {
  color: var(--text);
}

.nav-links a.is-active:not(.nav-cta)::after {
  transform: scaleX(1);
}

.nav-links .nav-cta {
  transition: box-shadow 300ms var(--ease);
}

.nav-links .nav-cta.is-active {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
}

.nav-links .nav-cta {
  color: var(--on-accent);
  background: var(--accent-btn);
  padding: 0.35rem 0.95rem;
  border-radius: 980px;
}

.nav-links .nav-cta:hover {
  color: var(--on-accent);
}

/* Type scale: tracking tightens and leading drops as size grows */
.eyebrow {
  font-size: 1.3125rem;
  font-weight: 600;
  letter-spacing: 0.004em;
  color: var(--text-2);
}

.display {
  font-size: clamp(3rem, 9vw, 6rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.headline {
  font-size: clamp(2.25rem, 5.5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.07;
  letter-spacing: -0.028em;
  margin-bottom: 2.5rem;
}

.lede {
  font-size: clamp(1.1875rem, 2vw, 1.5rem);
  line-height: 1.33;
  letter-spacing: 0.009em;
  color: var(--text-2);
  max-width: 34ch;
}

.gradient {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.muted {
  color: var(--text-2);
}

/* Hero: text left, portrait right */
.hero {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 300px);
  align-items: center;
  gap: 3.5rem;
  padding: 6rem var(--gutter) 0;
}

.hero-text {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 0.85rem 1.6rem;
  border-radius: 980px;
  font-size: 1.0625rem;
  font-weight: 400;
  transition:
    transform 100ms ease-out,
    background-color 150ms;
}

.btn-primary {
  background: var(--accent-btn);
  color: var(--on-accent);
}

.btn-primary:hover {
  background: color-mix(in srgb, var(--accent-btn) 88%, #fff);
}

/* Feedback on press, not release */
.btn:active,
.contact:active,
.nav-cta:active {
  transform: scale(0.97);
}

.link-more {
  color: var(--accent-text);
  font-size: 1.0625rem;
}

.link-more::after {
  content: " ›";
}

.link-more:hover {
  text-decoration: underline;
}

.portrait {
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #111;
}

.portrait img {
  display: block;
  width: 100%;
  height: auto;
}

/* Sections */
.section {
  padding: 8rem var(--gutter) 0;
}

.bento {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.tile {
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 220px;
  justify-content: flex-end;
}

.tile-wide {
  grid-column: span 2;
}

.tile-accent {
  background: var(--text);
  color: var(--bg);
}

.tile-accent .tile-text,
.tile-accent .tile-label {
  color: color-mix(in srgb, var(--bg) 65%, var(--text));
}

.tile-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
}

.tile-big {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.tile-text {
  font-size: 1.0625rem;
  color: var(--text-2);
  max-width: 46ch;
}

/* Projects: cards stack on top of each other while scrolling */
.projects {
  list-style: none;
  display: grid;
  gap: 2rem;
}

.project-slot {
  position: sticky;
  top: calc(52px + 1.5rem);
}

.project {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  min-height: 360px;
  background: var(--bg-alt);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.06);
  transform-origin: 50% 0;
  transform: scale(calc(1 - var(--covered, 0) * 0.08));
  filter: brightness(calc(1 - var(--covered, 0) * 0.35));
  will-change: transform;
}

.project-body {
  min-width: 0;
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.6rem;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
}

.project-title {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-top: 0.75rem;
}

.tags li {
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.3rem 0.85rem;
  border-radius: 980px;
  border: 1px solid var(--line);
  color: var(--text-2);
}

.project-art {
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 65%),
    #0b0b0c;
}

.cube {
  width: 120px;
  aspect-ratio: 1;
  border-radius: 26px;
  background: linear-gradient(145deg, #3a3a3c, #1c1c1e);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 30px 60px rgba(0, 0, 0, 0.6);
  position: relative;
}

.cube::after {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 10px;
  background: linear-gradient(160deg, #0a84ff, #5e5ce6);
  box-shadow: 0 0 40px rgba(10, 132, 255, 0.5);
}

.art-gantt {
  display: grid;
  gap: 14px;
  width: min(70%, 240px);
}

.art-gantt span {
  height: 18px;
  border-radius: 9px;
  background: linear-gradient(90deg, var(--accent), #7d4cdb);
  box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 45%, transparent);
}

.art-gantt span:nth-child(1) { width: 55%; }
.art-gantt span:nth-child(2) { width: 40%; margin-left: 35%; }
.art-gantt span:nth-child(3) { width: 65%; margin-left: 20%; opacity: 0.8; }
.art-gantt span:nth-child(4) { width: 30%; margin-left: 70%; opacity: 0.6; }

.art-sort {
  display: grid;
  grid-template-columns: repeat(3, 34px);
  gap: 16px 28px;
}

.art-sort span {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
}

.art-sort span:nth-child(3n + 1) {
  background: #30d158;
  border-color: #30d158;
  box-shadow: 0 0 20px rgba(48, 209, 88, 0.45);
}

.art-sort span:nth-child(3n + 2) {
  background: #b0703a;
  border-color: #b0703a;
  box-shadow: 0 0 20px rgba(176, 112, 58, 0.45);
}

.art-calendar {
  display: grid;
  grid-template-columns: repeat(7, 22px);
  gap: 8px;
}

.art-calendar span {
  aspect-ratio: 1;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
}

.art-calendar span:nth-child(9),
.art-calendar span:nth-child(10),
.art-calendar span:nth-child(11) {
  background: var(--accent);
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 60%, transparent);
}

.art-calendar span:nth-child(17),
.art-calendar span:nth-child(18) {
  background: #e0457b;
  box-shadow: 0 0 16px rgba(224, 69, 123, 0.5);
}

/* Long German compounds must wrap instead of pushing boxes wider */
.tile,
.project,
.contact {
  min-width: 0;
}

.tile-big,
.project-title,
.card-role,
.headline,
.display {
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Career timeline: scroll-driven line, steps light up as it reaches them */
.timeline {
  --year-w: 9rem;
  --col-gap: 1.5rem;
  --rail: 1.75rem;
  --rail-x: calc(var(--year-w) + var(--col-gap) + var(--rail) / 2);
  position: relative;
  list-style: none;
  display: grid;
  gap: 3.5rem;
  max-width: 860px;
}

.timeline::before,
.timeline::after {
  content: "";
  position: absolute;
  left: calc(var(--rail-x) - 1px);
  top: var(--line-top, 0.75rem);
  height: var(--line-h, calc(100% - 0.75rem));
  width: 2px;
  border-radius: 2px;
}

.timeline::before {
  background: var(--line);
}

.timeline::after {
  background: linear-gradient(180deg, var(--accent), #7d4cdb 70%, #e0457b);
  transform-origin: top;
  transform: scaleY(var(--progress, 1));
}

.step {
  display: grid;
  grid-template-columns: var(--year-w) var(--rail) 1fr;
  grid-template-areas: "year rail body";
  column-gap: var(--col-gap);
  align-items: start;
}

.step-year {
  grid-area: year;
  text-align: right;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  padding-top: 0.3rem;
}

.step-dot {
  grid-area: rail;
  justify-self: center;
  position: relative;
  z-index: 1;
  width: 16px;
  height: 16px;
  margin-top: 0.55rem;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid color-mix(in srgb, var(--text) 20%, transparent);
  transition:
    background-color 400ms var(--ease),
    border-color 400ms var(--ease),
    box-shadow 400ms var(--ease),
    transform 400ms var(--ease);
}

.step.is-passed .step-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 6px var(--accent-soft);
  transform: scale(1.1);
}

.step-body {
  grid-area: body;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.js .step-year,
.js .step-body {
  opacity: 0.3;
  transform: translateX(12px);
  transition:
    opacity 600ms var(--ease),
    transform 700ms var(--ease);
}

.js .step-year {
  transform: translateX(-12px);
}

.js .step.is-passed .step-year,
.js .step.is-passed .step-body {
  opacity: 1;
  transform: none;
}

.step-now .step-body {
  padding: var(--pad);
  border-radius: var(--radius);
  background: var(--grad);
  color: #fff;
}

.step-now .card-text {
  color: rgba(255, 255, 255, 0.85);
}

.step-badge {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.75rem;
  border-radius: 980px;
  background: rgba(255, 255, 255, 0.2);
  margin-bottom: 0.4rem;
}

.step-now.is-passed .step-dot {
  background: #e0457b;
  border-color: #e0457b;
  box-shadow: 0 0 0 6px rgba(224, 69, 123, 0.18);
  animation: pulse 2.4s var(--ease) infinite;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 6px rgba(224, 69, 123, 0.18);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(224, 69, 123, 0);
  }
}

.card-role {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.022em;
}

.card-company {
  font-size: 1.0625rem;
  font-weight: 600;
}

.card-text {
  font-size: 1.0625rem;
  color: var(--text-2);
}

/* Contact */
.section-contact {
  text-align: center;
  padding-bottom: 6rem;
}

.section-contact .headline {
  margin-bottom: 1rem;
}

.section-contact .lede {
  margin: 0 auto 3rem;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.contact {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: var(--pad);
  background: var(--bg-alt);
  border-radius: var(--radius);
  transition:
    transform 100ms ease-out,
    background-color 200ms;
}

.contact:hover {
  background: color-mix(in srgb, var(--bg-alt) 92%, var(--text));
}

.contact-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
}

.contact-value {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--accent-text);
  overflow-wrap: anywhere;
}

.footer {
  border-top: 1px solid var(--line);
  padding: 1.25rem var(--gutter);
  font-size: 0.75rem;
  color: var(--text-2);
}

/* Scroll reveal (enhanced by script.js) */
.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 700ms var(--ease),
    transform 900ms var(--ease);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Portrait grows gently into place while scrolling */
@supports (animation-timeline: view()) {
  .portrait img {
    animation: settle linear both;
    animation-timeline: view();
    animation-range: entry 0% cover 45%;
  }

  @keyframes settle {
    from {
      transform: scale(1.12);
    }
    to {
      transform: scale(1);
    }
  }
}

@media (max-width: 734px) {
  .nav-links li:not(:last-child) {
    display: none;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding-top: 2.5rem;
  }

  .portrait {
    order: -1;
    width: 140px;
    border-radius: 22px;
  }

  .project {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .project-slot {
    top: calc(52px + 0.75rem);
  }

  .section {
    padding-top: 5rem;
  }

  .bento,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .tile-wide {
    grid-column: auto;
  }

  .project-art {
    min-height: 160px;
  }

  .timeline {
    --rail-x: calc(var(--rail) / 2);
    gap: 2.5rem;
  }

  .step {
    grid-template-columns: var(--rail) 1fr;
    grid-template-areas:
      "rail year"
      "rail body";
    column-gap: 0.75rem;
    row-gap: 0.25rem;
  }

  .step-year {
    text-align: left;
    padding-top: 0.1rem;
  }

  .step-dot {
    margin-top: 0.3rem;
  }
}

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

  .js .reveal {
    transform: none;
    transition: opacity 200ms ease;
  }

  .portrait img,
  .step-now.is-passed .step-dot {
    animation: none;
  }

  .js .step-year,
  .js .step-body {
    transform: none;
  }

  .project {
    transform: none;
  }

  .btn:active,
  .contact:active,
  .nav-cta:active {
    transform: none;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .nav.is-scrolled {
    background: var(--bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  :root {
    --text-2: var(--text);
    --line: currentColor;
  }

  .tile,
  .contact,
  .project {
    border: 1px solid var(--text);
  }
}
