/* ==========================================================================
   BB|PY – components.css
   Wiederverwendbare Bausteine: Buttons, Hero, Galerie, Filter, Lightbox,
   Listen, Hinweise, Einbettungen, Formular.
   ========================================================================== */

/* ---------- Buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 48px;
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--color-text);
  border-radius: var(--radius-s);
  background: var(--color-text);
  color: var(--color-background);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.03em;
  text-decoration: none;
  transition: background-color var(--duration) var(--ease), border-color var(--duration) var(--ease),
    color var(--duration) var(--ease);
}

.button:hover {
  background: var(--color-gold-text);
  border-color: var(--color-gold-text);
  color: #fff;
}

.button--ghost {
  background: transparent;
  color: var(--color-text);
}

.button--ghost:hover {
  background: transparent;
  color: var(--color-gold-text);
  border-color: var(--color-gold);
}

.button--light {
  background: var(--color-on-dark);
  border-color: var(--color-on-dark);
  color: var(--color-text);
}

.button--light:hover {
  background: var(--color-gold-on-dark);
  border-color: var(--color-gold-on-dark);
  color: var(--color-dark);
}

.button--outline-light {
  background: transparent;
  border-color: rgba(244, 240, 232, 0.7);
  color: var(--color-on-dark);
}

.button--outline-light:hover {
  background: transparent;
  border-color: var(--color-gold-on-dark);
  color: var(--color-gold-on-dark);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s);
}

/* Textlink mit Linie */
.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: underline;
  text-decoration-color: var(--color-gold);
}

/* ---------- Strich-Liste (Leitmotiv „|“ aus BB|PY) ---------- */
.pipe-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pipe-list li {
  display: inline-flex;
  align-items: center;
}

.pipe-list li:not(:last-child)::after {
  content: "";
  display: inline-block;
  width: 1px;
  height: 0.95em;
  margin-inline: 0.8rem;
  background: var(--color-gold);
}

/* ---------- Hero (Startseite) ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-items: end;
  color: var(--color-on-dark);
  background-color: #3a3a36;
  background-image: linear-gradient(160deg, #6f7a78 0%, #3d4543 55%, #262826 100%);
  overflow: hidden;
  isolation: isolate;
}

.hero__media {
  position: absolute;
  inset: 0;
  z-index: -2;
}

.hero__media video,
.hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to bottom, rgba(20, 19, 17, 0.45) 0%, rgba(20, 19, 17, 0) 28%),
    linear-gradient(to top, rgba(20, 19, 17, 0.72) 0%, rgba(20, 19, 17, 0.2) 55%, rgba(20, 19, 17, 0.05) 100%);
}

.hero__content {
  padding-block: calc(var(--header-height) + var(--space-xl)) var(--space-xl);
  display: grid;
  gap: var(--space-m);
}

.hero__mark {
  font-family: var(--font-display);
  font-size: clamp(5rem, 3rem + 13vw, 13rem);
  line-height: 0.85;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
}

.hero__mark .brand__bar {
  width: 2px;
  height: 0.78em;
  margin-inline: 0.12em;
  background: var(--color-gold-on-dark);
  transform-origin: center;
}

.hero__title {
  font-family: var(--font-body);
  font-size: var(--step-1);
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.3;
}

.hero__lead {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--step-3);
  line-height: 1.1;
  max-width: 22ch;
}

.hero .pipe-list {
  font-size: var(--step--1);
  color: #e3ddd1;
}

.hero .pipe-list li:not(:last-child)::after {
  background: var(--color-gold-on-dark);
}

.hero .button-row {
  margin-top: var(--space-xs);
}

/* Einmalige Einblendung beim Laden (nur ohne reduzierte Bewegung) */
@media (prefers-reduced-motion: no-preference) {
  .hero__mark .brand__bar {
    animation: bar-grow 1.1s var(--ease) 0.15s both;
  }

  .hero__content > :not(.hero__mark) {
    animation: hero-in 0.9s var(--ease) both;
  }

  .hero__content > :nth-child(2) { animation-delay: 0.45s; }
  .hero__content > :nth-child(3) { animation-delay: 0.55s; }
  .hero__content > :nth-child(4) { animation-delay: 0.65s; }
  .hero__content > :nth-child(5) { animation-delay: 0.75s; }
}

