/* clar.tax · Papierkorn, Scroll-Nebel, Cursor
 * Abgeleitet aus lavern.ai (site/index.html, Zeilen 174–360), Apache-2.0,
 * Copyright (c) 2025-2026 Antti Innanen. Für clar.tax angepasst, siehe NOTICE. */

/* ═══════════════════════════════════════════════════════════════════
   PAPER GRAIN — letterpress stipple on cream, multiply-blended
   ═══════════════════════════════════════════════════════════════════ */
@keyframes grain{
  0%,100%{transform:translate(0,0)}
  10%{transform:translate(-2%,-4%)} 20%{transform:translate(-7%,3%)}
  30%{transform:translate(4%,-10%)} 40%{transform:translate(-3%,10%)}
  50%{transform:translate(-7%,5%)}  60%{transform:translate(7%,0)}
  70%{transform:translate(0,7%)}    80%{transform:translate(2%,-14%)}
  90%{transform:translate(-5%,5%)}
}
body::after{
  content:'';position:fixed;inset:-50%;z-index:9998;pointer-events:none;
  background-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.92' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size:240px 240px;
  opacity:0.06;
  mix-blend-mode:multiply;
  animation:grain 9s steps(10) infinite
}
@media(prefers-reduced-motion:reduce){body::after{animation:none}}

/* Hero mist removed — the only atmospheric fog is now battle-mist at
   the lower part of the viewport. Keep stub so HTML <div> is harmless. */
.hero-mist{display:none}
.hero-mist span{
  position:absolute;border-radius:50%;
  filter:blur(30px);will-change:transform
}
/* 1 — large warm shadow stain, upper left (aged paper edge) — CRANKED */
.hero-mist span:nth-child(1){
  width:75vw;height:75vw;top:-22vw;left:-18vw;
  background:radial-gradient(circle,
    rgba(107,79,58,0.65) 0%,
    rgba(107,79,58,0.36) 22%,
    rgba(107,79,58,0.16) 45%,
    rgba(107,79,58,0.04) 65%,
    rgba(107,79,58,0) 78%);
  mix-blend-mode:multiply;
  animation:mist1 32s ease-in-out infinite alternate
}
/* 2 — bright cream highlight, mid-right (beam of light) — CRANKED */
.hero-mist span:nth-child(2){
  width:60vw;height:60vw;top:6vw;right:-18vw;
  background:radial-gradient(circle,
    rgba(255,255,255,1) 0%,
    rgba(255,255,255,0.7) 22%,
    rgba(255,255,255,0.35) 45%,
    rgba(255,255,255,0.1) 65%,
    rgba(255,255,255,0) 78%);
  mix-blend-mode:screen;
  animation:mist2 42s ease-in-out infinite alternate
}
/* 3 — warm tea stain, lower center (foxing) — CRANKED */
.hero-mist span:nth-child(3){
  width:65vw;height:65vw;bottom:-26vw;left:22vw;
  background:radial-gradient(circle,
    rgba(184,134,11,0.50) 0%,
    rgba(184,134,11,0.26) 22%,
    rgba(184,134,11,0.10) 45%,
    rgba(184,134,11,0.02) 65%,
    rgba(184,134,11,0) 78%);
  mix-blend-mode:multiply;
  animation:mist3 48s ease-in-out infinite alternate
}
@keyframes mist1{
  0%{transform:translate(0,0) scale(1)}
  100%{transform:translate(10vw,6vw) scale(1.14)}
}
@keyframes mist2{
  0%{transform:translate(0,0) scale(1)}
  100%{transform:translate(-8vw,10vw) scale(.9)}
}
@keyframes mist3{
  0%{transform:translate(0,0) scale(1)}
  100%{transform:translate(-12vw,-8vw) scale(1.1)}
}
@media(prefers-reduced-motion:reduce){
  .hero-mist span{animation:none}
}
/* Make sure hero content sits above mist */
.hero > *:not(.hero-mist){position:relative;z-index:1}

/* ═══════════════════════════════════════════════════════════════════
   SCROLL FOG — depth-of-field blur at top & bottom of viewport.
   Subtle backdrop-blur on the outer edges; crisp focus zone in the
   middle. Content scrolls in/out of softness like a real camera DOF.
   (Apple/Linear/Vercel use this. Not battle fog. Subtle.)
   ═══════════════════════════════════════════════════════════════════ */
