/* Tom & Berry strain slider hero. One strain at a time: colour world (MAGI-2 loop or still),
   giant strain name in brand lettering, the exact 3D jar render, floating buds, controls.
   Markup: tb-strain-hero.php (WordPress) or the bench build script. */

.tbh {
  --hybrid: #7CC360; --indica: #3F408E; --cream: #FFEFCF; --red: #E63625; --black: #231F20;
  --sans: "DM Sans", "Helvetica Neue", Arial, sans-serif;          /* kit Body / Button / Kicker */
  --hw: "Russo One", "Arial Black", sans-serif;                     /* kit Headline (DDC Hardware stand-in) */
  --serif: "Philosopher", Georgia, serif;                           /* kit Label Serif */
  /* --ink = text on the world, --paper = the opposite brand neutral (text on an --ink fill) */
  --world: var(--hybrid); --ink: var(--black); --paper: var(--cream);
  --hdr: 0px;                                      /* height of a solid header above the hero */
  --ease: cubic-bezier(.2, .8, .2, 1);
  position: relative; isolation: isolate; overflow: hidden; overflow: clip;   /* clip: never a scroll container */
  height: calc(100svh - var(--hdr)); min-height: 600px; max-height: 1100px;
  background: var(--world); color: var(--ink);
  font-family: var(--sans);
  transition: background-color .9s var(--ease), color .6s;
}
.tbh[data-type="indica"] { --world: var(--indica); --ink: var(--cream); --paper: var(--black); }

/* 1. world */
.tbh__world, .tbh__w, .tbh__w > * { position: absolute; inset: 0; }
.tbh__w { opacity: 0; transition: opacity 1s var(--ease); }
.tbh__w.is-on { opacity: 1; }
.tbh__w > img, .tbh__w > video { width: 100%; height: 100%; object-fit: cover; }
.tbh__w > img { animation: tbhDrift 18s ease-in-out infinite alternate; }   /* still poster still breathes */
.tbh__w.has-video > img { opacity: 0; transition: opacity .6s; }
/* scrim in the world colour under the info block, so drifting buds never fight the text */
.tbh__world::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(66% 62% at 0% 100%, color-mix(in srgb, var(--world) 88%, transparent) 0, color-mix(in srgb, var(--world) 60%, transparent) 45%, transparent 75%); }

/* 2. giant name (behind the jar) */
.tbh__names { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.tbh__name {
  --cap: min(calc(92vw / var(--len)), 30vh);
  position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%);
  display: flex; gap: calc(var(--cap) * .58); align-items: center; white-space: nowrap;
  color: var(--cream);
}
.tbh__line { display: flex; gap: calc(var(--cap) * .58); }
.tbh__word { display: block; height: var(--cap); overflow: hidden; }
.tbh__word > svg { display: block; height: 100%; width: auto;
  transform: translateY(125%); transition: transform .8s var(--ease) calc(var(--k) * 70ms); }
.tbh__name.is-on .tbh__word > svg { transform: none; }
/* strains without lettering on file: plain text in the same box */
.tbh__name--text .tbh__word > span { display: block; font: 400 calc(var(--cap) * 1.05)/1 var(--hw); letter-spacing: 0; text-transform: uppercase;
  transform: translateY(125%); transition: transform .8s var(--ease); }
.tbh__name--text.is-on .tbh__word > span { transform: none; }
.tbh__name.is-out .tbh__word > svg { transform: translateY(-125%); transition-duration: .5s; transition-delay: calc(var(--k) * 40ms); }

/* 3. jar */
.tbh__jars { position: absolute; left: 50%; bottom: 7vh; z-index: 3; width: min(52vh, 40vw); aspect-ratio: 1422 / 1836;
  transform: translateX(-50%); animation: tbhFloat 7s ease-in-out infinite; }
.tbh__jar { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  opacity: 0; transform: translateX(calc(var(--dir, 1) * 38%)) rotate(calc(var(--dir, 1) * 9deg)) scale(.9);
  transition: opacity .55s var(--ease), transform .9s var(--ease);
  filter: drop-shadow(0 28px 34px rgba(20, 15, 16, .28)); }
.tbh__jar.is-on { opacity: 1; transform: none; }
.tbh__jar.is-out { opacity: 0; transform: translateX(calc(var(--dir, 1) * -38%)) rotate(calc(var(--dir, 1) * -9deg)) scale(.9); }
.tbh__shadow { position: absolute; left: 50%; bottom: 5.5vh; z-index: 2; width: min(40vh, 30vw); height: 4.5vh;
  transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(closest-side, rgba(20, 15, 16, .35), transparent);
  animation: tbhShadow 7s ease-in-out infinite; }

