/* ============================================================
   GRAUTON Galerie — galerie.css (fine.rayhen.art)
   Zwei Raumtöne:  body[data-raum="karton"]  (dunkler Karton, Standard)
                   body[data-raum="galerie"] (heller Galerieraum)
   Drei Hängungen: body[data-layout="raster" | "saeulen" | "einspaltig"]
   Umschaltbar über tweaks.js (Tweaks-Panel).
   ============================================================ */

:root {
  --g-copper: #B26D40;
  --g-copper-soft: rgba(178, 109, 64, 0.45);
  --display-scale: 1;
  --grain-o: 1;
  --tracking: 0.04em;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  min-height: 100%;
  background: var(--g-bg);
  color: var(--g-fg);
  font-family: 'Noto Sans', sans-serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 400ms ease, color 400ms ease;
}

/* ── Raumton: Karton (Standard, dunkel) ── */
body, body[data-raum="karton"] {
  --g-bg: #232120;
  --g-fg: #F5F2EE;
  --g-fg-soft: rgba(245, 242, 238, 0.75);
  --g-fg-faint: rgba(245, 242, 238, 0.5);
  --g-fg-mute: rgba(245, 242, 238, 0.25);
  --g-hair: rgba(245, 242, 238, 0.1);
  --g-card: #2a2724;
  --g-img-bg: #1a1714;
  --g-card-shadow:
    0 2px 4px rgba(0, 0, 0, 0.4),
    0 8px 24px rgba(0, 0, 0, 0.35),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.04);
  --g-vig: rgba(26, 23, 20, 0.3);
  --g-grain-a: 0.6;
  --g-grain-b: 0.4;
}

/* ── Raumton: Galerie (hell, Museums-Hängung) ── */
body[data-raum="galerie"] {
  --g-bg: #F5F2EE;
  --g-fg: #1A1714;
  --g-fg-soft: rgba(26, 23, 20, 0.72);
  --g-fg-faint: rgba(26, 23, 20, 0.5);
  --g-fg-mute: rgba(26, 23, 20, 0.3);
  --g-hair: rgba(26, 23, 20, 0.14);
  --g-card: #FCFBF9;
  --g-img-bg: #E9E5DF;
  --g-card-shadow:
    0 1px 2px rgba(26, 23, 20, 0.06),
    0 14px 40px rgba(26, 23, 20, 0.1),
    inset 0 0 0 0.5px rgba(26, 23, 20, 0.05);
  --g-vig: rgba(26, 23, 20, 0.12);
  --g-grain-a: 0.3;
  --g-grain-b: 0.18;
}

::selection { background: var(--g-copper); color: #F5F2EE; }

/* ── Korn ── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='400' height='400' filter='url(%23n)' opacity='0.07'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  mix-blend-mode: overlay;
  opacity: calc(var(--g-grain-a) * var(--grain-o));
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='turbulence' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23g)' opacity='0.05'/%3E%3C/svg%3E");
  background-size: 100px 100px;
  mix-blend-mode: multiply;
  opacity: calc(var(--g-grain-b) * var(--grain-o));
}

.gx-page {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(3rem, 8vh, 6rem) clamp(1.5rem, 5vw, 4rem);
}

/* ── Kopf ── */
.gx-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: clamp(2.5rem, 5vh, 4rem);
  border-bottom: 0.5px solid var(--g-hair);
  padding-bottom: 1.5rem;
  opacity: 0;
  animation: gxFadeUp 800ms ease forwards;
}

.gx-head__brand {
  font-size: clamp(0.7rem, 0.85vw, 0.8rem);
  font-weight: 300;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--g-fg-soft);
  text-decoration: none;
  transition: color 220ms ease;
}
.gx-head__brand:hover { color: var(--g-copper); }

.gx-head__site {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.1rem, 1.4vw, 1.3rem);
  font-weight: 300;
  letter-spacing: 0.06em;
  color: var(--g-copper);
}

/* ── Galerie-Headline ── */
.gx-hl {
  margin-bottom: clamp(2rem, 4vh, 3.5rem);
  opacity: 0;
  animation: gxFadeUp 800ms ease forwards;
  animation-delay: 60ms;
}

.gx-hl__label {
  display: block;
  font-size: clamp(0.6rem, 0.7vw, 0.68rem);
  font-weight: 300;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--g-fg-faint);
  margin-bottom: 0.4rem;
}

