/* =========================================================
   Tokens
   ========================================================= */
:root {
  --paper: #F0F0F0;
  --ink: #111111;
  --grey: #9A9A9A;
  --rule: rgba(17, 17, 17, .15);
  --overlay: rgba(17, 17, 17, .88);
  --red: #FF0000;        /* Header */

  --font-grotesk: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;

  --margin: clamp(20px, 2.5vw, 40px);
  --gutter: 20px;

  --s-4: 4px;
  --s-8: 8px;
  --s-16: 16px;
  --s-24: 24px;
  --s-40: 40px;
  --s-64: 64px;
  --s-104: 104px;
  --s-168: 168px;

  --ease: cubic-bezier(.2, .8, .2, 1);
}

/* =========================================================
   Schriften (self-hosted)
   ========================================================= */
@font-face {
  font-family: "Inter Tight";
  src: url("../fonts/InterTight-Variable.woff2") format("woff2");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/JetBrainsMono-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-grotesk);
  font-size: 17px;
  font-weight: 350;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--ink); color: var(--paper); }

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img, video, iframe { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

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

/* Hover: 1px-Linie wächst von links nach rechts */
.link {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 1px;
  transition: background-size 250ms var(--ease);
}
.link:hover { background-size: 100% 1px; }

:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 4px;
}

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

/* Labels (Mono) */
.label {
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: 12px;
  line-height: 1.3;
  letter-spacing: .02em;
}
.label--grey { color: var(--grey); }

/* 12-Spalten-Raster */
.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  padding-inline: var(--margin);
}
.grid > * { grid-column: 1 / -1; }

/* =========================================================
   Globaler Header: links Rolle, mittig Name, rechts Navigation.
   Klein, fett, Versalien, rot – bleibt immer sichtbar.
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  column-gap: var(--s-24);
  padding: var(--s-16) var(--margin);
  background: var(--paper);
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
  /* fetter als 700: feine Kontur in Schriftfarbe (die Schriftdatei reicht nur bis 700) */
  -webkit-text-stroke: .4px currentColor;
  paint-order: stroke fill;
  line-height: 1.15;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.site-header__role,
.site-header__name { font: inherit; margin: 0; }
.site-header__name { text-align: center; }
/* Startseite: Kacheln dürfen unter den Header gezogen werden */
.page-home .site-header {
  background: transparent;
  pointer-events: none;
}
.page-home .site-header a { pointer-events: auto; }
.site-nav {
  justify-self: end;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--s-4) var(--s-24);
  text-align: right;
}

/* =========================================================
   Startseite
   ========================================================= */
.tile {
  display: block;
  position: relative;
}
.tile__client {
  display: block;
  margin-bottom: var(--s-8);
  hyphens: auto;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}