/* 4. foreground buds */
.tbh__bud { position: absolute; z-index: 4; pointer-events: none; user-select: none;
  translate: calc(var(--px, 0) * var(--depth)) calc(var(--py, 0) * var(--depth)); transition: translate .6s var(--ease); }
.tbh__bud--a { --depth: 28px; width: min(22vw, 300px); left: 3vw; bottom: -4vh; filter: blur(5px); animation: tbhBudA 11s ease-in-out infinite; }
.tbh__bud--b { --depth: 16px; width: min(9vw, 130px); right: 26vw; top: 22vh; filter: blur(1.5px); animation: tbhBudB 9s ease-in-out infinite; }

/* 5. UI. Type and buttons follow the site's Elementor kit (Kicker, Badge, Label Serif, Button) */
.tbh .tbh__arrow:focus-visible, .tbh .tbh__btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

.tbh__info { position: absolute; z-index: 6; left: 5vw; bottom: 7vh; width: min(30rem, 30vw); display: grid; }
.tbh__kicker { grid-row: 1; }
.tbh__slide { grid-row: 2; grid-column: 1; align-self: end; opacity: 0; visibility: hidden;
  transform: translateY(14px); transition: opacity .5s, transform .7s var(--ease), visibility 0s .7s; }
.tbh__slide.is-on { opacity: 1; visibility: visible; transform: none; transition-delay: .15s, .15s, 0s; }
.tbh .tbh__kicker { margin: 0 0 .9rem; color: var(--ink); font: 700 13px/1.3 var(--sans); letter-spacing: 2.6px; text-transform: uppercase; }
.tbh .tbh__count { margin: 0 0 .6rem; color: var(--ink); font: 400 1.15rem/1 var(--hw); letter-spacing: .04em; }
.tbh__count span { opacity: .78; }                                   /* ≥4.5:1 on both worlds */
.tbh .tbh__chip { display: inline-block; margin: 0 0 .8rem; padding: .42rem .75rem; border-radius: 999px;
  background: var(--ink); color: var(--world); font: 800 12px/1 var(--sans); letter-spacing: 1.6px; text-transform: uppercase; }
.tbh .tbh__lineage { margin: 0 0 1.3rem; color: var(--ink); font: 400 1.2rem/1.45 var(--serif); }
.tbh__ctas { display: flex; flex-wrap: wrap; gap: .7rem; margin: 0; }
/* site button: DM Sans 700 13px caps, 1.8px tracking, 40px pill, 17/30 padding.
   Solid = the --ink neutral (Rich Black on green, Label Cream on purple); ghost = 2px ring in the same neutral.
   Hover inverts, as the site's ink/cream/ghost buttons do. Every state is ≥7:1 text contrast. */
.tbh .tbh__btn, .tbh .tbh__btn:visited { display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: 17px 30px; border-radius: 40px; border: 0; background: var(--ink); color: var(--paper) !important;
  box-shadow: inset 0 0 0 2px var(--ink); font: 700 13px/1.2 var(--sans); letter-spacing: 1.8px; text-transform: uppercase;
  text-decoration: none !important; white-space: nowrap;
  transition: transform .25s var(--ease), background-color .25s, color .25s, box-shadow .25s; }
.tbh .tbh__btn:hover { transform: translateY(-2px); background: var(--paper); color: var(--ink) !important;
  box-shadow: inset 0 0 0 2px var(--paper), 0 10px 24px -10px rgba(20, 15, 16, .5); }
.tbh .tbh__btn--ghost, .tbh .tbh__btn--ghost:visited { background: transparent; color: var(--ink) !important; }
.tbh .tbh__btn--ghost:hover { background: var(--ink); color: var(--paper) !important;
  box-shadow: inset 0 0 0 2px var(--ink), 0 10px 24px -10px rgba(20, 15, 16, .5); }

.tbh__ctrl { position: absolute; z-index: 6; right: 5vw; bottom: 7vh; display: flex; align-items: center; gap: .8rem; }
/* .tbh prefix + every state: the site theme styles all <button>s (red pill, caps, padding) */
.tbh .tbh__arrow, .tbh .tbh__arrow:hover, .tbh .tbh__arrow:focus, .tbh .tbh__arrow:active {
  width: 3.2rem; height: 3.2rem; min-width: 0; padding: 0; margin: 0; border-radius: 50%; border: 0; box-shadow: none;
  background: var(--ink); color: var(--world); display: grid; place-items: center; cursor: pointer;
  font: inherit; text-transform: none; letter-spacing: 0; line-height: 1; transition: transform .25s var(--ease); }
