/* ---------- Fonts ---------- */
@font-face {
  font-family: "Moderat Serif";
  src: url("../fonts/Moderat-Serif-Light.woff2") format("woff2"),
       url("../fonts/Moderat-Serif-Light.woff") format("woff");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Moderat";
  src: url("../fonts/Moderat-Light.woff2") format("woff2"),
       url("../fonts/Moderat-Light.woff") format("woff");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ----------
   Cargo skaliert alles mit der Fensterbreite, daher vw-Werte.
   clamp() sorgt dafür, dass es auf kleinen Screens lesbar bleibt. */
:root {
  --bg: #f6f6f6;
  --text: rgba(0, 0, 0, 0.88);
  --text-muted: rgba(20, 4, 4, 0.85);

  --serif: "Moderat Serif", Georgia, "Times New Roman", serif;
  --sans: "Moderat", "Helvetica Neue", Arial, sans-serif;

  --margin: clamp(14px, 1.72vw, 48px);   /* Seitenrand */
  --gutter: clamp(10px, 0.8vw, 24px);    /* Abstand zwischen Bildern */

  --size-header: clamp(18px, 1.23vw, 34px);
  --size-caption: clamp(12px, 0.75vw, 20px);
  --size-footer: clamp(10px, 0.58vw, 16px);

  /* Abstands-System: drei Stufen für die ganze Website */
  --space-s: clamp(12px, 1.5vw, 42px);   /* eng zusammengehörig: Bild -> Titel, Header -> Inhalt */
  --space-m: clamp(22px, 2.6vw, 72px);   /* zwischen Blöcken: Text, Bilder, Bildgruppen */
  --space-l: clamp(36px, 4.6vw, 128px);  /* große Pausen: vor dem Footer, um das Porträt */
}

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

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;   /* gleiche Breite auf allen Seiten, ob mit oder ohne Scrollbalken */
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 var(--margin);
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

img { display: block; max-width: 100%; height: auto; }

:focus-visible { outline: 1px solid currentColor; outline-offset: 3px; }

/* ---------- Header ---------- */
.site-header {
  display: grid;
  grid-template-columns: minmax(0,5fr) minmax(0,2fr) minmax(0,5fr);   /* wie Cargo: Spalten 5 / 2 / 5 */
  align-items: center;
  padding-top: calc(var(--margin) * 0.72);
  margin-bottom: calc(var(--margin) * 0.98);
  font-size: var(--size-header);
  line-height: 1;
}
.site-name  { justify-self: start; white-space: nowrap; }
.site-index { justify-self: end; }
.site-name:hover,
.site-index:hover {
  text-decoration: underline;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.12em;
}

.site-icon {
  justify-self: center;
  display: block;
  width: 0.72em;
}
.site-icon svg {
  display: block;
  width: 100%;
  height: auto;
  fill: var(--bg);
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linejoin: round;
  stroke-linecap: round;
  transform-origin: 50% 50%;
  will-change: transform;
}

/* ---------- Galerie ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: var(--gutter);
  row-gap: calc(var(--margin) * 1.3);
  align-items: start;
}

.project { margin: 0; }

.project img { width: 100%; }
.project-link { display: block; }
/* Hover: nur der Text selbst wird rot hinterlegt (Zeile für Zeile), Schrift bleibt schwarz */
.project .hl {
  padding: 0 0.12em;              /* gilt dank "clone" für jede Zeile gleich */
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;    /* jede Zeile bekommt ihren eigenen Hintergrund */
  transition: background-color 0.15s ease;
}
.project .category,
.project .title,
.project .meta { margin-left: -0.12em; }   /* Text bleibt trotz Polsterung bündig mit dem Bild */
/* Schrift liegt immer über dem Rot: positionierte Elemente werden nach allen Hintergründen gezeichnet */
.project .hl-t { position: relative; }
.project:hover .hl,
.project:focus-within .hl {
  background-color: #ff3200;
  color: #000;
}

.project figcaption {
  margin-top: calc(var(--size-caption) * 0.4);
  font-size: var(--size-caption);
  line-height: 0.97;
  letter-spacing: -0.02em;
}
.project--muted figcaption { color: var(--text-muted); }

.project .category,
.project .title {
  display: block;
  text-transform: uppercase;
}
.project .title {
  text-decoration: underline;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.12em;
}
.project .meta {
  display: block;
  margin-top: 0.8em;   /* ersetzt das <hr> aus Cargo */
  max-width: 34em;
}

/* ---------- Footer ---------- */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  column-gap: 2.5em;            /* langes Leerzeichen zwischen den beiden */
  row-gap: 0.3em;
  padding: calc(var(--margin) * 1.95) 0 calc(var(--margin) * 0.7);
  font-family: var(--sans);
  font-size: clamp(9px, 0.52vw, 14px);
  line-height: 1.1;
  color: rgba(0, 0, 0, 0.5);
}
.site-footer a:hover,
.site-footer a:focus-visible {
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.15em;
}

