/* ============================================
   AIFEIN v6 — THE STANDOUT RELEASE
   
   New typography: Fraunces (editorial) + Inter (precise) + JetBrains Mono (technical)
   Cursor aura · magnetic buttons · letter reveals · aurora · scan lines
   Mascot integration: no white background, glow, parallax, breathing
   
   Loaded AFTER all other stylesheets - this is the polish layer
   ============================================ */

/* ============================================
   TYPOGRAPHY OVERRIDE — Editorial × Engineering
   ============================================ */
:root {
  /* Refined colors — slightly more edge */
  --bg: #060606;
  --bg-2: #0c0c0c;
  --bg-3: #131313;
  --ink: #f6f1e7;
  --ink-2: #cfc7b8;
  --ink-3: #807a6f;
  --gold: #d4a857;
  --gold-2: #e8c47a;
  --gold-soft: #8d7440;
  --plasma: #7df9ff;       /* NEW — technical accent */
  --plasma-soft: rgba(125,249,255,0.5);
  --line: rgba(246,241,231,0.08);
  --line-2: rgba(246,241,231,0.14);
  --shadow-lg: 0 30px 80px -20px rgba(0,0,0,0.7);
  --shadow-glow: 0 0 40px rgba(212,168,87,0.25);

  --font-display: 'Fraunces', 'Cormorant Garamond', serif;
  --font-body: 'Inter', -apple-system, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  --font-cn: 'Noto Sans SC', var(--font-body);
}

[data-theme="light"] {
  --bg: #faf8f3;
  --bg-2: #f3eee5;
  --bg-3: #ebe4d6;
  --ink: #0a0a0a;
  --ink-2: #2c2c2c;
  --ink-3: #6b665d;
  --gold: #a8854a;
  --gold-2: #8d7440;
  --gold-soft: #c8a96a;
  --plasma: #0096a8;
  --plasma-soft: rgba(0,150,168,0.5);
  --line: rgba(10,10,10,0.08);
  --line-2: rgba(10,10,10,0.14);
}

body {
  font-family: var(--font-body);
  font-weight: 300;
  font-feature-settings: 'ss01' 1, 'cv11' 1; /* Inter's clean digits */
  letter-spacing: -0.005em;
}

/* Override display fonts everywhere */
h1, h2, h3, h4, h5, h6,
.hero__title, .section__head h2, .tool__name,
.pick__name, .pick__verdict,
.radar-card__name, .stack__price, .tier__price,
.calc__value strong, .calc__card__price strong,
.tool__rating__value,
.fein-chat__name, .stack-item__name, .stack-item__price,
.deal__tool, .deal__discount__value,
.review__title, .tip__tool,
.foot__tag, .hero__stats strong,
.persona__title, .drawer__head h3 {
  font-family: var(--font-display);
  font-feature-settings: 'ss01' 1, 'liga' 1;
}

[lang="zh"] h1, [lang="zh"] h2, [lang="zh"] h3,
[lang="zh"] .hero__title, [lang="zh"] .section__head h2,
[lang="zh"] .tool__name, [lang="zh"] .pick__name {
  font-family: var(--font-cn);
}

/* Mono for technical/numeric data */
.tool__score, .pick__score__value,
.score-tip__total, .score-tip__row__val,
.tool__rating__value, .tool__rating__count,
.hero__stats strong, .nav__country__code,
.kbd, .finder__kbd,
.deal__code-row__value,
.stack-item__price,
.tool__regional__price,
.calc__card__price strong {
  font-family: var(--font-mono);
  font-feature-settings: 'zero' 1, 'ss01' 1;
  font-weight: 500;
  letter-spacing: -0.02em;
}

/* Italics use Fraunces' wonderful italic axis */
.hero__title em,
.section__head h2 em,
.eyebrow,
.mascot-section__features strong {
  font-style: italic;
  font-variation-settings: "opsz" 144, "SOFT" 100;
}

/* ============================================
   AURORA BACKGROUND — moves slowly behind content
   ============================================ */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  opacity: 0.55;
}

.aurora::before, .aurora::after {
  content: '';
  position: absolute;
  width: 80vw;
  height: 80vw;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.35;
}

.aurora::before {
  top: -20vw;
  left: -20vw;
  background: radial-gradient(circle, rgba(212,168,87,0.35), transparent 70%);
  animation: auroraDrift1 24s ease-in-out infinite;
}

.aurora::after {
  bottom: -20vw;
  right: -20vw;
  background: radial-gradient(circle, rgba(125,249,255,0.18), transparent 70%);
  animation: auroraDrift2 32s ease-in-out infinite;
}

@keyframes auroraDrift1 {
  0%, 100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(15vw, 8vw) scale(1.15); }
  66% { transform: translate(-8vw, 12vw) scale(0.9); }
}

