/* Studio Behnecke – Projekt-Website
   Schlicht: weisser Hintergrund, schwarze Schrift, Roboto. */

:root {
  --bg: #ffffff;
  --fg: #000000;
  --muted: #8a8a8a;
  --line: #e6e6e6;
  --hover: #f4f4f4;
  --sidebar-w: 340px;
  --side-pad: 28px;      /* horizontaler Innenabstand der Sidebar */
  --top-pad: 40px;       /* Abstand von oben (Logo) */
  --brand-h: 95.5px;     /* Hoehe des "blockq"-Kopfbereichs -> Abstand Logo->Liste (etwas hochgeschoben) */
  --content-pad-x: 100px;/* weisser Rand zwischen Projektliste und Medien */
  --grid-max: 880px;     /* Maximalbreite des Rasters -> Medien insgesamt etwas kleiner */
  --gap: 38px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: "Roboto", -apple-system, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Sidebar / Projektliste ---------- */
#sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  overflow-y: auto;
  padding: var(--top-pad) 0 40px;
}

.brand {
  height: var(--brand-h);
  padding: 0 var(--side-pad);
  display: flex;
  align-items: flex-start;       /* "blockq" oben, Liste darunter mit Abstand */
  justify-content: flex-start;   /* "blockq" linksbuendig (an der Tabellen-Linie) */
}
.brand-name {
  font-size: 52px;           /* groesser; Strichstaerke entspricht so den Namen (15px/400) */
  font-weight: 100;          /* Roboto Thin */
  line-height: 1.1;
  letter-spacing: 0.005em;
}

#project-list {
  display: flex;
  flex-direction: column;
}

.project-item {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  padding: 13.2px var(--side-pad);   /* Zeilenabstand x1,2 */
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 15px;
  color: var(--fg);
  cursor: pointer;
  line-height: 1.35;
  white-space: nowrap;
}

/* Kuerzel + Name als eine Zeile; durchgaengiger Strich beim Hover/aktiv */
.project-item .row {
  display: inline-flex;
  align-items: baseline;
  gap: 14px;                          /* kleiner Abstand Kuerzel <-> Name */
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  line-height: 1.35;
}
.project-item:hover .row,
.project-item.active .row {
  border-bottom-color: var(--fg);     /* durchgaengige Unterstreichung */
}

.project-item .code {
  font-family: "Roboto Mono", ui-monospace, monospace;  /* gleich lange Kuerzel */
  font-weight: 400;          /* gleiche Schriftdicke wie die Namen */
  letter-spacing: 0;
  color: var(--fg);          /* Kuerzel in Schwarz */
}
.project-item .name {
  text-align: left;          /* linksbuendig, tabellarisch (alle an gleicher Linie) */
}

/* ---------- Inhaltsbereich ---------- */
#content {
  margin-left: var(--sidebar-w);
  min-height: 100%;
  /* Medien beginnen auf gleicher Hoehe wie die Projektliste (oben weisser Streifen),
     links ein weisser Rand zur Projektliste */
  padding: calc(var(--top-pad) + var(--brand-h)) 56px 80px var(--content-pad-x);
}

/* ---------- Kopfbereich: Ueberschrift oben; darunter Text (2 Kacheln) + Titelbild "00" (1 Kachel) ---------- */
.project-head {
  max-width: var(--grid-max);
  margin-top: 13px;            /* Ueberschrift auf Hoehe der obersten Listenzeile */
  margin-bottom: var(--gap);   /* Kachelabstand zum Raster -> Titelbild direkt ueber Bild 03 */
}
.proj-title {
  font-size: 15px;             /* genau wie der Text in der Liste */
  font-weight: 400;
  margin: 0 0 14px;
}
.head-row {
  display: flex;
  gap: calc(var(--gap) + 22px);   /* etwas groesserer Abstand Text <-> Titelbild */
  align-items: flex-end;          /* Unterkanten buendig: Text endet auf Hoehe der Bildunterschrift */
}
.proj-body {
  flex: 1 1 auto;             /* zwei Kacheln breit */
  min-width: 0;
  font-size: 13.5px;
  line-height: 1.6;
  margin: 0;
  color: var(--fg);
  text-align: justify;        /* Blocksatz -> rechte Kante franst nicht aus */
  hyphens: auto;
}
.head-image {
  flex: 0 0 calc((100% - 2 * var(--gap)) / 3);   /* eine Kachel breit -> Spalte 3, ueber Bild 03 */
  margin: 0;
}
.head-image figcaption {
  margin-top: 8px;            /* Bildunterschrift wie bei den anderen Kacheln */
  font-size: 12px;
  line-height: 1.35;
  color: #555;
  text-align: center;
}
.head-image img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;        /* quadratische Kachel wie im Raster */
  object-fit: contain;        /* Querformat mittig, Rest weiss (wie die Bilder unten) */
  background: var(--bg);
  cursor: zoom-in;
}

