/* ═══════════════════════════════════════════════════════════════
   AGRI GROWTH ENGINE X — COMPONENTS
   Cards, hero, assistant panel, FAB, engagement elements
   ═══════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════
   1. HERO SECTION
   ══════════════════════════════════════ */
.agex-hero {
  position: relative;
  width: 100%;
  min-height: clamp(280px, 42vw, 520px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(24px, 4vw, 60px);
  border-radius: var(--agex-r-lg);
  overflow: hidden;
  margin-bottom: var(--agex-sp-lg);
  isolation: isolate;
}

.agex-hero__bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #0a3020 0%, #1a5c38 40%, #2d7a50 100%);
  z-index: -2;
}
.agex-hero__bg img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: .45;
  z-index: 0;
}
.agex-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(5,20,12,.90) 0%,
    rgba(5,20,12,.55) 50%,
    rgba(5,20,12,.15) 100%
  );
  z-index: 1;
}
.agex-hero__content {
  position: relative;
  z-index: 2;
  color: #fff;
  max-width: 780px;
}
.agex-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,196,106,.22);
  border: 1px solid rgba(0,196,106,.4);
  color: #7affb8;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: var(--agex-r-pill);
  margin-bottom: 14px;
  backdrop-filter: blur(8px);
}
.agex-hero__title {
  font-family: var(--agex-font-display);
  font-size: clamp(26px, 4.5vw, 52px);
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
  letter-spacing: -.03em;
  margin: 0 0 16px;
  text-shadow: 0 2px 20px rgba(0,0,0,.35);
}
.agex-hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: rgba(255,255,255,.72);
  margin-bottom: 22px;
}
.agex-hero__meta-dot { opacity: .4; }
.agex-hero__ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.agex-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: var(--agex-r-pill);
  font-family: var(--agex-font-display);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none !important;
  cursor: pointer;
  border: none;
  transition: transform var(--agex-dur) var(--agex-ease), box-shadow var(--agex-dur) ease;
}
.agex-btn--primary {
  background: linear-gradient(135deg, var(--agex-green-lite), var(--agex-green));
  color: #fff !important;
  box-shadow: 0 8px 28px rgba(0,147,69,.4);
}
.agex-btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(0,147,69,.52);
  color: #fff !important;
}
.agex-btn--glass {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.35);
  color: #fff !important;
  backdrop-filter: blur(12px);
}
.agex-btn--glass:hover {
  background: rgba(255,255,255,.25);
  transform: translateY(-2px);
  color: #fff !important;
}

/* ══════════════════════════════════════
   2. POST CARDS GRID
   ══════════════════════════════════════ */
.agex-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 20px;
  margin: 24px 0;
}

.agex-card {
  display: flex;
  flex-direction: column;
  background: var(--agex-surface);
  border: 1px solid var(--agex-glass-border);
  border-radius: var(--agex-r);
  overflow: hidden;
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  box-shadow: 0 4px 22px rgba(0,40,20,.10);
  transition:
    transform var(--agex-dur) var(--agex-ease),
    box-shadow var(--agex-dur) ease;
  will-change: transform;
  text-decoration: none !important;
  color: var(--agex-ink) !important;
}
.agex-card:hover {
  transform: translateY(-6px) scale(1.008);
  box-shadow: 0 18px 48px rgba(0,40,20,.18);
}

.agex-card__thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: linear-gradient(135deg, #c8eed8, #e8f8f0);
}
.agex-card__thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .5s var(--agex-ease-out);
  display: block;
}
.agex-card:hover .agex-card__thumb img {
  transform: scale(1.06);
}
.agex-card__cat-badge {
  position: absolute;
  top: 10px; left: 10px;
  background: rgba(0,147,69,.88);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--agex-r-pill);
  backdrop-filter: blur(8px);
}
.agex-card__diff-badge {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(0,0,0,.45);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: var(--agex-r-pill);
  backdrop-filter: blur(6px);
}

