/* MetaFarms — Custom styles */

:root {
  --mf-primary: #16a34a;
  --mf-primary-dark: #15803d;
  --mf-accent: #f59e0b;
  --mf-glow: rgba(34, 197, 94, 0.35);
  --mf-surface: rgba(255, 255, 255, 0.78);
  --mf-surface-strong: rgba(255, 255, 255, 0.92);
  --mf-border: rgba(22, 163, 74, 0.18);
  --mf-text-muted: #4b5563;
  --mf-hero-gradient: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 25%, #fefce8 60%, #ecfdf5 100%);
  --mf-hero-overlay: linear-gradient(135deg, rgba(236,253,245,0.92) 0%, rgba(240,253,244,0.88) 40%, rgba(254,252,232,0.85) 100%);
}

.dark {
  --mf-primary: #4ade80;
  --mf-primary-dark: #22c55e;
  --mf-accent: #fbbf24;
  --mf-glow: rgba(74, 222, 128, 0.28);
  --mf-surface: rgba(15, 23, 42, 0.78);
  --mf-surface-strong: rgba(15, 23, 42, 0.94);
  --mf-border: rgba(74, 222, 128, 0.14);
  --mf-text-muted: #94a3b8;
  --mf-hero-gradient: linear-gradient(135deg, #0f172a 0%, #14532d 40%, #1e1b4b 100%);
  --mf-hero-overlay: linear-gradient(135deg, rgba(15,23,42,0.94) 0%, rgba(20,83,45,0.88) 50%, rgba(30,27,75,0.92) 100%);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Outfit', system-ui, sans-serif;
  transition: background-color 0.4s ease, color 0.4s ease;
}

.font-display { font-family: 'Syne', 'Outfit', sans-serif; }

/* ── Background ── */
.bg-mesh {
  background: var(--mf-hero-gradient);
  position: relative;
  overflow-x: hidden;
}

.bg-mesh::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, var(--mf-glow) 0%, transparent 45%),
    radial-gradient(circle at 80% 70%, rgba(245, 158, 11, 0.1) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(34, 197, 94, 0.06) 0%, transparent 60%);
  animation: meshPulse 12s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

@keyframes meshPulse {
  0% { opacity: 0.6; transform: scale(1); }
  100% { opacity: 1; transform: scale(1.04); }
}

.particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  background: var(--mf-primary);
  opacity: 0.12;
  animation: floatUp linear infinite;
}

@keyframes floatUp {
  0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
  10% { opacity: 0.18; }
  90% { opacity: 0.1; }
  100% { transform: translateY(-10vh) rotate(360deg); opacity: 0; }
}

/* ── Glass ── */
.glass-card {
  background: var(--mf-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--mf-border);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease, border-color 0.4s ease;
}

.glass-card:not(.eco-card):hover {
  border-color: var(--mf-primary);
}

.glass-card-strong {
  background: var(--mf-surface-strong);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--mf-border);
}

.card-lift:hover {
  transform: translateY(-8px);
  box-shadow: 0 24px 48px -16px var(--mf-glow);
  border-color: var(--mf-primary);
}

/* ── Hero cinematic ── */
.hero-cinematic {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-bg-image {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-bg-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.08);
  transition: transform 8s ease-out;
}

.hero-cinematic.loaded .hero-bg-image img {
  transform: scale(1);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: var(--mf-hero-overlay);
  z-index: 1;
}

.hero-grid-pattern {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0.04;
  background-image:
    linear-gradient(var(--mf-primary) 1px, transparent 1px),
    linear-gradient(90deg, var(--mf-primary) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}

.hero-content { position: relative; z-index: 10; }

.hero-image-stack {
  position: relative;
  height: 520px;
}

.hero-float-card {
  position: absolute;
  border-radius: 1.25rem;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  border: 3px solid rgba(255,255,255,0.8);
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.dark .hero-float-card {
  border-color: rgba(74, 222, 128, 0.2);
}

.hero-float-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-float-main {
  width: 72%;
  height: 85%;
  top: 5%;
  right: 0;
  z-index: 2;
}

.hero-float-secondary {
  width: 48%;
  height: 42%;
  bottom: 0;
  left: 0;
  z-index: 3;
}

.hero-float-accent {
  width: 36%;
  height: 32%;
  top: 0;
  left: 8%;
  z-index: 4;
}

.hero-float-badge {
  position: absolute;
  bottom: 12%;
  right: -4%;
  z-index: 5;
  animation: floatBadge 4s ease-in-out infinite;
}

@keyframes floatBadge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  animation: bounceDown 2s ease-in-out infinite;
}

@keyframes bounceDown {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

/* ── Images ── */
.img-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.img-zoom-wrap {
  overflow: hidden;
  border-radius: inherit;
}

.img-zoom-wrap img {
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.img-zoom-wrap:hover img {
  transform: scale(1.08);
}

/* ── Ecosystem cards with images ── */
.eco-card {
  overflow: hidden;
  display: block;
}

.eco-card-image {
  position: relative;
  height: 200px;
  overflow: hidden;
}

.eco-card-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--mf-surface) 0%, transparent 60%);
}

