@font-face {
  font-family: "ABC Areal Mono";
  src: url("fonts/ABCArealMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --fg: #000;
  --bg: #fff;
  --pad: clamp(6px, 0.55vw, 10px);
  --fs: clamp(10.5px, 0.936vw, 16px);
  --dur: 700ms;
  --ease: cubic-bezier(.65, 0, .25, 1);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: "ABC Areal Mono", ui-monospace, Menlo, monospace;
  font-weight: 500;
  font-size: var(--fs);
  line-height: 1.2;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.work { overflow: hidden; overscroll-behavior: none; }

a { color: inherit; text-decoration: none; }
a:hover, .is-active, .caption-title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .15em;
}

/* ---------- Navigation (Ecken) ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(3, 16.76%) 1fr auto;   /* Name, Work, About, Imprint gleichmäßig; Contact rechts */
  padding: var(--pad);
  padding-top: var(--pad);
  pointer-events: none;
}
.nav a { pointer-events: auto; justify-self: start; }
.nav-name { margin-left: 0; }
.nav-contact { justify-self: end; }

/* ---------- Bühne ---------- */
.stage {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--top, 11.5vh);
  height: var(--H, 75vh);
  perspective: var(--persp, 4000px);
  perspective-origin: 50% 50%;
  -webkit-user-select: none;
  user-select: none;
  touch-action: pan-y;
}

.ring {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  pointer-events: none; /* liegt bei z=0 vor den Seitenbildern */
}

.face {
  position: absolute;
  top: 0;
  left: 50%;
  width: var(--W, 70vw);
  height: var(--H, 75vh);
  margin-left: calc(var(--W, 70vw) / -2);
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform-origin: 50% 50%;
  opacity: 0;
  pointer-events: none;
  transition:
    transform var(--dur) var(--ease),
    opacity var(--dur) var(--ease);
  will-change: transform, opacity;
  -webkit-tap-highlight-color: transparent;
}
.face.is-side { opacity: .3; pointer-events: auto; }
.face.is-focus { opacity: 1; pointer-events: auto; z-index: 2; }
.face.no-anim { transition: none; }
.face:focus-visible { outline: 1px solid var(--fg); outline-offset: 4px; }

.frame {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #f2f2f2;
}
.frame img,
.frame video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  -webkit-user-drag: none;
}

/* Paar: zwei Medien nebeneinander, je halbe Breite (media.txt: "a + b: pair") */
.media-pair {
  display: flex;
  width: 100%;
  height: 100%;
}
.media-pair > * {
  flex: 1 1 0;
  min-width: 0;
}