.agex-card__body {
  padding: 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.agex-card__title {
  font-family: var(--agex-font-display);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--agex-ink);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.agex-card__excerpt {
  font-size: 13.5px;
  color: var(--agex-ink-soft);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}
.agex-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--agex-muted);
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid rgba(0,147,69,.12);
}
.agex-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.agex-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--agex-green);
  background: var(--agex-green-pale);
  padding: 3px 9px;
  border-radius: var(--agex-r-pill);
}
.agex-card__read-time {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ══════════════════════════════════════
   3. FLOATING ASSISTANT (FAB + PANEL)
   ══════════════════════════════════════ */
/* FAB button */
.agex-fab {
  position: fixed;
  bottom: 24px; right: 20px;
  z-index: var(--agex-z-fab);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: var(--agex-r-pill);
  border: none;
  cursor: pointer;
  font-family: var(--agex-font-display);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--agex-green-lite), var(--agex-green));
  box-shadow:
    0 10px 32px rgba(0,147,69,.40),
    0 2px 0 rgba(255,255,255,.28) inset;
  transition:
    transform var(--agex-dur) var(--agex-ease),
    box-shadow var(--agex-dur) ease,
    opacity var(--agex-dur) ease;
  animation: agexFabPulse 3s ease-out infinite;
}
.agex-fab:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 18px 44px rgba(0,147,69,.52);
}
.agex-fab.is-open {
  opacity: 0;
  pointer-events: none;
  transform: scale(.85);
}
@keyframes agexFabPulse {
  0%,100% { box-shadow: 0 10px 32px rgba(0,147,69,.40), 0 0 0 0 rgba(0,196,106,.35); }
  50%      { box-shadow: 0 10px 32px rgba(0,147,69,.40), 0 0 0 12px rgba(0,196,106,0); }
}

/* Backdrop */
.agex-assistant-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5,20,12,.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1;
  opacity: 0;
  transition: opacity var(--agex-dur) ease;
}

/* Assistant wrapper */
#agex-assistant {
  position: fixed;
  inset: 0;
  z-index: var(--agex-z-assistant);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}
#agex-assistant:not([hidden]) {
  pointer-events: auto;
}
#agex-assistant:not([hidden]) .agex-assistant-backdrop {
  opacity: 1;
}

/* Panel */
.agex-assistant-panel {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: rgba(250,255,252,.96);
  border: 1px solid var(--agex-glass-border);
  border-bottom: none;
  border-radius: var(--agex-r-lg) var(--agex-r-lg) 0 0;
  box-shadow: 0 -8px 60px rgba(0,40,20,.22);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  transform: translateY(100%);
  transition: transform .38s var(--agex-ease-out);
  overflow: hidden;
}
#agex-assistant:not([hidden]) .agex-assistant-panel {
  transform: translateY(0);
}

/* Header */
.agex-assistant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0,147,69,.12);
  background: linear-gradient(180deg, #fff, rgba(240,255,248,.6));
}
.agex-assistant-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--agex-font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--agex-ink);
}
.agex-brand-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--agex-green);
  box-shadow: 0 0 0 3px rgba(0,147,69,.22);
  animation: agexBrandPulse 2s ease-out infinite;
}
@keyframes agexBrandPulse {
  0%,100% { box-shadow: 0 0 0 3px rgba(0,147,69,.22); }
  50%      { box-shadow: 0 0 0 7px rgba(0,147,69,0); }
}
.agex-assistant-close {
  width: 34px; height: 34px;
  border-radius: var(--agex-r-sm);
  border: none;
  background: rgba(0,0,0,.06);
  cursor: pointer;
  font-size: 15px;
  color: var(--agex-ink-soft);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--agex-dur) ease, transform var(--agex-dur) ease;
}
.agex-assistant-close:hover { background: rgba(0,147,69,.1); transform: rotate(-4deg); }

/* Thread */
.agex-assistant-thread {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}
.agex-assistant-thread::-webkit-scrollbar { width: 4px; }
.agex-assistant-thread::-webkit-scrollbar-thumb { background: rgba(0,147,69,.25); border-radius: 99px; }

.agex-msg { display: flex; }
.agex-msg--ai  { justify-content: flex-start; }
.agex-msg--user{ justify-content: flex-end; }

.agex-bubble {
  max-width: 80%;
  padding: 13px 17px;
  border-radius: 20px;
  font-size: 15px;
  line-height: 1.58;
  animation: agexBubbleIn .28s var(--agex-ease-out) both;
}
@keyframes agexBubbleIn {
  from { opacity:0; transform:translateY(8px) scale(.96); }
  to   { opacity:1; transform:translateY(0) scale(1); }
}
.agex-msg--ai .agex-bubble {
  background: #fff;
  border: 1px solid rgba(0,147,69,.18);
  color: var(--agex-ink);
  border-bottom-left-radius: 6px;
  box-shadow: 0 2px 12px rgba(0,40,20,.08);
}
.agex-msg--user .agex-bubble {
  background: linear-gradient(135deg, var(--agex-green-lite), var(--agex-green));
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,147,69,.30);
}