.tbh .tbh__arrow:hover { transform: scale(1.08); }
/* the theme paints every <button> with a red ::before/::after layer and fills all SVGs: switch both off */
.tbh .tbh__arrow::before, .tbh .tbh__arrow::after { content: none !important; display: none !important; }
.tbh .tbh__arrow svg { width: 1.2rem; height: 1.2rem; fill: none !important; stroke: currentColor; }
.tbh .tbh__arrow svg path { fill: none !important; }
.tbh__progress { width: 4.5rem; height: 3px; border-radius: 3px; background: color-mix(in srgb, var(--ink) 25%, transparent); overflow: hidden; }
.tbh__progress i { display: block; height: 100%; width: 100%; background: var(--ink); transform-origin: left; transform: scaleX(0); }
.tbh.is-playing .tbh__progress i { animation: tbhProg var(--dur, 6s) linear forwards; }
.tbh.is-paused .tbh__progress i { animation-play-state: paused; }
.tbh__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@keyframes tbhFloat { 0%, 100% { transform: translateX(-50%) translateY(0) rotate(-1deg); } 50% { transform: translateX(-50%) translateY(-16px) rotate(1deg); } }
@keyframes tbhShadow { 0%, 100% { transform: translateX(-50%) scale(1); opacity: 1; } 50% { transform: translateX(-50%) scale(.86); opacity: .7; } }
@keyframes tbhBudA { 0%, 100% { transform: translateY(0) rotate(-8deg); } 50% { transform: translateY(-26px) rotate(4deg); } }
@keyframes tbhBudB { 0%, 100% { transform: translateY(0) rotate(12deg); } 50% { transform: translateY(18px) rotate(-6deg); } }
@keyframes tbhDrift { from { transform: scale(1.04) translate(0, 0); } to { transform: scale(1.1) translate(-1.2%, -1%); } }
@keyframes tbhProg { to { transform: scaleX(1); } }

/* phone / portrait. Sizes follow the hero's own height (--H = viewport minus the site header), not vh,
   so name, jar and info never collide under a real header or a short Safari viewport. */
@media (max-width: 767px), (max-aspect-ratio: 4/5) {
  .tbh { min-height: 640px; --H: clamp(640px, calc(100svh - var(--hdr)), 1100px); }
  .tbh__name { --cap: min(calc(88vw / var(--len-m)), calc(var(--H) * .1)); flex-direction: column; gap: calc(var(--cap) * .18);
    top: calc(var(--H) * .045); transform: translate(-50%, 0); }
  .tbh__jars { width: calc(var(--H) * .35 / 1.291); top: calc(var(--H) * .25); bottom: auto; }
  .tbh__shadow { width: calc(var(--H) * .2); height: calc(var(--H) * .035); top: calc(var(--H) * .585); bottom: auto; }
  .tbh__info { left: 1.25rem; right: 1.25rem; bottom: 2rem; width: auto; }
  .tbh__world::after { background: linear-gradient(to top, color-mix(in srgb, var(--world) 86%, transparent) 0, color-mix(in srgb, var(--world) 60%, transparent) 26%, transparent 42%); }
  .tbh__ctrl { left: .75rem; right: .75rem; top: calc(var(--H) * .425 - 1.3rem); bottom: auto; justify-content: space-between; pointer-events: none; }
  .tbh__ctrl .tbh__arrow { pointer-events: auto; }
  .tbh .tbh__arrow, .tbh .tbh__arrow:hover, .tbh .tbh__arrow:focus, .tbh .tbh__arrow:active { width: 2.6rem; height: 2.6rem; }
  .tbh__progress { display: none; }
  .tbh__bud--a { width: 34vw; left: -8vw; top: calc(var(--H) * .5); bottom: auto; }
  .tbh__bud--b { width: 14vw; right: 3vw; top: calc(var(--H) * .2); bottom: auto; }
  .tbh .tbh__kicker { margin-bottom: .7rem; }
  .tbh .tbh__lineage { margin-bottom: 1rem; font-size: 1.05rem; }
  .tbh__ctas { gap: .5rem; }
  .tbh .tbh__btn, .tbh .tbh__btn:visited { padding: 15px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .tbh *, .tbh *::before { animation: none !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
}