.gx-hl__title {
  font-family: 'Cormorant Garamond', serif;
  font-size: calc(clamp(2.4rem, 5.5vw, 4.8rem) * var(--display-scale));
  font-weight: 300;
  letter-spacing: 0.06em;
  line-height: 0.95;
  text-transform: uppercase;
  color: var(--g-fg);
}

.gx-hl__note {
  margin-top: 1.1rem;
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--g-fg-soft);
  max-width: 56ch;
}

/* ── Serien-Index ── */
.gx-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2.25rem;
  padding: 1.1rem 0;
  border-top: 0.5px solid var(--g-hair);
  border-bottom: 0.5px solid var(--g-hair);
  margin-bottom: clamp(1rem, 2vh, 1.5rem);
  opacity: 0;
  animation: gxFadeUp 800ms ease forwards;
  animation-delay: 120ms;
}

.gx-toc a {
  display: inline-flex;
  align-items: baseline;
  gap: 0.6rem;
  font-size: 0.7rem;
  font-weight: 300;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--g-fg-soft);
  text-decoration: none;
  transition: color 220ms ease;
}
.gx-toc a span {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: var(--g-copper);
}
.gx-toc a:hover { color: var(--g-copper); }

/* ── Serie ── */
.gx-serie { margin-top: clamp(3rem, 7vh, 5rem); }

.gx-serie__head {
  display: flex;
  align-items: baseline;
  gap: clamp(1rem, 2.5vw, 1.75rem);
  margin-bottom: clamp(1.25rem, 3vh, 2rem);
  opacity: 0;
  animation: gxFadeUp 700ms ease forwards;
}

.gx-serie__no {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.8rem, 3.4vw, 2.8rem);
  font-weight: 300;
  letter-spacing: 0.05em;
  color: var(--g-copper-soft);
  flex-shrink: 0;
}

.gx-serie__label {
  display: block;
  font-size: clamp(0.58rem, 0.68vw, 0.66rem);
  font-weight: 300;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--g-fg-faint);
  margin-bottom: 0.25rem;
}

.gx-serie__title {
  font-family: 'Cormorant Garamond', serif;
  font-size: calc(clamp(1.7rem, 3.6vw, 2.7rem) * var(--display-scale));
  font-weight: 300;
  letter-spacing: 0.05em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--g-fg);
}

.gx-serie__intro {
  margin: 0 0 clamp(1.5rem, 3vh, 2.25rem);
  opacity: 0;
  animation: gxFadeUp 700ms ease forwards;
  animation-delay: 80ms;
}
.gx-serie__intro p {
  font-size: 0.98rem;
  line-height: 1.8;
  color: var(--g-fg-soft);
  max-width: 62ch;
  margin-bottom: 0.9rem;
}
.gx-serie__intro p:last-child { margin-bottom: 0; }

/* ── Raster (Standard-Hängung) ── */
.gx-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(0.75rem, 2vw, 2rem);
}

.gx-card.span-2 { grid-column: span 2; }
.gx-card.span-3 { grid-column: span 3; }
.gx-card.span-2 .gx-card__wrap { aspect-ratio: 3 / 2; }
.gx-card.span-3 .gx-card__wrap { aspect-ratio: 21 / 9; }

.gx-text { grid-column: 1 / -1; padding: clamp(0.5rem, 1.5vw, 1rem) 0; }
.gx-text.span-1 { grid-column: span 1; }
.gx-text.span-2 { grid-column: span 2; }
.gx-text p {
  font-weight: 300;
  font-size: 1rem;
  line-height: 1.8;
  color: var(--g-fg-soft);
  max-width: 62ch;
  margin-bottom: 0.9rem;
}
.gx-text p:last-child { margin-bottom: 0; }

/* ── Foto-Karte (Passepartout) ── */
.gx-card {
  position: relative;
  background: var(--g-card);
  padding: clamp(0.6rem, 1.2vw, 1rem);
  box-shadow: var(--g-card-shadow);
  cursor: pointer;
  opacity: 0;
  animation: gxFadeUp 700ms ease forwards;
  transition: background 400ms ease;
}
.gx-card:focus-visible {
  outline: 1.5px solid var(--g-copper);
  outline-offset: 3px;
}

.gx-card__wrap {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--g-img-bg);
  user-select: none;
  -webkit-user-select: none;
}
.gx-card__wrap::after { content: ""; position: absolute; inset: 0; z-index: 2; }

.gx-card__wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  -webkit-user-drag: none;
  transition: opacity 260ms ease;
}
.gx-card:hover .gx-card__wrap img { opacity: 0.88; }

