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

/* Lato (Latin) — selbst gehostet, kein externer Request */
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 300; font-display: swap; src: url('fonts/lato-300.woff2') format('woff2'); }
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/lato-400.woff2') format('woff2'); }
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/lato-700.woff2') format('woff2'); }
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 900; font-display: swap; src: url('fonts/lato-900.woff2') format('woff2'); }

/* [hidden] muss display:flex/grid sicher schlagen (z. B. .hero, .grid, .site-footer) */
[hidden] { display: none !important; }

:root {
  --bg: #15110c; /* warm near-black (amber) */
  --surface: #0a0a0a;
  --border: #1a1a1a;
  --text: #fff;
  --muted: rgba(255,255,255,0.5);
  --gold: #e0a82e; /* warm gold — Nikon-Akzent (aktive Pill, Sucher-Ecken, Kameradaten) */
  --gap: 20px;
  --max-width: 1440px;
  --viewer-pad-x: 80px; /* min safe space left/right around the photo */
  --viewer-pad-y: 96px; /* fixed safe space top/bottom (holds the bottom close+counter cluster) */
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  min-height: 100vh;
  /* Flex-Spalte: der Sucher (.hero) füllt per flex:1 die Resthöhe unter dem Header,
     ohne dass die Header-Höhe in JS gemessen werden muss. Im Grid-Modus ist .hero
     ausgeblendet und das Grid wächst natürlich (scrollt). */
  display: flex;
  flex-direction: column;
  overflow-anchor: none; /* verhindert spontanes Nachrücken durch Scroll-Anchoring im columns-Layout (Höhen sind via aspect-ratio reserviert) */
}

/* ── Header (sticky) ── */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(21, 17, 12, 0.93); /* = var(--bg) #15110c, leicht durchscheinend */
  backdrop-filter: blur(12px); /* dezentes Frosted-Glass über den durchscrollenden Bildern */
  -webkit-backdrop-filter: blur(12px);
}

/* ── Navbar ── */
.navbar {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px 44px; /* 40 oben, 44 unten = etwas mehr Luft zur Pill-Reihe */
  display: flex;
  align-items: center;
}

.site-title {
  /* Button-Reset (ist jetzt der Home-Link → Sucher, Inhalt = Logo-SVG) */
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: none;
  padding: 0;
  /* +14px = Pill-Innenpadding: Logo fluchtet mit dem Text "Portrait", nicht der Pill-Kante */
  margin-left: 14px;
  display: inline-flex;
  cursor: pointer;
  transition: opacity 0.2s;
}
.site-title:hover { opacity: 0.75; }
.site-title:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

.site-logo {
  display: block;
  height: 28px;
  width: auto;
}

