@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600;700;800&display=swap');

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Tokens ────────────────────────────────────────────────────────────────── */
:root {
  --black:   #000;
  --white:   #fff;
  --orange:  #ff5e1b;
  --skel:    #ebebeb;
  --skel2:   #e0e0e0;
  --font:    'Manrope', sans-serif;
  --pad-x:   8vw;
  --col-gap:     260px;   /* horizontal between columns */
  --col-gap-y:   200px;   /* vertical between items */
}

html[data-theme="dark"] {
  --white: #000;
  --black: #fff;
  --skel:  #1e1e1e;
  --skel2: #2a2a2a;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--white);
  color: var(--black);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 600ms ease, color 600ms ease;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }

/* ── Skip link ─────────────────────────────────────────────────────────────── */
.skip-link {
  position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden;
}
.skip-link:focus {
  left: 1rem; top: 1rem; width: auto; height: auto;
  z-index: 1000; background: var(--black); color: var(--white); padding: .5rem 1rem;
}

/* ── Header ────────────────────────────────────────────────────────────────── */
#header {
  background: var(--white);
  padding: 26px var(--pad-x) 26px;
  position: relative;
  z-index: 101;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  transition: background-color 600ms ease;
}

/* Logo — 2-line bold text, matches 311×90px image on live site */
.site-logo {
  font-size: 2.1rem;        /* ≈33px per line × 1.35 lh ≈ 90px total */
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0.02em;
  max-width: 320px;
}
.site-logo a { display: block; }

/* Header right: nav + Instagram */
.header-right {
  display: flex;
  align-items: center;
  gap: 28px;
  padding-top: 8px;         /* vertically center relative to 2-line logo */
}

/* Nav */
nav.main-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

nav.main-nav a {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  position: relative;
  padding-bottom: 2px;
}

/* Dark mode toggle */
.dark-toggle {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--black);
  line-height: 0;
  display: flex;
  align-items: center;
  transform: translateY(-2px);
  transition: color .3s;
}
.dark-toggle:hover { color: var(--orange); }
.dark-toggle .icon-sun { display: none; }
html[data-theme="dark"] .dark-toggle .icon-moon { display: none; }
html[data-theme="dark"] .dark-toggle .icon-sun  { display: block; }

/* Burger button — hidden on desktop, shown on mobile */
.burger {
  display: none;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--black);
  line-height: 0;
  transition: color .3s;
}
@media (hover: hover) {
  .burger:not(.open):hover { color: var(--orange); }
}
.burger .b1,
.burger .b2,
.burger .b3 {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1), opacity 220ms ease;
}
.burger.open .b1 { transform: translateY(6px) rotate(45deg); }
.burger.open .b2 { opacity: 0; }
.burger.open .b3 { transform: translateY(-6px) rotate(-45deg); }

/* Mega menu — hidden until .open is added by JS */
.mega-menu {
  display: none;
}

/* Underline slides in from left on hover */
nav.main-nav a::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 100%; height: 2px;
  background: var(--black);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform .28s ease;
}
nav.main-nav a:hover::after { transform: scaleX(1); }
nav.main-nav a.active::after { transform: scaleX(1); }


#page { padding-top: 0; }

/* ── Custom + cursor ──────────────────────────────────────────────────────── */
/* 40×40 SVG crosshair, 3px stroke, hotspot at center (20 20) */
:root {
  --cursor-plus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cline x1='20' y1='1' x2='20' y2='39' stroke='black' stroke-width='3'/%3E%3Cline x1='1' y1='20' x2='39' y2='20' stroke='black' stroke-width='3'/%3E%3C/svg%3E") 20 20, crosshair;
}
html[data-theme="dark"] {
  --cursor-plus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cline x1='20' y1='1' x2='20' y2='39' stroke='white' stroke-width='3'/%3E%3Cline x1='1' y1='20' x2='39' y2='20' stroke='white' stroke-width='3'/%3E%3C/svg%3E") 20 20, crosshair;
}

/* ── Skeleton pulse ───────────────────────────────────────────────────────── */
@keyframes skeleton-pulse {
  0%, 100% { background-color: var(--skel); }
  50%       { background-color: var(--skel2); }
}

