/* ==========================================================================
   Web Lab — Work Showcase (weflash.studio/projekte-inspired motion & layout)
   Adapted to Web Lab palette (#0b0b28, #3224df, #f5f5fb) & Bricolage Grotesque
   ========================================================================== */

:root {
  --wf-bg: #0b0b28;
  --wf-bg-elev: #121238;
  --wf-bezel: #151540;
  --wf-bezel-border: rgba(255, 255, 255, 0.1);
  --wf-ink: #ffffff;
  --wf-ink-muted: rgba(200, 202, 224, 0.78);
  --wf-ink-dim: rgba(200, 202, 224, 0.52);
  --wf-accent: #3224df;
  --wf-accent-bright: #6f64ff;
  --wf-paper: #f5f5fb;
  --wf-paper-ink: #0b0b28;
  --wf-paper-muted: rgba(11, 11, 40, 0.62);
  --wf-paper-line: rgba(11, 11, 40, 0.14);
  --wf-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --wf-ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Dark theme override scoped to /work/ */
body.wl-work-page {
  background: var(--wf-bg);
  color: var(--wf-ink);
  overflow-x: clip;
}

/* Fixed atmospheric depth layer (ambient indigo radial glow + subtle film grain + vignette) */
.wf-depth {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.wf-depth-glow {
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(65% 55% at 50% 28%, rgba(50, 36, 223, 0.22) 0%, rgba(50, 36, 223, 0.08) 42%, transparent 72%),
    radial-gradient(45% 40% at 82% 72%, rgba(111, 100, 255, 0.12) 0%, transparent 65%),
    radial-gradient(40% 35% at 15% 80%, rgba(50, 36, 223, 0.1) 0%, transparent 65%);
}

.wf-depth-grain {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
}

.wf-depth-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(85% 85% at 50% 50%, transparent 52%, rgba(5, 5, 20, 0.62) 100%);
}

@keyframes wf-grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-2%, 2%); }
  40% { transform: translate(2%, -1%); }
  60% { transform: translate(-1%, -2%); }
  80% { transform: translate(2%, 2%); }
  100% { transform: translate(0, 0); }
}

/* Navigation uses unified floating pill & adaptive light/dark theme from weblab.css */

body.wl-work-page main {
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   1. HERO — 3D HELIX TORNADO WITH SEAMLESS CARD DOCKING
   ========================================================================== */

.wf-hero {
  position: relative;
  height: 100svh;
  min-height: 620px;
  z-index: 4;
  overflow: visible;
}

.wf-tornado-scene {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
  contain: layout style;
}

.wf-tornado-scene.is-hidden {
  display: none;
}

.wf-tornado-list {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.wf-tornado-item {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--tornado-w, 640px);
  aspect-ratio: 4 / 3;
  margin-left: calc(var(--tornado-w, 640px) * -0.5);
  margin-top: calc(var(--tornado-w, 640px) * -0.375);
  transform-style: preserve-3d;
  backface-visibility: visible;
  will-change: transform, opacity;
  pointer-events: none;
}

/* Exact match with .wf-screen + .wf-screen-window so handoff at scale:1 is invisible */
.wf-tornado-card {
  position: relative;
  width: 100%;
  height: 100%;
  background: linear-gradient(155deg, #19194a 0%, #111134 55%, #0e0e2c 100%);
  border: 1px solid var(--wf-bezel-border);
  border-radius: 6px;
  box-shadow: 0 24px 60px -24px rgba(4, 4, 20, 0.85);
}

.wf-tornado-window {
  position: absolute;
  inset: 7%;
  overflow: hidden;
  border-radius: 3px;
  display: grid;
  place-items: center;
}

.wf-tornado-window img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  border-radius: 3px;
  display: block;
}

.wf-hero-center {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 12;
  width: min(88vw, 1020px);
  text-align: center;
  pointer-events: none;
  transform: translate3d(-50%, -50%, 0);
  will-change: transform, opacity;
}

.wf-hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.21rem, 5.27vw, 5.44rem);
  font-weight: 500;
  line-height: 1.0;
  letter-spacing: -0.035em;
  color: #ffffff;
  margin: 0;
  text-shadow: 0 12px 48px rgba(6, 6, 24, 0.85);
}

.wf-scroll-cue {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(11, 11, 40, 0.6);
  backdrop-filter: blur(10px);
  transition: color 0.25s ease, border-color 0.25s ease, opacity 0.35s ease, transform 0.25s ease;
}

.wf-scroll-cue:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.38);
  transform: translateX(-50%) translateY(2px);
}

.wf-scroll-cue svg {
  width: 14px;
  height: 14px;
  animation: wf-bounce-down 2.2s ease-in-out infinite;
}