/* Result links in bubble */
.agex-bubble .agex-result-link {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--agex-green-pale);
  border: 1px solid rgba(0,147,69,.18);
  border-radius: var(--agex-r-sm);
  margin: 6px 0;
  text-decoration: none;
  color: var(--agex-ink) !important;
  transition: background var(--agex-dur) ease;
}
.agex-bubble .agex-result-link:hover { background: rgba(0,196,106,.15); }
.agex-result-link-title { font-weight: 600; font-size: 13.5px; line-height: 1.35; }
.agex-result-link-url   { font-size: 11px; color: var(--agex-muted); margin-top: 2px; }

/* Dots loader */
.agex-dots {
  display: flex; align-items: center; gap: 5px; padding: 6px 0;
}
.agex-dots span {
  width: 7px; height: 7px;
  background: var(--agex-muted);
  border-radius: 50%;
  animation: agexDot 1.2s ease-in-out infinite;
}
.agex-dots span:nth-child(2) { animation-delay: .2s; }
.agex-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes agexDot {
  0%,80%,100% { transform: scale(.7); opacity: .4; }
  40%          { transform: scale(1); opacity: 1; }
}

/* Suggestion chips */
.agex-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid rgba(0,147,69,.08);
}
.agex-chip {
  font-family: var(--agex-font-display);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--agex-r-pill);
  border: 1px solid rgba(0,147,69,.25);
  background: var(--agex-green-pale);
  color: var(--agex-ink-2);
  cursor: pointer;
  transition:
    transform var(--agex-dur) var(--agex-ease),
    background var(--agex-dur) ease,
    box-shadow var(--agex-dur) ease;
}
.agex-chip:hover {
  background: rgba(0,196,106,.18);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,147,69,.18);
}

/* Input row */
.agex-assistant-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid rgba(0,147,69,.12);
  background: #fff;
}
.agex-search-icon {
  color: var(--agex-muted);
  flex-shrink: 0;
}
.agex-chat-input {
  flex: 1;
  height: 48px;
  padding: 0 14px;
  border: 2px solid rgba(0,147,69,.25);
  border-radius: var(--agex-r-pill);
  font-family: var(--agex-font-body);
  font-size: 15px;
  color: var(--agex-ink);
  background: var(--agex-surface-3);
  outline: none;
  transition: border-color var(--agex-dur) ease, box-shadow var(--agex-dur) ease;
}
.agex-chat-input:focus {
  border-color: var(--agex-green);
  box-shadow: 0 0 0 4px rgba(0,196,106,.15);
}
.agex-chat-input::placeholder { color: var(--agex-muted); }
.agex-send-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--agex-green-lite), var(--agex-green));
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0,147,69,.32);
  transition: transform var(--agex-dur) var(--agex-ease), box-shadow var(--agex-dur) ease;
}
.agex-send-btn:hover { transform: scale(1.08); box-shadow: 0 8px 22px rgba(0,147,69,.44); }

/* ══════════════════════════════════════
   4. ENGAGEMENT ELEMENTS
   ══════════════════════════════════════ */
/* Sticky sidebar */
.agex-sticky-sidebar {
  position: sticky;
  top: 90px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* "Continue Reading" band */
.agex-continue-reading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-radius: var(--agex-r);
  background: var(--agex-surface);
  border: 1px solid var(--agex-glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--agex-glass-shadow);
  margin: 32px 0;
  text-decoration: none !important;
  color: var(--agex-ink) !important;
  transition: transform var(--agex-dur) var(--agex-ease), box-shadow var(--agex-dur) ease;
}
.agex-continue-reading:hover { transform: translateY(-2px); box-shadow: 0 18px 48px rgba(0,40,20,.16); }
.agex-continue-reading__label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--agex-green); }
.agex-continue-reading__title { font-family: var(--agex-font-display); font-size: 17px; font-weight: 700; color: var(--agex-ink); line-height: 1.25; }
.agex-continue-reading__arrow { font-size: 22px; color: var(--agex-green); flex-shrink: 0; }

