/* =====================================================================
   Referenzen — Showroom mit Geräte-Mockups (nur Tokens aus tokens.css)
   ===================================================================== */

/* ---------- Filter ---------- */
.ref-filter { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: var(--space-l); }
.ref-filter[hidden] { display: none; }
.ref-filter button {
  min-height: 44px; padding: 0.55em 1.05em; border-radius: 999px; cursor: pointer;
  font: 600 var(--step--1)/1 var(--font-body); color: var(--color-text);
  background: var(--color-card); border: 1.5px solid var(--color-border-strong);
  transition: background var(--duration-fast), color var(--duration-fast), border-color var(--duration-fast);
}
.ref-filter button:hover { border-color: var(--color-text); }
.ref-filter button[aria-pressed="true"] { background: var(--color-text); color: var(--color-bg); border-color: var(--color-text); }
.ref-filter button span { font-family: var(--font-mono); font-weight: 500; font-size: 0.85em; opacity: 0.7; margin-left: 0.35em; }

/* ---------- Raster ---------- */
.ref-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-xl) var(--space-l); list-style: none; padding: 0; }
.ref-grid > li { max-width: none; }
.ref-grid > li[hidden] { display: none; }
@media (min-width: 60rem) { .ref-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.ref { display: flex; flex-direction: column; }

/* ---------- Bühne mit Geräten ---------- */
.ref__stage {
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 11.5; padding: 0;
  border: 0; border-radius: var(--radius-l); overflow: hidden; cursor: zoom-in; text-align: left;
  background:
    radial-gradient(120% 90% at 100% 100%, rgb(240 116 43 / 0.16), transparent 55%),
    linear-gradient(to right, rgb(24 24 27 / 0.06) 1px, transparent 1px) 0 0 / 8.333% 100%,
    var(--color-surface);
  isolation: isolate;
}
html:not(.js) button.ref__stage { cursor: default; pointer-events: none; }
.ref__stage::after { /* Pixel-Quadrat aus dem Logo */
  content: ""; position: absolute; z-index: -1; right: 9%; top: 9%; width: 16%; aspect-ratio: 1;
  border-radius: 12%; background: var(--gradient-brand); opacity: 0.9;
  transition: transform 600ms var(--ease-out);
}
.ref__stage:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 4px; }

