/* ---- TOKENS ---- */
:root {
  --color-bg:      #f9f9f9;
  --color-project: #FFF6EE;
  --color-about:   #EFEBE8;
  --color-text:    #1d1d1d;
  --bar-h:         var(--letter-d);
  --pad:           1rem;
  --ui-size:       0.75rem;
  --letter-d:      1.875rem;
  --ui-lh:         1.1;
  --ui-pad-v:      0.55rem;
  /* derived — update automatically when ui-size / ui-lh / ui-pad-v change */
  --header-h:      calc(var(--ui-size) * var(--ui-lh) + 2 * var(--ui-pad-v));
  --footer-h:      calc(4 * var(--ui-size) * var(--ui-lh) + 2 * var(--ui-pad-v));
}

/* ---- FONTS ---- */
@font-face {
  font-family: 'KleischLL';
  src: url(fonts/KleischLLTrial-Regular.otf) format('opentype');
  font-display: swap;
}
@font-face {
  font-family: 'RobotoFlex';
  src: url('fonts/RobotoFlex-VariableFont_GRAD,XOPQ,XTRA,YOPQ,YTAS,YTDE,YTFI,YTLC,YTUC,opsz,slnt,wdth,wght.ttf') format('truetype');
  font-display: swap;
}

/* ---- RESET ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  cursor: none !important;
}
html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  font-family: 'RobotoFlex', Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.4;
  font-variation-settings: 'wdth' 80, 'wght' 400;
  background: var(--color-bg);
  color: var(--color-text);
  overflow: hidden;
  height: 100dvh;
  user-select: none;
}
::-webkit-scrollbar {
  display: none;
}

/* ---- HERO AMPERSAND ---- */
.hero-ampersand {
  padding: calc(var(--pad) * 0.625) var(--pad) 0;
  scroll-snap-align: start;
}
.hero-ampersand img {
  display: block;
  width: 100%;
  height: auto;
}

/* ---- HEADER ---- */
.site-header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--ui-pad-v) var(--pad);
  background: var(--color-bg);
  z-index: 100;
  font-size: var(--ui-size);
  line-height: var(--ui-lh);
}
.site-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: var(--pad);
  right: var(--pad);
  height: 1px;
  background: var(--color-text);
}
.site-header,
.hero-ampersand {
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

body.footer-open .hero-ampersand {
  transform: translateY(-8rem);
}

/* ---- FOOTER ---- */

.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--footer-h);
  overflow: hidden;

  background: transparent;
  background-color: transparent;

  z-index: 100;

  transition:
    height 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    background-color 0.5s ease;
}

.site-footer.is-open {
  height: calc(100dvh - var(--header-h)); /* Füllt den Raum bis exakt zum Header */
  background: var(--color-about);
  background-color: color-mix(in srgb, var(--color-about) 80%, transparent);
}
.site-footer.is-open::before {
  opacity: 0;
  transition: opacity 0.4s ease;
}

.site-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: var(--pad);
  right: var(--pad);
  height: 1px;
  background: var(--color-text);
}

.footer-top {
  position: relative;

  display: flex;
  justify-content: space-between;
  align-items: flex-start;

  padding: var(--ui-pad-v) var(--pad);

  font-size: var(--ui-size);
  line-height: var(--ui-lh);

  z-index: 2;
}

.footer-contact {
  font-style: normal;
}

