/* Sampoorna — motion + texture system
   Keep classes intentionally short. Use them like Tailwind utilities. */

/* ============================================================
   PAPER GRAIN / TEXTURE — applied to body underlay
   ============================================================ */

body::before {
  content: "";
  position: fixed; inset: 0;
  background-image:
    radial-gradient(ellipse at 8% 0%,   color-mix(in srgb, var(--brand)  4%, transparent) 0%, transparent 40%),
    radial-gradient(ellipse at 95% 100%, color-mix(in srgb, var(--accent) 3%, transparent) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
  opacity: 0.7;
}

/* very subtle grain — much lower than before */
body::after {
  content: "";
  position: fixed; inset: -50%;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='1' seed='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.035 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
  mix-blend-mode: multiply;
}

[data-aesthetic="console"] body::after { opacity: 0.3; mix-blend-mode: screen; }

/* keep app above texture layers */
#app, #boot { position: relative; z-index: 1; }

/* ============================================================
   KEYFRAMES
   ============================================================ */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}
@keyframes fadeRight {
  from { opacity: 0; transform: translateX(-14px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes drawLine {
  from { stroke-dashoffset: var(--dash-len, 200); }
  to   { stroke-dashoffset: 0; }
}
@keyframes fillBar {
  from { width: 0 !important; }
  to   { width: var(--fill, 100%); }
}
@keyframes pulseRing {
  0%   { box-shadow: 0 0 0 0   color-mix(in srgb, var(--brand) 40%, transparent); }
  70%  { box-shadow: 0 0 0 14px color-mix(in srgb, var(--brand) 0%,  transparent); }
  100% { box-shadow: 0 0 0 0   color-mix(in srgb, var(--brand) 0%,  transparent); }
}
@keyframes breathe {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%      { transform: scale(1.06); opacity: 0.85; }
}
@keyframes orbitDrift {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes bobble {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}
@keyframes drawStroke {
  to { stroke-dashoffset: 0; }
}
@keyframes confettiFall {
  0%   { opacity: 1; transform: translate(0, 0) rotate(0deg); }
  100% { opacity: 0; transform: translate(var(--cx, 0), 120px) rotate(var(--rot, 360deg)); }
}
@keyframes blink {
  50% { opacity: 0.4; }
}

/* ============================================================
   UTILITY ANIMATION CLASSES
   ============================================================ */

.anim-fade-up    { animation: fadeUp    600ms var(--ease); }
.anim-fade-in    { animation: fadeIn    400ms var(--ease); }
.anim-fade-right { animation: fadeRight 600ms var(--ease); }
.anim-scale-in   { animation: scaleIn   500ms var(--ease); }
.anim-breathe    { animation: breathe   3.4s ease-in-out infinite; }
.anim-pulse-ring { animation: pulseRing 2.2s ease-out  infinite; }
.anim-bobble     { animation: bobble    3s   ease-in-out infinite; }

/* Stagger children — content is visible by default. Animation is decorative. */
.stagger.stagger-in > *               { animation: fadeUp 700ms var(--ease); }
.stagger.stagger-in > *:nth-child(1)  { animation-delay: 0.05s; }
.stagger.stagger-in > *:nth-child(2)  { animation-delay: 0.12s; }
.stagger.stagger-in > *:nth-child(3)  { animation-delay: 0.20s; }
.stagger.stagger-in > *:nth-child(4)  { animation-delay: 0.28s; }
.stagger.stagger-in > *:nth-child(5)  { animation-delay: 0.36s; }
.stagger.stagger-in > *:nth-child(6)  { animation-delay: 0.44s; }
.stagger.stagger-in > *:nth-child(7)  { animation-delay: 0.52s; }
.stagger.stagger-in > *:nth-child(8)  { animation-delay: 0.60s; }
.stagger.stagger-in > *:nth-child(9)  { animation-delay: 0.68s; }
.stagger.stagger-in > *:nth-child(10) { animation-delay: 0.76s; }

/* When element is "revealed" (intersection observer adds .is-in-view).
   IMPORTANT: content is visible by default. The .in class adds the animation
   as a decorative entrance. If the browser's timeline can't advance, content
   still shows. */
.reveal       { animation: fadeUp 700ms var(--ease); }
.reveal.in    { /* trigger via JS to re-run animation if desired */ }
.reveal-r     { animation: fadeRight 700ms var(--ease); }
.reveal-r.in  { }

/* Animated count-up — JS injects --to and we tween via CSS counter trick is heavy.
   Easier: just a fade-up for the wrapper plus tabular nums. (JS does the increment.) */

/* Card hover refinement — much more pronounced */
.card.interactive {
  transition: transform 280ms var(--ease), box-shadow 280ms var(--ease), border-color 280ms var(--ease);
  will-change: transform;
}
.card.interactive:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px color-mix(in srgb, var(--ink) 8%, transparent),
              0 3px 8px  color-mix(in srgb, var(--ink) 5%, transparent);
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
}

/* Buttons get a subtle press */
.btn { transition: all 180ms var(--ease); }
.btn:active { transform: scale(0.97); }

/* Score bar — animate width into view */
.score-bar > span {
  transition: width 1.2s cubic-bezier(.2, .9, .2, 1);
}
.score-bar.from-zero > span { width: 0 !important; }

/* Hand-drawn underline — visible by default; the draw animation is a bonus
   in browsers where the timeline runs */
.hand-underline {
  position: relative;
  display: inline-block;
  margin-right: 0.18em;
}
.hand-underline svg {
  position: absolute;
  left: -4px; right: -4px; bottom: -10px;
  width: calc(100% + 8px); height: 14px;
  overflow: visible;
}
.hand-underline svg path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
}

/* Sparkle pulse — small dot, used on KPI labels etc */
.live-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--c-emerald);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--c-emerald) 50%, transparent);
  animation: pulseRing 2.2s ease-out infinite;
}