.eco-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.eco-card:hover .eco-card-image img {
  transform: scale(1.1);
}

.eco-card-body {
  padding: 1.5rem 1.75rem 1.75rem;
  margin-top: -2rem;
  position: relative;
  z-index: 2;
}

/* ── Marquee ── */
.marquee-wrap {
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent);
}

.marquee-track {
  display: flex;
  gap: 3rem;
  width: max-content;
  animation: marquee 30s linear infinite;
}

.marquee-track:hover {
  animation-play-state: paused;
}

@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.marquee-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--mf-text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── Timeline ── */
.timeline-line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, transparent, var(--mf-primary), transparent);
  transform: translateX(-50%);
  opacity: 0.3;
}

.timeline-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--mf-primary);
  box-shadow: 0 0 0 4px var(--mf-glow);
  flex-shrink: 0;
}

/* ── Bento grid ── */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: 180px;
  gap: 1rem;
}

@media (min-width: 768px) {
  .bento-grid { grid-auto-rows: 200px; gap: 1.25rem; }
}

.bento-item {
  position: relative;
  border-radius: 1.25rem;
  overflow: hidden;
}

.bento-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s ease;
}

.bento-item:hover img { transform: scale(1.06); }

.bento-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.1) 60%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.25rem;
}

.bento-span-4 { grid-column: span 12; }
.bento-span-6 { grid-column: span 12; }
.bento-span-8 { grid-column: span 12; }

@media (min-width: 768px) {
  .bento-span-4 { grid-column: span 4; }
  .bento-span-6 { grid-column: span 6; }
  .bento-span-8 { grid-column: span 8; }
  .bento-row-2 { grid-row: span 2; }
}

/* ── Parallax banner ── */
.parallax-banner {
  position: relative;
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.parallax-banner-bg {
  position: absolute;
  inset: -20% 0;
  z-index: 0;
}

.parallax-banner-bg img {
  width: 100%;
  height: 120%;
  object-fit: cover;
}

.parallax-banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(22,163,74,0.85) 0%, rgba(15,23,42,0.8) 100%);
  z-index: 1;
}

.dark .parallax-banner-overlay {
  background: linear-gradient(135deg, rgba(20,83,45,0.9) 0%, rgba(15,23,42,0.92) 100%);
}

/* ── Tech pills ── */
.tech-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: var(--mf-surface);
  border: 1px solid var(--mf-border);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--mf-text-muted);
  transition: all 0.25s ease;
}

.tech-pill:hover {
  border-color: var(--mf-primary);
  color: var(--mf-primary);
  transform: translateY(-2px);
}

/* ── Section label ── */
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mf-primary);
}

.section-label::before {
  content: '';
  width: 24px;
  height: 2px;
  background: var(--mf-primary);
  border-radius: 1px;
}

/* ── Loader ── */
#page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--mf-hero-gradient);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

#page-loader.hidden { opacity: 0; visibility: hidden; }

.loader-leaf {
  width: 52px;
  height: 52px;
  border: 3px solid var(--mf-border);
  border-top-color: var(--mf-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Reveal ── */
.reveal {
  opacity: 0;
  transform: translateY(36px);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.visible { opacity: 1; transform: translateY(0); }

.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal-left.visible { opacity: 1; transform: translateX(0); }

.reveal-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal-right.visible { opacity: 1; transform: translateX(0); }

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }

/* ── Nav ── */
.nav-link { position: relative; transition: color 0.25s ease; }

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--mf-primary);
  transition: width 0.3s ease;
  border-radius: 2px;
}

.nav-link:hover::after,
.nav-link.active::after { width: 100%; }

.nav-link.active { color: var(--mf-primary); font-weight: 600; }

#site-header.nav-transparent nav {
  background: rgba(255,255,255,0.55);
  border-color: rgba(255,255,255,0.4);
}

.dark #site-header.nav-transparent nav {
  background: rgba(15,23,42,0.55);
  border-color: rgba(74,222,128,0.1);
}

/* ── Theme toggle ── */
.theme-toggle {
  width: 52px;
  height: 28px;
  border-radius: 999px;
  background: var(--mf-border);
  position: relative;
  cursor: pointer;
  border: 1px solid var(--mf-border);
  transition: background 0.3s ease;
}

.theme-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--mf-primary);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.dark .theme-toggle-knob { transform: translateX(24px); }

