/* ==========================================================================
   tjaard-hehenberger.de
   Idee: der Viewport. Mittelgrauer Arbeitsraum statt Schwarz, drei Achsen
   für drei gleichrangige Disziplinen — X 3D, Y Code, Z Gestaltung.
   ========================================================================== */

@font-face {
  font-family: 'Archivo';
  src: url('fonts/archivo-var.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 100%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('fonts/sourceserif4-var.woff2') format('woff2');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --raum:       #3a3a3a;   /* Viewport-Hintergrund */
  --panel:      #2c2c2c;   /* Flächen, die Inhalt tragen */
  --panel-hoch: #464646;   /* angehobene Fläche */
  --linie:      #575757;
  --text:       #e7e5e1;
  --text-leise: #a5a29c;

  --x: #f05f5f;  /* 3D und Animation */
  --y: #9bd14a;  /* Code */
  --z: #5a8dff;  /* Gestaltung */
  --auswahl: #ffa028;

  --rand: clamp(1.25rem, 4vw, 4rem);
  --spalte: 66ch;

  --display: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --lesetext: 'Source Serif 4', Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--raum);
  color: var(--text);
  font-family: var(--lesetext);
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.1rem);
  line-height: 1.65;
}

h1, h2, h3, nav, .meta, .marke, .knopf, .achse__name, figcaption, .fuss {
  font-family: var(--display);
}
h1, h2, h3 { line-height: 1.04; letter-spacing: -0.022em; margin: 0; }
h1 { font-size: clamp(2.6rem, 1.4rem + 5.5vw, 6rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.2rem); font-weight: 700; }
h3 { font-size: clamp(1.1rem, 1rem + 0.5vw, 1.35rem); font-weight: 600; }

p { margin: 0 0 1.1em; max-width: var(--spalte); }
a { color: inherit; text-underline-offset: 0.18em; }
a:hover { color: var(--auswahl); }
:focus-visible { outline: 2px solid var(--auswahl); outline-offset: 3px; }
img, video { max-width: 100%; height: auto; display: block; }

/* --- Kopf ----------------------------------------------------------------- */
.kopf {
  display: flex; flex-wrap: wrap; gap: 0.75rem 2rem;
  align-items: baseline; justify-content: space-between;
  padding: 1.4rem var(--rand);
  max-width: 76rem; margin: 0 auto;
}
.marke { font-weight: 700; font-size: 1rem; text-decoration: none; }
.kopf nav { display: flex; gap: 1.5rem; font-size: 0.95rem; font-weight: 500; }
.kopf nav a { text-decoration: none; padding-bottom: 3px; border-bottom: 2px solid transparent; }
.kopf nav a:hover { border-bottom-color: var(--auswahl); }
.kopf nav a[aria-current='page'] { border-bottom-color: var(--text); }

/* --- Viewport-Kopfbereich ------------------------------------------------- */
.viewport {
  position: relative;
  max-width: 76rem;
  margin: 0 auto 5rem;
  min-height: min(78vh, 44rem);
  display: grid;
  align-content: center;
  padding: clamp(2rem, 6vw, 5rem) clamp(1.25rem, 4vw, 3.5rem);
  border: 1px solid var(--linie);
  overflow: hidden;
  perspective: 900px;
  touch-action: pan-y;
  cursor: grab;
}
.viewport:active { cursor: grabbing; }

.boden {
  position: absolute;
  inset: -40% -20% -30%;
  background:
    repeating-linear-gradient(to right, rgba(255,255,255,.09) 0 1px, transparent 1px 84px),
    repeating-linear-gradient(to bottom, rgba(255,255,255,.09) 0 1px, transparent 1px 84px);
  transform-origin: 50% 100%;
  transform: rotateX(calc(74deg + var(--rx, 0deg))) rotateZ(var(--ry, 0deg)) translateZ(-60px);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 35%, transparent 78%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 35%, transparent 78%);
  pointer-events: none;
}
.boden::before, .boden::after { content: ''; position: absolute; left: 50%; top: 50%; }
.boden::before { width: 60%; height: 2px; background: linear-gradient(90deg, transparent, var(--x)); transform: translateY(-50%); }
.boden::after { width: 2px; height: 55%; background: linear-gradient(180deg, transparent, var(--y)); transform: translate(-50%, -100%); }

.viewport__inhalt { position: relative; }
.viewport h1 { margin-bottom: 0.8rem; }
.viewport .anriss {
  font-family: var(--display); font-weight: 500;
  font-size: clamp(1.05rem, 0.95rem + 0.6vw, 1.45rem);
  color: var(--text-leise); max-width: 40ch; line-height: 1.35;
}