@keyframes wf-bounce-down {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(3px); }
}

/* ==========================================================================
   2. FEATURED CASE STUDIES — STAGGERED 2-COLUMN EDITORIAL GRID
   ========================================================================== */

.wf-feature {
  position: relative;
  padding: clamp(3rem, 6vw, 6.5rem) var(--gutter) clamp(5rem, 9vw, 9rem);
}

.wf-container {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
}

.wf-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.5rem, 2.5vw, 2.5rem);
  align-items: start;
}

.wf-feature-col {
  display: flex;
  flex-direction: column;
  gap: clamp(3.5rem, 6.5vw, 6.5rem);
}

/* Right column vertical stagger (96px / 6rem at desktop, matching weflash) */
.wf-feature-col.is-right {
  margin-top: clamp(4rem, 7vw, 6.5rem);
}

/* Individual Case Study Item */
.wf-item {
  --glow: #3224df;
  --float: 0;
  --float-dur: 7s;
  --float-delay: 0s;
  opacity: 0;
  transform: translateY(36px);
  transition: opacity 0.85s var(--wf-ease-out), transform 0.85s var(--wf-ease-out);
}

/* Docked hero-target items must stay at exact layout coordinates (no Y reveal offset) */
.wf-item[data-wf-dock-ready],
.wf-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.wf-card {
  display: block;
  text-decoration: none;
  color: inherit;
  position: relative;
  outline: none;
}

.wf-card:focus-visible .wf-screen {
  outline: 2px solid var(--wf-accent-bright);
  outline-offset: 6px;
}

/* --- Continuous Idle Floating Stage (signature weflash animation) --- */
.wf-stage {
  display: block;
  position: relative;
  will-change: translate, rotate;
  animation: wf-feature-float var(--float-dur, 7.6s) ease-in-out var(--float-delay, 0s) infinite alternate;
}

@keyframes wf-feature-float {
  from {
    translate: 0 -0.35rem;
    rotate: -0.35deg;
  }
  to {
    translate: 0 0.35rem;
    rotate: 0.3deg;
  }
}

/* Framed 4:3 Screen Bezel */
.wf-screen {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: linear-gradient(155deg, #19194a 0%, #111134 55%, #0e0e2c 100%);
  border: 1px solid var(--wf-bezel-border);
  border-radius: 6px;
  overflow: visible;
  box-shadow:
    0 24px 60px -24px rgba(4, 4, 20, 0.85),
    0 0 0 0 color-mix(in srgb, var(--glow) 0%, transparent);
  transition:
    box-shadow 0.65s var(--wf-ease-out),
    border-color 0.45s ease,
    transform 0.65s var(--wf-ease-out);
}

/* Ambient Colored Glow on Hover (exact weflash signature: 0 0 240px -20px) */
.wf-card:hover .wf-screen,
.wf-card:focus-visible .wf-screen {
  border-color: color-mix(in srgb, var(--glow) 45%, rgba(255, 255, 255, 0.18));
  box-shadow:
    0 28px 64px -24px rgba(4, 4, 20, 0.85),
    0 0 220px -20px color-mix(in srgb, var(--glow) 72%, transparent);
}

/* Inner inset 7% viewport inside the dark bezel */
.wf-screen-window {
  position: absolute;
  inset: 7%;
  overflow: hidden;
  border-radius: 3px;
  display: grid;
  place-items: center;
}

.wf-poster,
.wf-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  border-radius: 3px;
  display: block;
  transition: transform 0.75s var(--wf-ease-out), opacity 0.55s ease;
  will-change: transform;
}

.wf-poster--top {
  object-fit: cover;
  object-position: top center;
}

.wf-video {
  opacity: 0;
  pointer-events: none;
}

.wf-screen.is-playing .wf-video,
.wf-card:hover .wf-video {
  opacity: 1;
}

/* Poster/Media Zoom on Hover (scale: 1.04) */
.wf-card:hover .wf-poster,
.wf-card:focus-visible .wf-poster,
.wf-card:hover .wf-video,
.wf-card:focus-visible .wf-video {
  transform: scale(1.045);
}

/* Corner Ribbon (e.g., Before & After / Featured) */
.wf-ribbon {
  position: absolute;
  top: 0;
  right: 1rem;
  z-index: 4;
  background: #ffffff;
  color: #0b0b28;
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  padding: 0.48rem 0.62rem 0.55rem;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(-105%);
  transition: transform 0.6s var(--wf-ease-out) 0.12s, opacity 0.25s ease 0.12s;
  pointer-events: none;
}

.wf-card:hover .wf-ribbon,
.wf-card:focus-visible .wf-ribbon {
  opacity: 1;
  transform: translateY(0);
}

