/* David Brosius – Portfolio. Mobile first: Grundregeln gelten fürs Handy, Breakpoints erweitern. */

@font-face {
  font-family: "Albert Sans";
  src: url("../fonts/albert-sans-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --rot-flaeche: var(--rot);
  --grau-hell: #E6E6E6;
  --linie-schwach: rgba(0, 0, 0, .2);
  --rot: #E30613;
  --flieder: #D2C4FF;
  --schwarz: #000;
  --weiss: #fff;
  --dunkel: #2B2B2B;
  --grau-text: #4A4A4A;
  /* Seitenrand: am Handy 16 px, ab sehr breiten Bildschirmen so, dass der Inhalt max. ~1344 px breit ist.
     iPhone quer: Inhalt bleibt neben Notch/Dynamic Island, Hintergründe laufen bis zum Rand (viewport-fit=cover) */
  --rand: max(clamp(16px, 4vw, 48px), calc((100vw - 1344px) / 2),
              calc(env(safe-area-inset-left, 0px) + 16px), calc(env(safe-area-inset-right, 0px) + 16px));
  --ease: cubic-bezier(.16, 1, .3, 1);
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: var(--kopf, 64px); }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  @view-transition { navigation: auto; }
}

body {
  margin: 0;
  background: var(--weiss);
  color: var(--schwarz);
  font-family: "Albert Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.45;
  overflow-x: hidden;
}

::selection { background: var(--flieder); color: var(--schwarz); }

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { opacity: .7; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--rot); outline-offset: 3px; }
/* In Karussells und Kacheln innen zeichnen, sonst schneidet der Rand den Fokus ab */
.card__media:focus-visible, .format:focus-visible { outline-offset: -4px; }
.label[tabindex]:focus { outline: none; }
.label[tabindex]:focus-visible { outline: 3px solid var(--rot); outline-offset: 3px; }

.i { width: 1em; height: 1em; flex: none; display: inline-block; vertical-align: -.12em; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.skip {
  position: absolute; left: 8px; top: -60px; z-index: 20;
  background: var(--weiss); padding: 10px 14px; font-weight: 600;
}
.skip:focus { top: 8px; }

/* Abschnittsüberschrift mit Quadrat */
.label {
  margin: 0; display: flex; align-items: center; gap: 10px;
  font-weight: 500; font-size: 22px; line-height: 1.2;
}
.label::before {
  content: ""; width: 14px; height: 14px; flex: none; background: var(--sq, var(--schwarz));
}

/* ---------- Kopfzeile: verschwindet beim Runterscrollen, kommt beim Hochscrollen ---------- */
.top {
  position: sticky; top: 0; z-index: 10; background: var(--weiss);
  transition: transform .45s var(--ease), box-shadow .3s;
}
.top.is-hidden { transform: translateY(-100%); }
.top.is-scrolled { box-shadow: 0 1px 0 var(--schwarz); }
.nav {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0 16px;
  padding: 4px var(--rand); font-weight: 500; font-size: 15px;
}
.nav a { text-decoration: none; padding: 12px 0; }
.nav__name { font-weight: 600; white-space: nowrap; }
.nav__links { display: flex; gap: 0 16px; }

/* ---------- Anfang ---------- */
.intro { padding: 12px 0 0; }
.title {
  margin: 0; font-weight: 500; font-size: clamp(56px, 16vw, 210px);
  line-height: 1; letter-spacing: -.04em;
}
.title__line {
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--schwarz); padding: 2px var(--rand) 8px; overflow: hidden;
}
.title__line:first-child { border-top: 1px solid var(--schwarz); }
.title__line--right { justify-content: flex-end; }
.title__word { display: inline-block; }
.title__dot { width: .4em; height: .4em; border-radius: 50%; background: var(--rot); flex: none; }
.intro__text {
  margin: 20px var(--rand) 0; max-width: 18em;
  font-weight: 500; font-size: clamp(24px, 3.4vw, 44px); line-height: 1.15; letter-spacing: -.02em;
  text-wrap: balance;
}

/* ---------- Projekt-Reihen ---------- */
.work { background: var(--flieder); margin-top: 40px; padding: 28px 0 32px; }
.work__head {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 0 var(--rand) 18px;
}
.work__hint { font-size: 24px; line-height: 1; }
.work__arrows { display: none; gap: 8px; }
.arrow {
  width: 48px; height: 48px; border: 1px solid var(--schwarz); border-radius: 50%;
  background: transparent; cursor: pointer; font-size: 20px;
  display: grid; place-items: center;
  transition: background .2s, color .2s;
}
.arrow:hover { background: var(--schwarz); color: var(--weiss); }
.arrow:disabled { opacity: .3; cursor: default; background: transparent; color: inherit; }