/* Achsenkreuz: echtes 3D-Objekt mit derselben Kamera wie der Boden (Neigung 74°).
   Zusätzlich 30° Gierwinkel, sonst läge Y in Ruhestellung genau hinter Z. */
.gizmo {
  --neigung: calc(74deg + var(--rx, 0deg));
  --gier: calc(30deg + var(--ry, 0deg));
  position: absolute; right: clamp(1rem, 3vw, 2rem); top: clamp(1rem, 3vw, 2rem);
  width: 74px; height: 74px;
  transform-style: preserve-3d;
  transform: rotateX(var(--neigung)) rotateZ(var(--gier));
  pointer-events: none;
}
.gizmo span {
  position: absolute; left: 50%; top: 50%; width: 28px; height: 2px;
  transform-origin: 0 50%;
  transform-style: preserve-3d;
}
/* Strichbreite jeweils so gedreht, dass sie nicht in Blickrichtung liegt */
.gizmo .gx { background: var(--x); transform: rotateX(90deg); }                  /* X: nach rechts */
.gizmo .gy { background: var(--y); transform: rotateZ(-90deg); }                 /* Y: in die Tiefe */
.gizmo .gz { background: var(--z); transform: rotateY(-90deg) rotateX(90deg); }  /* Z: nach oben */
/* Endpunkte: Gesamtdrehung rückgängig machen, damit sie als Kreise zur Kamera zeigen */
.gizmo span::after {
  content: ''; position: absolute; right: -5px; top: -3px;
  width: 8px; height: 8px; border-radius: 50%; background: inherit;
}
.gizmo .gx::after { transform: rotateX(-90deg) rotateZ(calc(-1 * var(--gier))) rotateX(calc(-1 * var(--neigung))); }
.gizmo .gy::after { transform: rotateZ(90deg) rotateZ(calc(-1 * var(--gier))) rotateX(calc(-1 * var(--neigung))); }
.gizmo .gz::after { transform: rotateX(-90deg) rotateY(90deg) rotateZ(calc(-1 * var(--gier))) rotateX(calc(-1 * var(--neigung))); }

.hinweis {
  position: absolute; left: clamp(1.25rem, 4vw, 3.5rem); bottom: 1.25rem;
  font-family: var(--display); font-size: 0.78rem; color: var(--text-leise);
}

/* --- Die drei Achsen ------------------------------------------------------ */
.achsen {
  display: grid; gap: 1px;
  grid-template-columns: 1fr;
  background: var(--linie);
  border: 1px solid var(--linie);
  margin-bottom: 5rem;
}
@media (min-width: 48rem) { .achsen { grid-template-columns: repeat(3, 1fr); } }

.achse { background: var(--panel); padding: 1.75rem 1.5rem; }
.achse__name {
  display: flex; align-items: center; gap: 0.6rem;
  font-weight: 700; font-size: 1.05rem; margin-bottom: 0.5rem;
}
.achse__name::before { content: ''; width: 22px; height: 2px; background: var(--farbe); flex: none; }
.achse p { color: var(--text-leise); font-size: 0.95rem; margin: 0; max-width: 34ch; }
.achse--x { --farbe: var(--x); }
.achse--y { --farbe: var(--y); }
.achse--z { --farbe: var(--z); }

/* --- Filter --------------------------------------------------------------- */
.filter { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 2rem; }
.knopf {
  font: 500 0.9rem/1 var(--display);
  color: var(--text-leise);
  background: transparent;
  border: 1px solid var(--linie);
  padding: 0.55rem 0.9rem;
  cursor: pointer;
}
.knopf:hover { color: var(--text); border-color: var(--text-leise); }
.knopf[aria-pressed='true'] { color: #1c1c1c; background: var(--text); border-color: var(--text); }

/* --- Projekte ------------------------------------------------------------- */
.projekte { display: grid; gap: 1px; background: var(--linie); border: 1px solid var(--linie); }
@media (min-width: 52rem) { .projekte { grid-template-columns: repeat(2, 1fr); } }

.projekt { background: var(--panel); position: relative; }
.projekt[hidden] { display: none; }
.projekt__bild { aspect-ratio: 16 / 10; overflow: hidden; background: var(--panel-hoch); }
.projekt__bild img { width: 100%; height: 100%; object-fit: cover; }
.projekt__text { padding: 1.5rem; }
.projekt h3 { margin-bottom: 0.5rem; }
.projekt h3 a { text-decoration: none; }
.projekt h3 a::after { content: ''; position: absolute; inset: 0; }
.projekt p { color: var(--text-leise); font-size: 0.97rem; margin-bottom: 0; }
.projekt:hover { background: var(--panel-hoch); }
.projekt:hover h3 { color: var(--auswahl); }
.projekt:has(a:focus-visible) { outline: 2px solid var(--auswahl); outline-offset: -2px; }
.projekt::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--farbe, transparent); z-index: 1;
}
.projekt[data-achse='3d'] { --farbe: var(--x); }
.projekt[data-achse='code'] { --farbe: var(--y); }
.projekt[data-achse='gestaltung'] { --farbe: var(--z); }