.ref__browser, .ref__phone { position: absolute; display: block; background: var(--color-text); box-shadow: 0 30px 50px -28px rgb(24 24 27 / 0.55), 0 8px 18px -10px rgb(24 24 27 / 0.3); transition: transform 600ms var(--ease-out); }
.ref__browser { left: 5%; top: 8%; width: 78%; aspect-ratio: 1440 / 940; border-radius: 10px; padding: 0 3px 3px; }
.ref__bar { display: flex; align-items: center; gap: 4px; height: calc(var(--bar-h, 22px)); padding-inline: 8px; }
.ref__bar i { width: 7px; height: 7px; border-radius: 50%; background: #3F3F46; flex: none; }
.ref__bar i:first-child { background: #F0742B; }
.ref__url {
  flex: 1; margin-left: 8px; height: 13px; border-radius: 4px; background: #27272A; color: #A1A1AA;
  font: 500 9px/13px var(--font-mono); letter-spacing: 0.02em; text-align: center;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding-inline: 6px;
}
.ref__phone { right: 6%; bottom: 7%; width: 21%; aspect-ratio: 390 / 820; border-radius: 18% / 8.6%; padding: 4.5%; }
.ref__phone::before { /* Dynamic Island */
  content: ""; position: absolute; z-index: 2; top: 3.6%; left: 50%; width: 30%; height: 2.6%;
  border-radius: 99px; background: var(--color-text); transform: translateX(-50%);
}

.ref__screen { display: block; position: relative; overflow: hidden; container-type: size; background: #fff; }
.ref__browser .ref__screen { height: calc(100% - var(--bar-h, 22px)); border-radius: 0 0 7px 7px; }
.ref__phone .ref__screen { height: 100%; border-radius: 14% / 6.6%; }
.ref__screen picture, .ref__screen img { width: 100%; height: auto; }
.ref__screen img { will-change: transform; transition: transform 1.2s var(--ease-out); }

/* Hover / Fokus: Seite scrollt im Gerät von oben nach unten */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .ref__stage:hover .ref__screen img,
  .ref__stage:focus-visible .ref__screen img { transform: translateY(calc(-100% + 100cqh)); transition: transform 9s cubic-bezier(0.45, 0, 0.55, 1) 0.15s; }
  .ref__stage:hover .ref__phone .ref__screen img,
  .ref__stage:focus-visible .ref__phone .ref__screen img { transition-duration: 11s; }
  .ref__stage:hover .ref__browser { transform: translateY(-4px); }
  .ref__stage:hover .ref__phone { transform: translateY(-10px) rotate(-1.5deg); }
  .ref__stage:hover::after { transform: translate(8%, -8%) rotate(8deg); }
}

.ref__cue {
  position: absolute; left: 5%; bottom: 5%; display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.45rem 0.8rem; border-radius: 999px; background: rgb(24 24 27 / 0.88); color: var(--color-night-text);
  font: 500 var(--step--2)/1 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: background var(--duration-base);
}
.ref__cue svg { width: 1rem; height: 1rem; }
.ref__stage:hover .ref__cue { background: var(--color-primary); }
html:not(.js) .ref__cue { display: none; }

/* ---------- Text ---------- */
.ref__body { display: grid; gap: var(--space-2xs); padding-top: var(--space-m); }
.ref__body .mono { display: flex; flex-wrap: wrap; gap: 0.2rem 0.9rem; }
.ref__body .mono span + span::before { content: "·"; margin-right: 0.9rem; }
.ref__title { font-size: var(--step-3); }
.ref__text { color: var(--color-text-muted); max-width: 46ch; }
.ref__tags { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0; margin-top: var(--space-3xs); }
.ref__tags li { padding: 0.3em 0.7em; border: 1px solid var(--color-border-strong); border-radius: var(--radius-s); font-size: var(--step--1); font-weight: 550; max-width: none; }
.ref__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem var(--space-m); margin-top: var(--space-2xs); }
.ref__actions .btn { min-height: 44px; padding: 0.6em 1.1em; }
.ref__actions .text-link svg { width: 0.95em; height: 0.95em; }
html:not(.js) .js-only { display: none; }

/* ---------- Abschluss-Kachel im Raster ---------- */
.ref--cta .ref__stage { cursor: default; display: grid; place-content: center; text-align: center; gap: var(--space-s); padding: var(--space-l); background: var(--color-night); color: var(--color-night-text); pointer-events: auto; }
.ref--cta .ref__stage::after { right: 8%; top: 10%; width: 12%; }
.ref--cta h3 { font-size: var(--step-3); max-width: 16ch; margin-inline: auto; }
.ref--cta p { color: var(--color-night-muted); max-width: 32ch; margin-inline: auto; }
.ref--cta .btn { justify-self: center; }

/* ---------- Kleine Bildschirme ---------- */
@media (max-width: 29.99rem) {
  .ref__stage { aspect-ratio: 4 / 3.4; }
  .ref__browser { left: 4%; width: 86%; top: 7%; --bar-h: 16px; padding: 0 2px 2px; border-radius: 7px; }
  .ref__bar i { width: 5px; height: 5px; }
  .ref__url { height: 10px; font-size: 7px; line-height: 10px; }
  .ref__phone { width: 27%; right: 4%; bottom: 5%; }
  .ref__cue { display: none; }
}

/* ---------- Live-Vorschau (Dialog) ---------- */
html.viewer-open { overflow: hidden; }
.viewer {
  width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 0; border: 0;
  background: var(--color-night); color: var(--color-night-text);
}
.viewer[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.viewer::backdrop { background: rgb(19 19 22 / 0.7); }
@media (prefers-reduced-motion: no-preference) {
  .viewer[open] { animation: viewer-in 320ms var(--ease-out); }
}
@keyframes viewer-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.viewer :focus-visible { outline: 3px solid var(--color-accent); outline-offset: 3px; }

.viewer__head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--space-xs) var(--space-m); padding: var(--space-xs) var(--gutter); border-bottom: 1px solid var(--color-night-line); }
.viewer__head .mono { color: var(--color-night-muted); display: block; }
.viewer__title { font-size: var(--step-2); line-height: 1.1; }
.viewer__tools { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs); }
.viewer__seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--color-night-2); border: 1px solid var(--color-night-line); }
.viewer__seg button {
  display: inline-flex; align-items: center; gap: 0.45rem; min-height: 40px; padding: 0 1rem; border-radius: 999px; border: 0; cursor: pointer;
  font: 600 var(--step--1)/1 var(--font-body); color: var(--color-night-muted); background: transparent;
}
.viewer__seg button svg { width: 1.05rem; height: 1.05rem; }
.viewer__seg button[aria-pressed="true"] { background: var(--color-night-text); color: var(--color-night); }
.viewer__link { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 44px; color: var(--color-night-text); font-weight: 600; text-decoration: none; }
.viewer__link:hover { text-decoration: underline; }
.viewer__link svg { width: 1rem; height: 1rem; }
.viewer__close {
  grid-column: 2; grid-row: 1; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%;
  border: 1.5px solid var(--color-night-line); background: transparent; color: var(--color-night-text); cursor: pointer;
}
.viewer__close:hover { background: var(--color-primary); border-color: var(--color-primary); }
.viewer__close svg { width: 1.1rem; height: 1.1rem; }
@media (min-width: 64rem) {
  .viewer__head { grid-template-columns: minmax(0, 1fr) auto auto; }
  .viewer__tools { grid-column: 2; grid-row: 1; }
  .viewer__close { grid-column: 3; }
}

