/* ==========================================================================
   Farbwelt – Stylesheet der Unterseite „Farbtöne“
   Wird nur auf dieser Seite geladen. Nutzt die Variablen des Designsystems.
   ========================================================================== */

/* --- Bühne mit Stimmungslicht -------------------------------------------- */
.fw {
  position: relative;
  isolation: isolate;
  background: var(--fw-deep, #15151a);
  color: var(--color-text-invert);
  transition: background 900ms cubic-bezier(0.33, 0, 0.15, 1);
  overflow: clip;
}
.fw__mood {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.fw__mood i {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  transition: background 1100ms cubic-bezier(0.33, 0, 0.15, 1);
  will-change: transform;
}
.fw__mood i:nth-child(1) {
  width: 60%; height: 70%; left: -10%; top: -12%;
  background: var(--fw-glow, #2a2a2f);
  animation: fwDriftA 30s ease-in-out infinite alternate;
}
.fw__mood i:nth-child(2) {
  width: 55%; height: 65%; right: -12%; top: 22%;
  background: var(--fw-accent, #3a3a3f);
  animation: fwDriftB 36s ease-in-out infinite alternate;
}
@keyframes fwDriftA {
  from { transform: translate3d(-4%, -3%, 0) scale(0.95); }
  to   { transform: translate3d(18%, 12%, 0) scale(1.25); }
}
@keyframes fwDriftB {
  from { transform: translate3d(4%, 8%, 0) scale(1.2); }
  to   { transform: translate3d(-16%, -10%, 0) scale(0.92); }
}
/* feine Körnung – nimmt den Flächen das Digitale */
.fw::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.5;
  background-image: radial-gradient(rgba(255, 255, 255, 0.045) 0.5px, transparent 0.5px);
  background-size: 3px 3px;
}
.fw > * { position: relative; z-index: 2; }

/* --- Kopfbereich ---------------------------------------------------------- */
.fw-hero {
  padding-top: calc(var(--header-height) + clamp(3rem, 8vh, 6rem));
  padding-bottom: clamp(2rem, 5vh, 3.5rem);
}
.fw-hero__inner { max-width: 62rem; }
.fw-hero h1 {
  font-size: clamp(2.2rem, 1.2rem + 3.2vw, 4.2rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
  color: var(--color-text-invert);
  margin-bottom: 1.25rem;
}
.fw-hero h1 em { font-style: normal; color: var(--color-accent); }
.fw-hero__lead {
  font-size: clamp(1.02rem, 0.95rem + 0.5vw, 1.3rem);
  line-height: 1.55;
  color: rgba(246, 243, 238, 0.72);
  max-width: 46ch;
}
.fw-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 2rem;
  margin-top: 2.25rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(246, 243, 238, 0.16);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(246, 243, 238, 0.5);
}

/* --- Filterleiste --------------------------------------------------------- */
.fw-filter {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0.25rem 0 1.25rem;
  scroll-snap-type: x proximity;
}
.fw-filter::-webkit-scrollbar { display: none; }
.fw-filter__btn {
  flex: none;
  scroll-snap-align: start;
  border: 1px solid rgba(246, 243, 238, 0.22);
  background: transparent;
  color: rgba(246, 243, 238, 0.78);
  border-radius: var(--radius-pill);
  padding: 0.5rem 1rem;
  font: inherit;
  font-size: 0.84rem;
  cursor: pointer;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: color var(--transition-fast), border-color var(--transition-fast),
              background var(--transition-fast);
}
.fw-filter__btn i {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--dot, currentColor);
  flex: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.22);
}
.fw-filter__btn b {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  opacity: 0.55;
}
.fw-filter__btn:hover { border-color: var(--color-accent); color: #fff; }
.fw-filter__btn[aria-pressed="true"] {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-brand-primary);
}
.fw-filter__btn[aria-pressed="true"] b { opacity: 0.7; }

/* --- Farbwelt: Bühne ------------------------------------------------------ */
.fw-stage { position: relative; }
.fw-stage__track { position: relative; }
.fw-stage__pin {
  position: sticky;
  top: 0;
  height: 100svh;
  height: 100vh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  align-content: center;
  gap: clamp(0.5rem, 2vh, 1.5rem);
  padding-top: var(--header-height);
  padding-bottom: clamp(1rem, 3vh, 2rem);
  overflow: hidden;
}
.fw-rail {
  position: relative;
  height: 100%;
  perspective: 1500px;
  perspective-origin: 50% 46%;
  transform-style: preserve-3d;
}

/* --- Farbkarte ------------------------------------------------------------ */
.fw-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(190px, 22vw, 320px);
  height: clamp(260px, 30vw, 430px);
  margin-left: calc(clamp(190px, 22vw, 320px) / -2);
  margin-top: calc(clamp(260px, 30vw, 430px) / -2);
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  font: inherit;
  transform-style: preserve-3d;
  will-change: transform, opacity;
  backface-visibility: hidden;
}
.fw-card__face {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: var(--tone);
  overflow: hidden;
  box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.95),
              0 2px 10px -4px rgba(0, 0, 0, 0.6),
              inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  transition: box-shadow 500ms ease;
}
/* Materialwirkung: Lichtkante, Verlauf, feine Struktur */
.fw-card__face::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(148deg, rgba(255, 255, 255, 0.42) 0%, rgba(255, 255, 255, 0) 38%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.22) 0%, rgba(0, 0, 0, 0) 42%);
}
.fw-card__face::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: radial-gradient(rgba(0, 0, 0, 0.16) 0.5px, transparent 0.5px);
  background-size: 3px 3px;
}
/* Lichtreflex, folgt dem Zeiger */
.fw-card__gloss {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(38% 38% at var(--mx, 50%) var(--my, 30%),
                              rgba(255, 255, 255, 0.5), transparent 70%);
  opacity: 0;
  transition: opacity 400ms ease;
  pointer-events: none;
}
.fw-card__label {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 2;
  padding: 1.1rem 1.15rem;
  text-align: left;
  display: grid;
  gap: 0.15rem;
}
.fw-card__name {
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: #fff;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.45);
}
.fw-card__code {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.82);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
}
.fw-card--light .fw-card__name { color: rgba(16, 16, 20, 0.92); text-shadow: none; }
.fw-card--light .fw-card__code { color: rgba(16, 16, 20, 0.6); text-shadow: none; }

