/* Shared interaction/motion toolkit for the example sites under /beispiele.
   Include once per page:
     <link rel="stylesheet" href="/beispiele/_shared/interactions.css">
     <script src="/beispiele/_shared/interactions.js" defer></script>

   Everything here is opt-in via data-attributes so each example keeps its
   own palette/typography; this file only supplies the mechanics. Colors that
   need to adapt to a site's theme are exposed as custom properties with
   sane defaults (override on :root or a container). */

:root {
  --ia-ripple-color: rgba(255, 255, 255, 0.45);
  --ia-spotlight-color: rgba(255, 255, 255, 0.16);
  --ia-nav-bg: #ffffff;
  --ia-nav-fg: #14151a;
  --ia-nav-backdrop: rgba(10, 10, 12, 0.45);
}

/* Ambient glow orbs (.ia-glow) and other decorative blurred shapes are
   deliberately positioned so they bleed past their section's edges and fade
   out naturally. Sections used to clip that bleed with overflow:hidden,
   which cut the soft blur off in a hard, visible rectangle instead of
   letting it blend. Clipping now happens here instead, far enough out that
   these shapes always fully fade before reaching it. */
html,
body {
  overflow-x: hidden;
}

/* --- Scroll reveal (same convention as the main Zverd site) ------------- */
[data-reveal] {
  opacity: 0;
  translate: 0 28px;
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), translate 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
[data-reveal].reveal-left { translate: -32px 0; }
[data-reveal].reveal-right { translate: 32px 0; }
[data-reveal].is-visible { opacity: 1; translate: 0 0; }

/* --- Hero word-by-word entrance ----------------------------------------- */
[data-split-reveal] .word-rise {
  display: inline-block;
  opacity: 0;
  transform: translateY(22px);
  animation: ia-word-rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes ia-word-rise {
  to { opacity: 1; transform: translateY(0); }
}

/* --- Text scramble ------------------------------------------------------- */
[data-scramble] { display: inline-block; }

/* --- Magnetic elements --------------------------------------------------- */
[data-magnetic] { display: inline-block; transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1); }

/* --- 3D tilt cards -------------------------------------------------------- */
[data-tilt] { transition: transform 0.15s ease-out; transform-style: preserve-3d; will-change: transform; }

/* --- Cursor spotlight ----------------------------------------------------- */
[data-spotlight] { position: relative; overflow: hidden; }
[data-spotlight]::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  /* "circle closest-side" always fades fully to transparent by the nearest
     edge, regardless of the element's aspect ratio. The previous default
     sizing (farthest-corner) only fully faded along the longer axis of wide,
     short sections, leaving a visible hard-edged rectangle along the short
     axis instead of blending in. */
  background: radial-gradient(circle closest-side at var(--ia-spot-x, 50%) var(--ia-spot-y, 50%), var(--ia-spotlight-color), transparent);
}
[data-spotlight]:hover::before,
[data-spotlight].is-spotlit::before { opacity: 1; }

/* --- Parallax layers ------------------------------------------------------ */
[data-parallax-group] { position: relative; }
[data-parallax] { will-change: transform; }

/* --- Ripple click feedback ------------------------------------------------ */
[data-ripple] { position: relative; overflow: hidden; }
.ia-ripple-piece {
  position: absolute;
  border-radius: 50%;
  background: var(--ia-ripple-color);
  transform: scale(0);
  pointer-events: none;
  animation: ia-ripple-expand 0.6s ease-out;
}
@keyframes ia-ripple-expand {
  to { transform: scale(1); opacity: 0; }
}

/* --- Accordion ------------------------------------------------------------ */
[data-accordion-panel] {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
[data-accordion-panel] > div { overflow: hidden; }
[data-accordion-panel].is-open { grid-template-rows: 1fr; }
[data-accordion-trigger] .ia-acc-icon { transition: transform 0.3s ease; }
[data-accordion-trigger][aria-expanded="true"] .ia-acc-icon { transform: rotate(180deg); }

/* --- Sticky header shrink-on-scroll ---------------------------------------- */
[data-shrink-header] { transition: padding 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease; }
[data-shrink-header].is-scrolled { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); }

/* --- Mobile nav drawer ------------------------------------------------------ */
[data-nav-toggle] {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  z-index: 60;
}
[data-nav-toggle] span {
  display: block;
  width: 100%;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}
[data-nav-toggle][aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
[data-nav-toggle][aria-expanded="true"] span:nth-child(2) { opacity: 0; }
[data-nav-toggle][aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.ia-nav-backdrop {
  position: fixed;
  inset: 0;
  background: var(--ia-nav-backdrop);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 55;
}
.ia-nav-backdrop.is-visible { opacity: 1; pointer-events: auto; }

@media (max-width: 900px) {
  [data-nav-toggle] { display: flex; }
  [data-nav-panel] {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 82vw);
    height: 100dvh;
    background: var(--ia-nav-bg);
    color: var(--ia-nav-fg);
    display: flex !important;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 22px;
    padding: 100px 40px 60px;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 56;
    overflow-y: auto;
  }
  [data-nav-panel].is-open { transform: translateX(0); }
  [data-nav-panel] a,
  [data-nav-panel] .lang-switch,
  [data-nav-panel] .nav-cta { font-size: 1.05rem; }
}

/* --- Ambient glow orbs (the soft blurred color-bloom behind hero/CTA
   sections on the main Zverd site) --------------------------------------- */
.ia-glow {
  pointer-events: none;
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  background: var(--ia-glow-color, rgba(14, 124, 107, 0.18));
  z-index: 0;
}

/* --- Floating overlap card (a card that breaks out of its section via
   negative margin and sits above the fold boundary with a strong shadow —
   the main site's stats-band-over-the-hero move) ------------------------- */
.ia-float-card {
  position: relative;
  z-index: 5;
  border-radius: 22px;
  box-shadow: 0 30px 60px -15px var(--ia-shadow-color, rgba(0, 0, 0, 0.28));
}

/* --- Bento tiles (icon chip that inverts to solid on hover, lift + border
   + shadow — the main site's Leistungen grid) ---------------------------- */
.ia-bento-tile {
  position: relative;
  z-index: 1;
  border-radius: 20px;
  border: 1px solid var(--ia-border-color, rgba(0, 0, 0, 0.08));
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}
.ia-bento-tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px -12px var(--ia-shadow-color, rgba(0, 0, 0, 0.2));
  border-color: var(--ia-accent-color, currentColor);
}
.ia-bento-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--ia-icon-bg, rgba(0, 0, 0, 0.06));
  color: var(--ia-accent-color, currentColor);
  transition: background-color 0.3s ease, color 0.3s ease;
}
.ia-bento-tile:hover .ia-bento-icon {
  background: var(--ia-accent-color, currentColor);
  color: var(--ia-icon-invert, #fff);
}

/* --- Scroll-grown line (a vertical line that fills in as you scroll past
   its section — the main site's numbered-steps scroll-story) ------------- */
[data-grow-section] { position: relative; }
[data-grow-line] { transform-origin: top; transform: scaleY(0); }

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { transition: none; opacity: 1; translate: 0 0; }
  [data-split-reveal] .word-rise { animation: none; opacity: 1; transform: none; }
  [data-tilt] { transition: none; }
  [data-tilt].ia-tilt-active { transform: none !important; }
  [data-parallax] { transform: none !important; }
  [data-magnetic] { transition: none; }
  [data-magnetic].ia-magnet-active { transform: none !important; }
  [data-grow-line] { transform: scaleY(1) !important; }
  .ia-bento-tile { transition: none; }
}
