/* ==========================================================================
   KartCenter Hildesheim – Shared site styles
   Animations, mobile nav, page transitions, motion polish.
   ========================================================================== */

/* Base tokens --------------------------------------------------------------- */
:root {
  --kc-red: #E30613;
  --kc-red-soft: #ffb4aa;
  --kc-bg: #131313;
  --kc-surface: #1c1b1b;
  --kc-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* Respect reduced-motion users */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Material Symbols default */
.material-symbols-outlined { font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
.italic-lean { font-style: italic; transform: skewX(-5deg); display: inline-block; }
.glass-effect { background: rgba(53,53,52,0.4); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }

/* ==========================================================================
   Page transitions (fade-in on load, fade-out on navigate)
   Uses a CSS animation so content appears even if JS fails to load.
   ========================================================================== */
@keyframes kc-page-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
body {
  animation: kc-page-in 460ms var(--kc-ease) both;
}
body.kc-leaving {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 240ms var(--kc-ease), transform 240ms var(--kc-ease);
  animation: none;
}
@media (prefers-reduced-motion: reduce) {
  body { animation: none; }
  body.kc-leaving { transition: none; }
}

/* ==========================================================================
   Scroll-reveal
   ========================================================================== */
.kc-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 700ms var(--kc-ease), transform 700ms var(--kc-ease);
  will-change: opacity, transform;
}
.kc-reveal.kc-in {
  opacity: 1;
  transform: translateY(0);
}
/* staggered children inside a reveal container */
.kc-reveal[data-stagger] > * {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 600ms var(--kc-ease), transform 600ms var(--kc-ease);
}
.kc-reveal[data-stagger].kc-in > * { opacity: 1; transform: translateY(0); }
.kc-reveal[data-stagger].kc-in > *:nth-child(1) { transition-delay: 40ms; }
.kc-reveal[data-stagger].kc-in > *:nth-child(2) { transition-delay: 110ms; }
.kc-reveal[data-stagger].kc-in > *:nth-child(3) { transition-delay: 180ms; }
.kc-reveal[data-stagger].kc-in > *:nth-child(4) { transition-delay: 250ms; }
.kc-reveal[data-stagger].kc-in > *:nth-child(5) { transition-delay: 320ms; }
.kc-reveal[data-stagger].kc-in > *:nth-child(6) { transition-delay: 390ms; }
.kc-reveal[data-stagger].kc-in > *:nth-child(7) { transition-delay: 460ms; }
.kc-reveal[data-stagger].kc-in > *:nth-child(8) { transition-delay: 530ms; }

/* ==========================================================================
   Header behaviour (shrink on scroll, active link underline handled in JS)
   ========================================================================== */
header.kc-scrolled {
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
  background: rgba(19,19,19,0.92);
  box-shadow: 0 4px 30px rgba(0,0,0,0.5);
  transition: padding 250ms var(--kc-ease), background 250ms var(--kc-ease), box-shadow 250ms var(--kc-ease);
}
header { transition: padding 250ms var(--kc-ease), background 250ms var(--kc-ease), box-shadow 250ms var(--kc-ease); }

/* ==========================================================================
   Mobile nav (injected by site.js)
   ========================================================================== */
.kc-burger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  cursor: pointer;
  transition: background 200ms var(--kc-ease), border-color 200ms var(--kc-ease);
}
.kc-burger:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.25); }
.kc-burger .material-symbols-outlined { font-size: 24px; }
@media (min-width: 768px) { .kc-burger { display: none; } }

.kc-mobile-nav {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(13,13,13,0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  padding: 90px 2rem 2rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 280ms var(--kc-ease), transform 280ms var(--kc-ease);
}
.kc-mobile-nav.kc-open { opacity: 1; pointer-events: auto; transform: translateY(0); }
.kc-mobile-nav a {
  font-family: 'Space Grotesk', sans-serif;
  font-style: italic;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  font-size: 1.75rem;
  color: rgba(255,255,255,0.85);
  padding: 0.9rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  transition: color 180ms var(--kc-ease), padding-left 180ms var(--kc-ease);
}
.kc-mobile-nav a:hover, .kc-mobile-nav a:focus { color: #fff; padding-left: 0.5rem; }
.kc-mobile-nav a.kc-active { color: var(--kc-red); border-color: rgba(227,6,19,0.3); }
.kc-mobile-nav .kc-mobile-cta {
  margin-top: 2rem;
  display: inline-flex;
  align-self: flex-start;
  background: var(--kc-red);
  color: #fff !important;
  padding: 0.9rem 1.5rem;
  border-radius: 4px;
  border: none;
  font-size: 1rem;
}
.kc-mobile-nav .kc-mobile-cta:hover { padding-left: 1.5rem; }
.kc-mobile-nav .kc-mobile-meta {
  margin-top: auto;
  padding-top: 2rem;
  color: rgba(255,255,255,0.4);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  border: none;
}
body.kc-nav-open { overflow: hidden; }

/* ==========================================================================
   Small polish
   ========================================================================== */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--kc-red-soft);
  outline-offset: 3px;
  border-radius: 2px;
}