.fw-card.is-active .fw-card__face {
  box-shadow: 0 60px 110px -40px rgba(0, 0, 0, 0.95),
              0 0 0 2px var(--color-accent),
              inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}
.fw-card:hover .fw-card__gloss, .fw-card:focus-visible .fw-card__gloss { opacity: 1; }
.fw-card[hidden] { display: none; }

/* --- Anzeige des aktiven Tons --------------------------------------------- */
.fw-readout {
  position: relative;
  z-index: 3;
  display: grid;
  gap: 0.5rem;
  padding: 0 0 clamp(1.5rem, 4vh, 3rem);
  text-align: center;
  max-width: 46rem;
  margin-inline: auto;
}
.fw-readout__name {
  font-size: clamp(1.5rem, 1rem + 2vw, 2.6rem);
  letter-spacing: -0.03em;
  font-weight: 600;
  color: var(--color-text-invert);
  line-height: 1.05;
}
.fw-readout__values {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
}
.fw-readout__text {
  color: rgba(246, 243, 238, 0.72);
  max-width: 52ch;
  margin-inline: auto;
  font-size: 0.95rem;
}
.fw-readout__hint {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(246, 243, 238, 0.38);
}
.fw-readout.is-updating { animation: fwFade 500ms cubic-bezier(0.16, 0.84, 0.44, 1); }
@keyframes fwFade {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* Fortschritt der Farbwelt */
.fw-progress {
  justify-self: center;
  width: min(360px, 60%);
  height: 2px;
  background: rgba(246, 243, 238, 0.16);
  border-radius: 2px;
  overflow: hidden;
  z-index: 3;
}
.fw-progress i {
  display: block;
  height: 100%;
  width: 14%;
  background: var(--color-accent);
  border-radius: 2px;
  transform-origin: left center;
}

/* --- Detailansicht -------------------------------------------------------- */
.fw-detail {
  position: fixed;
  inset: 0;
  z-index: var(--z-lightbox, 90);
  display: grid;
  grid-template-columns: 1fr min(520px, 92vw);
}
.fw-detail[hidden] { display: none; }
.fw-detail__backdrop {
  background: rgba(10, 10, 13, 0.72);
  backdrop-filter: blur(6px);
  border: 0;
  cursor: pointer;
  animation: fwFadeIn 300ms ease both;
}
@keyframes fwFadeIn { from { opacity: 0; } to { opacity: 1; } }
.fw-detail__panel {
  background: var(--color-surface);
  color: var(--color-text);
  overflow-y: auto;
  animation: fwSlide 420ms cubic-bezier(0.16, 0.84, 0.44, 1) both;
  display: flex;
  flex-direction: column;
}
@keyframes fwSlide { from { transform: translateX(6%); opacity: 0; } to { transform: none; opacity: 1; } }
.fw-detail__swatch {
  position: relative;
  height: clamp(180px, 30vh, 280px);
  background: var(--tone, #ddd);
  flex: none;
}
.fw-detail__swatch::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0) 44%);
}
.fw-detail__close {
  position: absolute;
  top: 1rem; right: 1rem;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 0;
  background: rgba(16, 16, 20, 0.55);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.fw-detail__close:hover { background: var(--color-brand-primary); }
.fw-detail__body { padding: clamp(1.5rem, 3vw, 2.25rem); display: grid; gap: 1.25rem; }
.fw-detail__name { font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: -0.03em; margin: 0; }
.fw-detail__values { display: grid; gap: 0.55rem; }
.fw-detail__row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
}
.fw-detail__row span:first-child { color: var(--color-muted); }
.fw-detail__row span:last-child { font-family: var(--font-mono); font-size: 0.82rem; }
.fw-detail__partners { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.fw-partner {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.8rem 0.4rem 0.45rem;
  background: none;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}
.fw-partner i {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--tone);
  border: 1px solid rgba(0, 0, 0, 0.12);
}
.fw-partner:hover { border-color: var(--color-accent); }