/* 3-Spalten-Raster mit quadratischem Grundraster.
   Bilder vollstaendig sichtbar (nicht beschnitten), mittig in der Kachel;
   bei Hoch-/Querformat entsteht seitlich bzw. oben/unten ein weisser Streifen. */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
  max-width: var(--grid-max);   /* Medien insgesamt etwas kleiner */
  align-items: start;
}

.grid figure {
  margin: 0;
}
.grid img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;   /* quadratische Kachel */
  object-fit: contain;   /* ganzes Bild, mittig, Rest weiss */
  background: var(--bg);
  cursor: zoom-in;
}
.grid figcaption {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.35;
  color: #555;
  text-align: center;   /* mittig unter dem Bild */
}

.empty {
  color: var(--muted);
  font-size: 15px;
}

.placeholder {
  color: var(--muted);
  font-size: 15px;
}

/* ---------- Lightbox (Klick auf Bild) ---------- */
#lightbox {
  position: fixed;
  inset: 0;
  background: #f2f2f2;   /* ganz leicht eingegraut, deckend (Seite dahinter verdeckt) */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px;
  cursor: zoom-out;
  z-index: 50;
}
#lightbox[hidden] { display: none; }

/* Quadratischer Rahmen wie eine Kachel, nur groesser; bleibt bei jedem Bild gleich */
.lb-frame {
  flex: 0 0 auto;
  /* Quadrat: Hoehe begrenzt, Breite zusaetzlich so, dass die Pfeile daneben passen */
  width: min(82vh, calc(100vw - 130px));
  height: min(82vh, calc(100vw - 130px));
  cursor: default;
}
#lightbox img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;      /* ganzes Bild im Quadrat, Rest weiss (wie die Kacheln) */
  background: var(--bg);     /* weiss */
  cursor: zoom-out;          /* Klick aufs Bild schliesst */
}

/* Pfeile links/rechts zum Durchblaettern */
.lb-nav {
  flex: 0 0 auto;
  border: none;
  background: none;
  color: var(--fg);
  font-size: 44px;
  line-height: 1;
  font-family: "Roboto", sans-serif;
  font-weight: 300;
  padding: 8px 10px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s;
  -webkit-user-select: none;
  user-select: none;
}
.lb-nav:hover { opacity: 1; }

/* ---------- Responsiv ---------- */
@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}

/* Schmales Fenster / Handy: alles untereinander, gleich gross */
@media (max-width: 720px) {
  :root { --sidebar-w: 0px; }
  #sidebar {
    position: static;
    width: auto;
    border-right: none;
    /* horizontal 0 -> Liste startet durch das .project-item-Padding bei --side-pad,
       gleiche linke Kante wie Textblock/Medien */
    padding: 28px 0 8px;
  }
  #content {
    margin-left: 0;
    padding: 8px var(--side-pad) 60px;   /* gleiche linke Kante wie die Projektliste */
  }

  /* Kopfbereich gestapelt, volle Breite */
  .project-head {
    margin-top: 0;
    margin-bottom: 16px;
    max-width: none;
  }
  .head-row {
    flex-direction: column;   /* Titel oben, dann Text, dann Bild */
    gap: 16px;
    align-items: stretch;     /* volle Breite (kein flex-end aus dem Desktop) */
  }
  .head-image { flex: none; width: 100%; }   /* volle Breite, quadratische Kachel (wie Raster) */

  /* eine Spalte, alle Medien gleich gross untereinander */
  .grid {
    grid-template-columns: 1fr;
    max-width: none;
  }
}