.track {
  list-style: none; margin: 0; display: flex; gap: var(--rand);
  overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  padding: 0 var(--rand) 8px; scroll-padding-left: var(--rand);
  scrollbar-width: none;
}
.track::-webkit-scrollbar { display: none; }
/* Handy: immer genau eine Karte im Bild, gewischt wird von Karte zu Karte */
.card { flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; }
.card--tall { flex-basis: 100%; }
.card--tall .card__media { max-height: 70svh; }
.card[hidden] { display: none; }

.card__media {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end;
  width: 100%; aspect-ratio: 4 / 5; padding: 14px 52px 14px 14px; overflow: hidden;
  border: 0; text-align: left; text-decoration: none; cursor: pointer;
  background: var(--weiss); color: var(--schwarz);
}
.card--tall .card__media { aspect-ratio: 9 / 16; }
.card__media--img { padding: 0; background: var(--grau-hell); }
.card__media:hover { opacity: 1; }
.card__media img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: transform .8s var(--ease);
}
.card__media:hover img { transform: scale(1.04); }

.card__arrow {
  position: absolute; z-index: 1; right: 12px; bottom: 12px; width: 30px; height: 30px;
  transition: transform .35s var(--ease);
}
.card__media--img .card__arrow { color: #fff; filter: drop-shadow(0 1px 4px rgba(0, 0, 0, .5)); }
.card__media:hover .card__arrow, .card__media:focus-visible .card__arrow { transform: translate(3px, -3px); }
.card__title {
  margin: 10px 0 0; font-weight: 600; font-size: 24px; line-height: 1.15; letter-spacing: -.02em;
  -webkit-hyphens: auto; hyphens: auto; overflow-wrap: break-word;
}
.card__meta { margin: 6px 0 0; font-size: 15px; }
.card__media--link + .card__meta { margin-top: 10px; }

/* ---------- Formate: Kacheln in Zweierreihen, darunter das Karussell des gewählten Formats ---------- */
.formats { padding: 36px 0 28px; }
.formats > .label { padding: 0 var(--rand); margin-bottom: 18px; }
.formats__grid {
  list-style: none; margin: 0; padding: 0 var(--rand);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
}
.format {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px;
  width: 100%; aspect-ratio: 3 / 4; padding: 14px; overflow: hidden; border: 0; cursor: pointer;
  text-align: left; color: #fff; background: var(--dunkel);
}
.format img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: transform .8s var(--ease);
}
.format::after {
  content: ""; position: absolute; inset: 60% 0 0; pointer-events: none;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, .62));
}
.format:hover img { transform: scale(1.05); }
.format__name, .format__info { position: relative; z-index: 1; }
.format__name { font-weight: 600; font-size: clamp(19px, 5.4vw, 34px); overflow-wrap: anywhere; line-height: 1; letter-spacing: -.035em; }
.format__info { font-size: 13px; font-weight: 500; }
.format[aria-expanded="true"] { outline: 4px solid var(--rot); outline-offset: -4px; }
.work--format { background: var(--weiss); margin-top: 28px; padding: 0; }
.motion .work--format[hidden] { display: none; }
.credit { margin: 14px var(--rand) 0; font-size: 13px; color: var(--grau-text); }

.work.is-static .progress, .work.is-static .work__arrows, .work.is-static .work__hint { visibility: hidden; }
.progress {
  position: relative; height: 3px; margin: 16px var(--rand) 0; background: var(--linie-schwach);
}
.progress__bar {
  position: absolute; top: 0; bottom: 0; left: 0; background: var(--schwarz);
  width: var(--w, 25%); transform: translateX(var(--x, 0));
}