/* Related posts */
.agex-related-section {
  margin: 40px 0;
  padding: 30px;
  border-radius: var(--agex-r-lg);
  background: var(--agex-surface-3);
  border: 1px solid rgba(0,147,69,.14);
}
.agex-related-section h3 {
  font-family: var(--agex-font-display);
  font-size: 20px;
  font-weight: 800;
  color: var(--agex-ink);
  margin: 0 0 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.agex-related-section h3::before {
  content: '';
  display: block;
  width: 4px; height: 22px;
  background: var(--agex-green);
  border-radius: var(--agex-r-pill);
}

/* ══════════════════════════════════════
   5. MONETISATION / CTA BLOCKS
   ══════════════════════════════════════ */
.agex-cta-block {
  position: relative;
  padding: 28px 28px 28px 20px;
  border-radius: var(--agex-r);
  background: linear-gradient(135deg, var(--agex-green-pale), #fff);
  border: 1px solid rgba(0,147,69,.2);
  border-left: 4px solid var(--agex-green);
  margin: 36px 0;
  display: flex;
  align-items: flex-start;
  gap: 18px;
  overflow: hidden;
}
.agex-cta-block::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(0,196,106,.15) 0%, transparent 70%);
  border-radius: 50%;
}
.agex-cta-block__icon {
  font-size: 32px;
  flex-shrink: 0;
  line-height: 1;
}
.agex-cta-block__content { flex: 1; }
.agex-cta-block__title {
  font-family: var(--agex-font-display);
  font-size: 17px;
  font-weight: 800;
  color: var(--agex-ink);
  margin: 0 0 6px;
}
.agex-cta-block__text {
  font-size: 14px;
  color: var(--agex-ink-soft);
  margin: 0 0 14px;
  line-height: 1.55;
}

/* Product/affiliate card */
.agex-product-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: var(--agex-r);
  background: var(--agex-surface);
  border: 1px solid var(--agex-glass-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0,40,20,.10);
  margin: 10px 0;
  text-decoration: none !important;
  color: var(--agex-ink) !important;
  transition: transform var(--agex-dur) var(--agex-ease), box-shadow var(--agex-dur) ease;
}
.agex-product-card:hover { transform: translateY(-3px); box-shadow: 0 12px 36px rgba(0,40,20,.16); }
.agex-product-card__thumb {
  width: 64px; height: 64px;
  border-radius: var(--agex-r-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--agex-green-pale);
}
.agex-product-card__name { font-weight: 700; font-size: 15px; margin: 0 0 4px; }
.agex-product-card__price { color: var(--agex-green); font-weight: 700; font-size: 14px; }
.agex-product-card__badge { font-size: 11px; color: var(--agex-muted); }

/* ══════════════════════════════════════
   6. READING EXPERIENCE
   ══════════════════════════════════════ */
body.agex-active.agex-single .entry-content {
  font-size: clamp(16px, 2vw, 18px);
  line-height: 1.78;
  max-width: 72ch;
  margin-left: auto;
  margin-right: auto;
  color: var(--agex-ink-2);
}
body.agex-active.agex-single .entry-content h2,
body.agex-active.agex-single .entry-content h3 {
  margin-top: 2.2em;
  margin-bottom: .6em;
}
body.agex-active.agex-single .entry-content blockquote {
  border-left: 4px solid var(--agex-green);
  padding: 16px 22px;
  background: var(--agex-green-pale);
  border-radius: 0 var(--agex-r-sm) var(--agex-r-sm) 0;
  margin: 24px 0;
  font-style: italic;
  color: var(--agex-ink-2);
}

/* ══════════════════════════════════════
   7. CONTENT TABLE OF CONTENTS
   ══════════════════════════════════════ */
.agex-toc {
  background: var(--agex-surface-3);
  border: 1px solid rgba(0,147,69,.18);
  border-radius: var(--agex-r);
  padding: 20px 24px;
  margin: 28px 0;
}
.agex-toc__title {
  font-family: var(--agex-font-display);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--agex-green);
  margin: 0 0 12px;
}
.agex-toc ol {
  margin: 0; padding-left: 20px;
}
.agex-toc li { margin: 6px 0; font-size: 14px; }
.agex-toc a { color: var(--agex-ink-2); text-decoration: none; font-weight: 500; }
.agex-toc a:hover { color: var(--agex-green); }

/* ══════════════════════════════════════
   8. FADE-IN ON SCROLL (JS adds class)
   ══════════════════════════════════════ */
.agex-reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .55s var(--agex-ease-out), transform .55s var(--agex-ease-out);
}
.agex-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