@keyframes auroraDrift2 {
  0%, 100% { transform: translate(0,0) scale(1); }
  50% { transform: translate(-12vw, -10vw) scale(1.2); }
}

[data-theme="light"] .aurora { opacity: 0.4; }

/* ============================================
   CURSOR AURA — leuchtender Cursor folgt der Maus
   ============================================ */
.cursor-aura {
  position: fixed;
  top: 0; left: 0;
  width: 320px;
  height: 320px;
  pointer-events: none;
  z-index: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212,168,87,0.12), transparent 60%);
  transform: translate(-50%, -50%);
  transition: opacity 0.4s ease;
  opacity: 0;
  mix-blend-mode: screen;
  will-change: transform;
}

.cursor-aura.active { opacity: 1; }

@media (hover: none) {
  .cursor-aura { display: none; }
}

/* ============================================
   FLOATING PARTICLES — subtle gold dust
   ============================================ */
.particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--gold);
  border-radius: 50%;
  opacity: 0;
  box-shadow: 0 0 6px var(--gold), 0 0 12px rgba(212,168,87,0.5);
  animation: particleFloat linear infinite;
}

@keyframes particleFloat {
  0% { opacity: 0; transform: translateY(100vh) translateX(0); }
  10% { opacity: 0.6; }
  90% { opacity: 0.6; }
  100% { opacity: 0; transform: translateY(-10vh) translateX(40px); }
}

/* ============================================
   COMMAND CENTER FRAME — corner crosshairs
   ============================================ */
.corner-frame {
  position: fixed;
  inset: 1.5rem;
  pointer-events: none;
  z-index: 90;
  opacity: 0.5;
}

.corner-frame::before,
.corner-frame::after,
.corner-frame > span:first-child,
.corner-frame > span:last-child {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 1px solid var(--gold);
}

.corner-frame::before { top: 0; left: 0; border-right: none; border-bottom: none; }
.corner-frame::after { top: 0; right: 0; border-left: none; border-bottom: none; }
.corner-frame > span:first-child { bottom: 0; left: 0; border-right: none; border-top: none; }
.corner-frame > span:last-child { bottom: 0; right: 0; border-left: none; border-top: none; }

@media (max-width: 720px) {
  .corner-frame { display: none; }
}

/* ============================================
   SCAN LINE — appears top of viewport while loading/scanning
   ============================================ */
.scan-bar {
  position: fixed;
  top: 65px;
  left: 0;
  right: 0;
  z-index: 95;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--ink-3);
  background: linear-gradient(180deg, rgba(0,0,0,0.4), transparent);
  text-transform: uppercase;
  pointer-events: none;
}

.scan-bar__dot {
  width: 6px; height: 6px;
  background: var(--plasma);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--plasma);
  animation: scanPulse 1.4s ease-in-out infinite;
}

@keyframes scanPulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

.scan-bar__num {
  color: var(--gold-2);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) { .scan-bar { display: none; } }

/* ============================================
   HERO — letter-by-letter reveal + new feel
   ============================================ */
.hero__title .word {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
}

.hero__title .char {
  display: inline-block;
  transform: translateY(110%);
  opacity: 0;
  animation: charReveal 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes charReveal {
  to { transform: translateY(0); opacity: 1; }
}

/* Make em pop with plasma glow */
.hero__title em {
  position: relative;
  display: inline-block;
}

.hero__title em::after {
  content: '';
  position: absolute;
  inset: -8% -4%;
  background: radial-gradient(ellipse at center, rgba(212,168,87,0.25), transparent 70%);
  filter: blur(20px);
  z-index: -1;
  animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

/* ============================================
   MASCOT INTEGRATION — no more white background
   ============================================ */
.hero__mascot,
.mascot-section__img img,
.pick__visual img,
.fein-chat-fab img,
.fein-chat__avatar img,
.pwa-banner__icon img {
  /* Mix-blend mode integrates the white background of the PNG into the page */
  mix-blend-mode: screen;
  filter:
    drop-shadow(0 0 30px rgba(212,168,87,0.4))
    drop-shadow(0 30px 60px rgba(0,0,0,0.6))
    contrast(1.05)
    brightness(0.95);
}

/* Light theme: invert blend for white-bg PNG */
[data-theme="light"] .hero__mascot,
[data-theme="light"] .mascot-section__img img,
[data-theme="light"] .pick__visual img {
  mix-blend-mode: multiply;
  filter:
    drop-shadow(0 0 30px rgba(212,168,87,0.4))
    drop-shadow(0 30px 60px rgba(0,0,0,0.2))
    contrast(1.1);
}

/* Hero mascot - dramatic entrance */
.hero__mascot {
  animation: mascotFloat 6s ease-in-out infinite, mascotEntrance 1.6s cubic-bezier(0.22, 1, 0.36, 1) both;
  will-change: transform;
  transform-origin: center bottom;
}

@keyframes mascotEntrance {
  0% { opacity: 0; transform: translateY(50px) scale(0.95); }
  100% { opacity: 0.95; transform: translateY(0) scale(1); }
}

@keyframes mascotFloat {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-18px) rotate(1deg); }
}

