/*
 * ══════════════════════════════════════════════════════════════
 * 3D-CORE.CSS — itzhak-pitronot.com
 * ROLLBACK: מחק קובץ זה + advanced-animations.js + הסר <link><script> מ-HTML
 * ══════════════════════════════════════════════════════════════
 */

/* ═══════════════════════════════════════════════════
   ACCESSIBILITY — NO MOTION
   ═══════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration:       0.01ms !important;
    animation-iteration-count: 1     !important;
    transition-duration:      0.01ms !important;
  }
  .ys-reveal-up, .ys-reveal-scale, .ys-reveal-stat, .ys-reveal-left {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ═══════════════════════════════════════════════════
   MODULE 1 — SCROLL REVEAL — Initial hidden states
   (Applied via JS → IntersectionObserver → .ys-in-view)
   ═══════════════════════════════════════════════════ */

.ys-reveal-up {
  opacity: 0;
  transform: translate3d(0, 54px, -40px);
  transition: opacity 0.72s ease, transform 0.72s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

.ys-reveal-scale {
  opacity: 0;
  transform: scale3d(0.88, 0.88, 1) translate3d(0, 30px, 0);
  transition: opacity 0.78s ease, transform 0.78s cubic-bezier(0.34, 1.38, 0.64, 1);
  will-change: opacity, transform;
}

.ys-reveal-stat {
  opacity: 0;
  transform: scale3d(0.45, 0.45, 1);
  transition: opacity 0.62s ease, transform 0.62s cubic-bezier(0.34, 1.7, 0.64, 1);
  will-change: opacity, transform;
}

.ys-reveal-left {
  opacity: 0;
  transform: translate3d(64px, 10px, 0);
  transition: opacity 0.65s ease, transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

/* Resolved state */
.ys-in-view {
  opacity: 1 !important;
  transform: translate3d(0, 0, 0) scale3d(1, 1, 1) !important;
}

/* ═══════════════════════════════════════════════════
   MODULE 2 — KINETIC SEARCH BAR
   ═══════════════════════════════════════════════════ */

/* Backdrop dimmer */
#ys-search-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 15, 36, 0);
  pointer-events: none;
  z-index: 15;
  transition: background 0.42s ease;
}
#ys-search-backdrop.ys-active {
  background: rgba(6, 15, 36, 0.55);
  pointer-events: auto;
}

/* Main search box (index.html) */
.search-box {
  position: relative;
  transition:
    transform   0.48s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow  0.42s ease,
    border-color 0.3s ease;
  will-change: transform, box-shadow;
}

.search-box.ys-focused {
  transform: scale(1.03) translate3d(0, -7px, 0);
  z-index: 20;
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow:
    0 0 0 3px rgba(245, 158, 11, 0.38),
    0 0 45px rgba(245, 158, 11, 0.18),
    0 0 100px rgba(245, 158, 11, 0.06),
    0 32px 80px rgba(0, 0, 0, 0.32);
}

/* Neon scan line — uses clip-path to avoid overflow issues with dropdown */
@keyframes ysScan {
  0%   { clip-path: inset(0 100% 0 0 round 2px); }
  38%  { clip-path: inset(0   0% 0 0 round 2px); }
  62%  { clip-path: inset(0   0% 0 0 round 2px); }
  100% { clip-path: inset(0   0% 0 100% round 2px); }
}

.search-box.ys-focused::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2.5px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(245, 158, 11, 0.7)  20%,
    rgba(245, 158, 11, 1)    50%,
    rgba(245, 158, 11, 0.7)  80%,
    transparent 100%
  );
  clip-path: inset(0 100% 0 0 round 2px);
  animation: ysScan 1.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  z-index: 5;
  pointer-events: none;
}

/* Search bar (professionals/index.html) */
.search-bar {
  position: relative;
  transition: transform 0.48s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.42s ease;
  will-change: transform, box-shadow;
}

.search-bar.ys-focused {
  transform: scale(1.022) translate3d(0, -4px, 0);
  z-index: 20;
  box-shadow:
    0 0 0 2.5px rgba(245, 158, 11, 0.4),
    0 0 36px rgba(245, 158, 11, 0.16),
    0 24px 56px rgba(0, 0, 0, 0.24);
}