.gx-card__vig {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(ellipse at center, transparent 60%, var(--g-vig) 100%);
  pointer-events: none;
}

.gx-card__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.1rem 0.3rem;
  border-top: 0.5px solid var(--g-hair);
  margin-top: 0.55rem;
}

.gx-card__name {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(0.88rem, 1.05vw, 1rem);
  font-weight: 300;
  font-style: italic;
  letter-spacing: 0.04em;
  color: var(--g-fg);
  min-width: 0;
}
.gx-card__name--empty { color: var(--g-fg-mute); }

.gx-card__num {
  font-size: clamp(0.6rem, 0.68vw, 0.65rem);
  font-weight: 300;
  letter-spacing: 0.1em;
  color: var(--g-fg-mute);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Stagger */
.gx-grid .gx-card:nth-child(1)  { animation-delay: 100ms; }
.gx-grid .gx-card:nth-child(2)  { animation-delay: 160ms; }
.gx-grid .gx-card:nth-child(3)  { animation-delay: 220ms; }
.gx-grid .gx-card:nth-child(4)  { animation-delay: 280ms; }
.gx-grid .gx-card:nth-child(5)  { animation-delay: 340ms; }
.gx-grid .gx-card:nth-child(6)  { animation-delay: 400ms; }
.gx-grid .gx-card:nth-child(7)  { animation-delay: 460ms; }
.gx-grid .gx-card:nth-child(8)  { animation-delay: 520ms; }
.gx-grid .gx-card:nth-child(n+9) { animation-delay: 580ms; }

/* ── Hängung: Säulen ── */
body[data-layout="saeulen"] .gx-grid {
  display: block;
  columns: 3;
  column-gap: clamp(0.75rem, 2vw, 2rem);
}
body[data-layout="saeulen"] .gx-card,
body[data-layout="saeulen"] .gx-text {
  break-inside: avoid;
  margin-bottom: clamp(0.75rem, 2vw, 2rem);
}
body[data-layout="saeulen"] .gx-card__wrap,
body[data-layout="saeulen"] .gx-card.span-2 .gx-card__wrap,
body[data-layout="saeulen"] .gx-card.span-3 .gx-card__wrap { aspect-ratio: auto; }
body[data-layout="saeulen"] .gx-card__wrap img { height: auto; }

/* ── Hängung: Einspaltig groß ── */
body[data-layout="einspaltig"] .gx-grid {
  display: flex;
  flex-direction: column;
  gap: clamp(2rem, 5vh, 3.5rem);
  max-width: 780px;
  margin: 0 auto;
}
body[data-layout="einspaltig"] .gx-card__wrap,
body[data-layout="einspaltig"] .gx-card.span-2 .gx-card__wrap,
body[data-layout="einspaltig"] .gx-card.span-3 .gx-card__wrap { aspect-ratio: auto; }
body[data-layout="einspaltig"] .gx-card__wrap img { height: auto; }
body[data-layout="einspaltig"] .gx-card__name { font-size: 1.05rem; }
body[data-layout="einspaltig"] .gx-serie__head,
body[data-layout="einspaltig"] .gx-serie__intro,
body[data-layout="einspaltig"] .gx-text {
  max-width: 780px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Fuß ── */
.gx-footer {
  margin-top: clamp(3rem, 6vh, 5rem);
  padding-top: 1.5rem;
  border-top: 0.5px solid var(--g-hair);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  opacity: 0;
  animation: gxFadeUp 700ms ease forwards;
  animation-delay: 600ms;
}

.gx-footer__left { display: flex; flex-direction: column; gap: 0.45rem; }

.gx-footer__copy {
  font-size: 0.72rem;
  font-weight: 300;
  letter-spacing: 0.08em;
  color: var(--g-fg-mute);
}

.gx-footer__legal { display: flex; gap: 1.1rem; }
.gx-footer__legal a {
  font-size: 0.72rem;
  font-weight: 300;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--g-fg-faint);
  text-decoration: none;
  transition: color 220ms ease;
}
.gx-footer__legal a:hover { color: var(--g-copper); }

.gx-footer__mark {
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.9rem;
  font-weight: 300;
  letter-spacing: 0.06em;
  color: var(--g-copper-soft);
}

/* ── Lightbox (Werkansicht — immer dunkler Betrachtungsraum) ── */
body.gx-noscroll { overflow: hidden; }

.gx-lb {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  background: rgba(20, 18, 16, 0.96);
}
.gx-lb.is-open { display: block; animation: gxFade 260ms ease; }

.gx-lb__fig {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(3rem, 7vh, 4.5rem) clamp(3.25rem, 8vw, 6rem) clamp(1.5rem, 4vh, 2.5rem);
  gap: 1.1rem;
}

.gx-lb__stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.gx-lb__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.55);
  background: #1a1714;
  user-select: none;
  -webkit-user-drag: none;
}