/* Kontakt-Aktion oben rechts: Icon-only Mailto, vertikal zur Wortmarke zentriert. */
.header-contact {
  margin-left: auto; /* schiebt das Icon an den rechten Rand der Logo-Zeile */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: color 0.2s;
}
.header-contact:hover { color: #e0a82e; } /* warm gold, wie der Akzent */
.header-contact:focus-visible { outline: 2px solid #fff; outline-offset: 3px; border-radius: 4px; }

.header-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
  display: block;
}

/* ── Filter pills ── */
.filter-bar {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 24px; /* 24 Frosted-Polster unter den Pills (im Sticky-Header) */
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;     /* old Edge */
}

.filter-bar::-webkit-scrollbar { display: none; } /* Chrome/Safari */

.pill {
  flex-shrink: 0;
  background: rgba(255,255,255,0.06); /* dezente Füllung statt Outline — leise Fläche, nicht „Button" */
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  letter-spacing: 0.8px;
  line-height: 1.1;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.pill:hover { background: rgba(255,255,255,0.12); color: #fff; }

.pill.active {
  background: #e0a82e; /* warm gold — Nikon nod */
  color: #15110c;
}

/* Thema ohne sichtbare Fotos: sichtbar, aber gedimmt + nicht klickbar.
   Wird automatisch wieder normal, sobald das Thema Fotos hat. */
.pill:disabled,
.pill.is-empty {
  background: rgba(255,255,255,0.03);
  color: rgba(255,255,255,0.28);
  cursor: not-allowed;
}
.pill:disabled:hover,
.pill.is-empty:hover {
  background: rgba(255,255,255,0.03); /* kein Hover-Aufhellen */
  color: rgba(255,255,255,0.28);
}

/* ── Sucher-Auftakt (Startansicht "Alle") ── */
/* .hero füllt per flex:1 die Resthöhe unter dem Header; der Rahmen ist auf die
   Content-Breite begrenzt (wie das Grid) mit 24px-Rinne ringsum. */
.hero {
  flex: 1 1 auto;
  min-height: 0; /* erlaubt dem Rahmen, in der Flex-Spalte zu schrumpfen statt überzulaufen */
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 0 24px 24px; /* Pills tragen oben schon 24px; seitlich + unten bündig zum Grid */
  display: flex;
}

.hero[hidden] { display: none; }

/* Bühne = klickbarer Button, füllt den verfügbaren Raum. Reset der Button-Defaults. */
.hero-frame {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: none;
  -webkit-appearance: none;
  appearance: none; /* sonst zeichnet der Button natives Chrome (dünne 1px-Linie) trotz border:none */
  font: inherit; /* KRITISCH: <button> erbt die Schrift NICHT vom Body → sonst bleiben Headline + Kameradaten auf Arial statt der Body-Schrift */
  background: #0a0a0a; /* Fallback hinter dem Bild, falls noch nicht geladen */
  overflow: hidden;
  cursor: pointer;
  display: block;
}

.hero-frame:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Zwei gestapelte Ebenen für Crossfade — beide object-cover (formatfüllend, egal ob Hoch-/Querformat) */
.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.8s ease;
  user-select: none;
  pointer-events: none;
}
.hero-img.is-active { opacity: 1; }

/* Bottom-Scrim: weicher dunkler Verlauf nur im unteren Bildbereich, sichert die Lesbarkeit
   des Wortblocks über wechselnden Bildern. Höhe prozentual zur Bildhöhe (responsiv) +
   clamp gegen Extreme; fädelt nach oben in Transparenz aus. Liegt über dem Bild, aber
   unter Ecken & Text. */
.hero-scrim {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: clamp(200px, 45%, 460px);
  background: linear-gradient(to top, rgba(0,0,0,0.62) 0%, rgba(0,0,0,0.34) 45%, rgba(0,0,0,0) 100%);
  pointer-events: none;
}

/* Goldene Eckklammern (Sucher-Winkel) — responsiv eingerückt; je Ecke zwei Borders */
.vf-corner {
  position: absolute;
  width: clamp(24px, 4vw, 32px);
  height: clamp(24px, 4vw, 32px);
  pointer-events: none;
}
.vf-tl { top: clamp(16px, 3.5vw, 44px); left: clamp(16px, 3.5vw, 44px); border-top: 2px solid var(--gold); border-left: 2px solid var(--gold); }
.vf-tr { top: clamp(16px, 3.5vw, 44px); right: clamp(16px, 3.5vw, 44px); border-top: 2px solid var(--gold); border-right: 2px solid var(--gold); }
.vf-bl { bottom: clamp(16px, 3.5vw, 44px); left: clamp(16px, 3.5vw, 44px); border-bottom: 2px solid var(--gold); border-left: 2px solid var(--gold); }
.vf-br { bottom: clamp(16px, 3.5vw, 44px); right: clamp(16px, 3.5vw, 44px); border-bottom: 2px solid var(--gold); border-right: 2px solid var(--gold); }

/* Wording unten-zentriert über dem Bild */
.hero-caption {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: clamp(40px, 9vh, 110px);
  width: min(732px, 90%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
  pointer-events: none; /* Klicks gehen an den Frame-Button durch */
}

.hero-headline {
  white-space: pre-line; /* \n im Text = Zeilenumbruch (zwei Zeilen) */
  font-weight: 300;
  font-size: clamp(24px, 4.2vw, 40px);
  line-height: 1.25;
  letter-spacing: -0.026em; /* = -1.04px bei 40px */
  color: var(--text);
  text-shadow: 0 1px 12px rgba(0,0,0,0.45); /* Lesbarkeit über hellen Bildpartien */
}

.hero-data {
  display: flex;
  justify-content: center;
  font-weight: 400;
  font-size: 16px;
  letter-spacing: 0.25em; /* Tagline-Anmutung statt Datenzeile */
  color: var(--gold);
  text-shadow: 0 1px 12px rgba(0,0,0,0.45);
}

@media (prefers-reduced-motion: reduce) {
  .hero-img { transition: none; } /* kein Crossfade, harter Wechsel */
}

/* ── Footer (Name + Mail, dezent am Seitenende) ── */
.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px 48px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-top: 1px solid var(--border);
}

.footer-name {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Masonry grid (zeilenweise = Leserichtung, native aspect ratios) ── */
/* Spalten sind echte Container; main.js verteilt die Fotos round-robin
   (Foto 1→Sp.1, Foto 2→Sp.2, Foto 3→Sp.3, Foto 4→Sp.1 …) statt CSS-columns,
   das spaltenweise von oben nach unten füllen würde. */
.grid {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  gap: var(--gap);
  align-items: flex-start;
  padding: 0 24px 40px;
}

.grid-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.grid-item {
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  overflow: hidden;
  display: block;
  /* Reveal: dezentes Aufsteigen + Fade, diagonal gestaffelt — spürbar, nicht vorführend */
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.grid-item.revealed {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .grid-item { opacity: 1; transform: none; transition: none; }
}

.grid-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: opacity 0.2s;
}

.grid-item:hover img { opacity: 0.85; }

.grid-item.hidden { display: none; }

/* ── Visible focus for keyboard users ── */
.pill:focus-visible,
.grid-item:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Viewer-Controls: dezenter Fokus durch Aufhellen statt Rahmen (passt zum reduzierten Design) */
.overlay-close:focus-visible,
.overlay-prev:focus-visible:not(:disabled),
.overlay-next:focus-visible:not(:disabled) {
  outline: none;
  color: #fff;
}

/* ── Fullscreen overlay ── */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--viewer-pad-y) var(--viewer-pad-x); /* safe space around photo */
}

.overlay.hidden { display: none; }

/* Dialog-Container ist fokussierbar (Fokusmanagement), zeigt aber keinen Rahmen */
.overlay:focus { outline: none; }

.overlay-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
}

