/* ==========================================================================
   spaet — studio for spatial études
   ========================================================================== */

@font-face {
  font-family: "Jali Italic";
  src: url("fonts/JaliLatin-SemiBoldItalic.woff2") format("woff2");
  font-weight: 600;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Jali";
  src: url("fonts/JaliLatin-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "GT Standard Heavy";
  src: url("fonts/GT-Standard-L-Standard-Heavy.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "GT Standard Heavy";
  src: url("fonts/GT-Standard-L-Standard-Heavy-Oblique.woff2") format("woff2");
  font-weight: 800;
  font-style: oblique;
  font-display: swap;
}

:root {
  --bg: #0b0b0c;
  --tile-bg: #1a1a1c;
  --tile-bg-hover: #212123;
  --text: #f3f1ec;
  --text-dim: #a8a6a1;
  --hairline: rgba(243, 241, 236, 0.14);
  --radius: 22px;
  --radius-sm: 12px;
  --gap: clamp(14px, 2.2vw, 28px);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: "Jali", "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; }

/* -- Header -------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--gap);
  padding: var(--gap);
  background: rgba(11, 11, 12, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.logo {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.6em;
  text-decoration: none;
  color: var(--text);
}

.logo-mark {
  font-family: "Jali Italic", "Jali", sans-serif;
  font-style: italic;
  font-weight: 600;
  font-size: clamp(22px, 3vw, 32px);
  letter-spacing: -0.03em;
}

.logo-sub {
  font-family: "Jali", sans-serif;
  font-weight: 400;
  font-size: clamp(14px, 1.8vw, 18px);
  color: var(--text-dim);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.5vw, 32px);
}

/* -- Kontakt Pill-Button --------------------------------------------------- */

.kontakt-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: "Jali", sans-serif;
  font-size: clamp(14px, 1.6vw, 16px);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.kontakt-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(243, 241, 236, 0.28);
}

.kontakt-pill svg {
  width: 16px;
  height: 16px;
  flex: none;
}

/* -- About Pill-Button (klappt den Header nach unten auf, kein Pop-up) ----- */

.about-pill {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: "Jali", sans-serif;
  font-size: clamp(14px, 1.6vw, 16px);
  cursor: pointer;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.about-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(243, 241, 236, 0.28);
}

.pill-chevron {
  width: 14px;
  height: 14px;
  flex: none;
  transition: transform 0.3s var(--ease);
}

.about-pill[aria-expanded="true"] .pill-chevron {
  transform: rotate(180deg);
}

/* Erzwingt den Umbruch: das Panel landet als eigene Zeile unterhalb von
   Logo + Nav, egal wie breit die vorherige Zeile gerade ist. */
.about-panel {
  flex-basis: 100%;
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s var(--ease);
}

.about-panel.is-open {
  grid-template-rows: 1fr;
}

.about-panel-inner {
  overflow: hidden;
  min-height: 0;
  max-width: 640px;
}

.about-panel.is-open .about-panel-inner {
  padding-top: 18px;
}

.about-panel-inner p {
  font-family: "Jali", sans-serif;
  line-height: 1.6;
  color: var(--text-dim);
  font-size: clamp(14px, 1.6vw, 16px);
  margin: 0 0 14px;
  text-align: left;
}

.about-panel-inner p:last-child { margin-bottom: 0; }

/* -- Projekt-Grid ---------------------------------------------------------- */

main {
  flex: 1;
  display: flex;
  padding: 0 var(--gap) var(--gap);
}

.project-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  align-content: flex-start;
  gap: var(--gap);
}

.project-tile {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  /* Kein eigener Hintergrund mehr -- sonst schimmert beim Flip (wenn die
     Karte seitlich auf der Kante steht) kurz ein graues Rechteck durch.
     Stattdessen scheint einfach die Seiten-Hintergrundfarbe durch, die
     ohnehin fast identisch dunkel ist und so unsichtbar bleibt. */
  cursor: pointer;
  perspective: 1800px;
}

/* -- Flip-Mechanik: Karte dreht sich um die eigene Y-Achse, Größe bleibt
   fest -- kein Wachsen/Springen der Kachel mehr wie bei der frueheren
   Wachs-nach-unten-Variante. ---------------------------------------------- */

.tile-flip {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.7s var(--ease);
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
}

.project-tile.is-flipped .tile-flip {
  transform: rotateY(180deg);
}

.tile-face {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  isolation: isolate;
}

.tile-face-back {
  transform: rotateY(180deg);
}

/* -- Vorderseite: Hauptbild + Titel/Jahr (wie zuvor) ------------------------ */

.tile-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}