.meta {
  display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem;
  font-size: 0.82rem; font-weight: 500; color: var(--text-leise);
  margin: 0 0 0.9rem;
}
.meta div { display: flex; gap: 0.4rem; }
.meta dt { color: #8b8882; }
.meta dd { margin: 0; }

/* --- Inhaltsseiten -------------------------------------------------------- */
.seite { max-width: 76rem; margin: 0 auto 5rem; padding: 0 var(--rand); }
.zurueck {
  display: inline-block; margin-bottom: 2rem;
  font: 500 0.9rem/1 var(--display); color: var(--text-leise); text-decoration: none;
}
.abschnitt { margin-top: 3.25rem; }
.abschnitt h2 { margin-bottom: 0.9rem; }

.film { margin-top: 2.5rem; background: #1e1e1e; border: 1px solid var(--linie); }
.film video { width: 100%; }
.platzhalter-film {
  display: grid; place-content: center; aspect-ratio: 16/9;
  color: var(--text-leise); font: 500 0.95rem/1.5 var(--display);
  text-align: center; padding: 2rem;
}

/* Vorher/Nachher */
.vergleich { position: relative; border: 1px solid var(--linie); overflow: hidden; margin-top: 1.5rem; }
.vergleich > img { width: 100%; display: block; }
.vergleich__oben { position: absolute; inset: 0; clip-path: inset(0 0 0 var(--schnitt, 50%)); }
.vergleich__oben img { width: 100%; height: 100%; object-fit: cover; }
.vergleich__kante {
  position: absolute; top: 0; bottom: 0; left: var(--schnitt, 50%);
  width: 2px; background: var(--auswahl); pointer-events: none;
}
.vergleich input[type='range'] {
  position: absolute; left: 1rem; right: 1rem; bottom: 0.9rem; width: calc(100% - 2rem);
  margin: 0; accent-color: var(--auswahl);
}
.vergleich__marke {
  position: absolute; top: 0.75rem; font: 500 0.78rem/1 var(--display);
  background: rgba(28,28,28,.78); padding: 0.35rem 0.5rem;
}
.vergleich__marke--l { left: 0.75rem; }
.vergleich__marke--r { right: 0.75rem; }

.stills { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.stills figure { margin: 0; }
.stills img { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: var(--panel-hoch); }
.stills figcaption { font-size: 0.8rem; color: var(--text-leise); margin-top: 0.4rem; }

.zweispaltig { display: grid; gap: 2.5rem 3.5rem; grid-template-columns: 1fr; margin-top: 2.5rem; }
@media (min-width: 54rem) { .zweispaltig { grid-template-columns: minmax(0,1.3fr) minmax(0,1fr); } }
.portrait { aspect-ratio: 4/5; background: var(--panel-hoch); border: 1px solid var(--linie); }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.koennen { margin-top: 2.5rem; display: grid; gap: 1.6rem; }
.koennen h3 { margin-bottom: 0.3rem; }
.koennen p { color: var(--text-leise); margin: 0; max-width: 46ch; }

.rechtstext { max-width: var(--spalte); }
.rechtstext h2 { font-size: 1.25rem; margin: 2.25rem 0 0.7rem; }
mark { background: var(--auswahl); color: #1c1c1c; padding: 0 0.2em; }

/* --- Fuß ------------------------------------------------------------------ */
.fuss {
  max-width: 76rem; margin: 0 auto; padding: 2rem var(--rand) 3.5rem;
  border-top: 1px solid var(--linie);
  display: flex; flex-wrap: wrap; gap: 0.75rem 2rem;
  justify-content: space-between; align-items: baseline;
  font-size: 0.88rem; color: var(--text-leise);
}
.fuss nav { display: flex; gap: 1.5rem; }
.fuss a { text-decoration: none; }