.search-bar.ys-focused::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(
    90deg, transparent 0%, rgba(245,158,11,0.9) 40%, rgba(245,158,11,0.9) 60%, transparent 100%
  );
  clip-path: inset(0 100% 0 0);
  animation: ysScan 1.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  z-index: 5;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════
   NAVBAR — Glassmorphism + scroll state
   ═══════════════════════════════════════════════════ */
nav#navbar {
  background: rgba(11, 26, 56, 0.88);
  backdrop-filter: blur(24px) saturate(175%);
  -webkit-backdrop-filter: blur(24px) saturate(175%);
  border-bottom: 1px solid rgba(245, 158, 11, 0.12);
  box-shadow: 0 4px 36px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: background 0.4s ease, box-shadow 0.4s ease, border-color 0.4s ease;
}

nav#navbar.ys-scrolled {
  background: rgba(7, 17, 38, 0.97);
  box-shadow:
    0 4px 44px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -1px 0 rgba(245, 158, 11, 0.1);
  border-bottom-color: rgba(245, 158, 11, 0.18);
}

/* ═══════════════════════════════════════════════════
   HERO — Cinematic depth + atmosphere
   ═══════════════════════════════════════════════════ */
.hero {
  background: linear-gradient(140deg, #071829 0%, #1b3f72 42%, #102447 72%, #162f60 100%);
}

.hero::after {
  content: '';
  position: absolute; inset: 0;
  z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 88% 68% at 20% 60%, rgba(245, 158, 11, 0.08) 0%, transparent 58%),
    radial-gradient(ellipse 68% 58% at 80% 22%, rgba(37, 99, 168, 0.2)   0%, transparent 56%),
    radial-gradient(ellipse 48% 44% at 55% 88%, rgba(27, 63, 114, 0.22)  0%, transparent 60%);
  animation: heroAtmosphere 12s ease-in-out infinite alternate;
}

@keyframes heroAtmosphere {
  0%   { opacity: 0.6; transform: scale(1); }
  100% { opacity: 1;   transform: scale(1.06); }
}

.hero h1 {
  text-shadow:
    0 0 90px rgba(245, 158, 11, 0.16),
    0 4px 28px rgba(0, 0, 0, 0.48);
}

.hero h1 em {
  text-shadow:
    0 0 60px rgba(245, 158, 11, 0.65),
    0 0 120px rgba(245, 158, 11, 0.22);
}

/* Hero cards — advanced glassmorphism */
.hero-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(22px) saturate(165%) brightness(110%);
  -webkit-backdrop-filter: blur(22px) saturate(165%) brightness(110%);
  box-shadow:
    0 10px 36px rgba(0, 0, 0, 0.22),
    0 2px 8px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08);
  will-change: transform;
  transition: transform 0.38s cubic-bezier(0.03, 0.98, 0.52, 0.99), box-shadow 0.38s;
}

@media (hover: hover) and (pointer: fine) {
  .hero-card:hover {
    transform: none; /* JS tilt takes over */
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    box-shadow:
      0 18px 56px rgba(0, 0, 0, 0.3),
      0 0 0 1px rgba(245, 158, 11, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.22);
  }
}

.hero-card .icon {
  filter: drop-shadow(0 0 12px rgba(245, 158, 11, 0.4));
}

.hero-stat .num {
  text-shadow: 0 0 30px rgba(245, 158, 11, 0.5);
}

/* ═══════════════════════════════════════════════════
   PRO CARDS — 3D tilt-ready + shimmer
   ═══════════════════════════════════════════════════ */
.pro-card {
  position: relative;
  will-change: transform;
  transition:
    transform    0.32s cubic-bezier(0.03, 0.98, 0.52, 0.99),
    box-shadow   0.32s ease,
    border-color 0.32s ease;
}

/* Shimmer sweep */
.pro-card::after {
  content: '';
  position: absolute;
  top: 0; right: -95%; width: 58%; height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.06),
    transparent
  );
  transform: skewX(-8deg);
  transition: right 0.7s ease;
  pointer-events: none;
  z-index: 4;
}