/* ── Typography ── */
.hero-gradient-text {
  background: linear-gradient(135deg, var(--mf-primary) 0%, var(--mf-accent) 45%, var(--mf-primary-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--mf-primary), transparent);
  opacity: 0.25;
}

/* ── Collapsible nav panel ── */
.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.nav-overlay.open {
  opacity: 1;
  visibility: visible;
}

.nav-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 70;
  width: min(360px, 92vw);
  height: 100vh;
  background: var(--mf-surface-strong);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid var(--mf-border);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.nav-panel.open { transform: translateX(0); }

.nav-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--mf-border);
  flex-shrink: 0;
}

.nav-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem 2rem;
}

.nav-group { border-bottom: 1px solid var(--mf-border); }
.nav-group:last-child { border-bottom: none; }

.nav-group-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 0.5rem;
  font-family: 'Syne', 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mf-text-muted);
  cursor: pointer;
  transition: color 0.2s ease;
  background: none;
  border: none;
  text-align: left;
}

.nav-group-toggle:hover { color: var(--mf-primary); }

.nav-group-toggle .chevron {
  transition: transform 0.3s ease;
  font-size: 0.75rem;
  opacity: 0.6;
}

.nav-group.open .nav-group-toggle .chevron { transform: rotate(180deg); }

.nav-group-links {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.nav-group.open .nav-group-links { max-height: 400px; }

.nav-group-links a {
  display: block;
  padding: 0.6rem 0.75rem 0.6rem 1rem;
  margin-bottom: 0.15rem;
  border-radius: 0.625rem;
  font-size: 0.9375rem;
  color: var(--mf-text-muted);
  transition: all 0.2s ease;
}

.nav-group-links a:hover {
  background: rgba(34, 197, 94, 0.08);
  color: var(--mf-primary);
}

.nav-group-links a.active {
  background: rgba(34, 197, 94, 0.12);
  color: var(--mf-primary);
  font-weight: 600;
}

#menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--mf-text-muted);
  border: 1px solid var(--mf-border);
  background: var(--mf-surface);
  transition: all 0.25s ease;
  cursor: pointer;
}

#menu-btn:hover {
  border-color: var(--mf-primary);
  color: var(--mf-primary);
}

#menu-btn.open {
  background: var(--mf-primary);
  color: white;
  border-color: var(--mf-primary);
}

.dark #menu-btn.open { color: #0f172a; }

body.nav-open { overflow: hidden; }

/* ── Three commitments ── */
.commitment-card { position: relative; overflow: hidden; }

.commitment-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--mf-primary), var(--mf-accent));
}

.commitment-number {
  font-family: 'Syne', sans-serif;
  font-size: 4rem;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, var(--mf-primary), var(--mf-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  opacity: 0.25;
  position: absolute;
  top: 1rem;
  right: 1.25rem;
}

/* ── Prose ── */
.prose-mf p {
  margin-bottom: 1.25rem;
  line-height: 1.85;
  color: var(--mf-text-muted);
}

.prose-mf p:last-child { margin-bottom: 0; }

/* ── Components ── */
.icon-badge {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--mf-primary), var(--mf-primary-dark));
  color: white;
  font-size: 1.35rem;
  box-shadow: 0 8px 24px var(--mf-glow);
}

.dark .icon-badge { color: #0f172a; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 1.85rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--mf-primary), var(--mf-primary-dark));
  color: white;
  font-weight: 600;
  font-size: 0.9375rem;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 4px 24px var(--mf-glow);
}

.dark .btn-primary { color: #0f172a; }

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 36px var(--mf-glow);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 1.85rem;
  border-radius: 999px;
  border: 2px solid var(--mf-primary);
  color: var(--mf-primary-dark);
  font-weight: 600;
  font-size: 0.9375rem;
  transition: all 0.25s ease;
}

.dark .btn-outline { color: var(--mf-primary); }

.btn-outline:hover {
  background: var(--mf-primary);
  color: white;
}

.dark .btn-outline:hover { color: #0f172a; }

.stat-number { font-variant-numeric: tabular-nums; }

.page-hero {
  padding-top: 8rem;
  padding-bottom: 4rem;
  position: relative;
}

.breadcrumb a { transition: color 0.2s ease; }
.breadcrumb a:hover { color: var(--mf-primary); }

.feature-line {
  width: 48px;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--mf-primary), var(--mf-accent));
}

/* ── Value card ── */
.value-card {
  position: relative;
  padding: 2rem;
  border-radius: 1.25rem;
  overflow: hidden;
}

.value-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--mf-primary), var(--mf-accent));
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--mf-primary);
  border-radius: 4px;
  opacity: 0.5;
}

/* ── Image fade in ── */
img[data-src] { opacity: 0; transition: opacity 0.6s ease; }
img.loaded { opacity: 1; }