/* ---------- Projektseiten ---------- */
.page-project {
  --bg: #f1f1f1;                 /* Projektseiten sind bei Cargo einen Tick dunkler */
  --slide-h: 72vh;               /* Höhe der Slideshows ("limit by height") */
  --size-title: clamp(30px, 2.76vw, 80px);
  --size-text: clamp(17px, 1.65vw, 46px);
}

/* Slideshow: alle Bilder übereinander, das aktive ist sichtbar */
.slideshow {
  display: grid;
  justify-items: center;
  align-items: center;
}
.slideshow > img {
  grid-area: 1 / 1;
  /* Alle Bilder einer Slideshow im gleichen Format: --r ist das Seitenverhältnis
     des ERSTEN Bildes (setzt das Script). Andere Formate werden passend beschnitten. */
  width: min(100%, calc(var(--slide-h) * var(--r, 1.5)));
  height: auto;
  aspect-ratio: var(--r, 1.5);
  object-fit: cover;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0s linear 0.35s;
}
.slideshow > img.is-active {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s ease;
}
.slideshow.is-interactive > img { cursor: pointer; }
.project-wide.zoomable { cursor: zoom-in; }

/* Pfeile an Slideshows mit mehreren Bildern (erscheinen beim Überfahren) */
.slideshow { position: relative; }
.slide-btn {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: clamp(28px, 1.8vw, 52px);
  aspect-ratio: 1;
  margin-top: calc(clamp(28px, 1.8vw, 52px) / -2);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #bbb;
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.slide-btn svg { display: block; width: 44%; margin: auto; fill: none; stroke: currentColor; stroke-width: 1.4; }
.slide-btn--prev { left: clamp(6px, 0.9vw, 26px); }
.slide-btn--next { right: clamp(6px, 0.9vw, 26px); }
.slideshow:hover .slide-btn,
.slide-btn:focus-visible { opacity: 1; }
@media (hover: none) { .slide-btn { opacity: 1; } }

.project-head {
  margin-top: clamp(14px, 1.65vw, 44px);
}
.project-kicker,
.project-meta {
  margin: 0;
  font-size: var(--size-caption);
  line-height: 0.97;
  letter-spacing: -0.02em;
}
.project-kicker { text-transform: uppercase; }

.project-title {
  margin: 0.29em 0 0;
  font-size: var(--size-title);
  font-weight: 300;
  line-height: 0.98;
  text-transform: uppercase;
  text-decoration: underline;
  text-decoration-thickness: 0.065em;
  text-underline-offset: 0.05em;
}
.project-meta { margin-top: calc(var(--size-title) * 0.52); }
.project-title .lc { text-transform: none; }
/* Titel steht bei Cargo in der linken Hälfte einer 2-Spalten-Zeile */
@media (min-width: 701px) { .project-title { max-width: calc(50% - var(--gutter) / 2); } }

.project-text {
  margin: calc(var(--size-text) * 1.45) 0 0;
  font-size: var(--size-text);
  line-height: 0.98;
  letter-spacing: -0.01em;
}

.project-text p { margin: 0; }
.project-text p + p { margin-top: 0.98em; }   /* eine Leerzeile zwischen Absätzen */


.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gutter);
  margin-top: calc(var(--size-text) * 1.4);
}
.project-grid img { width: 100%; cursor: zoom-in; }
.project-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.project-wide { display: block; width: 100%; height: auto; }

/* Bilder in einer Zeile, alle gleich hoch (Breite je nach Format über flex-grow) */
.project-row {
  display: flex;
  width: 100%;
  gap: var(--gutter);
  align-items: flex-start;
}
.project-row img { flex: 1 1 0; min-width: 0; width: 0; height: auto; cursor: zoom-in; }

/* höhere Slideshow (Morgenstern) */
.page-project .slideshow--tall { --slide-h: 88vh; }
.project-meta--muted { color: var(--text-muted); }

/* schmale, mittige Medien untereinander (Video + Bild) */
.project-narrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(16px, 1.6vw, 44px);
}
.project-narrow > img,
.project-narrow > video {
  display: block;
  width: 14.3%;
  min-width: 180px;
  height: auto;
  background: #e2e2e2;
}
.project-narrow > img { cursor: zoom-in; }
.project-grid--6 {
  /* 6er-Raster, die vorhandenen Bilder mittig */
  grid-template-columns: repeat(auto-fit, calc((100% - 5 * var(--gutter)) / 6));
  justify-content: center;
}
.project-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.project-grid .span-2 { grid-column: span 2; }

/* Bild und Text nebeneinander */
.project-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gutter);
  align-items: start;
}
.project-split img { width: 100%; cursor: zoom-in; }
.project-split .project-text { margin: 0; }

.project-block { margin-top: clamp(24px, 3vw, 80px); }

.project-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gutter);
  margin-top: clamp(20px, 1.6vw, 44px);
}


.page-project .site-footer {
  padding-top: calc(var(--margin) * 0.5);
}