/* Floating Award / Highlight Seals at top-right of stage */
.wf-seals {
  position: absolute;
  top: -0.95rem;
  right: 1rem;
  z-index: 6;
  display: flex;
  gap: 0.4rem;
  pointer-events: none;
}

.wf-seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.35rem;
  height: 2.35rem;
  padding: 0 0.55rem;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0b0b28;
  background: var(--seal-bg, #ffffff);
  box-shadow: 0 10px 24px rgba(4, 4, 20, 0.55);
  opacity: 0;
  transform: translateY(14px) scale(0.72) rotate(-8deg);
  transition:
    transform 0.45s var(--wf-ease-out) calc((2 - var(--k, 0)) * 40ms),
    opacity 0.35s ease calc((2 - var(--k, 0)) * 40ms);
}

.wf-card:hover .wf-seal,
.wf-card:focus-visible .wf-seal {
  opacity: 1;
  transform: none;
  transition:
    transform 0.8s var(--wf-ease-out) calc(var(--k, 0) * 90ms),
    opacity 0.5s ease calc(var(--k, 0) * 90ms);
}

/* Mobile / Touch circular white action button */
.wf-go {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  z-index: 5;
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 50%;
  background: #ffffff;
  color: #0b0b28;
  display: none;
  place-items: center;
  font-size: 1.05rem;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.38);
  transition: transform 0.3s var(--wf-ease-out);
}

/* Card Typography & Metadata */
.wf-name {
  display: block;
  margin-top: 1.25rem;
  font-family: var(--font-display);
  font-size: clamp(1.23rem, 1.74vw, 1.66rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: #ffffff;
  transition: color 0.25s ease;
}

.wf-card:hover .wf-name {
  color: #ffffff;
}

.wf-teaser {
  display: block;
  margin-top: 0.65rem;
  max-width: 92%;
  font-size: clamp(0.92rem, 1.05vw, 1.02rem);
  line-height: 1.55;
  color: var(--wf-ink-muted);
}

/* Staggered Tag Pills (sequential inversion on hover) */
.wf-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1.1rem;
}

.wf-tag {
  display: inline-flex;
  align-items: center;
  height: 1.7rem;
  padding: 0 0.65rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 3px;
  transition:
    color 0.2s ease calc(var(--k, 0) * 70ms),
    background-color 0.2s ease calc(var(--k, 0) * 70ms),
    border-color 0.2s ease calc(var(--k, 0) * 70ms);
}

.wf-card:hover .wf-tag,
.wf-card:focus-visible .wf-tag {
  color: #0b0b28;
  background-color: #ffffff;
  border-color: #ffffff;
}

/* ==========================================================================
   3. EDITORIAL TRUST TILES (interspersed in the 2-column grid)
   ========================================================================== */

.wf-tile {
  position: relative;
  padding: clamp(2rem, 3.2vw, 3rem);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.035) 0%, rgba(50, 36, 223, 0.07) 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: clamp(220px, 22vw, 300px);
  overflow: hidden;
  transition: border-color 0.4s ease, transform 0.65s var(--wf-ease-out);
}

.wf-tile:hover {
  border-color: rgba(111, 100, 255, 0.45);
}

.wf-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.wf-tile-kicker {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #dcd8ff;
}

.wf-tile-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(50, 36, 223, 0.2);
  color: #dcd8ff;
  flex-shrink: 0;
}

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

.wf-tile-icon.is-spin svg {
  animation: wf-spin-slow 16s linear infinite;
}

@keyframes wf-spin-slow {
  to { transform: rotate(360deg); }
}

.wf-tile-metric {
  margin-top: 1.5rem;
  font-family: var(--font-display);
  font-size: clamp(2.12rem, 3.57vw, 3.4rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
  color: #ffffff;
}

.wf-tile-copy {
  margin: 0.85rem 0 0;
  font-size: 0.96rem;
  line-height: 1.55;
  color: var(--wf-ink-muted);
  max-width: 38ch;
}

/* ==========================================================================
   4. CUSTOM MARKER-STROKE CURSOR (data-cursor="View Case")
   ========================================================================== */

.wf-cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(-120px, -120px, 0) scale(0.65);
  transition: opacity 0.22s ease, transform 0.28s var(--wf-ease-out);
  will-change: transform, opacity;
}

.wf-cursor.is-active {
  opacity: 1;
}

.wf-cursor-inner {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 1.2rem;
  transform: translate(-50%, -50%);
}

.wf-cursor-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 10px 24px rgba(4, 4, 20, 0.45));
}