@keyframes bar-grow {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

@keyframes hero-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.hero__scroll {
  position: absolute;
  right: var(--gutter);
  bottom: var(--space-l);
  display: none;
  writing-mode: vertical-rl;
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  color: #e3ddd1;
  text-decoration: none;
}

@media (min-width: 56em) {
  .hero__scroll {
    display: block;
  }
}

.hero__video-toggle {
  position: absolute;
  left: var(--gutter);
  bottom: var(--space-s);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0 0.25rem;
  border: 0;
  background: none;
  color: #e3ddd1;
  font-size: var(--step--1);
  opacity: 0.85;
}

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

/* ---------- Galerie ----------
   Mehrspaltiges Layout (CSS columns): unterschiedliche Bildformate greifen
   ruhig ineinander – ohne JavaScript-Masonry. Jede Kachel hat über
   data-format ein festes Seitenverhältnis, dadurch kein Layout-Shift. */
.gallery {
  column-count: 1;
  column-gap: clamp(0.6rem, 0.3rem + 1vw, 1.1rem);
}

@media (min-width: 30em) {
  .gallery { column-count: 2; }
}

@media (min-width: 52em) {
  .gallery { column-count: 3; }
}

@media (min-width: 80em) {
  .gallery--four { column-count: 4; }
}

.portfolio-item {
  position: relative;
  margin: 0 0 clamp(0.6rem, 0.3rem + 1vw, 1.1rem);
  background: var(--color-surface);
  break-inside: avoid;
  aspect-ratio: 4 / 3;
}

.portfolio-item[data-format="portrait"] { aspect-ratio: 3 / 4; }
.portfolio-item[data-format="square"] { aspect-ratio: 1 / 1; }
.portfolio-item[data-format="wide"] { aspect-ratio: 16 / 9; }
.portfolio-item[data-format="pano"] { aspect-ratio: 2 / 1; }

.portfolio-item__link {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  overflow: hidden;
  position: relative;
  text-align: left;
  color: inherit;
}

.portfolio-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 700ms var(--ease), filter 700ms var(--ease);
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .portfolio-item__link:hover img {
    transform: scale(1.025);
  }
}

.portfolio-item figcaption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 2.2rem 0.9rem 0.75rem;
  background: linear-gradient(to top, rgba(20, 19, 17, 0.7), rgba(20, 19, 17, 0));
  color: var(--color-on-dark);
  font-size: var(--step--1);
  line-height: 1.35;
  opacity: 0;
  transition: opacity var(--duration) var(--ease);
  pointer-events: none;
}

.portfolio-item figcaption span {
  display: block;
  color: #d9d1c2;
  font-size: 0.8rem;
}

.portfolio-item__link:hover + figcaption,
.portfolio-item__link:focus-visible + figcaption,
.portfolio-item:focus-within figcaption {
  opacity: 1;
}

@media (hover: none) {
  .portfolio-item figcaption {
    opacity: 1;
  }
}

.portfolio-item__link:focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: 3px;
}

/* Fehlendes Bild: deutlich gekennzeichneter Platzhalter */
.portfolio-item.is-missing img {
  display: none;
}

.image-missing {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 0.35rem;
  padding: var(--space-s);
  text-align: center;
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, rgba(179, 147, 89, 0.08) 14px 15px),
    var(--color-surface);
  color: var(--color-muted);
  font-size: var(--step--1);
  line-height: 1.35;
}

.image-missing strong {
  color: var(--color-text);
  font-weight: 500;
}

