/* ============================================================
   La Fenice — Effekt-Layer (fx)
   Tageszeit-Rail · Scroll-Ink · Wasserzeichen · Curtain-Footer
   Hover-Wipe · unsichtbare Qualität. Motion gated via .fx-rm.
   ============================================================ */

/* --- Easing-Vokabular (feste Rollen, nie eine sechste Kurve) --- */
:root {
  --fx-ease-reveal: cubic-bezier(0.24, 1, 0.36, 1);
  --fx-ease-entrance: cubic-bezier(0.16, 1, 0.3, 1);
  --fx-ease-utility: cubic-bezier(0.32, 0.72, 0, 1);
  --fx-ease-media: cubic-bezier(0.18, 1, 0.22, 1);
  --fx-ease-line: cubic-bezier(0.86, 0, 0.07, 1);
}

/* --- Unsichtbare Qualität --- */
body {
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

::selection {
  background: rgba(201, 62, 69, 0.2);
  color: #171511;
}

html {
  scrollbar-color: rgba(23, 21, 17, 0.35) transparent;
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(23, 21, 17, 0.3);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}

:focus-visible {
  outline: 1px solid #C93E45;
  outline-offset: 4px;
  border-radius: 2px;
}

[id] {
  scroll-margin-top: 96px;
}

* {
  -webkit-tap-highlight-color: transparent;
}

/* --- Tageszeit-Rail (GIORNO → NOTTE) --- */
.fx-rail {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 55;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 700ms var(--fx-ease-utility);
}

.fx-rail.is-on {
  opacity: 1;
}

.fx-rail-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.3em;
  writing-mode: vertical-rl;
  color: rgba(23, 21, 17, 0.4);
  transition: color 500ms var(--fx-ease-utility);
}

.fx-rail-label--notte {
  color: rgba(212, 160, 61, 0.75);
}

.fx-rail-track {
  position: relative;
  width: 1px;
  height: min(26vh, 220px);
  background: rgba(23, 21, 17, 0.18);
  transition: background 500ms var(--fx-ease-utility);
}

.fx-rail-dot {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -50%);
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #C93E45;
  box-shadow: 0 0 10px rgba(201, 62, 69, 0.5);
  transition: background 500ms var(--fx-ease-utility), box-shadow 500ms var(--fx-ease-utility);
}

/* Nacht-Modus: Rail über dunklen Sektionen */
.fx-rail.is-night .fx-rail-label {
  color: rgba(245, 240, 232, 0.45);
}

.fx-rail.is-night .fx-rail-label--notte {
  color: rgba(212, 160, 61, 0.9);
}

.fx-rail.is-night .fx-rail-track {
  background: rgba(245, 240, 232, 0.22);
}

.fx-rail.is-night .fx-rail-dot {
  background: #D4A03D;
  box-shadow: 0 0 12px rgba(212, 160, 61, 0.6);
}

@media (max-width: 1100px) {
  .fx-rail {
    display: none;
  }
}

/* --- Scroll-Ink (Statement färbt sich beim Scrollen ein) --- */
.fx-ink-word {
  opacity: 0.22;
  transition: opacity 420ms var(--fx-ease-reveal);
}

.fx-ink-word.is-inked {
  opacity: 1;
}

.fx-rm .fx-ink-word {
  opacity: 1;
  transition: none;
}

/* --- Riesen-Wasserzeichen --- */
.fx-watermark {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin-bottom: -0.24em;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(120px, 18vw, 300px);
  line-height: 1;
  letter-spacing: -0.02em;
  text-align: center;
  color: rgba(245, 240, 232, 0.04);
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  z-index: 0;
}

/* --- Underline-Grow: rein von links, raus nach rechts --- */
.fx-wipe {
  position: relative;
}

.fx-wipe::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 1.5px;
  background: currentColor; /* Linie erbt immer die Textfarbe — nie Rot unter Gold */
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 480ms var(--fx-ease-line);
}

.fx-wipe:hover::after,
.fx-wipe:focus-visible::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* --- Grid-Fokus: Geschwister dimmen, Hover-Kachel bleibt scharf --- */
@media (hover: hover) {
  /* Dim auf den Kachel-KINDERN — die Kachel selbst gehört dem
     Export-Reveal (Inline-Opacity + eigene Transition) */
  .fx-tile > * {
    transition: opacity 600ms var(--fx-ease-utility), filter 600ms var(--fx-ease-utility);
  }

  .fx-gallery:hover .fx-tile:not(:hover) > * {
    opacity: 0.45;
    filter: saturate(0.8);
  }

  /* Bild-Lift: langsame Sättigung statt Zoom (Transform gehört der Komponente) */
  image-slot::part(image) {
    transition: filter 900ms var(--fx-ease-media);
  }

  .fx-tile:hover image-slot::part(image),
  figure:hover image-slot::part(image) {
    filter: saturate(1.08) brightness(1.04);
  }
}

.fx-rm .fx-gallery:hover .fx-tile:not(:hover) > * {
  opacity: 1;
  filter: none;
}

.fx-rail,
.fx-watermark {
  print-color-adjust: exact;
}

@media print {
  .fx-rail {
    display: none;
  }
}