/* --- Auswahl / Merkliste --------------------------------------------------- */
.fw-picked {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
}
.fw-picked__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid rgba(246, 243, 238, 0.22);
  border-radius: var(--radius-pill);
  padding: 0.35rem 0.7rem 0.35rem 0.4rem;
  font-size: 0.82rem;
  color: rgba(246, 243, 238, 0.9);
  animation: fwChip 320ms cubic-bezier(0.16, 0.84, 0.44, 1) both;
}
@keyframes fwChip { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: none; } }
.fw-picked__chip i {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--tone); border: 1px solid rgba(255, 255, 255, 0.2);
}
.fw-picked__chip button {
  border: 0; background: none; color: inherit; cursor: pointer;
  font-size: 1rem; line-height: 1; opacity: 0.6; padding: 0 0.1rem;
}
.fw-picked__chip button:hover { opacity: 1; color: var(--color-accent); }
.fw-picked__empty {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(246, 243, 238, 0.4);
}

/* --- Mobile: Wischgalerie statt Bühne ------------------------------------- */
@media (max-width: 900px) {
  .fw-stage__track { height: auto !important; }
  .fw-stage__pin {
    position: static;
    height: auto;
    display: block;
  }
  .fw-rail {
    display: flex;
    gap: 1rem;
    height: auto;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    padding: 1.5rem 0 2rem;
    perspective: 900px;
    /* Die Schiene läuft bereits über die volle Breite – nur Innenabstand,
       damit die erste und letzte Karte nicht am Rand kleben. */
    padding-inline: var(--gutter);
    scroll-padding-inline: var(--gutter);
  }
  .fw-rail::-webkit-scrollbar { display: none; }
  .fw-card {
    position: relative;
    left: auto; top: auto;
    margin: 0;
    flex: none;
    width: min(74vw, 300px);
    height: min(96vw, 400px);
    scroll-snap-align: center;
  }
  .fw-progress { position: static; transform: none; width: 100%; margin: 0 auto 1.25rem; }
  .fw-readout { text-align: left; padding-bottom: 1.5rem; }
  .fw-readout__values { justify-content: flex-start; }
  .fw-detail { grid-template-columns: 1fr; align-items: end; }
  .fw-detail__backdrop { grid-row: 1; }
  .fw-detail__panel {
    grid-row: 1;
    max-height: 88svh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    animation: fwSheet 420ms cubic-bezier(0.16, 0.84, 0.44, 1) both;
  }
  @keyframes fwSheet { from { transform: translateY(8%); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* --- Bewegung reduziert ---------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .fw, .fw__mood i { transition: none !important; animation: none !important; }
  .fw-stage__track { height: auto !important; }
  .fw-stage__pin { position: static; height: auto; display: block; }
  .fw-rail {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    height: auto;
    perspective: none;
    padding-block: 1.5rem;
  }
  .fw-card {
    position: relative;
    left: auto; top: auto; margin: 0;
    width: 100%; height: auto; aspect-ratio: 3 / 4;
    transform: none !important;
    opacity: 1 !important;
  }
  .fw-readout.is-updating, .fw-picked__chip, .fw-detail__panel, .fw-detail__backdrop {
    animation: none !important;
  }
}
