/* =========================================================
   Dr. Kloß – zentrales Stylesheet
   Alle Stellschrauben stehen oben als Variablen.
   ========================================================= */

/* ---------- Schrift ----------
   Apple-Geräte haben "Avenir Next" vorinstalliert → wird direkt benutzt.
   Alle anderen bekommen "Nunito Sans" (freie Schrift, SIL Open Font License, liegt in assets/fonts/
   auf dem eigenen Server – keine Verbindung zu Google o. Ä.). Arial nur als letzte Rückfallebene. */
@font-face {
  font-family: "Nunito Sans Web";
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url("fonts/nunito-sans-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Nunito Sans Web";
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url("fonts/nunito-sans-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

:root {
  --schrift: "Avenir Next", "Nunito Sans Web", Arial, Helvetica, sans-serif;
  --fett: 600;             /* Navigation, Titel, Überschriften (Avenir Next "Demi Bold"); 700 = wie vorher */
  --bg: #fff;
  --fg: #000;
  --band: 15vh;            /* oberer/unterer Bereich: 15 % der Seitenhöhe */
  --kv-ratio: 3 / 2;       /* Querformat der Key Visuals (Desktop)        */
  --gap: 24px;             /* Abstand zwischen Key Visuals / Medien        */
  --pad: 24px;             /* Seitenrand für Kopfzeile und Name            */
  --magenta: #F20089;      /* Unterstreichung externer Links (Instagram, E-Mail, andere Websites) */
  --kv-w: 65vw;            /* wird per JS gesetzt: min(Fenster, 65 % Bildschirm) */
  --col-w: var(--kv-w);    /* Spalte, an der Kopf- und Fußzeile ausgerichtet werden */
  --inset: 5px;            /* Abstand von Kopf-/Fußzeile zur Kante der Spalte */
}

@supports (height: 100dvh) {
  :root { --band: 15dvh; }
}

/* Dunkelmodus nur auf Mobilgeräten (Touch, kein Hover) */
@media (hover: none) and (pointer: coarse) and (prefers-color-scheme: dark) {
  :root { --bg: #000; --fg: #fff; color-scheme: dark; }
}

* { box-sizing: border-box; }

html {
  font-size: 24px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--schrift);
  font-weight: var(--fett);
  line-height: 1.25;
}

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

/* ---------- Kopfzeile: obere 15 % ---------- */
.site-head {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--band);
  padding: var(--pad);
  /* Seitenrand: Spaltenkante + 5 px, aber nie weniger als --pad */
  padding-left:  max(var(--pad), calc((100% - var(--col-w)) / 2 + var(--inset)));
  padding-right: max(var(--pad), calc((100% - var(--col-w)) / 2 + var(--inset)));
  padding-top: max(var(--pad), env(safe-area-inset-top));
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 10;
  pointer-events: none;
}
.site-head a { pointer-events: auto; }

/* Desktop: Navigation beim Runterscrollen ausblenden (0,5 s), Einblenden sofort */
.site-head.nav-hidden {
  opacity: 0;
  transition: opacity .5s ease;
}
.site-head.nav-hidden a { pointer-events: none; }

/* Farbe automatisch schwarz/weiß je nach Hintergrund (per JS) */
.auto-contrast { color: var(--fg); }
.auto-contrast.on-dark  { color: #fff; }
.auto-contrast.on-light { color: #000; }

/* ---------- Projekte: Key Visuals (Desktop) ---------- */
.kv-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap);
  padding: var(--band) 0;
}

.kv {
  display: block;
  width: var(--kv-w);
  aspect-ratio: var(--kv-ratio);
  overflow: hidden;
}
.kv { position: relative; }
.kv img,
.kv video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Slideshow: Bilder liegen übereinander und blenden über */
.kv img.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.5s ease;     /* Dauer der Überblendung */
}
.kv img.slide.on { opacity: 1; }

/* Desktop: Projektname mittig im Key Visual */
.kv-title {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  max-width: calc(100% - 2 * var(--pad));
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .5s ease;      /* Ausblenden: 0,5 s */
}
.kv:hover .kv-title,
.kv:focus-visible .kv-title {
  opacity: 1;
  transition: none;                  /* Einblenden: sofort */
}

/* ---------- Projektname: untere 15 % ---------- */
.kv-name {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: var(--band);
  padding: 0 var(--pad);
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity .5s ease;      /* Ausblenden: 0,5 s */
}
.kv-name.show {
  opacity: 1;
  transition: none;                  /* Einblenden: sofort */
}

/* ---------- Mobil: Hochformat, bildschirmfüllend, seitlich wischen ---------- */
@media (max-width: 767px), (hover: none) and (pointer: coarse) and (orientation: portrait) {
  body.page-index { overflow: hidden; }

  .page-index .kv-list {
    position: fixed;
    inset: 0;
    flex-direction: row;
    align-items: stretch;
    gap: 0;
    padding: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .page-index .kv-list::-webkit-scrollbar { display: none; }

  .page-index .kv {
    flex: 0 0 100vw;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    aspect-ratio: auto;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  .page-index .kv-name {
    opacity: 1;
    transition: none;
  }
  .page-index .kv-title { display: none; }   /* mobil: Name unten statt mittig */
}

/* ---------- Inhaltsseiten (Projekt, Dr. Kloß, Impressum) ---------- */
.content {
  font-size: .75rem;      /* Fließtext 18 px (Überschriften rechnen mit rem und bleiben gleich) */
  width: var(--kv-w);
  margin: 0 auto;
  padding: var(--band) 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

/* Titel und Text nie direkt am Fensterrand (Bilder und Videos bleiben randlos) */
.content > :not(img):not(video):not(.gallery) {
  padding-left: var(--edge, 0px);
  padding-right: var(--edge, 0px);
}
.content > img.portrait { margin-left: var(--edge, 0px); }

.content h1 {
  font-size: 1.8rem;
  margin: 0;
  color: var(--fg);
}

.content h2 {
  font-size: 1.2rem;      /* ≈ 29 px – zwischen Fließtext (18 px) und Titel (≈ 43 px) */
  font-weight: var(--fett);   /* wie der Titel */
  line-height: 1.2;
  margin: 1.5em 0 0.5em;  /* Abstand nach oben größer als nach unten: gehört zum folgenden Text */
  color: var(--fg);
}
.content h2:first-child { margin-top: 0; }   /* kein Leerraum, wenn er ganz oben in einem Block steht */
.content > h2.subtitle { margin: 0; }          /* Untertitel direkt unter dem Titel */

.content img,
.content video {
  width: auto;
  height: auto;
  max-width: 100%;
  align-self: flex-start;            /* linksbündig wie Titel und Text */
}
.content img   { max-height: 75vh; } /* Desktop: Bilder höchstens 75 % der Fensterhöhe */
.content video { max-height: 90vh; } /* Desktop: Videos höchstens 90 % der Fensterhöhe */
.content video.poster-fill { object-fit: cover; }   /* Standbild füllt den Rahmen, bis das Video startet */

.content p { margin: 0 0 1em; }
.content .text p:last-child { margin-bottom: 0; }

.foot-link { margin-top: var(--gap); }

.content img.portrait { width: min(100%, 12rem); }   /* Foto auf der Dr.-Kloß-Seite */

@media (max-width: 767px), (hover: none) and (pointer: coarse) and (orientation: portrait) {
  .content { width: 100%; padding-left: var(--pad); padding-right: var(--pad); --edge: 0px; }
  .content img,
  .content video { width: 100%; max-height: none; }   /* mobil: volle Breite wie bisher */
  .content img.portrait { width: min(100%, 12rem); }

  .content.full-bleed { padding-left: 0; padding-right: 0; }
  .content.full-bleed h1 { padding: 0 var(--pad); }
}

/* Fließtext in normaler Strichstärke (Titel, Navigation, Namen bleiben fett) */
p { font-weight: 400; }
h1, h2, h3, b, strong { font-weight: var(--fett); }   /* Browser-Standard wäre 700 */

/* Projektseiten: Medien links, Text rechts daneben – überall außer in der Handyansicht.
   Die Bedingung unten ist das genaue Gegenteil der Handy-Bedingung
   "(max-width: 767px), (hover: none) and (pointer: coarse) and (orientation: portrait)". */
.text-group > * + * { margin-top: 1em; }
@media (min-width: 768px) and (hover: hover), (min-width: 768px) and (pointer: fine), (min-width: 768px) and (orientation: landscape) {
  .content.cols {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);   /* Medien : Text */
    column-gap: calc(2 * var(--gap));
    row-gap: var(--gap);
    align-items: start;
    width: min(calc(100vw - 2 * var(--pad)), 1800px);
    --edge: 0px;
  }
  body.has-cols { --col-w: min(calc(100vw - 2 * var(--pad)), 1800px); }   /* Projektseiten zweispaltig */
  .content.cols { position: relative; }
  .content.cols > h1,
  .content.cols > h2.subtitle { grid-column: 1 / -1; }
  .content.cols > img,
  .content.cols > video,
  .content.cols > .gallery,
  .content.cols > .credits { grid-column: 1; }
  .content.cols > .text-group {              /* Text rechts, Höhe setzt site.js */
    position: absolute;
    right: 0;
    width: calc((100% - 2 * var(--gap)) * 2 / 5);
  }
}

/* Bild groß anzeigen (Klick auf ein Bild einer Projektseite) */
.content img.zoomable { cursor: zoom-in; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--pad);
  cursor: zoom-out;
}
.lightbox img {
  max-width: calc(100vw - 2 * var(--pad));
  max-height: calc(100vh - 2 * var(--pad));
  width: auto;
  height: auto;
}

/* Slideshow auf Projektseiten (Bilder mit class="slideshow") */
.gallery {
  position: relative;
  width: 100%;
  max-height: 75vh;
  overflow: hidden;
  outline: none;
}
.gallery-track {
  display: flex;
  height: 100%;
  transition: transform .45s ease;      /* seitliches Schieben */
}
.content .gallery img {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;                   /* ganzes Bild sichtbar, nichts abgeschnitten */
}
.gallery-btn {                           /* Pfeile – immer sichtbar */
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 1.8rem;
  height: 1.8rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--bg);
  color: var(--fg);
  opacity: .85;
  font: var(--fett) 1.4rem/1 var(--schrift);
  cursor: pointer;
  z-index: 2;
}
.gallery-btn:hover,
.gallery-btn:focus-visible { opacity: 1; }
/* Farbe je nach Bild darunter: helles Bild → schwarzer Kreis, weißer Pfeil; dunkles Bild → umgekehrt */
.gallery-btn.auto-contrast.on-dark  { background: #fff; color: #000; }
.gallery-btn.auto-contrast.on-light { background: #000; color: #fff; }
.gallery-prev { left: 12px; }
.gallery-next { right: 12px; }


/* Fußzeile: © + Impressum, klein links unten (wird vom Aktualisierungs-Skript eingefügt) */
/* Projektseiten: Pfeile zum vorherigen / nächsten Projekt (setzt site.js ein) */
.proj-nav {
  display: flex;
  justify-content: space-between;
  padding: 0 max(var(--pad), calc((100% - var(--col-w)) / 2 + var(--inset))) var(--gap);   /* oben reicht der Abstand unter dem Inhalt */
  font-size: 1.5rem;                     /* 36 px */
  line-height: 1;
}
.proj-nav a { padding: .25em 0; }       /* etwas größere Klickfläche */
.proj-nav a:hover { opacity: .5; }
@media (max-width: 767px), (hover: none) and (pointer: coarse) and (orientation: portrait) {
  .proj-nav { padding-left: var(--pad); padding-right: var(--pad); }
}

.site-foot,
.site-foot a {
  font-family: var(--schrift);
  font-size: 8pt;
  font-weight: 400;                      /* normal, nicht fett */
}
.site-foot {
  padding: 0 var(--pad) var(--pad);
  padding-left: max(var(--pad), calc((100% - var(--col-w)) / 2 + var(--inset)));   /* bündig mit der Navigation */
  padding-bottom: max(var(--pad), env(safe-area-inset-bottom));
  text-align: left;
}
@media (max-width: 767px), (hover: none) and (pointer: coarse) and (orientation: portrait) {
  .page-index .site-foot {               /* mobile Übersicht: keine Fußzeile (nur auf Projekt- und Dr.-Kloß-Seite) */
    display: none;
  }
  .site-foot { padding-left: var(--pad); }   /* mobil: bündig mit dem Text darüber */
}

/* Kontakt auf der Dr.-Kloß-Seite: Icon links, Text mit Abstand daneben.
   Die Icons werden als Maske in der Textfarbe gezeichnet → im Dunkelmodus automatisch weiß. */
.kontakt { list-style: none; margin: 0 0 1em; padding: 0; font-weight: 400; }
.kontakt li { display: flex; align-items: center; gap: .6em; margin-bottom: .4em; }
.kontakt .icon {
  flex: none;
  width: 1.1em; height: 1.1em;
  background-color: currentColor;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-size: contain;    mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}
.icon-insta { -webkit-mask-image: url("instaicon.png"); mask-image: url("instaicon.png"); }
.icon-mail  { -webkit-mask-image: url("aticon.png");    mask-image: url("aticon.png"); }

/* ---------- Dr.-Kloß-Seite ----------
   Handy: alles untereinander. Sonst: Foto links, Text rechts; Blöcke nebeneinander. */
.about {
  --abstand: calc(6 * var(--gap));      /* Weißraum zwischen Text, Kontakt, Blöcken (144 px) */
  gap: calc(6 * var(--gap));            /* Weißraum zwischen den Zeilen (Foto + Text) (144 px) */
}
@media (max-width: 767px), (hover: none) and (pointer: coarse) and (orientation: portrait) {
  .about {                              /* Handy (alles untereinander): knapper */
    --abstand: calc(2 * var(--gap));    /* 48 px */
    gap: calc(3 * var(--gap));          /* 72 px */
  }
}
.about .zeile,
.about .spalte,
.about .bloecke { display: flex; flex-direction: column; gap: var(--abstand); }
.about .block > :last-child,
.about .kontakt { margin-bottom: 0; }

/* Titel + Untertitel oben auf der Dr.-Kloß-Seite: dicht beieinander, nicht im großen Seitenabstand */
.about .kopf > * { margin: 0; }
.about .kopf > h2 { margin-top: .3em; }

/* Unterschrift: als Maske in der Textfarbe → hell/dunkel automatisch */
.signatur {
  display: block;
  width: 6rem;             /* Unterschrift unabhängig von der Textgröße */
  aspect-ratio: 996 / 785;
  margin-top: .75em;
  background-color: currentColor;
  -webkit-mask: url("signatur.png") left center / contain no-repeat;
          mask: url("signatur.png") left center / contain no-repeat;
}

@media (min-width: 768px) and (hover: hover), (min-width: 768px) and (pointer: fine), (min-width: 768px) and (orientation: landscape) {
  .about .zeile {
    display: grid;
    grid-template-columns: 12rem 1fr;
    gap: calc(2 * var(--gap));
    align-items: start;
  }
  .about .zeile > img.portrait { width: 100%; margin-left: 0; }
  .about .bloecke {                       /* normale Blöcke teilen sich die ganze Breite */
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--abstand) calc(2 * var(--gap));
    align-items: flex-start;
  }
  .about .block { flex: 1 1 11rem; min-width: 0; }   /* erst unter 11rem pro Block in die nächste Zeile */
  .about .block.breit { flex-basis: 100%; }          /* eigene Zeile, volle Breite */
}

/* Externe Links, Instagram, E-Mail: Magenta-Unterstreichung (interne Links bleiben ohne) */
a[href^="http"]:not([href*="chriskloss.com"]),
a[href^="mailto:"],
a.email {
  text-decoration: underline;
  text-decoration-color: var(--magenta);
  text-decoration-thickness: from-font;   /* Stärke wie in der Schrift festgelegt  */
  text-underline-position: from-font;     /* Lage wie in der Schrift festgelegt */
}

/* Bildnachweise / Copyright-Notiz unter den Medien: <p class="credits">…</p> */
.content .credits {
  font-size: 8pt;
  font-weight: 400;
  line-height: 1.4;
  margin: calc(-0.5 * var(--gap)) 0 0;  /* etwas näher an das Medium darüber */
}


/* Lebenslauf-Liste (z. B. Awards, Scholarships auf der Dr.-Kloß-Seite):
   <ul class="cv"><li><span>2022</span><span>Eintrag</span></li></ul> */
.cv { list-style: none; margin: 0 0 1em; padding: 0; font-weight: 400; }
.cv li { display: grid; grid-template-columns: 3em 1fr; gap: 0 .5em; margin-bottom: .4em; }