/* ---------- Über mich ---------- */
.about { padding: 28px var(--rand) 48px; --sq: var(--rot); }
.about__photo { margin: 16px 0 0; }
.about__photo img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.about__name {
  display: flex; justify-content: space-between; padding: 12px 0;
  border-bottom: 1px solid var(--schwarz); font-weight: 600; font-size: 16px;
}
.about__text {
  margin: 24px 0 0; max-width: 30em;
  font-weight: 500; font-size: clamp(19px, 2.1vw, 26px); line-height: 1.35; letter-spacing: -.01em;
}
.about__text + .about__text { margin-top: .8em; }
.facts { margin: 22px 0 0; border-top: 1px solid var(--schwarz); font-size: 16px; }
.facts div {
  display: flex; justify-content: space-between; gap: 16px;
  border-bottom: 1px solid var(--schwarz); padding: 12px 0;
}
.facts dt, .facts dd { margin: 0; }
.facts dd { text-align: right; }

/* ---------- Kontakt ---------- */
.contact { background: var(--rot-flaeche); padding: 32px var(--rand); }
.contact .label { font-size: 24px; font-weight: 700; }
.contact :focus-visible { outline-color: var(--schwarz); }
.contact__line {
  margin: 18px 0 0; font-weight: 500; font-size: clamp(32px, 7.4vw, 88px);
  line-height: 1.04; letter-spacing: -.04em;
}
.contact__mail {
  display: flex; align-items: center; justify-content: center; margin-top: 48px; min-height: 120px;
  border: 1px solid var(--schwarz); text-decoration: none; padding: 16px;
  font-weight: 700; font-size: 24px; overflow-wrap: anywhere; text-align: center;
  transition: background .25s, color .25s;
}
.contact__mail:hover { opacity: 1; background: var(--schwarz); color: var(--weiss); }

/* ---------- Footer ---------- */
.footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0 24px;
  padding: 20px var(--rand) 28px; font-size: 15px;
}
.footer nav { display: flex; flex-wrap: wrap; gap: 0 22px; }
.footer a { padding: 12px 0; display: inline-block; }
.footer p { margin: 12px 0; }

/* ---------- Unterseiten (Impressum, Datenschutz) ---------- */
.page-head {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 4px var(--rand); border-bottom: 1px solid var(--schwarz); font-weight: 500;
}
.page-head a { text-decoration: none; padding: 12px 0; display: inline-flex; align-items: center; gap: 6px; }
.page-head svg { width: 1em; height: 1em; }
.legal { max-width: 760px; margin: 0 auto; padding: 32px max(clamp(16px, 4vw, 48px), calc(env(safe-area-inset-left, 0px) + 16px)) 56px; }
.legal h1 { margin: 0 0 24px; font-weight: 500; font-size: clamp(44px, 12vw, 96px); line-height: 1; letter-spacing: -.04em; }
.legal h2 { margin: 36px 0 8px; font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.legal h3 { margin: 24px 0 6px; font-size: 18px; font-weight: 600; }
.legal p, .legal li { overflow-wrap: anywhere; }
.draft {
  border: 2px solid var(--rot); padding: 14px 16px; margin: 0 0 28px; font-size: 15px; background: #FFF4F4;
}
.ph { background: var(--flieder); padding: 0 .2em; }

/* ---------- Bewegung (nur mit JS und ohne Bewegungsreduktion) ----------
   Ein Moment: die Überschrift fährt beim Laden ein. Dazu gleiten die Karten einer Reihe herein. */
.motion .title__word { transform: translateY(105%); transition: transform 1.1s var(--ease); transition-delay: var(--d, 0s); }
.motion .title.is-in .title__word { transform: none; }
.motion .title__dot { transform: scale(0); transition: transform .8s var(--ease) .55s; }
.motion .title.is-in .title__dot { transform: none; }
.motion .card { opacity: 0; transform: translateX(40px); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: var(--d, 0s); }
.motion .track.is-in .card, .motion .work--format .card, .motion .card.is-sofort { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .top { transition: none; }
}

/* ---------- Tablet / Desktop ---------- */
@media (min-width: 768px) {
  .nav { font-size: 16px; }
  .nav__links { gap: 0 22px; }
  .work__hint { display: none; }
  .work__arrows { display: flex; }
  .card { flex-basis: min(42%, 420px); }
  .card--tall { flex-basis: min(28%, 280px); }
  .formats__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .about__grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 48px; align-items: start; margin-top: 16px; }
  .about__photo { margin: 0; }
  .about__text:first-child { margin-top: 0; }
}

@media (min-width: 1100px) {
  .card { flex-basis: 380px; }
  .card--tall { flex-basis: 260px; }
}

.nohyph { -webkit-hyphens: manual; hyphens: manual; }