/* Parallax — mascot reacts to mouse */
.hero__mascot {
  transition: transform 0.2s ease-out;
}

/* Mascot section — give the image a halo/portal feel */
.mascot-section__img {
  position: relative;
}

.mascot-section__img::before {
  content: '';
  position: absolute;
  inset: 10% 10%;
  background: radial-gradient(circle, rgba(212,168,87,0.25), transparent 60%);
  filter: blur(40px);
  z-index: 0;
  animation: haloPulse 4s ease-in-out infinite;
}

@keyframes haloPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 1; }
}

.mascot-section__img img {
  position: relative;
  z-index: 1;
  animation: mascotFloat 7s ease-in-out infinite;
}

/* Pick of the week image — same treatment */
.pick__visual img {
  animation: mascotFloat 5s ease-in-out infinite;
}

/* Hide the now-redundant halo div if it exists */
.mascot-section__halo { display: none; }

/* ============================================
   LOGO TREATMENT — lit from within
   ============================================ */
.nav__logo {
  filter:
    drop-shadow(0 0 8px rgba(212,168,87,0.5))
    drop-shadow(0 0 16px rgba(212,168,87,0.3))
    brightness(1.05);
}

.foot__brand img {
  filter:
    drop-shadow(0 0 12px rgba(212,168,87,0.4))
    drop-shadow(0 4px 12px rgba(0,0,0,0.4));
}

[data-theme="light"] .nav__logo,
[data-theme="light"] .foot__brand img {
  filter:
    drop-shadow(0 0 8px rgba(168,133,74,0.3))
    drop-shadow(0 2px 8px rgba(0,0,0,0.15));
}

/* ============================================
   MAGNETIC BUTTONS — ziehen den Cursor leicht an (per JS)
   ============================================ */
.btn-gold, .nav__cta, .finder__btn, .pick__cta, .persona__continue,
.deal__code-row__btn {
  transition: transform 0.4s cubic-bezier(0.4,0,0.2,1), box-shadow 0.3s ease;
  will-change: transform;
}

/* When magnetic-button has data-magnetic attribute it gets pulled via JS */

/* ============================================
   STAGGER ANIMATIONS — section reveal choreography
   ============================================ */
.tool, .stack, .battle, .tier, .usp__card, .radar-card, .deal, .tip {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.tool.in-view, .stack.in-view, .battle.in-view, .tier.in-view,
.usp__card.in-view, .radar-card.in-view, .deal.in-view, .tip.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Hover lift improvement */
.tool {
  transition:
    opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.6s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.3s ease,
    box-shadow 0.4s ease,
    background 0.4s ease;
}

.tool:hover {
  transform: translateY(-6px) scale(1.005);
  box-shadow:
    var(--shadow-lg),
    0 0 0 1px rgba(212,168,87,0.15),
    0 0 40px rgba(212,168,87,0.08);
}

/* Scan line on tool hover (command-center feel) */
.tool {
  position: relative;
  overflow: hidden;
}

.tool::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(212,168,87,0.1), transparent);
  pointer-events: none;
  transition: left 0.8s ease;
}

.tool:hover::after { left: 150%; }

/* ============================================
   NUMBER TICKERS — tabular feel for stats
   ============================================ */
.hero__stats strong {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'zero' 1;
}

/* ============================================
   FIND BUTTON: more striking
   ============================================ */
.finder__btn {
  position: relative;
  overflow: hidden;
}

.finder__btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--gold-2), var(--gold), var(--gold-2));
  background-size: 200% 200%;
  opacity: 0;
  transition: opacity 0.4s ease;
  animation: btnShimmer 3s linear infinite;
}

.finder__btn:hover::before { opacity: 1; }

.finder__btn > * { position: relative; z-index: 1; }

@keyframes btnShimmer {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* ============================================
   STATUS DOT — bigger pulse wave
   ============================================ */
.tool__status--operational .tool__status__dot {
  position: relative;
}

.tool__status--operational .tool__status__dot::before {
  content: '';
  position: absolute;
  inset: -6px;
  border: 1px solid currentColor;
  border-radius: 50%;
  animation: ring 2s ease-out infinite;
  opacity: 0;
}

@keyframes ring {
  0% { transform: scale(0.5); opacity: 0.6; }
  100% { transform: scale(2); opacity: 0; }
}

/* ============================================
   SECTION DIVIDERS — editorial feel
   ============================================ */
.section + .section,
.section + .section--alt,
.section--alt + .section {
  position: relative;
}

.section + .section::before,
.section + .section--alt::before,
.section--alt + .section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 60px;
  background: linear-gradient(to bottom, transparent, var(--gold-soft), transparent);
}

