/**
 * AgriKoshk v2 — Phase 02 Batch 2E — P2-06 Identity Visual Layer
 * Kill switch: window.AGRIKOSHK_V2_VISUAL_LAYER_ENABLED = false
 *   (requires html[data-v2-visual-layer="1"] set by tiny boot script)
 *
 * CLS-safe rules: no font-size jumps on hero LCP text, no padding inflation
 * on first viewport, no border-width changes, hover-only transforms.
 */

html[data-v2-visual-layer='1'] {
  --v2-forest: var(--brand-primary, #2d4f3c);
  --v2-ink: var(--brand-dark, #1e3328);
  --v2-leaf: var(--brand-accent, #769c58);
  --v2-soil: color-mix(in srgb, var(--brand-primary, #2d4f3c) 18%, #8b6914);
  --v2-mist: color-mix(in srgb, var(--brand-primary, #2d4f3c) 6%, var(--brand-page-bg, #f6f1e9));
  --v2-panel: #ffffff;
  --v2-line: color-mix(in srgb, var(--brand-primary, #2d4f3c) 16%, #e5e7eb);
  --v2-radius-card: 1.25rem;
  --v2-shadow-soft: 0 1px 2px rgb(30 51 40 / 0.04), 0 8px 24px rgb(30 51 40 / 0.05);
}

/* ---------- Typography (weight/color/tracking — keep sizes stable) ---------- */
html[data-v2-visual-layer='1'][data-agk-home='1'] .brand-kiosk-card h1,
html[data-v2-visual-layer='1'][data-agk-home='1'] [data-v2-hero='hero-identity'] h1 {
  color: var(--v2-ink);
  letter-spacing: -0.01em;
  font-weight: 800;
  text-wrap: balance;
}

html[data-v2-visual-layer='1'][data-agk-home='1'] [data-v2-hero='hero-identity'] p.leading-relaxed,
html[data-v2-visual-layer='1'][data-agk-home='1'] .brand-kiosk-card p.leading-relaxed {
  color: color-mix(in srgb, var(--v2-ink) 72%, #6b7280);
  line-height: 1.75;
}

html[data-v2-visual-layer='1'][data-agk-home='1'] .platform-v2-farm-section h2,
html[data-v2-visual-layer='1'][data-agk-home='1'] .platform-v2-tools-section h2,
html[data-v2-visual-layer='1'][data-agk-home='1'] [data-platform-patch='homepage-smart-services'] h2 {
  color: var(--v2-ink);
  letter-spacing: -0.015em;
  font-weight: 800;
}

html[data-v2-visual-layer='1'][data-agk-home='1'] .platform-v2-farm-section p,
html[data-v2-visual-layer='1'][data-agk-home='1'] .platform-v2-tools-section p,
html[data-v2-visual-layer='1'][data-agk-home='1'] [data-platform-patch='homepage-smart-services'] p {
  color: color-mix(in srgb, var(--v2-ink) 65%, #6b7280);
  line-height: 1.7;
}

/* ---------- Section atmosphere (decision vs marketplace) ---------- */
html[data-v2-visual-layer='1'][data-agk-home='1'] [data-platform-patch='homepage-smart-services'].platform-patch-smart-section,
html[data-v2-visual-layer='1'][data-agk-home='1'] [data-platform-patch='homepage-smart-services'] {
  background: linear-gradient(
    165deg,
    color-mix(in srgb, var(--v2-leaf) 10%, var(--brand-page-bg, #f6f1e9)) 0%,
    color-mix(in srgb, var(--v2-forest) 5%, var(--brand-page-bg, #f6f1e9)) 55%,
    var(--brand-page-bg, #f6f1e9) 100%
  );
  border: 1px solid transparent;
  border-color: color-mix(in srgb, var(--v2-leaf) 22%, transparent);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.55);
}

html[data-v2-visual-layer='1'][data-agk-home='1'] .platform-v2-farm-section {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--v2-forest) 7%, transparent) 0%,
    transparent 100%
  );
  border-block: 1px solid color-mix(in srgb, var(--v2-forest) 10%, transparent);
}

html[data-v2-visual-layer='1'][data-agk-home='1'] .platform-v2-tools-section {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--v2-leaf) 8%, white) 0%,
    color-mix(in srgb, var(--v2-forest) 4%, white) 100%
  ) !important;
  border-radius: 1.5rem;
  border: 1px solid color-mix(in srgb, var(--v2-leaf) 18%, transparent);
}

html[data-v2-visual-layer='1'][data-agk-home='1'] #v2-marketplace,
html[data-v2-visual-layer='1'][data-agk-home='1'] [data-v2-marketplace-banner] {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--v2-soil) 12%, white) 0%,
    color-mix(in srgb, var(--v2-forest) 6%, white) 100%
  );
  border: 1px solid color-mix(in srgb, var(--v2-soil) 28%, #e5e7eb);
  border-radius: 1.25rem;
}

/* Subtle section rhythm — use margin that collapses with existing py-* (avoid big jumps) */
html[data-v2-visual-layer='1'][data-agk-home='1'] .platform-v2-farm-section,
html[data-v2-visual-layer='1'][data-agk-home='1'] .platform-v2-tools-section {
  margin-block: 0.25rem;
}

/* ---------- Smart + Tools cards ---------- */
html[data-v2-visual-layer='1'][data-agk-home='1'] .platform-patch-card {
  background: var(--v2-panel);
  border-color: var(--v2-line) !important;
  border-radius: var(--v2-radius-card) !important;
  box-shadow: var(--v2-shadow-soft);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

html[data-v2-visual-layer='1'][data-agk-home='1'] .platform-patch-card:hover {
  border-color: color-mix(in srgb, var(--v2-leaf) 45%, #e5e7eb) !important;
  box-shadow: 0 2px 4px rgb(30 51 40 / 0.06), 0 12px 28px rgb(45 79 60 / 0.1);
  transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
  html[data-v2-visual-layer='1'][data-agk-home='1'] .platform-patch-card:hover {
    transform: none;
  }
}

html[data-v2-visual-layer='1'][data-agk-home='1'] .platform-patch-card-icon {
  background: color-mix(in srgb, var(--v2-leaf) 16%, white) !important;
  color: var(--v2-forest) !important;
  border: 1px solid color-mix(in srgb, var(--v2-leaf) 25%, transparent);
  box-sizing: border-box;
}

html[data-v2-visual-layer='1'][data-agk-home='1'] .platform-patch-card-icon svg {
  width: 1.35rem;
  height: 1.35rem;
}

html[data-v2-visual-layer='1'][data-agk-home='1'] .platform-patch-soon-pill {
  color: var(--v2-forest);
  background: color-mix(in srgb, var(--v2-leaf) 16%, white);
  border-color: color-mix(in srgb, var(--v2-leaf) 40%, transparent);
  font-weight: 800;
  letter-spacing: 0.01em;
}



html[data-v2-visual-layer='1'][data-agk-home='1'] .brand-badge {
  background: color-mix(in srgb, var(--v2-leaf) 14%, white);
  border: 1px solid color-mix(in srgb, var(--v2-leaf) 28%, transparent);
  color: var(--v2-forest);
}

/* ---------- CTA style (hero dual row + primary buttons) ---------- */
html[data-v2-visual-layer='1'][data-agk-home='1'] [data-v2-hero='cta-row'] a,
html[data-v2-visual-layer='1'][data-agk-home='1'] [data-v2-hero='cta-row'] button {
  border-radius: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: filter 140ms ease, box-shadow 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

html[data-v2-visual-layer='1'][data-agk-home='1'] [data-v2-hero='cta-row'] a:first-child,
html[data-v2-visual-layer='1'][data-agk-home='1'] [data-v2-hero='cta-row'] button:first-child,
html[data-v2-visual-layer='1'][data-agk-home='1'] [data-v2-hero='cta-primary'],
html[data-v2-visual-layer='1'][data-agk-home='1'] .brand-btn-primary {
  background: var(--v2-forest) !important;
  color: #fff !important;
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.12) inset, 0 6px 16px rgb(45 79 60 / 0.22);
}

html[data-v2-visual-layer='1'][data-agk-home='1'] [data-v2-hero='cta-row'] a:last-child,
html[data-v2-visual-layer='1'][data-agk-home='1'] [data-v2-hero='cta-row'] button:last-child,
html[data-v2-visual-layer='1'][data-agk-home='1'] [data-v2-hero='cta-secondary'] {
  border: 1px solid color-mix(in srgb, var(--v2-forest) 35%, #d1d5db) !important;
  color: var(--v2-ink) !important;
  background: color-mix(in srgb, white 88%, var(--v2-mist)) !important;
}

html[data-v2-visual-layer='1'][data-agk-home='1'] [data-v2-hero='cta-row'] a:hover,
html[data-v2-visual-layer='1'][data-agk-home='1'] [data-v2-hero='cta-row'] button:hover {
  filter: brightness(1.03);
}

/* Keep dual-CTA height stable (CLS) */
html[data-v2-visual-layer='1'][data-agk-home='1'] [data-v2-hero='cta-row'] {
  min-height: 3rem;
  align-items: center;
  gap: 0.75rem;
}

/* ---------- Nav identity polish (color only) ---------- */
html[data-v2-visual-layer='1'] header nav[data-v2-nav='desktop'] button[data-v2-nav-item],
html[data-v2-visual-layer='1'] header nav[data-v2-nav='desktop'] a {
  font-weight: 600;
  color: color-mix(in srgb, var(--v2-ink) 88%, #4b5563);
}

html[data-v2-visual-layer='1'] header nav[data-v2-nav='desktop'] button[data-v2-nav-item='tools'],
html[data-v2-visual-layer='1'] header nav[data-v2-nav='desktop'] button[data-v2-nav-item='farm'] {
  color: var(--v2-forest);
}

/* ---------- Tools hub page (when attribute present) ---------- */
html[data-v2-visual-layer='1'] .v2-tools-hub .v2-tools-card {
  border-color: var(--v2-line);
  box-shadow: var(--v2-shadow-soft);
  border-radius: var(--v2-radius-card);
}

html[data-v2-visual-layer='1'] .v2-tools-hub .v2-tools-cta-live {
  background: var(--v2-forest);
  box-shadow: 0 6px 16px rgb(45 79 60 / 0.2);
}

html[data-v2-visual-layer='1'] .v2-tools-hub .v2-tools-status-live {
  background: color-mix(in srgb, var(--v2-leaf) 18%, white);
  color: var(--v2-forest);
}

html[data-v2-visual-layer='1'] .v2-tools-hub .v2-tools-title {
  color: var(--v2-ink);
  letter-spacing: -0.015em;
}

/* ---------- Focus visibility ---------- */
html[data-v2-visual-layer='1'] .platform-patch-card:focus-visible,
html[data-v2-visual-layer='1'] [data-v2-hero='cta-row'] a:focus-visible,
html[data-v2-visual-layer='1'] [data-v2-hero='cta-row'] button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--v2-leaf) 70%, white);
  outline-offset: 2px;
}