@media (hover: hover) and (pointer: fine) {
  .pro-card:hover {
    transform: none; /* JS tilt takes over */
    border-color: rgba(245, 158, 11, 0.25);
    box-shadow:
      0 2px 4px rgba(0, 0, 0, 0.04),
      0 16px 40px rgba(27, 63, 114, 0.18),
      0 32px 64px rgba(27, 63, 114, 0.09),
      0 0 0 1px rgba(245, 158, 11, 0.12),
      inset 0 1px 0 rgba(255, 255, 255, 0.88);
  }
  .pro-card:hover::after { right: 130%; }
}

/* Card top — richer gradient */
.pro-card-top {
  background: linear-gradient(135deg, #1b3f72 0%, #0c2048 62%, #163269 100%);
  position: relative;
  overflow: hidden;
}

.pro-card-top::before {
  content: '';
  position: absolute;
  top: -60%; right: -30%;
  width: 80%; height: 200%;
  background: radial-gradient(ellipse, rgba(245, 158, 11, 0.1) 0%, transparent 65%);
  pointer-events: none;
}

/* Avatar glow */
.pro-card-avatar {
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.08),
    0 0 26px rgba(245, 158, 11, 0.2),
    0 4px 16px rgba(0, 0, 0, 0.3);
}

@media (hover: hover) {
  .btn-profile:hover {
    box-shadow: 0 6px 24px rgba(37, 99, 168, 0.45);
  }
}

/* ═══════════════════════════════════════════════════
   CATEGORY CARDS
   ═══════════════════════════════════════════════════ */
.cat-card {
  will-change: transform;
  transition:
    transform    0.28s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow   0.28s ease,
    border-color 0.28s ease;
}

@media (hover: hover) {
  .cat-card:hover {
    box-shadow:
      0 12px 32px rgba(27, 63, 114, 0.16),
      0 28px 56px rgba(27, 63, 114, 0.08),
      0 0 0 2px rgba(245, 158, 11, 0.18);
  }
}

/* ═══════════════════════════════════════════════════
   VALUE CARDS
   ═══════════════════════════════════════════════════ */
@media (hover: hover) {
  .val-card:hover {
    box-shadow:
      0 16px 44px rgba(27, 63, 114, 0.14),
      0 0 0 1px rgba(245, 158, 11, 0.1);
  }
}

/* ═══════════════════════════════════════════════════
   SEARCH BOX — Default depth
   ═══════════════════════════════════════════════════ */
.search-box:not(.ys-focused) {
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.05),
    0 20px 56px rgba(27, 63, 114, 0.16),
    0 40px 72px rgba(0, 0, 0, 0.08);
}

/* ═══════════════════════════════════════════════════
   FILTER CHIPS — Physical press + active glow
   ═══════════════════════════════════════════════════ */
.filter-chip {
  transition: all 0.17s cubic-bezier(0.03, 0.98, 0.52, 0.99);
}

.filter-chip:active {
  transform: scale(0.91) translateY(1.5px);
}

.filter-chip.active {
  box-shadow:
    0 4px 22px rgba(37, 99, 168, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

/* ═══════════════════════════════════════════════════
   STATS BAR — Deeper tone + number glow
   ═══════════════════════════════════════════════════ */
.stats-bar {
  background: linear-gradient(135deg, #152c5c 0%, #0b1d40 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.stat-item .num {
  text-shadow:
    0 0 36px rgba(245, 158, 11, 0.45),
    0 0 72px rgba(245, 158, 11, 0.15);
}

/* ═══════════════════════════════════════════════════
   SIDEBAR BUTTONS (profile page)
   ═══════════════════════════════════════════════════ */
@media (hover: hover) {
  .btn-wa:hover    { box-shadow: 0 6px 32px rgba(37, 211, 102, 0.44); }
  .btn-phone:hover { box-shadow: 0 6px 32px rgba(27,  63,  114, 0.44); }
}

/* ═══════════════════════════════════════════════════
   MOBILE — Graceful flat degradation
   ═══════════════════════════════════════════════════ */
@media (max-width: 768px), (hover: none) {
  .pro-card,
  .hero-card,
  .cat-card,
  .val-card {
    will-change: auto;
  }

  .pro-card::after,
  .pro-card-top::before {
    display: none;
  }

  .hero::after {
    animation: none;
    opacity: 0.88;
  }

  .hero h1,
  .hero h1 em {
    text-shadow: none;
  }

  .stat-item .num {
    text-shadow: none;
  }

  .search-box.ys-focused,
  .search-bar.ys-focused {
    transform: none;
  }
}