/* Videos: Darstellung pro Datei (media.txt) */
.media-video {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.fit-contain {
  background: #000;
  display: flex;
  align-items: center;         /* "contain 90": Video mittig, Rand oben/unten */
}
.fit-contain video { object-fit: contain; }
.fit-blur .media-bg {
  position: absolute;
  inset: 0;
  filter: blur(40px) saturate(1.15);
  transform: scale(1.3);       /* blendet die weichen Ränder der Unschärfe aus */
}
.fit-zoom { background: #d0d0d0; }   /* grauer Rand */
.fit-blur .media-main,
.fit-zoom .media-main {
  position: absolute;
  top: 50%;
  left: 50%;
  width: auto;                 /* Höhe kommt aus "visible", Breite aus dem Seitenverhältnis */
  transform: translate(-50%, -50%);
}

/* ---------- Hinweise (main.js) ---------- */
.hint {
  position: fixed;
  z-index: 5;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s, color .2s;
  font-size: .72em;              /* Desktop: kleiner als die Navigation */
  color: #000;
}
.hint.is-on { opacity: 1; }
.hint[data-tone="mid"] { color: #808080; }
.hint[data-tone="light"] { color: #fff; }

/* Desktop: oben im Fokusbild und auf den Seitenbildern */
.hint-click {
  left: 0;
  right: 0;
  text-align: center;
  top: calc(var(--top) + 8px);
}
/* auf den Seitenbildern, dicht an der Kante zum Fokusbild; Höhe setzt main.js
   (unter der schrägen Oberkante des Seitenbildes) */
.hint-prev { right: calc(50vw + var(--W) / 2 + 12px); top: calc(var(--top) + 18px); }
.hint-next { left: calc(50vw + var(--W) / 2 + 12px); top: calc(var(--top) + 18px); }

/* Handy: Swipe-Hinweis grau zwischen Navigation und Bild, Klick-Hinweis im Bild */
.is-mobile .hint { font-size: 1em; }
.is-mobile .hint-click { top: calc(var(--top) + 12px); }
.hint-swipe {
  left: 0;
  right: 0;
  text-align: center;
  top: calc(var(--top) - 1.2em - 12px);
  color: #8c8c8c;
}

.hint-dot {
  display: inline-block;
  width: .62em;
  height: .62em;
  margin-right: .55em;
  border-radius: 50%;
  background: currentColor;
  vertical-align: .02em;
}
.hint-tri {                      /* kleines Dreieck wie beim Cursor */
  display: inline-block;
  width: .55em;
  height: .62em;
  background: currentColor;
  vertical-align: .02em;
}
.hint-tri-r { clip-path: polygon(0 0, 100% 50%, 0 100%); margin-right: .55em; }
.hint-tri-l { clip-path: polygon(100% 0, 0 50%, 100% 100%); margin-left: .55em; }

/* ---------- Bildunterschrift ---------- */
.caption {
  position: fixed;
  left: 50%;
  bottom: var(--pad);
  transform: translateX(-50%);
  width: min(90ch, calc(100vw - 2 * var(--pad)));
  text-align: center;
}
/* Desktop: breiter, damit jede Beschreibung in höchstens 2 Zeilen passt (bis ~240 Zeichen);
   beide Zeilen gleich lang */
html:not(.is-mobile) .caption {
  width: min(120ch, calc(100vw - 2 * var(--pad)));
  text-wrap: balance;
}

/* ---------- Textseiten (Contact): oben links unter der Navigation ---------- */
.info {
  padding: calc(var(--pad) + 2.6em) var(--pad) var(--pad);
  max-width: 70ch;
}
.info p + p { margin-top: 1.2em; }
@media (max-width: 700px) { .br-desk { display: none; } }   /* Handy: Umbruch, wo es passt */

/* ---------- Startseite: Zehneck (home.js) ---------- */
.deca-edge {
  position: absolute;
  display: block;
  overflow: hidden;
  background: #d9d9d9;
  transform-origin: 0 0;          /* home.js setzt die linke Außenecke und dreht entlang der Kante */
  -webkit-tap-highlight-color: transparent;
}
.deca-edge img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Schwellenwert: nur Schwarz oder Weiß (Filter in index.html), Farbe beim Hovern.
     Zum Aktivieren die nächste Zeile aus dem Kommentar holen. */
  /* filter: url(#threshold); */
  pointer-events: none;
  -webkit-user-drag: none;
}
.deca-edge:hover img,
.deca-edge:focus-visible img { filter: none; }
.deca-edge.is-flipped img { transform: rotate(180deg); }   /* untere 5 Kanten: richtig herum */

/* ---------- Unterseiten (About / Contact) ---------- */
.page {
  min-height: 100%;
  padding: calc(var(--pad) * 6) var(--pad) var(--pad);
  display: grid;
  place-items: center;
  text-align: center;
}

/* ---------- Mobil ---------- */
@media (max-width: 700px) {
  :root { --fs: 10.5px; --dur: 600ms; }
  .nav { grid-template-columns: 1fr auto auto auto auto; gap: 1.2em; }
  .caption { bottom: calc(var(--pad) + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur: 250ms; }
}

/* ---------- Cursor (cursor.js) ---------- */
.has-cursor, .has-cursor * { cursor: none !important; }

.cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
  will-change: transform;
  --c: #000;
}
.cursor.is-visible { opacity: 1; }
.cursor[data-tone="mid"] { --c: #808080; }   /* hell und dunkel gleichermaßen: grau */
.cursor[data-tone="light"] { --c: #fff; }    /* überwiegend dunkel: weiß */

.cursor-shape {
  --s: 41px;               /* Größe über den Bildern */
  position: absolute;
  left: calc(var(--s) / -2);
  top: calc(var(--s) / -2);
  width: var(--s);
  height: var(--s);
  background: var(--c);
  transform: scale(.47);   /* Grundzustand: kleiner Kreis (~19px) */
  transition:
    background-color .15s,
    transform .22s cubic-bezier(.3, .7, .2, 1),
    clip-path .22s cubic-bezier(.3, .7, .2, 1);
}
.cursor[data-state="image"] .cursor-shape,
.cursor[data-state="open"] .cursor-shape,
.cursor[data-state="next"] .cursor-shape,
.cursor[data-state="prev"] .cursor-shape { transform: scale(1); }
.cursor.is-down .cursor-shape { transform: scale(.85); }

.cursor-text {
  position: absolute;
  left: -60px;
  top: -60px;
  width: 120px;
  height: 120px;
  overflow: visible;
  fill: var(--c);
  transition: fill .15s;
  font-family: "ABC Areal Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 9px;
  text-anchor: middle;
}
.cursor-label {
  opacity: 0;
  transform: rotate(-12deg) scale(.9);
  transition: opacity .18s, transform .25s cubic-bezier(.3, .7, .2, 1);
}
.cursor[data-state="image"] [data-label="image"],
.cursor[data-state="open"] [data-label="open"],
.cursor[data-state="next"] [data-label="next"],
.cursor[data-state="prev"] [data-label="prev"] { opacity: 1; transform: none; }