.tile__media {
  display: block;
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #DADAD6;
}
.tile__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tile__hover {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  padding: 5px;
  background: var(--c, var(--ink));
  color: #fff;
  opacity: 0;
  transition: opacity 250ms var(--ease);
}
/* Schriftgröße und Zeilenabstand setzt fitHeadline() */
.tile__headline {
  display: block;
  width: 100%;
  font-size: clamp(16px, 1.4vw, 22px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  overflow-wrap: normal;
  hyphens: manual;
}
.tile:hover .tile__hover,
.tile:focus-visible .tile__hover { opacity: 1; }

/* Skalier-Winkel unten links (nur Desktop mit JS) */
.tile__resize {
  display: none;
  position: absolute;
  left: -12px;
  bottom: -12px;
  width: 24px;
  height: 24px;
  cursor: nesw-resize;
}
.tile__resize::before {
  content: "";
  position: absolute;
  left: 6px;
  bottom: 6px;
  width: 9px;
  height: 9px;
  border-left: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

/* Mobil: untereinander, abwechselnd links/rechts versetzt */
.tiles {
  display: flex;
  flex-direction: column;
  gap: var(--s-64);
  padding: var(--s-64) var(--margin) var(--s-104);
}
.tile { width: var(--mw, 68%); }
.tile:nth-child(even) { margin-left: auto; }

/* Fallback ohne JS */
.tiles-fallback {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--s-40) var(--gutter);
  padding: var(--s-64) var(--margin) var(--s-104);
}
.tiles-fallback .tile { width: auto; margin: 0; }

@media (min-width: 768px) {
  .js .page-home {
    height: 100vh;
    height: 100svh;
    overflow: hidden;
  }
  .js .page-home .tiles {
    position: absolute;
    inset: 0;
    display: block;
    padding: 0;
  }
  .js .page-home .tile {
    position: absolute;
    margin: 0;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    /* left/top/width setzt das Layout; ausweichende Kacheln gleiten */
    transition: left 350ms var(--ease), top 350ms var(--ease);
  }
  .js .page-home .tile.is-active {
    z-index: 1;
    transition: none;
  }
  .js .page-home .tile__resize { display: block; }
  .is-dragging, .is-dragging * { cursor: grabbing !important; }
  .is-resizing, .is-resizing * { cursor: nesw-resize !important; }
}

/* =========================================================
   Let’s-talk-Overlay
   ========================================================= */
.contact {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: var(--margin);
  background: var(--overlay);
  color: var(--paper);
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms var(--ease), visibility 0s linear 200ms;
}
.contact.is-open,
.no-js .contact:target {
  opacity: 1;
  visibility: visible;
  transition: opacity 200ms var(--ease), visibility 0s;
}
.contact :focus-visible { outline-color: var(--paper); }

/* Klickfläche zum Schließen (funktioniert auch ohne JS) */
.contact__backdrop {
  position: absolute;
  inset: 0;
  cursor: default;
}
.contact__list {
  position: relative;
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: .02em;
}
.contact__list li + li { margin-top: var(--s-8); }

/* =========================================================
   Impressum / Privacy: zwei kleine Links unten rechts
   ========================================================= */
.site-legal {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-16);
  padding: var(--s-40) var(--margin) var(--s-16);
  color: var(--grey);
}
.legal { margin-top: var(--s-40); }
.legal__text {
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: 12px;
  letter-spacing: .02em;
  max-width: 62ch;
}
.legal__text h2 { margin-top: var(--s-24); }
.legal__text h2:first-child { margin-top: 0; }
.legal__text p { margin-top: var(--s-4); }

/* =========================================================
   Reduced Motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================
   Unterseiten (Projekt, About)
   ========================================================= */
.page-sub main { padding-bottom: var(--s-168); }

/* Projektkopf */
.project__head { margin-top: var(--s-64); }
.project__title {
  margin-top: var(--s-4);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.2;
}
.project__claim { margin-top: var(--s-24); }
/* Claim und Seitenüberschrift: Mono wie die Kundennamen */
.project__claim,
.page-title {
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: clamp(26px, 3vw, 48px);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* Medien – Grundform (mobil / ohne JS): untereinander, abwechselnd versetzt */
.project__media {
  display: flex;
  flex-direction: column;
  gap: var(--s-64);
  margin-top: var(--s-64);
  padding-inline: var(--margin);
}
.media { position: relative; margin: 0; }
.project__media .media { width: min(80%, 640px); }
.project__media .media--9x16 { width: min(55%, 360px); }
.project__media .media:nth-child(even) { margin-left: auto; }
/* Seite mit Hauptmedium: Hauptmedium voll, die übrigen Assets so groß,
   dass das Hauptmedium höchstens 50 % größer ist (längste Kante) */
.project__media .media--lead { width: min(100%, 640px); margin-left: 0; }
.project__media:has(.media--lead) .media:not(.media--lead) { width: min(70%, 448px); }
.project__media:has(.media--lead) .media.media--tall:not(.media--lead) { width: min(50%, 316px); }
.media img { width: 100%; height: auto; }
.media--16x9 { aspect-ratio: 16 / 9; }
.media--1x1  { aspect-ratio: 1 / 1; }
.media--9x16 { aspect-ratio: 9 / 16; }
.media--16x9 > *, .media--1x1 > *, .media--9x16 > * {
  width: 100%;
  height: 100%;
}
.media video,
.media iframe,
.media .player img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
  background: var(--ink);
}