img { color: transparent; } /* hide alt text flash while loading */

/* Marquee-safe ticker (replaces pulse) */
@keyframes kc-marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.kc-marquee-track {
  display: flex;
  width: max-content;
  animation: kc-marquee 40s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .kc-marquee-track { animation: none; }
}

/* ==========================================================================
   Kart Exploded-View Scroll Animation
   ========================================================================== */
.kc-explode-wrap {
  position: relative;
  width: 100%;
  /* height is set by JS based on frame count */
  background: #ffffff;
}

.kc-explode-sticky {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kc-explode-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Vignette – white edges to soften kart + hide watermark bottom-right */
.kc-explode-mask {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    radial-gradient(ellipse at 50% 50%, transparent 35%, rgba(255,255,255,0.35) 60%, rgba(255,255,255,0.85) 100%),
    radial-gradient(ellipse at 90% 90%, rgba(255,255,255,1) 0%, rgba(255,255,255,0.8) 12%, transparent 35%);
}

/* Top fade – blends into dark section above */
.kc-explode-fade-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 160px;
  z-index: 3;
  background: linear-gradient(to bottom, var(--kc-bg), rgba(19,19,19,0.4) 40%, transparent);
  pointer-events: none;
}

/* Bottom fade – blends into dark section below */
.kc-explode-fade-bottom {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 160px;
  z-index: 3;
  background: linear-gradient(to top, var(--kc-bg), rgba(19,19,19,0.4) 40%, transparent);
  pointer-events: none;
}

/* Title overlay (bottom-left) */
.kc-explode-overlay {
  position: absolute;
  bottom: 100px;
  left: 40px;
  z-index: 5;
  pointer-events: none;
  transition: opacity 150ms ease-out;
}
@media (min-width: 768px) { .kc-explode-overlay { left: 60px; bottom: 120px; } }
.kc-explode-overlay-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(0,0,0,0.35);
  margin-bottom: 8px;
}
.kc-explode-overlay-heading {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-style: italic;
  font-size: 2.5rem;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: #131313;
  text-transform: uppercase;
}
@media (min-width: 768px) { .kc-explode-overlay-heading { font-size: 3.5rem; } }
.kc-explode-overlay-accent { color: var(--kc-red); }

/* Scroll hint (bottom-center) */
.kc-explode-scroll-hint {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  transition: opacity 150ms ease-out;
}
.kc-explode-scroll-hint span {
  font-family: 'Inter', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(0,0,0,0.25);
}
.kc-explode-hint-line {
  width: 1px;
  height: 28px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.2), transparent);
  animation: kc-hint-pulse 1.8s ease-in-out infinite;
}
@keyframes kc-hint-pulse {
  0%, 100% { opacity: 0.3; transform: scaleY(0.7); }
  50% { opacity: 1; transform: scaleY(1); }
}

/* Progress bar (dark themed for white bg) */
.kc-explode-progress {
  position: absolute;
  bottom: 40px;
  right: 40px;
  width: 120px;
  height: 2px;
  background: rgba(0,0,0,0.08);
  border-radius: 1px;
  z-index: 4;
  overflow: hidden;
}
@media (min-width: 768px) { .kc-explode-progress { right: 60px; } }
.kc-explode-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--kc-red);
  border-radius: 1px;
  transition: width 60ms linear;
}

/* Loader (white bg context) */
.kc-explode-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  background: #ffffff;
  transition: opacity 600ms var(--kc-ease);
}
.kc-explode-loader.kc-loaded {
  opacity: 0;
  pointer-events: none;
}
.kc-explode-loader-ring {
  width: 40px;
  height: 40px;
  border: 2px solid rgba(0,0,0,0.06);
  border-top-color: var(--kc-red);
  border-radius: 50%;
  animation: kc-spin 800ms linear infinite;
}
@keyframes kc-spin {
  to { transform: rotate(360deg); }
}
.kc-explode-loader-text {
  margin-top: 14px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(0,0,0,0.3);
}