.scroll-fog{
  position:fixed;left:0;right:0;pointer-events:none;z-index:9997;
  backdrop-filter:blur(4px);
  -webkit-backdrop-filter:blur(4px);
  transition:opacity .55s var(--ease)
}
/* The mist clears when the footer enters the viewport (JS toggles this
   class via IntersectionObserver). Footer links read crisp; the rest
   of the page keeps its soft DOF edge. */
.scroll-fog.cleared{opacity:0}
/* Top scroll-fog removed — the nav already handles the top edge with
   its own backdrop-blur, so duplicating fog up there muddied the air
   without adding any DOF effect. Bottom-only now. */
.scroll-fog.bottom{
  bottom:0;height:14vh;
  mask-image:linear-gradient(to top,
    #000 0%,
    rgba(0,0,0,0.85) 35%,
    rgba(0,0,0,0.45) 65%,
    transparent 100%);
  -webkit-mask-image:linear-gradient(to top,
    #000 0%,
    rgba(0,0,0,0.85) 35%,
    rgba(0,0,0,0.45) 65%,
    transparent 100%);
  background:linear-gradient(to top,
    rgba(250,250,250,0.30) 0%,
    rgba(250,250,250,0.08) 60%,
    transparent 100%)
}
/* Safari/older fallback — without backdrop-filter, the gentle bg tint
   alone still softens the edges visually. */
@supports not (backdrop-filter:blur(1px)){
  .scroll-fog.top{background:linear-gradient(to bottom,
    rgba(250,250,250,0.85) 0%,
    rgba(250,250,250,0.35) 60%,
    transparent 100%)}
  .scroll-fog.bottom{background:linear-gradient(to top,
    rgba(250,250,250,0.85) 0%,
    rgba(250,250,250,0.35) 60%,
    transparent 100%)}
}
/* Mobile: keep the smog blur, fix the seam. The eye picks up the top
   edge of the fog as a horizontal line whenever the alpha change per
   vertical pixel rises above ~1%. The fix is purely geometric:
   1. Stretch the fog to 45vh so the same fade is distributed over a
      much longer distance — each pixel-row's alpha-delta drops below
      the perceptual threshold.
   2. Use 8 mask stops with eased (quadratic-ish) interpolation so the
      gradient has no kink that could read as a discrete band.
   3. Keep blur at 2px — strong enough to feel, weak enough that any
      residual transition at the very top is imperceptible.
   The `.cleared` class still hides the fog when the footer scrolls
   into view, so the bottom of the page reads crisp. */
/* Mobile: hide the bottom scroll-fog entirely. It's a desktop-only
   DOF nicety; on a narrow viewport it clutters the screen and the
   blur strip eats vertical real estate the page needs more. */
@media(max-width:760px){
  .scroll-fog.bottom{display:none}
}

/* ═══════════════════════════════════════════════════════════════════
   LAVERN CURSOR — matches viz/src/components/CustomCursor.tsx
   Dot tracks instantly; blurred trail lags. Difference-blended so it
   auto-inverts on cream paper AND on the dark GitHub button.
   ═══════════════════════════════════════════════════════════════════ */
@media(pointer:fine){
  html,body,*{cursor:none !important}
}
.cursor-dot,.cursor-trail{
  position:fixed;top:0;left:0;pointer-events:none;
  border-radius:50%;opacity:0;
  mix-blend-mode:difference
}
.cursor-dot{
  width:8px;height:8px;
  background:#FFFFFF;
  z-index:99999;
  transition:background-color .35s ease,border .35s ease
}
.cursor-dot.hover{
  background:transparent;
  border:1.5px solid rgba(255,255,255,0.6)
}
.cursor-trail{
  width:32px;height:32px;
  background:rgba(255,255,255,0.12);
  filter:blur(8px);
  z-index:99998
}
@media(pointer:coarse){
  .cursor-dot,.cursor-trail{display:none}
}

/* Scroll reveals */
.r{opacity:0;transform:translateY(20px);transition:opacity .9s var(--ease),transform .9s var(--ease)}
.r.v{opacity:1;transform:translateY(0)}
.r1{transition-delay:.08s}.r2{transition-delay:.16s}.r3{transition-delay:.24s}.r4{transition-delay:.32s}