/* ── Home: project grid ──────────────────────────────────────────────────── */
/* Mobile / no-JS fallback: simple 1-column stack */
.projects-masonry {
  padding: 40px var(--pad-x) 80px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.project-item {
  display: block;
}

/* Reinhard-Thomas-style 24-column asymmetric grid (JS-applied on desktop) */
@media (min-width: 769px) {
  .projects-masonry.rt-grid {
    --rt-container: calc(100vw - var(--pad-x) * 2);
    --rt-row-h:     calc(var(--rt-container) * 0.0215);
    --rt-gap:       11px;
    padding: 60px var(--pad-x) 120px;
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    grid-auto-rows: var(--rt-row-h);
    gap: var(--rt-gap);
    align-content: start;
  }
  .projects-masonry.rt-grid .project-item {
    margin: 0;
    align-self: start;
    min-width: 0;
  }
  .projects-masonry.rt-grid .project-thumb {
    width: 100%;
  }
  .projects-masonry.rt-grid .project-thumb img {
    width: 100%;
    height: auto;
  }
  }

.project-thumb {
  display: block;
  width: 100%;
  overflow: hidden;
  background: var(--skel);
}

/* Skeleton: pulsate until image loads */
.project-thumb.skeleton {
  animation: skeleton-pulse 1.8s ease-in-out infinite;
}

.project-thumb img {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0;
  transition: opacity .4s ease, filter 5s ease;
}

.project-thumb.img-loaded img {
  opacity: 1;
}

.project-item:hover .project-thumb img {
  filter: grayscale(100%);
  opacity: 0.7;
}

/* Desktop with hover: suppress default cursor on project items */
@media (hover: hover) and (pointer: fine) and (min-width: 769px) {
  .projects-masonry .project-item { cursor: none; }
}

.project-name {
  font-size: 20px;
  font-weight: 600;
  margin-top: 16px;
  letter-spacing: 0.01em;
  text-align: left;
}


.project-cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  pointer-events: none;
  font-size: 3rem;       /* 48px @ root 16px (2× the original 24px) */
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: #fff;
  opacity: 0;
  transform: translate3d(-9999px, -9999px, 0);
  transition: opacity 140ms ease;
  will-change: transform, opacity;
}
.project-cursor.visible { opacity: 1; }

/* ── Project page ──────────────────────────────────────────────────────────── */
.project-header {
  text-align: center;
  padding: 60px var(--pad-x) 35px;
}

.project-title {
  font-family: var(--font);
  font-size: 20rem;          /* JS overrides this to fit content width, 20rem is the cap */
  font-weight: 500;
  line-height: 1.09;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  margin-bottom: -0.29em;   /* cancels descender + half-leading; pins element bottom to baseline */
}

.project-year {
  font-size: 1.3rem;
  font-weight: 600;
  margin-top: 77px;          /* fixed px gap from title baseline — consistent at all font sizes */
  letter-spacing: 0.05em;
}

/* Project gallery: 3-column masonry */
.project-gallery {
  --gallery-gap: 72px;
  padding: 0 var(--pad-x) 80px;
  columns: 3;
  column-gap: var(--gallery-gap);
}

/* Gallery items — skeleton + cursor */
.gallery-item {
  break-inside: avoid;
  margin-bottom: var(--gallery-gap);
  display: block;
  background: var(--skel);
  overflow: hidden;
  cursor: var(--cursor-plus);
  transition: opacity 610ms cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item.skeleton {
  animation: skeleton-pulse 1.8s ease-in-out infinite;
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0;
  transition: opacity .4s ease, filter 5s ease;
}

.gallery-item.img-loaded {
  animation: none;
  background: transparent;
}

.gallery-item.img-loaded img {
  opacity: 1;
}

.gallery-item:hover img {
  filter: grayscale(100%);
  opacity: 0.7;
}

/* Lightbox open/close: fade non-active siblings + hide the active thumb */
.gallery-item.lb-fade {
  opacity: 0;
  pointer-events: none;
}
.gallery-item.lb-active { visibility: hidden; }

/* ── Lightbox ──────────────────────────────────────────────────────────────── */
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--white);
  color: var(--black);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 400ms cubic-bezier(0.4,0,0.2,1),
              visibility 0s linear 400ms,
              background-color 400ms ease;
}
#lightbox.open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 700ms cubic-bezier(0.4,0,0.2,1),
              visibility 0s linear 0s,
              background-color 600ms ease;
}

/* Image — centered in full viewport, max 82vh so controls fit below */
#lightbox-img-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
#lightbox-img {
  max-width: 90vw;
  max-height: 82vh;
  object-fit: contain;
  opacity: 0;
  will-change: opacity, transform, filter, clip-path;
  display: block;
}

/* Controls bar — full width at 5vw margins, top set by JS below image */
#lb-controls {
  position: absolute;
  left: 5vw;
  right: 5vw;
  /* top: injected by JS */
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: auto;
}

/* Start hidden; JS slides them in after open */
#lb-controls-left,
#lightbox-close {
  opacity: 0;
  transform: translateY(28px);
}

#lightbox-close {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  line-height: 0;
  display: block;
  transition: opacity 160ms ease;
}
#lightbox-close path { fill: var(--black); }

#lb-counter {
  font-family: var(--font);
  font-size: 2.35rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