.image-missing code {
  font-size: 0.72rem;
  word-break: break-all;
}

/* Allgemeiner Bild-Platzhalter (z. B. Porträt, Projektbilder) */
.media-frame {
  position: relative;
  background: var(--color-surface);
  overflow: hidden;
}

.media-frame img,
.media-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-frame.is-missing img,
figure.is-missing > img {
  display: none;
}

/* ---------- Galerie-Filter ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 var(--space-l);
  padding: 0;
  list-style: none;
}

.filter-button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.45rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface-raised);
  font-size: var(--step--1);
  letter-spacing: 0.02em;
  transition: border-color var(--duration) var(--ease), background-color var(--duration) var(--ease),
    color var(--duration) var(--ease);
}

.filter-button:hover {
  border-color: var(--color-gold);
}

.filter-button[aria-pressed="true"] {
  background: var(--color-text);
  border-color: var(--color-text);
  color: var(--color-background);
}

.filter-button__count {
  font-size: 0.78rem;
  opacity: 0.7;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.55rem;
  border: 1px solid var(--color-gold);
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--color-gold-text);
  background: transparent;
  white-space: nowrap;
}

.filter-button[aria-pressed="true"] .badge {
  color: var(--color-gold-on-dark);
  border-color: var(--color-gold-on-dark);
}

.gallery-status {
  margin-top: var(--space-l);
  color: var(--color-muted);
  font-size: var(--step--1);
}

.empty-state {
  column-span: all;
  padding: var(--space-xl) var(--space-m);
  border: 1px dashed var(--color-gold);
  text-align: center;
  display: grid;
  gap: var(--space-s);
  justify-items: center;
}

.empty-state h3 {
  font-size: var(--step-2);
}

.empty-state p {
  max-width: 34rem;
  color: var(--color-muted);
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #161513;
  color: var(--color-on-dark);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration) var(--ease), visibility 0s linear var(--duration);
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--duration) var(--ease), visibility 0s;
}

.lightbox :focus-visible {
  outline-color: var(--color-on-dark);
}

.lightbox__bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem var(--gutter);
  font-size: var(--step--1);
  color: #cfc8bb;
}

.lightbox__stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 0 var(--gutter);
  touch-action: pan-y;
}

.lightbox__img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.lightbox__stage.is-loading .lightbox__img {
  opacity: 0.35;
}

.lightbox__caption {
  display: grid;
  gap: 0.2rem;
  padding: var(--space-s) var(--gutter) var(--space-m);
  text-align: center;
}

.lightbox__title {
  font-family: var(--font-display);
  font-size: var(--step-2);
  line-height: 1.1;
}

.lightbox__meta {
  justify-content: center;
  font-size: var(--step--1);
  color: #cfc8bb;
}

.lightbox__meta li:not(:last-child)::after {
  background: var(--color-gold-on-dark);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  transition: border-color var(--duration) var(--ease), color var(--duration) var(--ease);
}

.icon-button:hover {
  border-color: var(--color-gold-on-dark);
  color: var(--color-gold-on-dark);
}

.icon-button svg {
  width: 22px;
  height: 22px;
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(22, 21, 19, 0.55);
}

.lightbox__nav--prev { left: 0.5rem; }
.lightbox__nav--next { right: 0.5rem; }

@media (min-width: 56em) {
  .lightbox__nav--prev { left: 1.5rem; }
  .lightbox__nav--next { right: 1.5rem; }
}

body.lightbox-open {
  overflow: hidden;
}

/* ---------- Kategorien-Index (typografische Liste) ---------- */
.category-index {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--color-border);
}

.category-index li {
  border-bottom: 1px solid var(--color-border);
}

.category-index a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-s);
  padding: 1.1rem 0;
  text-decoration: none;
}

.category-index__name {
  font-family: var(--font-display);
  font-size: var(--step-3);
  line-height: 1.05;
  transition: color var(--duration) var(--ease), transform var(--duration) var(--ease);
}