/* Handy quer: Karten und Kacheln im Querformat (16:9, eigenes Bild aus bauen.py), zwei bis drei
   nebeneinander; Über mich mit Foto links und Text rechts */
@media (orientation: landscape) and (max-height: 540px) {
  .card, .card--tall { flex-basis: min(46%, calc((100svh - 150px) * 16 / 9)); }
  .card__media, .card--tall .card__media { aspect-ratio: 16 / 9; max-height: none; }
  .card__title { font-size: 18px; }
  .card__meta { font-size: 13px; margin-top: 4px; }
  .track { gap: 12px; }
  .formats__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .format { aspect-ratio: 16 / 9; }
  .format__name { font-size: clamp(18px, 2.6vw, 26px); }
  .about__grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 32px; align-items: start; margin-top: 16px; }
  .about__photo { margin: 0; width: calc((100svh - 120px) * .8); }
  .about__text:first-child { margin-top: 0; }
}

/* Breite Bildschirme: genug Platz, keine Silbentrennung in Titeln */
@media (min-width: 768px) {
  .track { gap: 12px; }
  .card__title { -webkit-hyphens: manual; hyphens: manual; }
}

/* Hoher Kontrast (Windows): Punkt und Quadrate sichtbar halten */
@media (forced-colors: active) {
  .title__dot, .label::before { forced-color-adjust: none; }
  .format::after { display: none; }
}

/* ---------- Intro „Tropfen“ (nur wenn intro-start.js has-intro3 setzt) ---------- */
.has-intro3 .title__dot { opacity: 0; transition: none; transform: none; }
/* Bis die Animation steht, weiß abdecken: sonst blitzt beim Laden kurz die Seite auf */
.has-intro3:not(.i3-ready) body::after {
  content: ""; position: fixed; inset: 0; z-index: 29; background: var(--weiss);
  animation: i3-cover 0s 2.5s forwards;  /* Rückfall: spätestens nach 2,5 s weg, auch wenn das Skript hängt */
}
@keyframes i3-cover { to { visibility: hidden; } }
/* Kopfzeile bleibt während des Intros sichtbar und klickbar, die Seite ist nie ganz leer */
.has-intro3:not(.i3-landed) .top { z-index: 31; }
.i3-ball { position: fixed; inset: 0; z-index: 32; pointer-events: none; overflow: hidden; }  /* Ball vor der Kopfzeile, Klicks gehen durch */
.has-intro3.i3-landed .title__dot { opacity: 1; }
.i3 { position: fixed; inset: 0; z-index: 30; overflow: hidden; }  /* fängt Tipps ab, damit nichts darunter angeklickt wird */
.i3-bg { position: absolute; inset: 0; background: var(--weiss); }
.i3-name {
  position: absolute; left: 50%; top: 40%; margin: 0; translate: -50% 0; visibility: hidden;
  font-weight: 500; line-height: 1.1; letter-spacing: -.04em; white-space: nowrap;
}
.i3-ready .i3-name { visibility: visible; }
.i3-w { display: inline-block; overflow: hidden; vertical-align: bottom; padding: 0 .02em .1em; }
.i3-w > span { display: inline-block; }
.i3-cover { position: absolute; will-change: transform; }
.i3-dx, .i3-dy { position: absolute; top: 0; left: 0; will-change: transform; }
.i3-shape { width: 0; height: 0; border-radius: 50%; background: var(--rot); will-change: transform; }

/* ---------- Dunkel: automatisch nach Geräteeinstellung, der Knopf im Footer überschreibt (theme.js) ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --weiss: #121212; --schwarz: #EDEDED; --flieder: #2E2741; --rot-flaeche: #5C0A10;
  --dunkel: #1E1E1E; --grau-text: #A3A3A3; --grau-hell: #262626; --linie-schwach: rgba(255, 255, 255, .22);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --weiss: #121212; --schwarz: #EDEDED; --flieder: #2E2741; --rot-flaeche: #5C0A10;
    --dunkel: #1E1E1E; --grau-text: #A3A3A3; --grau-hell: #262626; --linie-schwach: rgba(255, 255, 255, .22);
  }
}
.theme-toggle {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 0; border: 0; background: none; cursor: pointer;
  font-size: 15px; color: inherit; text-decoration: underline; text-underline-offset: .18em; text-decoration-thickness: 1px;
}
.theme-toggle svg { width: 18px; height: 18px; flex: none; }
.theme-toggle[hidden] { display: none; }