.viewer__stage {
  position: relative; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; overflow: hidden; padding: var(--space-s) var(--gutter);
  background: radial-gradient(70% 60% at 50% 100%, rgb(240 116 43 / 0.14), transparent 70%), var(--color-night);
}
.viewer__device { position: relative; display: flex; flex-direction: column; height: 100%; max-height: 100%; background: #0B0B0D; box-shadow: 0 0 0 1px var(--color-night-line), 0 40px 80px -30px rgb(0 0 0 / 0.8); }
.viewer__device--desktop { width: min(100%, 1200px); border-radius: 12px; padding: 0 4px 4px; }
.viewer__device--mobile { aspect-ratio: 390 / 860; width: auto; max-width: 100%; border-radius: 46px; padding: 38px 12px 14px; }
.viewer__device--mobile::before { content: ""; position: absolute; z-index: 2; top: 11px; left: 50%; width: 26%; height: 17px; border-radius: 99px; background: #27272A; transform: translateX(-50%); }
.viewer__chrome { display: flex; align-items: center; gap: 6px; height: 34px; padding-inline: 10px; flex: none; }
.viewer__chrome i { width: 10px; height: 10px; border-radius: 50%; background: #3F3F46; }
.viewer__chrome i:first-child { background: #F0742B; }
.viewer__chrome span { flex: 1; max-width: 26rem; margin-inline: auto; height: 22px; border-radius: 6px; background: #1F1F23; color: #A1A1AA; font: 500 12px/22px var(--font-mono); text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding-inline: 10px; }
.viewer__device--mobile .viewer__chrome { display: none; }
.viewer__progress { position: absolute; left: 4px; right: 4px; top: 34px; z-index: 3; height: 3px; background: var(--gradient-brand); transform: scaleX(0); transform-origin: left; pointer-events: none; }
.viewer__device--mobile .viewer__progress { top: auto; bottom: 4px; left: 30%; right: 30%; border-radius: 3px; }
.viewer__scroll {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; background: #fff; cursor: grab;
  scrollbar-width: thin; scrollbar-color: #52525B transparent;
}
.viewer__device--desktop .viewer__scroll { border-radius: 0 0 9px 9px; }
.viewer__device--mobile .viewer__scroll { border-radius: 10px 10px 32px 32px; scrollbar-width: none; }
.viewer__device--mobile .viewer__scroll::-webkit-scrollbar { display: none; }
.viewer__scroll.is-dragging { cursor: grabbing; user-select: none; }
.viewer__scroll img { width: 100%; height: auto; -webkit-user-drag: none; user-select: none; }
.viewer__scroll:focus-visible { outline-offset: -3px; }

.viewer__hint {
  position: absolute; left: 50%; bottom: calc(var(--space-s) + 1.25rem); z-index: 4; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.6rem 1rem; border-radius: 999px; pointer-events: none;
  background: rgb(24 24 27 / 0.9); color: var(--color-night-text); font: 500 var(--step--2)/1 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap;
}
.viewer__hint[hidden] { display: none; }
.viewer__hint svg { width: 1rem; height: 1rem; }
@media (prefers-reduced-motion: no-preference) {
  .viewer__hint svg { animation: nudge 1.6s var(--ease-out) infinite; }
}
@keyframes nudge { 0%, 100% { transform: translateY(-2px); } 50% { transform: translateY(3px); } }

.viewer__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-s); padding: var(--space-2xs) var(--gutter); border-top: 1px solid var(--color-night-line); }
.viewer__foot .mono { color: var(--color-night-muted); }
.viewer__nav { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 44px; padding: 0 0.9rem; border-radius: 999px; border: 1.5px solid var(--color-night-line); background: transparent; color: var(--color-night-text); font: 600 var(--step--1)/1 var(--font-body); cursor: pointer; }
.viewer__nav:hover { border-color: var(--color-night-text); }
.viewer__nav svg { width: 1.05rem; height: 1.05rem; }
.viewer__nav--prev svg { transform: scaleX(-1); }
@media (max-width: 29.99rem) { .viewer__nav span { display: none; } }

.ref-note { margin-top: var(--space-s); }

/* ---------- Hero: aufgefächerte Smartphones ---------- */
.page-hero__side { display: grid; gap: var(--space-l); }
.hero-phones { position: relative; aspect-ratio: 1 / 0.92; max-width: 26rem; width: 100%; margin-inline: auto; }
.hero-phones::before { content: ""; position: absolute; left: 50%; top: 46%; width: 70%; aspect-ratio: 1; border-radius: 50%; transform: translate(-50%, -50%); background: radial-gradient(closest-side, rgb(240 116 43 / 0.28), transparent); z-index: -1; }
.hero-phone {
  position: absolute; top: 0; left: 50%; width: 36%; aspect-ratio: 480 / 1009; display: block;
  padding: 3.5%; border-radius: 16% / 7.6%; background: var(--color-text);
  box-shadow: 0 28px 44px -24px rgb(24 24 27 / 0.6);
  transform-origin: 50% 100%;
}
.hero-phone picture, .hero-phone img { width: 100%; height: 100%; object-fit: cover; object-position: top; border-radius: 13% / 6.2%; }
.hero-phone--1 { transform: translateX(-118%) translateY(9%) rotate(-9deg); }
.hero-phone--2 { transform: translateX(-50%); z-index: 2; }
.hero-phone--3 { transform: translateX(18%) translateY(9%) rotate(9deg); }
@media (prefers-reduced-motion: no-preference) {
  .hero-phone { animation: phone-in 900ms var(--ease-out) both; }
  .hero-phone--1 { animation-delay: 120ms; }
  .hero-phone--3 { animation-delay: 240ms; }
}
@keyframes phone-in { from { opacity: 0; translate: 0 24px; } }
@media (min-width: 64rem) { .hero-phones { max-width: 24rem; } }
