/* Cannabionics v6: section backgrounds, home hero carousel. Load after css/v4-grow.css on every page. */

/* ---------- 1. section backgrounds ---------- */
:root {
  --v6-grid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Ccircle cx='1' cy='1' r='1' fill='%23008136' fill-opacity='.22'/%3E%3C/svg%3E");
  --v6-rule: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='40'%3E%3Crect y='39' width='8' height='1' fill='%23008136' fill-opacity='.11'/%3E%3C/svg%3E");
  --v6-fade-y: linear-gradient(180deg, transparent 0, #000 96px, #000 calc(100% - 96px), transparent 100%);
}
.v3-bg-paper, .v3-bg-mint { isolation: isolate; }            /* .v3-sec already has position: relative; overflow: clip */
/* ponytail: z-index -1 (not 0) inside the isolated section, so static direct children (e.g. .c-docband) still paint above the texture */
.v3-bg-paper::before, .v3-bg-mint::before, .v3-hero-paper::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
}
/* V1 lab grid */
.v3-bg-paper::before {
  background: var(--v6-grid) 0 0 / 24px 24px; opacity: .85;
  -webkit-mask-image: var(--v6-fade-y); mask-image: var(--v6-fade-y);   /* fades at both ends: no seam between stacked paper sections */
}
/* V2 specimen plate: mint keeps its gradient (v3.css), the plate is green alpha through an SVG mask */
.v3-bg-mint:not(.v4-has-plate, .v3-sec--tight)::before {
  background-color: var(--cb-green); opacity: .07;
  -webkit-mask: url(/images/art/fan-leaf.svg) no-repeat right -140px top -120px / 560px auto;
          mask: url(/images/art/fan-leaf.svg) no-repeat right -140px top -120px / 560px auto;
}
/* second, fourth mint section on a page: plant plate from the left */
.v3-bg-mint ~ .v3-bg-mint:not(.v4-has-plate, .v3-sec--tight)::before,
.v3-bg-mint ~ .v3-bg-mint ~ .v3-bg-mint ~ .v3-bg-mint:not(.v4-has-plate, .v3-sec--tight)::before {
  -webkit-mask: url(/images/art/plant.svg) no-repeat left -120px bottom -80px / 520px auto;
          mask: url(/images/art/plant.svg) no-repeat left -120px bottom -80px / 520px auto;
}
.v3-bg-mint ~ .v3-bg-mint ~ .v3-bg-mint:not(.v4-has-plate, .v3-sec--tight)::before {
  -webkit-mask: url(/images/art/fan-leaf.svg) no-repeat right -140px top -120px / 560px auto;
          mask: url(/images/art/fan-leaf.svg) no-repeat right -140px top -120px / 560px auto;
}
/* V3 herbarium ruling: hero B (keeps the v3 radial mask at the top-right) and tight sections */
.v3-hero-paper::before { background: var(--v6-rule) 0 0 / 8px 40px; opacity: 1; }   /* v4.css set background-image: none; this wins (loaded later) */
.v3-sec--tight.v3-bg-paper::before, .v3-sec--tight.v3-bg-mint::before {
  background: var(--v6-rule) 0 0 / 8px 40px; background-color: transparent; opacity: 1;
  -webkit-mask: var(--v6-fade-y); mask: var(--v6-fade-y);
}
.v3-ledger-sec { background: #fff; }
@media (max-width: 767px) {
  .v3-bg-mint:not(.v4-has-plate, .v3-sec--tight)::before, .v3-bg-mint ~ .v3-bg-mint:not(.v4-has-plate, .v3-sec--tight)::before {
    opacity: .06; -webkit-mask-size: 300px auto; mask-size: 300px auto; -webkit-mask-position: right -80px bottom -60px; mask-position: right -80px bottom -60px;
  }
}

/* ---------- 2. home hero carousel ---------- */
.v6-hero { --v6-dwell: 6500ms; --v6-title: clamp(2.5rem, 1.4rem + 3.9vw, 4.75rem); }
.v6-hero > .v6-hero__wash { position: absolute; inset: 0; z-index: 0; pointer-events: none; }  /* beats .v4-has-plate > :not(...) (same specificity, later file) */
.v6-hero__wash::before, .v6-hero__wash::after { content: ""; position: absolute; inset: 0; transition: opacity 900ms var(--ease-out); }
.v6-hero__wash::before { background: radial-gradient(70% 60% at 82% 18%, rgba(255,197,60,.16), transparent 65%); opacity: 1; }   /* CBD: amber, the oil */
.v6-hero__wash::after  { background: radial-gradient(70% 60% at 82% 18%, rgba(0,129,54,.34), transparent 65%); opacity: 0; }     /* Ampleafy: green, growth */
.v6-hero[data-line="amp"] .v6-hero__wash::before { opacity: 0; }
.v6-hero[data-line="amp"] .v6-hero__wash::after  { opacity: 1; }

/* line plates: two in the DOM, one drawn. opacity handles the swap, the M3 clip wipe (v4-fx.css) handles the draw-on */
.v6-hero .v6-hero__plate { transition: clip-path var(--t-draw) var(--ease-out), opacity 400ms var(--ease-out); }
.v6-hero .v6-hero__plate:not(.is-in) { opacity: 0; }
.v6-hero .v6-hero__plate.is-in { opacity: .24; }
@media (max-width: 767px) { .v6-hero .v6-hero__plate.is-in { opacity: .12; } }

/* stack: every slide occupies the same grid cell, so the hero height is the tallest slide and never shifts */
.v6-hero__track { display: grid; touch-action: pan-y; }
.v6-slide { grid-area: 1 / 1; opacity: 0; visibility: hidden; transition: opacity 500ms var(--ease-inout), visibility 0s linear 500ms; }
.v6-slide.is-active { opacity: 1; visibility: visible; transition: opacity 700ms var(--ease-out), visibility 0s; }
html:not(.v3-js) .v6-slide:not(.is-active), html:not(.v3-js) .v6-hero__controls { display: none; }

/* .v6-hero prefix: slide 1 is an h1 and has to beat .v3-hero-split h1 */
.v6-hero .v6-slide__title { margin-top: var(--s-4); font-family: var(--ff-display); font-size: var(--v6-title); line-height: 1.02; letter-spacing: var(--ls-display); font-weight: 450; font-variation-settings: "opsz" 72; color: #fff; text-wrap: balance; max-width: 16ch; }
.v6-hero .v6-slide__title em { font-style: italic; font-weight: 400; letter-spacing: -.005em; padding-inline-end: .05em; color: inherit; }
.v6-hero .v6-slide__title em:has(+ .v3-reg) { padding-inline-end: 0; }
.v6-hero .v6-slide__visual { aspect-ratio: 4 / 3; }
@media (min-width: 960px) { .v6-hero .v6-slide__visual { aspect-ratio: 1 / 1; } }
.v6-slide__visual img { width: 100%; height: 100%; object-fit: cover; object-position: var(--v6-focal, 50% 50%); transform-origin: 50% 50%; }
.v6-hero .v6-slide__visual--render { background: radial-gradient(circle at 50% 50%, #fff 0%, var(--cb-mint) 70%); }
.v6-slide__visual--render img { object-fit: contain; object-position: 72% 22%; padding: 6% 6% 30% 30%; }   /* product top-right, clear of the fact card at bottom-left */
.v6-slide__card--stat dd { font-family: var(--ff-display); font-weight: 500; font-size: var(--fs-num); line-height: 1; letter-spacing: var(--ls-num); color: var(--cb-green); font-variant-numeric: tabular-nums lining-nums; }

/* entrance: incoming slide reveals its copy in a stagger, outgoing just fades with the slide (no delays outside .is-active).
   Eyebrow slides in from the left, the headline wipes up from a mask, the italic phrase de-blurs after it, the rest rises. */
.v6-slide__eyebrow { opacity: 0; transform: translateX(-28px); transition: opacity 500ms var(--ease-out), transform 700ms var(--ease-out); }
.v6-hero .v6-slide__title { opacity: 0; transform: translateY(42px); clip-path: inset(0 -6% 100% -6%); transition: opacity 400ms var(--ease-out), transform 1000ms cubic-bezier(.16, 1, .3, 1), clip-path 1000ms cubic-bezier(.16, 1, .3, 1); }
.v6-hero .v6-slide__title em { opacity: 0; filter: blur(10px); transition: opacity 600ms var(--ease-out), filter 800ms var(--ease-out); }
.v6-slide__lead, .v6-slide__actions, .v6-slide__card { opacity: 0; transform: translateY(26px); transition: opacity 600ms var(--ease-out), transform 800ms cubic-bezier(.16, 1, .3, 1); }
.v6-slide__visual { opacity: 0; transform: scale(.96); transition: opacity 800ms var(--ease-out), transform 1100ms cubic-bezier(.16, 1, .3, 1); }
.v6-hero .v6-slide.is-active :is(.v6-slide__eyebrow, .v6-slide__title, .v6-slide__lead, .v6-slide__actions, .v6-slide__card, .v6-slide__visual) { opacity: 1; transform: none; }
.v6-hero .v6-slide.is-active .v6-slide__title { clip-path: inset(-12% -6% -30% -6%); }   /* final inset leaves room for italic descenders */
.v6-hero .v6-slide.is-active .v6-slide__title em { opacity: 1; filter: none; }
.v6-slide.is-active .v6-slide__visual  { transition-delay: 60ms; }
.v6-slide.is-active .v6-slide__eyebrow { transition-delay: 120ms; }
.v6-hero .v6-slide.is-active .v6-slide__title    { transition-delay: 200ms; }
.v6-hero .v6-slide.is-active .v6-slide__title em { transition-delay: 620ms; }
.v6-slide.is-active .v6-slide__lead    { transition-delay: 520ms; }
.v6-slide.is-active .v6-slide__actions { transition-delay: 660ms; }
.v6-slide.is-active .v6-slide__card    { transition-delay: 780ms; }

/* Ken Burns: transform only, 8 s so it never settles inside the 6.5 s dwell, restarts on activation */
@keyframes v6-kb        { from { transform: scale(1) translate3d(0, 0, 0); } to { transform: scale(1.08) translate3d(-1.6%, -1.2%, 0); } }
@keyframes v6-kb-render { from { transform: scale(1) translate3d(0, 0, 0); } to { transform: scale(1.05) translate3d(0, -1.5%, 0); } }
.v6-slide.is-active .v6-slide__visual--photo img  { animation: v6-kb 8000ms linear forwards; will-change: transform; }
.v6-slide.is-active .v6-slide__visual--render img { animation: v6-kb-render 8000ms linear forwards; will-change: transform; }
.v6-hero.is-paused .v6-slide__visual img, .v6-hero.is-paused .v6-hero__fill { animation-play-state: paused; }

/* controls strip */
/* progress centred; prev/next sit faintly on the far left and right edges of the hero */
.v6-hero__controls { display: flex; justify-content: center; margin-top: var(--s-6); color: var(--cb-on-dark); }
.v6-hero > .v6-hero__edge {
  position: absolute; top: 50%; z-index: 3; display: grid; place-items: center; width: 52px; height: 52px; margin-top: -26px; padding: 0;
  border: 0; border-radius: 50%; background: none; color: #fff; opacity: .32; cursor: pointer;
  transition: opacity var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.v6-hero__edge--prev { left: clamp(4px, 1.2vw, 20px); }
.v6-hero__edge--next { right: clamp(4px, 1.2vw, 20px); }
.v6-hero__edge .v3-ic { width: 26px; height: 26px; }
.v6-hero__edge:hover, .v6-hero__edge:focus-visible { opacity: .9; }
.v6-hero__edge--prev:hover { transform: translateX(-3px); }
.v6-hero__edge--next:hover { transform: translateX(3px); }
.v6-hero__edge:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
html:not(.v3-js) .v6-hero__edge { display: none; }
.v6-hero__dots { display: flex; gap: 6px; width: min(420px, 100%); }
.v6-hero__dot { position: relative; flex: 1 1 24px; height: 44px; padding: 0; border: 0; background: none; cursor: pointer; }
.v6-hero__dot::before { content: ""; position: absolute; left: 0; right: 0; top: 21px; height: 2px; border-radius: 1px; background: rgba(255,255,255,.28); }
.v6-hero__fill { position: absolute; left: 0; right: 0; top: 21px; height: 2px; border-radius: 1px; background: var(--cb-yellow); transform: scaleX(0); transform-origin: left; }
.v6-hero__dot.is-done .v6-hero__fill { transform: none; }
@keyframes v6-fill { to { transform: none; } }
.v6-hero__dot.is-active .v6-hero__fill { animation: v6-fill var(--v6-dwell) linear forwards; }
.v6-hero.is-stopped .v6-hero__dot.is-active .v6-hero__fill { animation: none; transform: scaleX(.35); }   /* stopped: a short marker, not a timer */
.v6-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (max-width: 599.98px) { .v6-hero > .v6-hero__edge { display: none; } }   /* phones swipe; edge arrows would sit on the copy */
@media (min-width: 960px) {
  .v6-hero .v3-hero-split__grid { align-items: start; }   /* every slide's copy starts at the same height, no jump in the crossfade */
  .v6-slide__copy { padding-top: var(--s-6); }
}
@media (max-width: 959.98px) {
  /* 4:3 panel under a wide card: product in the top band, the card's two facts side by side so it stays low */
  .v6-slide__visual--render img { object-position: 50% 0; padding: 5% 6% 30%; }
  .v6-slide__visual--render + .v6-slide__card { grid-auto-flow: column; }
  .v6-slide__visual--render + .v6-slide__card div + div { padding: 0 0 0 var(--s-4); border-top: 0; border-left: 1px solid var(--cb-hair); }
}

/* no JS: slide 1 shows its final state, controls are hidden above */
html:not(.v3-js) .v6-slide.is-active * { opacity: 1; transform: none; clip-path: none; filter: none; transition: none; }

/* reduced motion: no drift, no stagger (v3.css already zeroes transition durations), instant swap */
@media (prefers-reduced-motion: reduce) {
  .v6-slide.is-active .v6-slide__visual img { animation: none; will-change: auto; }
  .v6-hero__dot.is-active .v6-hero__fill { animation: none; transform: scaleX(.35); }
  .v6-hero .v6-hero__plate { transition: none; }
  .v6-hero .v6-slide__title, .v6-hero .v6-slide__title em { clip-path: none; filter: none; }
}