/* Video: erst Poster + [ Play ], dann Video an derselben Stelle */
.player {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.player__label {
  position: absolute;
  left: var(--s-8);
  bottom: var(--s-8);
  padding: var(--s-4) var(--s-8);
  background: var(--ink);
  color: var(--paper);
  white-space: nowrap;
}
.player__hit {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.player__hit:focus-visible { outline-offset: -4px; outline-color: var(--paper); }

/* Highlights + Credits */
.project__info {
  margin-top: var(--s-104);
  row-gap: var(--s-64);
}
.project__info::before {
  content: "";
  grid-column: 1 / -1;
  border-top: 1px solid var(--rule);
  margin-bottom: calc(var(--s-40) - var(--s-64));
}
.project__highlights p {
  margin-top: var(--s-16);
  max-width: 62ch;
}

.table { margin-top: var(--s-16); }
.table__row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  column-gap: var(--gutter);
  align-items: baseline;
  padding: var(--s-8) 0;
  border-top: 1px solid var(--rule);
}
.table__row:last-child { border-bottom: 1px solid var(--rule); }
.table dt, .table dd { margin: 0; }
.table .label { color: var(--grey); }

/* Prev / Next */
.pager {
  display: flex;
  justify-content: space-between;
  padding: var(--s-64) var(--margin) var(--margin);
}
.pager a { padding: var(--s-8) 0; }

/* About */
.about__head { margin-top: var(--s-64); }
.page-title {
  margin-top: var(--s-24);
  font-size: clamp(36px, 5vw, 80px);   /* größer als die Projekt-Claims */
  line-height: 1.05;
}
.about__intro {
  margin-top: var(--s-64);
  row-gap: var(--s-40);
  align-items: start;
}
.about__photo img { width: 60%; height: auto; }
.about__text {                       /* Mono wie die Überschrift, 30 % kleiner als der Fließtext */
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: 12px;
  letter-spacing: .02em;
}
.about__text p { max-width: 62ch; }
.about__text p + p { margin-top: 1em; }
.about__lists {
  margin-top: var(--s-168);
  row-gap: var(--s-104);
}
.table--cv .table__row { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 2fr); }
.table__muted { color: var(--grey); }

@media (min-width: 768px) {
  .project__claim { grid-column: 1 / 9; }
  .page-title { grid-column: 1 / 10; }
  .project__highlights { grid-column: 1 / 6; }
  .project__credits { grid-column: 7 / 13; }
  .project__info { row-gap: 0; }
  .project__info::before { margin-bottom: var(--s-40); }

  /* Prev/Next fest am Viewportrand, vertikal mittig; Inhalt rückt dafür ein */
  .page-project .grid,
  .page-project .project__media { padding-inline: calc(var(--margin) + var(--s-40)); }
  .pager { padding: 0; }
  .pager a {
    position: fixed;
    top: 50%;
    z-index: 3;
    transform: translateY(-50%);
    padding: var(--s-8);
  }
  .pager__prev { left: var(--s-4); }
  .pager__next { right: var(--s-4); }

  /* Projektseite mit JS: eine Bildschirmhöhe, Medien und Text als zwei Slides */
  .js .page-project {
    height: 100vh;
    height: 100svh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .js .page-project main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
  }
  .js .project__stage {
    position: relative;
    flex: 1;
    min-height: 0;
    margin-top: var(--s-40);
    overflow: hidden;
  }
  .js .project__slide {
    position: absolute;
    inset: 0;
    margin: 0;
    transition: transform 1100ms var(--ease);
  }
  .js .project__media {
    display: block;
    padding-top: 0;
    padding-bottom: var(--margin);
  }
  .js .project__media .media {
    position: absolute;
    margin: 0;
    /* left/top/width setzt initProjectMedia() */
  }
  .js .project__info {
    transform: translateY(100%);
    overflow-y: auto;
    align-content: start;
    padding-bottom: var(--margin);
  }
  .js .project__stage[data-index="1"] .project__media { transform: translateY(-100%); }
  .js .project__stage[data-index="1"] .project__info { transform: none; }

  /* Startseite und Projektseiten passen auf einen Bildschirm: Links fest in der Ecke */
  .js .page-home .site-legal,
  .js .page-project .site-legal {
    position: fixed;
    right: var(--margin);
    bottom: var(--s-16);
    z-index: 4;
    padding: 0;
  }
  .legal__text { grid-column: 1 / 7; }

  .about__photo { grid-column: 1 / 5; }
  .about__text { grid-column: 6 / 12; }
  .table--cv .table__row { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .table--cv .table__row > :nth-child(1) { grid-column: 1 / 6; }
  .table--cv .table__row > :nth-child(2) { grid-column: 6 / 10; }
  .table--cv .table__row > :nth-child(3) { grid-column: 10 / 13; }
}

@media (max-width: 767.98px) {
  .site-header {
    font-size: 11px;
    column-gap: var(--s-16);
  }
  .site-nav { flex-direction: column; align-items: flex-end; }
  .project__head { margin-top: var(--s-40); }
  .project__info { margin-top: var(--s-104); }
  .page-project main { padding-bottom: 0; }
  .about__head { margin-top: var(--s-40); }
  .about__lists { margin-top: var(--s-104); row-gap: var(--s-64); }
  .about__photo { grid-column: 1 / 9; }
}