.project-tile:hover .tile-cover { transform: scale(1.03); }

.tile-scrim {
  position: absolute;
  inset: auto 0 0 0;
  height: 55%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0));
  pointer-events: none;
}

.tile-label {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 20px 22px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
}

.tile-label-title {
  font-family: "GT Standard Heavy", sans-serif;
  font-weight: 800;
  font-size: clamp(16px, 1.7vw, 20px);
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.tile-label-year {
  font-family: "Jali", sans-serif;
  color: var(--text-dim);
  font-size: 14px;
  white-space: nowrap;
}

/* -- Rückseite: zweites Medium als Hintergrund + Projektinfos darüber ------- */

.tile-back-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}

/* Projektinfos (Titel/Meta/Beschreibung) sind nach dem Flip standardmäßig
   sichtbar. Das Panel liegt nur über der Texthöhe (bottom-verankert, Höhe
   ergibt sich aus dem Inhalt) und zeichnet über backdrop-filter NUR das,
   was direkt dahinter liegt, weich -- der Rest des Mediums darüber bleibt
   scharf. Der X-Button blendet das Panel aus, der i-Button wieder ein. */
.tile-back-text {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: clamp(18px, 2.4vw, 28px);
  padding-right: 56px; /* Platz für den Info/Schließen-Button */
  padding-bottom: clamp(52px, 6vw, 60px); /* Platz für den Ton-Button */
  background: linear-gradient(to top, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.6) 55%, rgba(0, 0, 0, 0) 100%);
  opacity: 1;
  pointer-events: auto;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: opacity 0.3s var(--ease), backdrop-filter 0.3s var(--ease), -webkit-backdrop-filter 0.3s var(--ease);
}

.project-tile:not(.is-info-open) .tile-back-text {
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
}

.tile-back-title {
  font-family: "GT Standard Heavy", sans-serif;
  font-weight: 800;
  font-size: clamp(17px, 1.9vw, 22px);
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0;
}

.tile-back-meta {
  font-family: "Jali", sans-serif;
  color: var(--text-dim);
  font-size: clamp(12px, 1.3vw, 14px);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0;
}

.tile-back-meta .dot { opacity: 0.5; }

.tile-back-description {
  font-family: "Jali", sans-serif;
  font-size: clamp(13px, 1.4vw, 15px);
  line-height: 1.5;
  color: var(--text);
  margin: 6px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tile-media-mute {
  position: absolute;
  left: 12px;
  bottom: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1;
}

.tile-media-mute:hover { background: rgba(0, 0, 0, 0.65); }

.tile-media-mute svg {
  width: 18px;
  height: 18px;
}

.tile-info-toggle {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}

.tile-info-toggle:hover { background: rgba(0, 0, 0, 0.65); }

.tile-info-toggle svg {
  width: 17px;
  height: 17px;
}

/* -- Footer / Impressum (klappt nach unten auf, kein Pop-up) ---------------- */

.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 var(--gap) var(--gap);
  text-align: center;
}

.impressum-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 8px 0;
  color: var(--text);
  font-family: "Jali", sans-serif;
  font-size: clamp(14px, 1.6vw, 16px);
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.2s var(--ease);
}

.impressum-toggle:hover { opacity: 1; }

.impressum-chevron {
  width: 14px;
  height: 14px;
  transition: transform 0.3s var(--ease);
}

.impressum-toggle[aria-expanded="true"] .impressum-chevron {
  transform: rotate(180deg);
}

.impressum-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s var(--ease);
  width: 100%;
  max-width: 420px;
}

.impressum-panel.is-open {
  grid-template-rows: 1fr;
}

.impressum-panel-inner {
  overflow: hidden;
  min-height: 0;
  padding-top: 18px;
}

.legal-eyebrow {
  color: var(--text-dim);
  font-size: 13px;
  margin: 0 0 16px;
  text-align: left;
}

.impressum-panel-inner p {
  font-family: "Jali", sans-serif;
  line-height: 1.6;
  margin: 0 0 14px;
  text-align: left;
}

.impressum-panel-inner p:last-child { margin-bottom: 0; }

/* -- Responsive -------------------------------------------------------------- */

@media (max-width: 640px) {
  .site-header { padding: 18px; gap: 14px; }
  main { padding: 0 18px 18px; }
  .site-footer { padding: 0 18px 18px; }
  .project-grid { grid-template-columns: 1fr; }
  .site-nav { font-size: 14px; }
}
