/* ── Базовый фон (без белой вспышки при навигации) ─────────────── */
html {
  background-color: #ecfdf5;
}

/* ── Полная навигация: только CSS, без JS ─────────────────────── */
@view-transition {
  navigation: auto;
}

.site-header,
footer,
#sidebar {
  view-transition-name: none;
}

.page-root {
  view-transition-name: main-content;
}

/* Корень не мигает — анимируем только main */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
}

::view-transition-old(main-content),
::view-transition-new(main-content) {
  animation-duration: 0.28s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

::view-transition-old(main-content) {
  animation-name: vt-out;
}
::view-transition-new(main-content) {
  animation-name: vt-in;
}

/* Кроссфейд: не уходим в полную прозрачность */
@keyframes vt-out {
  to {
    opacity: 0.55;
    transform: translateY(-3px);
  }
}
@keyframes vt-in {
  from {
    opacity: 0.55;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── HTMX: лёгкий кроссфейд без «пустого» кадра ───────────────── */
.htmx-swapping {
  opacity: 0.94 !important;
  transition: opacity 0.12s ease-out !important;
}

.htmx-settling {
  opacity: 1 !important;
  transition: opacity 0.18s ease-in !important;
}

#main-section {
  will-change: opacity;
}

/* Мягкое появление (только для статичных блоков, не opacity:0) */
.fade-in-soft {
  animation: fade-in-soft 0.32s ease-out both;
}

@keyframes fade-in-soft {
  from {
    opacity: 0.88;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stagger-in > * {
  animation: fade-in-soft 0.3s ease-out both;
}
.stagger-in > *:nth-child(1) { animation-delay: 0.03s; }
.stagger-in > *:nth-child(2) { animation-delay: 0.06s; }
.stagger-in > *:nth-child(3) { animation-delay: 0.09s; }
.stagger-in > *:nth-child(4) { animation-delay: 0.12s; }
.stagger-in > *:nth-child(5) { animation-delay: 0.15s; }
.stagger-in > *:nth-child(6) { animation-delay: 0.18s; }

/* ── Ambient background ────────────────────────────────────────── */
body.site-body {
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(52, 211, 153, 0.35), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(45, 212, 191, 0.28), transparent 50%),
    radial-gradient(ellipse 50% 35% at 50% 100%, rgba(250, 204, 21, 0.12), transparent 55%),
    linear-gradient(165deg, #ecfdf5 0%, #f0fdfa 35%, #ffffff 100%);
  background-color: #ecfdf5;
  background-attachment: fixed;
}

/* ── Header shimmer line ───────────────────────────────────────── */
.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    #10b981,
    #2dd4bf,
    #fbbf24,
    #10b981,
    transparent
  );
  background-size: 200% 100%;
  animation: shimmer-line 6s linear infinite;
}

@keyframes shimmer-line {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Cards & nav ───────────────────────────────────────────────── */
.plant-card {
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.35s ease,
              border-color 0.35s ease;
}

.plant-card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 20px 40px -12px rgba(16, 185, 129, 0.35);
  border-color: rgba(52, 211, 153, 0.6);
}

.nav-pill {
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.nav-pill:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 14px -4px rgba(16, 185, 129, 0.45);
}

.nav-pill.is-active {
  background: linear-gradient(135deg, #059669 0%, #14b8a6 50%, #22c55e 100%) !important;
  color: white !important;
  box-shadow: 0 8px 24px -6px rgba(5, 150, 105, 0.55);
}

.section-hero {
  background: linear-gradient(135deg, #059669 0%, #0d9488 40%, #10b981 70%, #34d399 100%);
  position: relative;
  overflow: hidden;
}

.section-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 80% 20%, rgba(251, 191, 36, 0.2) 0%, transparent 35%);
  pointer-events: none;
}

.section-hero > * {
  position: relative;
  z-index: 1;
}

.glass-panel {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.btn-glow {
  background: linear-gradient(135deg, #059669, #14b8a6);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-glow:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px -8px rgba(5, 150, 105, 0.65);
  filter: brightness(1.06);
}

.btn-glow:active {
  transform: translateY(0);
}

.hero-title {
  background: linear-gradient(135deg, #064e3b 0%, #047857 40%, #0d9488 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  @view-transition { navigation: none; }
}
