/* ==========================================================================
   CITTASANA DESIGN SYSTEM
   Anti-slop primitives: motion, materiality, texture, rhythm.
   ========================================================================== */

:root {
  --bg: #0d0d12;
  --bg-warm: #0f0e14;
  --surface: #111117;
  --surface-low: #16161e;
  --surface-mid: #1d1d26;
  --surface-high: #24242f;
  --on-surface: #e8e6f0;
  --on-surface-dim: rgba(232, 230, 240, 0.78);
  --on-surface-faint: rgba(232, 230, 240, 0.56);
  --primary: #f59e0b;
  --primary-dim: #d97706;
  --primary-sub: rgba(245, 158, 11, 0.08);
  --primary-border: rgba(245, 158, 11, 0.2);
  --outline: rgba(255, 255, 255, 0.07);
  --outline-med: rgba(255, 255, 255, 0.12);
  --spring: cubic-bezier(0.16, 1, 0.3, 1);
  --spring-overshoot: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --------- TEXTURE LAYER: grain overlay (fixed, pointer-events-none) --------
   No mix-blend-mode — that forces a compositor layer below and blurs text
   subpixel rendering. Low opacity noise on top reads identically and keeps
   text crisp. */
.grain-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence baseFrequency='0.9' stitchTiles='stitch' numOctaves='2'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/></svg>");
}

/* --------- GLASS REFRACTION: replaces flat backdrop-blur ----------- */
.glass-refract {
  background: rgba(13, 13, 18, 0.82);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25),
    0 20px 60px -20px rgba(0, 0, 0, 0.6);
}

.glass-nav-scrolled {
  background: rgba(13, 13, 18, 0.95);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

/* --------- GRID BACKGROUND (subtle amber) ----------------------------- */
.grid-bg {
  background-image:
    linear-gradient(rgba(245, 158, 11, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245, 158, 11, 0.028) 1px, transparent 1px);
  background-size: 88px 88px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 30%, #000 40%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 30%, #000 40%, transparent 85%);
}

/* --------- KEYFRAMES --------------------------------------------------- */
@keyframes breathe {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.15); }
}
@keyframes float-slow {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50%      { transform: translate3d(0, -12px, 0); }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes marquee-x {
  0%   { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}
@keyframes marquee-x-reverse {
  0%   { transform: translate3d(-50%, 0, 0); }
  100% { transform: translate3d(0, 0, 0); }
}
@keyframes blink-caret {
  0%, 49%   { opacity: 1; }
  50%, 100% { opacity: 0; }
}
@keyframes reveal-up {
  from { opacity: 0; transform: translate3d(0, 24px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.28); }
  50%      { box-shadow: 0 0 0 14px rgba(245, 158, 11, 0); }
}
@keyframes drift-x {
  0%, 100% { transform: translate3d(-10%, 0, 0); }
  50%      { transform: translate3d(10%, 0, 0); }
}

/* --------- MOTION UTILITIES ------------------------------------------- */
.breathe       { animation: breathe 2.6s ease-in-out infinite; }
.float-slow    { animation: float-slow 7s ease-in-out infinite; }
.glow-pulse    { animation: glow-pulse 2.4s ease-out infinite; }
.drift-x       { animation: drift-x 14s ease-in-out infinite; }

.shimmer-text {
  background: linear-gradient(90deg, var(--on-surface-faint) 0%, var(--on-surface) 45%, var(--primary) 55%, var(--on-surface-faint) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 3.6s linear infinite;
}

/* Infinite horizontal marquee – use with two identical children inside */
.marquee {
  display: flex;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee__track {
  display: flex;
  flex-shrink: 0;
  min-width: 100%;
  gap: 4rem;
  animation: marquee-x 42s linear infinite;
}
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee--reverse .marquee__track { animation-name: marquee-x-reverse; }

/* --------- SCROLL REVEAL ----------------------------------------------
   After the element is in view, we drop the transform AND will-change
   entirely. Leaving either active keeps the element on a dedicated
   compositor layer — text on those layers is rasterized as a texture
   instead of rendered with subpixel AA, which looks visibly blurry. */
.reveal {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition: opacity 0.9s var(--spring), transform 0.9s var(--spring);
  will-change: opacity, transform;
}
.reveal.is-in {
  opacity: 1;
  transform: none;
  will-change: auto;
}
.reveal[data-delay="1"] { transition-delay: 80ms; }
.reveal[data-delay="2"] { transition-delay: 160ms; }
.reveal[data-delay="3"] { transition-delay: 240ms; }
.reveal[data-delay="4"] { transition-delay: 320ms; }
.reveal[data-delay="5"] { transition-delay: 400ms; }

/* --------- TILT CARD --------------------------------------------------
   No will-change on idle state — only promote to its own layer when the
   user is actively hovering (set inline by motion.js on mousemove). */
.tilt {
  transition: transform 0.6s var(--spring);
}
.tilt__inner {
  transition: transform 0.6s var(--spring);
}

/* --------- BUTTONS ---------------------------------------------------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 9999px;
  isolation: isolate;
  transition: transform 0.25s var(--spring), background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.btn:active { transform: translate3d(0, 1px, 0) scale(0.985); }

.btn--primary {
  background: var(--primary);
  color: #0a0a0f;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.btn--primary::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: radial-gradient(60% 60% at 50% 50%, rgba(245, 158, 11, 0.35), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}
.btn--primary:hover::before { opacity: 1; }
.btn--primary:hover { background: #ffb431; }

.btn--ghost {
  border: 1px solid var(--outline-med);
  color: var(--on-surface-dim);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
}
.btn--ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-sub);
}

/* Arrow animation inside buttons */
.btn .arrow {
  display: inline-block;
  transition: transform 0.3s var(--spring);
}
.btn:hover .arrow { transform: translate3d(4px, 0, 0); }

/* --------- LIVE DOT (breathing status) -------------------------------- */
.live-dot {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: var(--primary);
}
.live-dot::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  background: var(--primary);
  opacity: 0.35;
  animation: breathe 2.4s ease-in-out infinite;
  z-index: -1;
}

/* --------- TYPEWRITER -------------------------------------------------
   No white-space:nowrap — on mobile, long phrases like
   "Welche Verträge laufen dieses Quartal aus?" forced the parent card
   wider than the viewport and caused horizontal overflow. Let the text
   wrap naturally; the blinking caret stays at the end of the last line. */
.typewriter {
  border-right: 2px solid var(--primary);
  animation: blink-caret 0.9s steps(2) infinite;
}

/* --------- SECTION LABEL ---------------------------------------------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  font-weight: 700;
}
.eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: currentColor;
}

/* --------- TYPOGRAPHY -------------------------------------------------
   On dark backgrounds with -webkit-font-smoothing: antialiased, weight 300
   looks ghostly — letterforms vanish. Weight 400 keeps the refined serif
   feel without disappearing. Letter-spacing tightened slightly so the
   heavier weight still reads "display". */
.display {
  font-family: "Newsreader", serif;
  font-weight: 400;
  line-height: 0.94;
  letter-spacing: -0.025em;
  color: #f3f1fb;
  /* German compound words like "KI-Automatisierung" overflow narrow
     viewports at display sizes. Let the browser hyphenate (requires
     <html lang="de">) and break as a last resort. */
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow-wrap: break-word;
}
.display-italic {
  font-family: "Newsreader", serif;
  font-style: italic;
  font-weight: 400;
}

/* Ensure headlines don't wrap awkwardly on ultra-wide */
.display, .display-italic { text-wrap: balance; }

/* --------- NO-SCROLLBAR utility for horizontal rails ------------------ */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* --------- REDUCED MOTION --------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