.category-index__desc {
  display: block;
  font-family: var(--font-body);
  font-size: var(--step--1);
  color: var(--color-muted);
  margin-top: 0.3rem;
  line-height: 1.4;
}

.category-index__aside {
  display: flex;
  align-items: center;
  gap: var(--space-s);
  font-size: var(--step--1);
  color: var(--color-muted);
}

.category-index a:hover .category-index__name {
  color: var(--color-gold-text);
}

@media (prefers-reduced-motion: no-preference) {
  .category-index a:hover .category-index__name {
    transform: translateX(0.4rem);
  }
}

@media (min-width: 56em) {
  .category-index--columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: var(--space-xl);
    border-top: 0;
  }

  .category-index--columns li:nth-child(-n + 2) {
    border-top: 1px solid var(--color-border);
  }
}

/* ---------- Medien-/Text-Reihen (Projekte) ---------- */
.feature {
  display: grid;
  gap: var(--space-l);
  align-items: center;
}

.feature + .feature {
  margin-top: var(--space-2xl);
}

.feature__media {
  aspect-ratio: 4 / 3;
}

.feature__body {
  display: grid;
  gap: var(--space-s);
  max-width: 34rem;
}

.feature__body p {
  color: var(--color-muted);
}

@media (min-width: 56em) {
  .feature {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: var(--space-xl);
  }

  .feature--reverse {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  }

  .feature--reverse .feature__media {
    order: 2;
  }
}

/* ---------- Geräte-Liste ---------- */
.gear-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  border-top: 1px solid var(--color-border);
}

.gear-list > li {
  display: grid;
  gap: 0.4rem 2rem;
  padding: var(--space-m) 0;
  border-bottom: 1px solid var(--color-border);
}

@media (min-width: 48em) {
  .gear-list > li {
    grid-template-columns: minmax(12rem, 2fr) 3fr;
  }
}

.gear-list h3 {
  font-size: var(--step-2);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
}

.gear-list p {
  color: var(--color-muted);
}

.gear-list__use {
  font-size: var(--step--1);
  color: var(--color-gold-text);
  margin-top: 0.2rem;
}

.affiliate-link {
  font-size: var(--step--1);
  margin-top: 0.5rem;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

/* ---------- Journal-Liste ---------- */
.journal-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--color-border);
}

.journal-list li {
  border-bottom: 1px solid var(--color-border);
}

.journal-list a {
  display: grid;
  gap: 0.35rem;
  padding: var(--space-m) 0;
  text-decoration: none;
}

@media (min-width: 48em) {
  .journal-list a {
    grid-template-columns: 10rem minmax(0, 1fr);
    gap: var(--space-m);
  }
}

.journal-list time {
  font-size: var(--step--1);
  color: var(--color-muted);
  padding-top: 0.45rem;
}

.journal-list h2,
.journal-list h3 {
  font-size: var(--step-2);
  transition: color var(--duration) var(--ease);
}

.journal-list p {
  color: var(--color-muted);
  margin-top: 0.35rem;
  max-width: var(--width-text);
}

.journal-list a:hover h2,
.journal-list a:hover h3 {
  color: var(--color-gold-text);
}

/* ---------- Hinweisbox (z. B. Luftaufnahmen im Aufbau) ---------- */
.notice {
  position: relative;
  padding: var(--space-l) var(--space-l) var(--space-l) calc(var(--space-l) + 1px);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  display: grid;
  gap: var(--space-s);
}

.notice::before {
  content: "";
  position: absolute;
  left: 0;
  top: var(--space-l);
  bottom: var(--space-l);
  width: 2px;
  background: var(--color-gold);
}

.notice h2,
.notice h3 {
  font-size: var(--step-3);
}

.notice p {
  color: var(--color-muted);
  max-width: 42rem;
}