.wf-cursor-path {
  fill: none;
  stroke: #ffffff;
  stroke-width: 34;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 420;
  stroke-dashoffset: 420;
  transition: stroke-dashoffset 0.45s var(--wf-ease-out);
}

.wf-cursor.is-active .wf-cursor-path {
  stroke-dashoffset: 0;
}

.wf-cursor-label {
  position: relative;
  z-index: 2;
  font-family: var(--font-display);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #0b0b28;
  white-space: nowrap;
}

/* Hide default cursor on cards when custom marker cursor is active */
@media (hover: hover) and (pointer: fine) {
  body.wl-work-page.has-custom-cursor .wf-card,
  body.wl-home.has-custom-cursor .wf-card {
    cursor: none;
  }
}

/* ==========================================================================
   5.5. LIGHT THEME VARIANT (Home Page Selected Work — 2-Column Staggered)
   ========================================================================== */

.wf-feature--light {
  padding: 0;
}

.wf-feature--light .wf-feature-grid {
  gap: clamp(1.5rem, 2.6vw, 2.75rem);
}

.wf-feature--light .wf-feature-col {
  gap: clamp(3rem, 5.5vw, 5.25rem);
}

.wf-feature--light .wf-feature-col.is-right {
  margin-top: clamp(3.5rem, 6vw, 5.5rem);
}

.wf-feature--light .wf-screen {
  background: #ffffff;
  border: 1px solid rgba(11, 11, 40, 0.09);
  border-radius: 14px;
  box-shadow:
    0 18px 46px -22px rgba(11, 11, 40, 0.14),
    0 0 0 0 color-mix(in srgb, var(--glow) 0%, transparent);
}

.wf-feature--light .wf-card:hover .wf-screen,
.wf-feature--light .wf-card:focus-visible .wf-screen {
  border-color: color-mix(in srgb, var(--glow) 52%, rgba(11, 11, 40, 0.14));
  box-shadow:
    0 24px 56px -22px rgba(11, 11, 40, 0.18),
    0 0 130px -24px color-mix(in srgb, var(--glow) 46%, transparent);
}

.wf-feature--light .wf-screen-window {
  inset: 6%;
  border-radius: 6px;
}

.wf-feature--light .wf-poster,
.wf-feature--light .wf-video {
  border-radius: 6px;
}

.wf-feature--light .wf-ribbon {
  background: var(--ink);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(11, 11, 40, 0.22);
}

.wf-feature--light .wf-seal {
  border: 1px solid rgba(11, 11, 40, 0.07);
  box-shadow: 0 10px 22px rgba(11, 11, 40, 0.16);
}

.wf-feature--light .wf-go {
  background: var(--ink);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(11, 11, 40, 0.2);
}

.wf-feature--light .wf-name {
  color: var(--ink);
}

.wf-feature--light .wf-card:hover .wf-name,
.wf-feature--light .wf-card:focus-visible .wf-name {
  color: var(--accent);
}

.wf-feature--light .wf-teaser {
  color: var(--ink-muted);
}

.wf-feature--light .wf-tag {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(11, 11, 40, 0.14);
}

.wf-feature--light .wf-card:hover .wf-tag,
.wf-feature--light .wf-card:focus-visible .wf-tag {
  color: #ffffff;
  background-color: var(--ink);
  border-color: var(--ink);
}

.wf-cursor--light .wf-cursor-svg {
  filter: drop-shadow(0 10px 22px rgba(11, 11, 40, 0.24));
}

.wf-cursor--light .wf-cursor-path {
  stroke: #0b0b28;
}

.wf-cursor--light .wf-cursor-label {
  color: #ffffff;
}

.wl-home #work .wl-center-action {
  margin-top: clamp(44px, 5vw, 72px);
}

@media (max-width: 991px) {
  .wf-feature--light .wf-feature-col.is-right {
    margin-top: 0;
  }
}

/* ==========================================================================
   6. RESPONSIVE & ACCESSIBILITY
   ========================================================================== */

@media (max-width: 991px) {
  .wf-feature-grid {
    grid-template-columns: 1fr;
    gap: 3.5rem;
  }

  .wf-feature-col.is-right {
    margin-top: 0;
  }

  .wf-go {
    display: grid;
  }

  .wf-tornado-list {
    transform: none !important;
  }
}

@media (hover: none), (pointer: coarse) {
  .wf-cursor {
    display: none !important;
  }
  .wf-go {
    display: grid;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wf-stage,
  .wf-depth-grain,
  .wf-tile-icon.is-spin svg,
  .wf-scroll-cue svg {
    animation: none !important;
  }
  .wf-item {
    opacity: 1;
    transform: none;
  }
  .wf-cursor {
    display: none !important;
  }
}