/* Handwritten margin annotation */
.scribble {
  font-family: "Caveat", "Patrick Hand", "Bradley Hand", cursive;
  font-weight: 500;
  color: var(--accent);
  line-height: 1.1;
  transform: rotate(-3deg);
  display: inline-block;
}
.scribble-arrow {
  display: inline-block;
  width: 60px; height: 36px;
  pointer-events: none;
}
.scribble-arrow path {
  fill: none; stroke: var(--accent); stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}

/* Drop cap — first letter big and serif */
.dropcap::first-letter {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 3.4em;
  line-height: 0.86;
  float: left;
  margin: 4px 10px 0 -2px;
  color: var(--brand);
}

/* Section-divider scribble (between sections in landing) */
.section-rule {
  height: 24px;
  position: relative;
  display: flex; align-items: center; justify-content: center;
}
.section-rule::before {
  content: ""; height: 1px; flex: 1; max-width: 240px;
  background: linear-gradient(to right, transparent, var(--line), transparent);
}
.section-rule::after {
  content: ""; height: 1px; flex: 1; max-width: 240px;
  background: linear-gradient(to left, transparent, var(--line), transparent);
}
.section-rule .glyph {
  margin: 0 18px;
  color: var(--brand);
  font-size: 14px;
  opacity: 0.6;
}

/* Print mark — small inked stamp in corners */
.ink-stamp {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--accent);
  border: 1px solid currentColor;
  padding: 4px 8px;
  border-radius: 2px;
  text-transform: uppercase;
  transform: rotate(-3deg);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Marker highlight — for inline emphasis */
.highlight-mark {
  background: linear-gradient(180deg, transparent 60%, color-mix(in srgb, var(--accent) 30%, transparent) 60%, color-mix(in srgb, var(--accent) 30%, transparent) 90%, transparent 90%);
  padding: 0 4px;
}

/* Tabular nums for everything that should */
.tnum { font-variant-numeric: tabular-nums; }

/* Soft chunky gradient surface — used on big "feature" cards */
.surface-warm {
  background:
    radial-gradient(circle at 80% 20%, color-mix(in srgb, var(--accent) 12%, transparent) 0%, transparent 50%),
    var(--surface);
}
.surface-cool {
  background:
    radial-gradient(circle at 20% 80%, color-mix(in srgb, var(--brand) 12%, transparent) 0%, transparent 50%),
    var(--surface);
}

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

/* Smooth scroll */
html { scroll-behavior: smooth; }