/* Nav buttons (prev/next): icon only, generous hit area, no chrome */
.overlay-prev,
.overlay-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: none;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.25s, color 0.2s;
}

.overlay-prev { left: 18px; }  /* centers the 44px hit area in the 80px safe space */
.overlay-next { right: 18px; }

.overlay-prev svg,
.overlay-next svg { width: 28px; height: 28px; display: block; fill: currentColor; }

.overlay-prev:hover:not(:disabled),
.overlay-next:hover:not(:disabled) { color: #fff; }

.overlay-prev:disabled,
.overlay-next:disabled {
  opacity: 0.25;
  cursor: default;
}

/* Bottom-center cluster: close above the counter (sticky) */
.overlay-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--viewer-pad-y); /* unterer Schutzraum – Close darin vertikal zentriert */
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.25s;
}

.overlay-close {
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: none;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.overlay-close svg { width: 22px; height: 22px; display: block; fill: currentColor; }

.overlay-close:hover { color: #fff; }

/* Keep icons legible even if they sit near a bright image edge */
.overlay-prev svg,
.overlay-next svg,
.overlay-close svg { filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6)); }

/* Bildposition visuell entfernt (Reduktion); nur für Screenreader erhalten */
.overlay-counter {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Click on the photo toggles all chrome */
.overlay.controls-hidden .overlay-prev,
.overlay.controls-hidden .overlay-next,
.overlay.controls-hidden .overlay-footer {
  opacity: 0;
  pointer-events: none;
}

/* ── Avatar (rechts in der Titelbar, Link zur About-Seite) ── */
.avatar {
  margin-left: auto; /* schiebt den Avatar nach rechts außen */
  flex: none;
  display: block;
  position: relative;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #2a2a2a;
  border-radius: 50%;
  background: #1a1410;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s;
}
.avatar:hover { border-color: var(--gold); }
.avatar:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.avatar-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--muted);
}
.avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── About-Seite (eigene Route, Buchumschlag-Anmutung) ── */
.about-page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 8vh 24px 80px;
  display: flex;
  gap: clamp(36px, 6vw, 96px);
  align-items: flex-start;
}
.about-portrait { flex: none; width: clamp(260px, 32vw, 420px); }
.about-portrait img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  background: #1a1410;
  filter: grayscale(1); /* s/w wie eine Buchklappe — Farbe gehört den Arbeiten */
}
.about-text { flex: 1; min-width: 0; max-width: 52ch; padding-top: 4px; }
.about-name {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.05;
  margin-bottom: 6px;
}
.about-role {
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 36px;
}
.about-bio {
  font-size: 16px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.82);
  margin-bottom: 18px;
}
.about-craft {
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
  margin-bottom: 40px;
}
.about-contact { display: flex; gap: 22px; }
.about-contact a {
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color 0.2s, border-color 0.2s;
}
.about-contact a:hover { color: var(--gold); border-color: var(--gold); }

/* ── Responsive ── */
/* Spaltenzahl (3/2/1) steuert main.js → colCount(); hier nur Padding-Feinheiten */
@media (max-width: 540px) {
  .grid { padding: 0 20px 32px; }
  .navbar { padding: 28px 20px 32px; } /* 28 oben, 32 unten = etwas mehr Luft zur Pill-Reihe */
  .filter-bar { padding: 0 20px 20px; } /* 20 Polster unter den Pills */
  .hero { padding: 0 20px 20px; } /* bündig mit Pills/Grid */
  .hero-data { font-size: 14px; }
  .overlay { padding: 80px 16px; }
  .overlay-footer { height: 80px; } /* an mobilen Schutzraum unten angepasst */
  .overlay-prev, .overlay-next { width: 40px; height: 40px; }
  .overlay-prev svg, .overlay-next svg { width: 24px; height: 24px; }
  .overlay-prev { left: 4px; }
  .overlay-next { right: 4px; }

  .about-page { flex-direction: column; gap: 28px; padding: 24px 20px 60px; }
  .about-portrait { width: 100%; max-width: 360px; }
}