/* ---------- Click-to-load-Einbettung (360°, YouTube) ---------- */
.embed {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--color-dark);
  color: var(--color-on-dark);
  overflow: hidden;
}

.embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.embed__preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.7;
}

.embed__consent {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--space-s);
  padding: var(--space-m);
  text-align: center;
  background: linear-gradient(to top, rgba(20, 19, 17, 0.75), rgba(20, 19, 17, 0.35));
}

.embed__consent p {
  max-width: 30rem;
  font-size: var(--step--1);
  color: #e3ddd1;
}

.embed__consent a {
  color: var(--color-gold-on-dark);
}

/* ---------- Lokales Video ---------- */
.video-frame {
  position: relative;
  background: var(--color-dark);
  aspect-ratio: 16 / 9;
}

.video-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-frame__missing {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 0.35rem;
  padding: var(--space-m);
  text-align: center;
  color: #cfc8bb;
  font-size: var(--step--1);
}

.video-frame__missing code {
  font-size: 0.75rem;
  color: var(--color-gold-on-dark);
}

/* ---------- Fließtext (Rechtstexte, Journal) ---------- */
.prose {
  max-width: 42rem;
}

.prose > * + * {
  margin-top: 1em;
}

.prose h2 {
  font-size: var(--step-2);
  margin-top: 2.2em;
}

.prose h3 {
  font-size: var(--step-1);
  font-family: var(--font-body);
  font-weight: 600;
  margin-top: 1.8em;
}

.prose ul,
.prose ol {
  padding-left: 1.2em;
}

.prose li + li {
  margin-top: 0.35em;
}

.prose li::marker {
  color: var(--color-gold);
}

.prose figure {
  margin-block: var(--space-l);
}

.prose figcaption {
  font-size: var(--step--1);
  color: var(--color-muted);
  margin-top: 0.5rem;
}

.prose address {
  font-style: normal;
}

.prose .lead {
  font-size: var(--step-1);
  color: var(--color-muted);
}

/* ---------- Formular ---------- */
.form {
  display: grid;
  gap: var(--space-m);
  max-width: 36rem;
}

.form__field {
  display: grid;
  gap: 0.4rem;
}

.form label {
  font-size: var(--step--1);
  font-weight: 500;
}

.form input,
.form textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 0.9rem;
  border: 1px solid #cfc6b6;
  border-radius: var(--radius-s);
  background: var(--color-surface-raised);
}

.form textarea {
  min-height: 9rem;
  resize: vertical;
}

.form input:focus-visible,
.form textarea:focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: 1px;
  border-color: var(--color-text);
}

.form__hint {
  font-size: var(--step--1);
  color: var(--color-muted);
}

.form__check {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  font-size: var(--step--1);
}

.form__check input {
  width: 1.2rem;
  height: 1.2rem;
  min-height: 0;
  margin-top: 0.2rem;
  accent-color: var(--color-text);
}

.form__hp {
  position: absolute;
  left: -9999px;
}

.form-status {
  font-size: var(--step--1);
  padding: 0.8rem 1rem;
  border-left: 2px solid var(--color-gold);
  background: var(--color-surface);
}

/* Dateipfade in Platzhaltern nur lokal zeigen (Klasse aus js-flag.js) */
.image-missing code,
.video-frame__missing code {
  display: none;
}

.is-local .image-missing code,
.is-local .video-frame__missing code {
  display: block;
}

.affiliate-note {
  margin-top: var(--space-l);
  max-width: 42rem;
}

.notice .badge,
.gear-list .badge {
  justify-self: start;
}

/* YouTube-Platzhalter als Hero-Hintergrund */
.hero__yt {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 1.2s var(--ease);
  pointer-events: none;
}

.hero__yt.is-ready {
  opacity: 1;
}

.hero__yt iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 177.78vh;
  height: 56.25vw;
  min-width: 100%;
  min-height: 100%;
  border: 0;
  transform: translate(-50%, -50%);
}