.about-intro { margin-top: clamp(28px, 3.1vw, 90px); }
.about-portrait {
  display: block;
  width: 8.9%;
  min-width: 140px;
  height: auto;
  margin: clamp(60px, 7.1vw, 200px) auto 0;
  cursor: zoom-in;
}
.about-table {
  margin: clamp(40px, 4.9vw, 140px) 0 0;
  font-family: var(--sans);
  font-size: var(--size-caption);
  line-height: 1;
}
.about-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--gutter);
}
.about-row dd { line-height: 1.15; }
.about-row dt,
.about-row dd {
  margin: 0;
  min-height: 4em;
  padding-top: 0.55em;
  border-top: 1px solid #000;
}
.about-row:last-child dt,
.about-row:last-child dd { min-height: 0; }
@media (max-width: 700px) {
  .about-row { grid-template-columns: 1fr; }
  .about-row dd { border-top: 0; padding-top: 0.3em; min-height: 0; margin-bottom: 1.4em; }
  .about-row dt { min-height: 0; }
}

/* ---------- Impressum / Datenschutz ---------- */
.legal {
  margin-top: clamp(40px, 5.4vw, 150px);
  font-size: var(--size-header);
  line-height: 1.45;
  max-width: 100%;
}
.legal h1 {
  margin: 0 0 0.9em;
  font-family: var(--sans);
  font-weight: 300;
  font-size: clamp(18px, 1.3vw, 38px);
  line-height: 1.2;
}
.legal h2 {
  margin: 0;
  font: inherit;
}
.legal p { margin: 0; }
.legal--spaced p + p { margin-top: 1.45em; }   /* Leerzeile zwischen Blöcken */
.legal a { text-decoration: underline; text-decoration-thickness: 0.06em; text-underline-offset: 0.12em; }

/* ---------- Index-Overlay ---------- */
.index-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem var(--margin);
  background: rgba(255, 255, 255, 0.95);
  overflow-y: auto;
  animation: index-fade 0.2s ease;
}
.index-overlay[hidden] { display: none; }
@keyframes index-fade { from { opacity: 0; } to { opacity: 1; } }
.index-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.05em;
  text-align: center;
  font-size: clamp(18px, 1.3vw, 38px);
  line-height: 1.05;
  color: #000;
}
.index-inner a { display: block; }
.index-inner .t5 { display: block; font-family: var(--sans); }
.index-inner .t6 { display: block; font-family: var(--serif); }
.index-inner a:hover .t6 { text-decoration: underline; text-decoration-thickness: 0.06em; text-underline-offset: 0.12em; }
.index-close {
  margin-bottom: 0.15em;
  padding: 0 0.2em;
  border: 0;
  background: none;
  color: inherit;
  font-family: var(--sans);   /* × aus der Moderat */
  font-weight: 300;
  font-size: 1em;
  line-height: 1;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}
/* kein Rahmen um das Kreuz, egal wie das Overlay geöffnet wurde */
.index-close:focus,
.index-close:focus-visible { outline: none; box-shadow: none; }

/* ---------- Pfeil nach oben (Stil wie das × im Index) ---------- */
.to-top {
  position: fixed;
  right: var(--margin);
  bottom: var(--margin);
  z-index: 15;                    /* unter Index-Overlay und Lightbox */
  padding: 0 0.2em;
  border: 0;
  background: none;
  color: #000;
  font-family: var(--sans);       /* ↑ aus der Moderat */
  font-weight: 300;
  font-size: clamp(18px, 1.3vw, 38px);
  line-height: 1;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}
.to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease;
}
.to-top:focus,
.to-top:focus-visible { outline: none; }

/* ---------- Einheitliche Abstände ---------- */
.site-header { margin-bottom: var(--space-s); }
.gallery { row-gap: var(--space-m); }
.site-footer,
.page-project .site-footer { padding-top: var(--space-l); }

/* Projektseiten: jeder Block hat denselben Abstand zum vorherigen */
.page-project main:not(.legal) > * + * { margin-top: var(--space-m); margin-bottom: 0; }
.page-project main:not(.legal) > .project-head { margin-top: var(--space-s); }

/* About */
.page-about main > .about-intro { margin-top: var(--space-m); }
.page-about main:not(.legal) > .about-portrait,
.page-about main:not(.legal) > .about-table { margin-top: var(--space-l); }

/* Impressum / Datenschutz */
.legal { margin-top: var(--space-m); }

/* ---------- Lightbox (Cargo "zoomable") ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--margin);
  background: var(--bg);
  cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* ---------- Mobil: eine Spalte ---------- */
@media (max-width: 700px) {
  .page-project, .page-project .slideshow--tall { --slide-h: auto; }
  .project-text { line-height: 1.12; }
  .slideshow > img { width: 100%; height: auto; }
  .project-grid,
  .project-columns,
  .project-split { grid-template-columns: 1fr; row-gap: var(--gutter); }
  .project-grid .span-2 { grid-column: auto; }
  .project-row { flex-direction: column; }
  .project-row img { flex: none !important; width: 100%; }
  .project-grid--6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery {
    grid-template-columns: 1fr;
    row-gap: 2.2rem;
  }
  .site-header { margin-bottom: 0.9rem; }
}