#lb-num { display: inline-block; width: 2ch; text-align: left; }

/* Click zones overlaying each half of the lightbox — added by JS.
   They sit above the image but below #lb-controls/#lightbox-close (later DOM
   siblings paint on top). Custom arrow-in-circle cursors. */
.lb-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
}
.lb-zone-prev { left: 0; }
.lb-zone-next { right: 0; }
/* Cursor arrows mirror the lightbox controls' long arrow shape, scaled
   to fit a 40×40 circle. Light mode: white circle + black arrow.
   Path copied from the inline SVGs in project.php (#lb-prev / #lb-next). */
.lb-zone-prev {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Ccircle cx='20' cy='20' r='19' fill='white'/%3E%3Cg transform='translate(30 11.3) scale(-0.156 0.156)' fill='black'%3E%3Cpath d='M72.2124 111.364L64.8793 104.093L108.132 60.902H0V50.4616H108.132L64.8793 7.27094L72.2124 0L127.894 55.6818L72.2124 111.364Z'/%3E%3C/g%3E%3C/svg%3E") 20 20, w-resize;
}
.lb-zone-next {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Ccircle cx='20' cy='20' r='19' fill='white'/%3E%3Cg transform='translate(10 11.3) scale(0.156)' fill='black'%3E%3Cpath d='M72.2124 111.364L64.8793 104.093L108.132 60.902H0V50.4616H108.132L64.8793 7.27094L72.2124 0L127.894 55.6818L72.2124 111.364Z'/%3E%3C/g%3E%3C/svg%3E") 20 20, e-resize;
}
/* Dark mode: black circle, white arrow */
html[data-theme="dark"] .lb-zone-prev {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Ccircle cx='20' cy='20' r='19' fill='black'/%3E%3Cg transform='translate(30 11.3) scale(-0.156 0.156)' fill='white'%3E%3Cpath d='M72.2124 111.364L64.8793 104.093L108.132 60.902H0V50.4616H108.132L64.8793 7.27094L72.2124 0L127.894 55.6818L72.2124 111.364Z'/%3E%3C/g%3E%3C/svg%3E") 20 20, w-resize;
}
html[data-theme="dark"] .lb-zone-next {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Ccircle cx='20' cy='20' r='19' fill='black'/%3E%3Cg transform='translate(10 11.3) scale(0.156)' fill='white'%3E%3Cpath d='M72.2124 111.364L64.8793 104.093L108.132 60.902H0V50.4616H108.132L64.8793 7.27094L72.2124 0L127.894 55.6818L72.2124 111.364Z'/%3E%3C/g%3E%3C/svg%3E") 20 20, e-resize;
}
/* On hover devices, JS replaces the native cursor with an animated DOM element */
@media (hover: hover) and (pointer: fine) {
  #lightbox.lb-custom-cursor .lb-zone { cursor: none; }
}
/* Animated DOM cursor for lightbox (hover devices only) */
.lb-cursor {
  position: fixed;
  width: 40px;
  height: 40px;
  margin-left: -20px;
  margin-top: -20px;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transition: rotate 280ms cubic-bezier(0.4, 0, 0.2, 1),
              opacity 120ms ease;
}
.lb-cursor.visible { opacity: 1; }
.lb-cursor.is-prev { rotate: 180deg; }
.lb-cursor .lb-cc { fill: white; }
.lb-cursor .lb-ca { fill: black; }
html[data-theme="dark"] .lb-cursor .lb-cc { fill: black; stroke: none; }
html[data-theme="dark"] .lb-cursor .lb-ca { fill: white; }

/* ── Project page entrance: per-letter title rise, year fade, gallery staggers ── */
/* Initial-hidden state — only while .js-pre-enter is on <html>; JS removes it
   at the end of the animation, so subsequent layouts/lightbox don't conflict. */

/* Title is hidden until JS has split it into per-letter spans; then inline
   opacity:1 unhides the masks while letters are still translated out of view. */
.js-pre-enter .project-title { opacity: 0; }

/* Always-on: keep mask + letter spans as inline-block so the title's width
   stays stable. If they reverted to plain inline after .js-pre-enter is
   removed, kerning across spans would re-enable and the centered title would
   shift horizontally — that's the "small jerk" right after the entrance. */
.project-title .ltr-mask {
  display: inline-block;
  vertical-align: bottom;
  line-height: inherit;
}
.project-title .ltr { display: inline-block; }

/* Entrance-only: clip the mask + push letters out of view */
.js-pre-enter .project-title .ltr-mask { overflow: hidden; }
.js-pre-enter .project-title .ltr {
  transform: translateY(110%) rotate(6deg);
  transform-origin: 0 100%;
}