.footer-btn {
  background: none;
  border: none;

  font-family: 'RobotoFlex', sans-serif;
  font-size: var(--ui-size);
  font-variation-settings: 'wdth' 80, 'wght' 400;

  color: var(--color-text);

  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ABOUT CONTENT */

.footer-about {
  position: absolute;
  inset: var(--footer-h) 0 0 0;

  overflow-y: auto;

  padding: 2rem var(--pad) 4rem;

  opacity: 0;
  transition: opacity 0.4s ease;
}
.site-footer.is-open .footer-about {
  opacity: 1;
}

.about-inner {
  font-family: 'KleischLL', serif;
  font-size: 1.125rem;
  line-height: 1.5;
}

/* ---- MAIN SCROLL AREA ---- */
/* covers full viewport so images slide behind transparent header/footer */
.projects-main {
  position: fixed;
  inset: 0;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  /* offset snap-center so it lands between the two sticky bars */
  scroll-padding-top: calc(var(--header-h) + var(--pad) / 2 + var(--bar-h));
  scroll-padding-bottom: calc(var(--footer-h) + var(--pad) / 2 + var(--bar-h));
  scrollbar-width: none;
}
.projects-main::-webkit-scrollbar {
  display: none;
}

/* ---- BARS (ZEITSTRAHL) ---- */
.bar {
  position: relative;
  height: var(--bar-h);
  margin: 0 var(--pad);
  z-index: 60;
  overflow: visible;
}
.bar--filter {
  position: sticky;
  top: calc(var(--header-h) + var(--pad) / 2);
  margin-top: calc(var(--pad) / 2);
}
.bar--sort {
  position: sticky;
  bottom: calc(var(--footer-h) + var(--pad) / 2);
}

/* Dynamische Achse: Linie + Ticks bewegen sich gemeinsam */
.bar-axis {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.bar-axis-line {
  position: absolute;
  top: 0;
  height: 1px;
  background: transparent;
  /* left/right per JS animiert */
  transition:
    left  0.7s cubic-bezier(0.16, 1, 0.3, 1),
    right 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.bar-axis-line::before,
.bar-axis-line::after {
  content: '';
  position: absolute;
  top: 0;
  width: 1px;
  height: var(--letter-d);
  background: var(--color-text);
}
.bar-axis-line::before { content: none; }
.bar-axis-line::after  { right: 0; }

/* Buchstaben-Container */
.bar-letters {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Einzelner Buchstaben-Button — left per JS */
.bar-letter {
  position: absolute;
  top: 0;
  width: var(--letter-d);
  height: var(--letter-d);
  border-radius: 50%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'KleischLL', serif;
  font-size: 0.9375rem;
  line-height: 1;
  color: var(--color-text);
  pointer-events: none;
  opacity: 0;
  transform: scale(0.4);
  transition:
    left      0.7s  cubic-bezier(0.16, 1, 0.3, 1),
    opacity   0.22s ease,
    transform 0.22s ease,
    background-color 0.25s ease,
    color     0.25s ease;
}
.bar-letter.is-selected {
  background: var(--color-text);
  color: var(--color-bg);
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}
.bar.is-open .bar-letter {
  pointer-events: auto;
  opacity: 1;
  transform: scale(1);
}
.bar.is-open .bar-letter:not(.is-selected):hover {
  background: rgba(29, 29, 29, 0.1);
}

/* Dropdown ohne Hintergrund */
.bar-dropdown {
  position: absolute;
  left: 0;
  width: fit-content;
  pointer-events: none;
  transition: clip-path 0.28s cubic-bezier(0.7, 0, 1, 1);
  display: grid;
  grid-template-rows: repeat(3, auto);
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  align-items: start;
  column-gap: 1rem;
}
.bar-dropdown--down {
  top: 100%;
  padding: 0.2rem 0 0.9rem;
  clip-path: inset(0 0 100% 0);
}
.bar-dropdown--up {
  bottom: 100%;
  padding: 0.9rem 0 0.2rem;
  clip-path: inset(100% 0 0 0);
}
.bar.is-open .bar-dropdown {
  clip-path: inset(0 0 0 0);
  pointer-events: auto;
  transition: clip-path 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dropdown-Items — kompakt, RobotoFlex wie Footer */
.dropdown-item {
  display: block;
  width: auto;
  background: none;
  border: none;
  font-family: 'RobotoFlex', sans-serif;
  font-variation-settings: 'wdth' 80, 'wght' 400;
  font-size: var(--ui-size);
  line-height: var(--ui-lh);
  text-align: left;
  padding: 0.15rem 0;
  color: var(--color-text);
  opacity: 0.3;
  transition: opacity 0.2s ease;
}
.dropdown-item.is-selected { opacity: 1; }
.dropdown-item:hover:not(.is-selected) { opacity: 0.6; }

/* Initialisierungs-Guard */
.bar.no-transition .bar-letter,
.bar.no-transition .bar-axis-line,
.bar.no-transition .bar-dropdown {
  transition: none !important;
}

/* ---- PROJECTS LIST ---- */
.projects-list {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  padding-top: calc(50dvh - var(--header-h) - var(--bar-h));
  padding-bottom: calc(50dvh - var(--footer-h) - var(--bar-h));
}

/* ---- PROJECT ITEM ---- */
.project-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 var(--pad);
  scroll-snap-align: center;
}

/* Image: fixed height, width auto */
.project-img {
  display: block;
  width: auto;
  height: auto;
  max-height: 35dvh;
  max-width: 100%;
  filter: grayscale(100%);
  opacity: 0.3;
  transition: filter 0.55s ease, opacity 0.55s ease;
}
.project-item.is-active .project-img {
  filter: grayscale(0%);
  opacity: 1;
}

/* Project info: below image, fades in when active */
.project-info {
  display: flex;
  gap: 0.5em;
  align-items: baseline;
  margin-top: 0.6rem;
  opacity: 0;
  transition: opacity 0.55s ease;
}
.project-item.is-active .project-info {
  opacity: 1;
}
.project-index {
  font-family: 'RobotoFlex', sans-serif;
  font-variation-settings: 'wdth' 80;
  font-size: 0.75rem;
  line-height: var(--ui-lh);
}
.project-title {
  font-family: 'KleischLL', serif;
  font-size: 0.9375rem;
  line-height: 1.4;
}

/* ---- ABOUT PANEL ---- */
.about-panel {
  position: fixed;
  top: var(--header-h);
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-about);
  z-index: 90; /* below footer (100) so footer line + btn stay visible */
  transform: translateY(100%);
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  padding: 2rem var(--pad);
}
.about-panel.is-open {
  transform: translateY(0);
}
.about-inner {
  font-family: 'KleischLL', serif;
  font-size: 1.125rem;
  line-height: 1.5;
}

/* ---- CURSOR ---- */
.cursor-circle {
  position: fixed;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  mix-blend-mode: difference;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  transition: opacity 0.2s;
}

@media (pointer: coarse) {
  .cursor-circle {
    display: none;
  }
}

/* ---- DETAIL PANEL ---- */
.detail-panel {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: #fff7ef;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.detail-panel.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* Home-Elemente dimmen — wie inactive Projekte auf der Startseite */
body.detail-open .projects-main,
body.detail-open .bar--filter,
body.detail-open .bar--sort {
  opacity: 0.08;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
body.detail-open .site-footer {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* Fixierter Kopf (auto-Höhe) */
.detail-top {
  flex-shrink: 0;
  padding-top: var(--header-h);
}

/* Zurück-Button Zeile */
.detail-nav {
  padding: calc(var(--pad) / 2) var(--pad) 0;
  display: flex;
  align-items: center;
}

/* Kreis-Button: zwei überlagerte Zeichen (Buchstabe → Pfeil) */
.circle-btn {
  position: relative;
  width: var(--letter-d);
  height: var(--letter-d);
  border-radius: 50%;
  border: none;
  background: var(--color-text);
  color: var(--color-bg);
  flex-shrink: 0;
}
.btn-from-char,
.btn-arrow {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'KleischLL', serif;
  font-size: 0.9375rem;
  line-height: 1;
  transition: opacity 0.35s ease 0.1s;
}
.btn-from-char { opacity: 1; }
.btn-arrow     { opacity: 0; }
.detail-panel.is-open .btn-from-char { opacity: 0; }
.detail-panel.is-open .btn-arrow     { opacity: 1; }

/* Vertikale Linie rechts vom Button */
.detail-vline {
  width: 1px;
  height: var(--letter-d);
  background: var(--color-text);
  flex-shrink: 0;
  margin-left: var(--pad);
}

/* Titel (unterhalb der Nav-Zeile) */
.detail-title {
  font-family: 'KleischLL', serif;
  font-size: 0.9375rem;
  font-weight: normal;
  line-height: 1.3;
  padding: calc(var(--pad) / 2) var(--pad) 0;
}

/* Erste Info-Zeile (immer sichtbar) + Info-Button rechts */
.detail-info-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: calc(var(--pad) / 4) var(--pad) calc(var(--pad) / 2);
  font-family: 'RobotoFlex', sans-serif;
  font-variation-settings: 'wdth' 80, 'wght' 400;
  font-size: var(--ui-size);
  line-height: var(--ui-lh);
}
.detail-info-first {
  flex: 1;
  min-width: 0;
}
.detail-info-btn {
  background: none;
  border: none;
  font-family: 'RobotoFlex', sans-serif;
  font-variation-settings: 'wdth' 80, 'wght' 400;
  font-size: var(--ui-size);
  line-height: var(--ui-lh);
  color: var(--color-text);
  padding: 0;
  flex-shrink: 0;
  margin-left: var(--pad);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Aufklappbare Zusatz-Infos */
.detail-info-extra {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  padding: 0 var(--pad);
  pointer-events: none;
  font-family: 'RobotoFlex', sans-serif;
  font-variation-settings: 'wdth' 80, 'wght' 400;
  font-size: var(--ui-size);
  line-height: var(--ui-lh);
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}
.detail-panel.info-is-open .detail-info-extra {
  max-height: 8rem;
  opacity: 1;
  pointer-events: auto;
  padding-bottom: calc(var(--pad) / 2);
}

/* ---- DETAIL SCROLL-BEREICH ---- */
.detail-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: var(--pad);
}
.detail-scroll::-webkit-scrollbar { display: none; }

/* Nummern (normal im Fluss) */
.carousel-nums {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  padding: var(--pad) var(--pad) 0;
}
.carousel-num {
  background: none;
  border: none;
  font-family: 'RobotoFlex', sans-serif;
  font-variation-settings: 'wdth' 80, 'wght' 400;
  font-size: var(--ui-size);
  line-height: var(--ui-lh);
  color: var(--color-text);
  padding: 0;
  opacity: 0.35;
  transition: opacity 0.2s ease;
}
.carousel-num.is-active {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.carousel-stage { width: 100%; }

.carousel-img {
  display: block;
  width: 100%;
  height: auto;
  margin-top: var(--pad);
  transition: opacity 0.25s ease;
}
.carousel-img.is-fading { opacity: 0; }

.detail-caption-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 0.75rem;
  align-items: start;
  padding: 0.5rem var(--pad) 0;
  font-family: 'RobotoFlex', sans-serif;
  font-variation-settings: 'wdth' 80, 'wght' 400;
  font-size: var(--ui-size);
  line-height: var(--ui-lh);
}
.detail-caption {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  line-height: var(--ui-lh);
}
.detail-caption.is-expanded {
  -webkit-line-clamp: unset;
  line-clamp: unset;
  overflow: visible;
}
.caption-mehr-btn {
  background: none;
  border: none;
  font-family: 'RobotoFlex', sans-serif;
  font-variation-settings: 'wdth' 80, 'wght' 400;
  font-size: var(--ui-size);
  line-height: var(--ui-lh);
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0;
  display: none;
}
.detail-body {
  font-family: 'KleischLL', serif;
  font-size: 1.0625rem;
  line-height: 1.5;
  padding: 1.5rem var(--pad) 0;
}

/* ---- INTRO INITIAL STATES ---- */
body.intro .header-left,
body.intro .header-right {
  clip-path: inset(0 100% 0 0);
}
body.intro .bar--filter,
body.intro .bar--sort,
body.intro .hero-ampersand,
body.intro .projects-list,
body.intro .site-footer {
  opacity: 0;
}