.gx-lb__cap {
  flex-shrink: 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  color: #F5F2EE;
}

.gx-lb__row { display: flex; align-items: baseline; gap: 0.9rem; }

.gx-lb__name {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.15rem, 1.6vw, 1.45rem);
  font-weight: 300;
  font-style: italic;
  letter-spacing: 0.04em;
}
.gx-lb__name.is-empty { color: rgba(245, 242, 238, 0.45); }

.gx-lb__num {
  font-family: 'Noto Sans', sans-serif;
  font-size: 0.66rem;
  font-weight: 300;
  letter-spacing: 0.14em;
  color: rgba(245, 242, 238, 0.4);
}

.gx-lb__serie {
  font-family: 'Noto Sans', sans-serif;
  font-size: 0.62rem;
  font-weight: 300;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(245, 242, 238, 0.45);
}

.gx-lb__note {
  font-family: 'Noto Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 300;
  line-height: 1.6;
  color: rgba(245, 242, 238, 0.6);
  max-width: 58ch;
  margin-top: 0.3rem;
}
.gx-lb__note:empty { display: none; }

.gx-lb__inq {
  margin-top: 0.55rem;
  font-family: 'Noto Sans', sans-serif;
  font-size: 0.66rem;
  font-weight: 300;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--g-copper);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: border-color 220ms ease;
}
.gx-lb__inq:hover { border-bottom-color: var(--g-copper); }

.gx-lb__x {
  position: absolute;
  top: clamp(0.9rem, 2.5vh, 1.5rem);
  right: clamp(1rem, 3vw, 1.75rem);
  z-index: 2;
  background: none;
  border: none;
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 300;
  line-height: 1;
  color: rgba(245, 242, 238, 0.55);
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  transition: color 220ms ease;
}
.gx-lb__x:hover { color: var(--g-copper); }

.gx-lb__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  background: none;
  border: none;
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  font-weight: 300;
  line-height: 1;
  color: rgba(245, 242, 238, 0.4);
  cursor: pointer;
  padding: 1.25rem 0.9rem;
  transition: color 220ms ease;
}
.gx-lb__nav:hover { color: var(--g-copper); }
.gx-lb__nav--prev { left: clamp(0.25rem, 1.5vw, 1rem); }
.gx-lb__nav--next { right: clamp(0.25rem, 1.5vw, 1rem); }

/* ── Vorschau-Badge (nur vorschau.html) ── */
.gx-preview-tag {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 500;
  font-family: 'Noto Sans', sans-serif;
  font-size: 0.6rem;
  font-weight: 300;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(245, 242, 238, 0.75);
  background: rgba(26, 23, 20, 0.85);
  border: 0.5px solid rgba(245, 242, 238, 0.18);
  padding: 7px 12px;
  pointer-events: none;
}

/* ── Animation ── */
@keyframes gxFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes gxFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .gx-head, .gx-hl, .gx-toc, .gx-serie__head, .gx-serie__intro,
  .gx-card, .gx-text, .gx-footer { opacity: 1; animation: none; }
  .gx-lb.is-open { animation: none; }
}

/* ── Responsiv ── */
@media (max-width: 860px) {
  .gx-grid { grid-template-columns: repeat(2, 1fr); }
  .gx-card.span-3 { grid-column: span 2; }
  .gx-card.span-3 .gx-card__wrap { aspect-ratio: 3 / 2; }
  body[data-layout="saeulen"] .gx-grid { columns: 2; }
}

@media (max-width: 560px) {
  .gx-grid { grid-template-columns: 1fr; }
  .gx-card.span-2, .gx-card.span-3 { grid-column: span 1; }
  .gx-card.span-2 .gx-card__wrap, .gx-card.span-3 .gx-card__wrap { aspect-ratio: 3 / 4; }
  body[data-layout="saeulen"] .gx-grid { columns: 1; }
  .gx-lb__fig { padding: 3.25rem 1rem 5.5rem; }
  .gx-lb__nav { top: auto; bottom: 0.75rem; transform: none; }
  .gx-lb__nav--prev { left: 1rem; }
  .gx-lb__nav--next { right: 1rem; }
}