/* ============================================
   NEW HERO BADGE — more deliberate
   ============================================ */
.hero__badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-weight: 400;
  padding: 0.45rem 1rem;
  background: rgba(212,168,87,0.06);
  border-color: rgba(212,168,87,0.25);
}

/* ============================================
   FIX: tool__discount-flag should not overflow
   ============================================ */
.tool__discount-flag {
  white-space: nowrap;
  flex-shrink: 0;
}

.tool__top {
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tool__top-right {
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

/* ============================================
   BADGE size adjustments
   ============================================ */
.badge {
  white-space: nowrap;
}

/* ============================================
   SCORE TOOLTIP — make sure it's properly stacked
   ============================================ */
.score-tip {
  z-index: 1500;
}

/* ============================================
   IMPROVED CHAT FAB — pulse + Fein wave
   ============================================ */
.fein-chat-fab {
  background: radial-gradient(circle at 30% 30%, var(--gold-2), var(--gold) 60%, var(--gold-soft));
  box-shadow:
    0 0 0 0 rgba(212,168,87,0.6),
    0 15px 40px rgba(0,0,0,0.4),
    inset 0 2px 4px rgba(255,255,255,0.2),
    inset 0 -4px 12px rgba(0,0,0,0.2);
}

.fein-chat-fab img {
  filter:
    drop-shadow(0 2px 4px rgba(0,0,0,0.3))
    drop-shadow(0 0 8px rgba(255,220,150,0.5));
  mix-blend-mode: normal; /* Override the global mix-blend rule */
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.fein-chat-fab:hover img {
  transform: rotate(-8deg) scale(1.1);
}

.fein-chat-fab::after {
  /* Status dot already exists - improve glow */
  box-shadow:
    0 0 8px #5eb85e,
    0 0 16px rgba(94,184,94,0.5),
    inset 0 1px 2px rgba(255,255,255,0.3);
}

/* ============================================
   CHAT AVATAR PANEL HEAD — same treatment
   ============================================ */
.fein-chat__avatar {
  background: radial-gradient(circle at 30% 30%, var(--gold-2), var(--gold) 60%, var(--gold-soft));
  box-shadow: 0 4px 12px rgba(0,0,0,0.3), inset 0 1px 2px rgba(255,255,255,0.2);
}

.fein-chat__avatar img {
  mix-blend-mode: normal;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}

/* ============================================
   PWA banner logo
   ============================================ */
.pwa-banner__icon img {
  mix-blend-mode: normal;
}

/* ============================================
   NAVIGATION — refined
   ============================================ */
.nav {
  border-bottom: 1px solid transparent;
  transition: backdrop-filter 0.4s ease, background 0.4s ease, border-color 0.4s ease;
}

.nav.scrolled {
  border-bottom-color: var(--line);
  background: rgba(6,6,6,0.85);
}

[data-theme="light"] .nav.scrolled {
  background: rgba(250,248,243,0.92);
}

.nav__wordmark {
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.4em;
  font-size: 0.85rem;
}

/* ============================================
   PRICING TABS feel more technical
   ============================================ */
.calc__tab, .cat, .money__filter, .radar__filter, .lang__btn, .nav__country {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* ============================================
   PROGRESS bar in score tooltip
   ============================================ */
.score-tip__row__bar__fill {
  background: linear-gradient(90deg, var(--gold-soft), var(--gold-2), var(--plasma-soft));
  box-shadow: 0 0 8px rgba(212,168,87,0.4);
}

/* ============================================
   FOR YOU section — extra polish
   ============================================ */
.foryou {
  position: relative;
}

.foryou::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(212,168,87,0.06), transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(125,249,255,0.04), transparent 50%);
  pointer-events: none;
}

/* ============================================
   VERDICT — make it more striking
   ============================================ */
.tool__verdict {
  background: linear-gradient(180deg, rgba(212,168,87,0.06), rgba(212,168,87,0.02));
  border-left: 3px solid var(--gold);
}

.tool__verdict::before {
  font-family: var(--font-mono);
  letter-spacing: 0.2em;
}

/* ============================================
   ENHANCED SECTION TITLES
   ============================================ */
.section__head h2 {
  font-weight: 400;
  font-variation-settings: "opsz" 144, "SOFT" 100;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.35em;
  font-weight: 500;
}

/* ============================================
   FINISHING TOUCH — Selection
   ============================================ */
::selection {
  background: var(--gold);
  color: var(--bg);
  text-shadow: none;
}

/* ============================================
   REDUCED MOTION RESPECT
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .cursor-aura, .particles, .aurora { display: none; }
}