/* About page: same per-letter mask mechanics */
.about-page .ltr-mask {
  display: inline-block;
  vertical-align: bottom;
  line-height: inherit;
}
.about-page .ltr { display: inline-block; }
.js-pre-enter .about-page .ltr-mask { overflow: hidden; }
.js-pre-enter .about-page .ltr {
  transform: translateY(110%) rotate(6deg);
  transform-origin: 0 100%;
}

.js-pre-enter .project-year { opacity: 0; transform: translateY(16px); }
.js-pre-enter .project-gallery .gallery-item { opacity: 0; transform: translateY(150px); }

/* Home: thumbs slide-fade in on first load (handled by JS once rt-grid is set) */
.js-pre-enter .projects-masonry .project-item { opacity: 0; transform: translateY(150px); }

/* Text pages (Über / Impressum): single-block slide-up + fade from below */
.js-pre-enter .text-page {
  opacity: 0;
  transform: translateY(100px);
}

/* About page — word-level clip reveal */
.about-word-clip {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  /* extra room so descenders aren't clipped */
  padding-bottom: 0.18em;
  margin-bottom: -0.18em;
}
.about-word {
  display: inline-block;
}

.about-page p,
.about-page h1,
.about-page h2,
.about-page h3,
.about-page blockquote {
  margin-bottom: 0.6em;
}

/* About / Impressum */
.text-page {
  max-width: 600px;
  margin: 0 auto;
  padding: 60px var(--pad-x) 80px;
}
.text-page h1 { font-size: 2.5rem; font-weight: 700; margin-bottom: 2rem; }
.text-page p, .text-page a { font-size: 1rem; line-height: 1.7; font-weight: 300; }
.text-page a { text-decoration: underline; text-underline-offset: 3px; }

/* About page — large display typography spanning full content width */
.about-page {
  padding: 80px var(--pad-x) 120px;
}
.about-page p {
  font-size: 56px;
  line-height: 1.3;
  font-weight: 500;
}
.about-page a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 0.1em;   /* 10% of font-size */
  text-underline-offset: 0.25em;       /* 25% of font-size */
  transition: color 240ms ease, text-decoration-color 240ms ease;
}
.about-page a:hover {
  color: var(--orange);
  text-decoration-color: var(--orange);
}

@media (max-width: 1100px) {
  .about-page p { font-size: 40px; }
}
@media (max-width: 768px) {
  .about-page { padding: 40px var(--pad-x) 60px; }
  .about-page p { font-size: 28px; }
}

/* ── Footer ────────────────────────────────────────────────────────────────── */
footer {
  padding: 32px var(--pad-x);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.06em;
  display: flex;
  gap: 24px;
}
footer a { transition: color .3s; }
footer a:hover { color: var(--orange); }

/* ── Scroll-to-top ─────────────────────────────────────────────────────────── */
#scroll-top {
  display: none;
  position: fixed;
  bottom: 30px; right: 30px;
  z-index: 99;
  width: 44px; height: 44px;
  background: var(--white);
  color: var(--black);
  border: none; border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  transition: background .3s, color .3s;
}
#scroll-top:hover { background: var(--black); color: var(--white); }
#scroll-top.visible { display: flex; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .project-gallery  { columns: 2; }
}

@media (max-width: 768px) {
  :root { --pad-x: 5vw; }
  #header { padding: 18px var(--pad-x); }
  .site-logo { font-size: 1.5rem; }
  .projects-masonry { padding: 30px var(--pad-x) 60px; gap: 48px; }
  .project-gallery  { columns: 2; }
  .project-header   { padding: 40px var(--pad-x) 35px; }

  /* Hide desktop nav links, show burger */
  nav.main-nav a { display: none; }
  .burger { display: block; }
  .dark-toggle { transform: translateY(1px); }

  /* Mega menu */
  .mega-menu {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: var(--white);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 36px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 280ms ease, visibility 0s linear 280ms;
  }
  .mega-menu.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 280ms ease, visibility 0s linear 0s;
  }
  .mega-menu a {
    font-family: var(--font);
    font-size: 2.35rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    transition: color .3s;
  }
  .mega-menu a:hover { color: var(--orange); }
  .mega-menu a.active { color: var(--orange); }

  /* Project thumbnail titles */
  .project-name { font-size: 17px; font-weight: 500; margin-top: 12px; }

  /* Project page: halve gap between title and year */
  .project-year { margin-top: 38px; }

  /* Lightbox controls: fixed at bottom instead of below image */
  #lb-controls {
    position: fixed;
    top: auto;
    bottom: 64px;
  }
}

@media (max-width: 480px) {
  .project-gallery  { columns: 1; }
  nav.main-nav { gap: 14px; }
  nav.main-nav a { font-size: 13px; }
}
