/* =====================================================================
   Golfkit — App feature showcase, v3  (merged into "The modern caddie")
   Lives inside the site's own <section class="state on-cream showcase"
   id="about">, reusing its tokens, .wrap, .state-grid, .state-idx,
   #stateText and the .rv reveal.
   Two selector modes, switched by showcase.js at 900px:
     · desktop  → .wheel-area.is-pills : tappable pill "bubbles", wrapping
       left-aligned under the statement; the active pill fills with mint
       as its clip plays (the fill IS the progress bar)
     · phones   → .wheel-area.is-drum  : the 3D label drum
   The tour always runs: a tap jumps it, it never stops it.
   ===================================================================== */

.showcase{
  /* ---- theme: cream by default (the section carries .on-cream). */
  --sc-fg: var(--ink, #101410);
  --sc-muted: var(--ink-soft, #49514b);
  --sc-line: var(--line-ink, rgba(16,20,16,.12));
  --sc-accent: var(--green-deep, #1E8E6E);
  --sc-fill: var(--green, #2CD192);
  --sc-card: var(--card, #fff);
  --sc-glow: rgba(44,209,146,.14);
  --sc-contour: rgba(30,142,110,.10);

  /* ---- device size: matches the old baked video (≈600–680px tall) on desktop */
  --phone-w: clamp(266px, 25vh + 92px, 330px);
  --bezel: calc(var(--phone-w) * .030);
  --screen-w: calc(var(--phone-w) - 2 * var(--bezel));
  --screen-h: calc(var(--screen-w) * 2.1611);      /* 720 × 1556 clips */

  /* ---- pills (desktop) */
  --pill-font: clamp(14px, .8rem + .22vw, 16.5px);

  /* ---- drum (phones) */
  --wheel-font: clamp(1.3rem, .95rem + 1.2vw, 1.9rem);
  --wheel-gap: clamp(30px, 2.6vw, 48px);           /* visual gap between labels on the drum */
  --wheel-dim: .40;                                /* brightness of resting side labels */
  --wheel-persp: 800px;
}
/* dark-stage variant kept for reuse elsewhere */
.showcase.on-dark{
  --sc-fg: var(--text, #f4f7f4);
  --sc-muted: var(--muted, #a9b3ac);
  --sc-line: var(--line, rgba(255,255,255,.12));
  --sc-accent: var(--green, #2CD192);
  --sc-card: #101512;
  --sc-glow: rgba(44,209,146,.22);
  --sc-contour: rgba(44,209,146,.10);
}

/* ------------------------------------------------- merged-section layout */
section.state.showcase{ padding-bottom: clamp(96px, 12vh, 160px); overflow: clip; }
/* section vertical padding (desktop): scoped >900px so the mobile rules below stand */
@media (min-width: 901px){
  .state{ padding: clamp(70px, 1vh, 150px) 0; }
}
/* neutralise the site's old .state-media video sizing/nudge (it targeted the
   baked demo video) so it can never reach the clips inside the device */
.showcase .state-media .clip video, .showcase .state-media .clip img{
  width: 100%; height: 100%; transform: none; background: transparent;
}
.showcase .showcase-anchor{ position: absolute; top: 0; }   /* #features target for the nav */

.showcase .state-grid{
  grid-template-columns: minmax(0,1fr) auto;
  grid-template-areas: "copy media" "wheel media";
  align-items: center;
  align-content: center;
  row-gap: 85px;
}
.showcase .state-copy{ grid-area: copy; align-self: end; }
.showcase .state-media{ grid-area: media; align-self: center; position: relative; }
.showcase .wheel-area{ grid-area: wheel; align-self: start; min-width: 0; }

@media (max-width: 900px){
  .showcase .state-grid{
    grid-template-columns: minmax(0,1fr);
    grid-template-areas: "copy" "media" "wheel";
    row-gap: clamp(26px, 4vh, 40px);
  }
  .showcase{ --phone-w: clamp(184px, min(58vw, 36vh), 300px); }
  section.state.showcase{ padding-bottom: clamp(130px, 10vh, 220px); }
}
/* short landscape phones */
@media (max-height: 520px) and (orientation: landscape){
  .showcase{ --phone-w: clamp(150px, 52vh, 220px); }
}

/* ------------------------------------------------------------ device */
.device-wrap{ position: relative; z-index: 1; }
.showcase-rings{
  position: absolute; left: 50%; top: 50%;
  width: calc(var(--phone-w) * 2.9); height: calc(var(--phone-w) * 2.9);
  transform: translate(-50%, -50%);
  pointer-events: none;
  color: var(--sc-contour);
}
.showcase-rings::before{
  content: ""; position: absolute; inset: -12%;
  background: radial-gradient(circle at 50% 50%, var(--sc-glow), transparent 58%);
}
.showcase-rings svg{ width: 100%; height: 100%; display: block; overflow: visible; }

.device{
  position: relative;
  width: var(--phone-w);
  padding: var(--bezel);
  border-radius: calc(var(--phone-w) * .158);
  background:
    linear-gradient(155deg, #3b3e3c 0%, #1a1c1b 22%, #101211 50%, #1c1e1d 78%, #34373a 100%);
  box-shadow:
    0 0 0 1px rgba(255,255,255,.07),
    0 34px 70px -28px rgba(8,18,14,.55),
    0 14px 32px -18px rgba(8,18,14,.4);
}
.device::before{
  content: ""; position: absolute; inset: calc(var(--bezel) * .38);
  border-radius: calc(var(--phone-w) * .158 - var(--bezel) * .38);
  background: #050605;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
}
.device-screen{
  position: relative;
  width: var(--screen-w);
  height: var(--screen-h);
  border-radius: calc(var(--phone-w) * .128);
  overflow: hidden;
  background: #1c1d20;
  isolation: isolate;
  transform: translateZ(0);
}
.device-btn{
  position: absolute; width: calc(var(--bezel) * .55); background: linear-gradient(90deg,#2a2d2b,#111312);
  border-radius: 2px; box-shadow: 0 0 0 .5px rgba(255,255,255,.08);
}
.device-btn.l1{ left: calc(var(--bezel) * -.5); top: 17%; height: 4.2%; }
.device-btn.l2{ left: calc(var(--bezel) * -.5); top: 24%; height: 7.4%; }
.device-btn.l3{ left: calc(var(--bezel) * -.5); top: 33%; height: 7.4%; }
.device-btn.r1{ right: calc(var(--bezel) * -.5); top: 27%; height: 11.5%; }

.device-island{
  position: absolute; left: 50%; top: calc(var(--screen-h) * .0135);
  width: calc(var(--screen-w) * .32); height: calc(var(--screen-h) * .0405);
  transform: translateX(-50%); border-radius: 999px; background: #000;
  z-index: 3;
}
.device-status{
  position: absolute; left: 0; right: 0; top: 0; height: calc(var(--screen-h) * .062);
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--screen-h) * .004) calc(var(--screen-w) * .075) 0 calc(var(--screen-w) * .09);
  color: #fff; z-index: 3; pointer-events: none;
  font: 600 calc(var(--screen-w) * .044)/1 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.device-status .icons{ display: flex; align-items: center; gap: calc(var(--screen-w) * .016); }
.device-status svg{ height: calc(var(--screen-w) * .034); width: auto; display: block; }

/* clips: poster underneath, video on top */
.clip{
  position: absolute; inset: 0; margin: 0;
  opacity: 0;
  transition: opacity .7s var(--ease);
  will-change: opacity;
}
.clip.is-active{ opacity: 1; z-index: 2; }
.clip img, .clip video{
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.clip video{ z-index: 1; }
.clip.is-broken video{ display: none; }

/* =========================================================== selector */
.wheel{ position: relative; }
.wheel-item{
  margin: 0; border: 0; background: none; padding: 0;
  font-family: var(--display);
  color: var(--sc-fg);
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.wheel-item:focus{ outline: none; }
.wheel-item:focus-visible{ outline: 2px solid var(--sc-accent); outline-offset: 4px; border-radius: 999px; }
.wheel-num, .wheel-label{ position: relative; z-index: 1; }

/* the progress element lives inside every button; each mode shapes it */
.wheel-bar{ position: absolute; overflow: hidden; pointer-events: none; }
.wheel-bar::after{
  content: ""; position: absolute; inset: 0; background: var(--sc-accent);
  transform-origin: 0 50%; transform: scaleX(var(--p, 0));
}

/* --------------------------------------------------- pills (desktop) */
.wheel-area.is-pills .wheel-clip{ overflow: visible; }
.wheel-area.is-pills .wheel{
  display: flex; flex-wrap: wrap; justify-content: flex-start;
  gap: 10px 10px;
}
.wheel-area.is-pills .wheel-item{
  position: relative; display: inline-flex; align-items: baseline; gap: .6em;
  padding: .8em 1.25em .84em 1.1em; border-radius: 999px;
  border: 1px solid var(--line-ink-2, rgba(16,20,16,.22));
  background: transparent;
  font-size: var(--pill-font); font-weight: 700; line-height: 1; letter-spacing: -.01em;
  overflow: hidden; isolation: isolate;
  transition: border-color .35s var(--ease), background-color .35s var(--ease),
              box-shadow .35s var(--ease), transform .35s var(--ease);
}
.wheel-area.is-pills .wheel-item:hover{
  background: var(--sc-card); border-color: var(--ink-faint, #8b928c);
  transform: translateY(-1px);
}
.wheel-area.is-pills .wheel-item:active{ transform: translateY(0) scale(.98); }
.wheel-area.is-pills .wheel-item[aria-selected="true"]{
  background: var(--sc-card); border-color: rgba(30,142,110,.35);
  box-shadow: 0 12px 26px -14px rgba(30,142,110,.5);
  cursor: default;
}
.wheel-area.is-pills .wheel-num{
  font-size: .68em; font-weight: 800; letter-spacing: .08em;
  color: var(--sc-accent); font-variant-numeric: tabular-nums;
  opacity: .85;
}
/* the mint fill sweeping through the active pill = the progress bar */
.wheel-area.is-pills .wheel-bar{
  inset: 0; border-radius: inherit;
  opacity: 0; transition: opacity .45s var(--ease);
}
.wheel-area.is-pills .wheel-bar::after{ background: var(--sc-fill); }
.wheel-area.is-pills .wheel-item[aria-selected="true"] .wheel-bar{ opacity: 1; }

/* ---------------------------------------------------- drum (phones)
   A real cylinder: every label keeps its full size on a rotating 3D
   drum; sides shrink only through true perspective. showcase.js solves
   the radius from label widths and clones a ghost set to close the
   circle. */
.wheel-area.is-drum .wheel-clip{
  overflow: hidden;
  margin: 0 calc(var(--gutter) * -.25);
  padding: .35em 0 .55em;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 clamp(18px,7%,70px), #000 calc(100% - clamp(18px,7%,70px)), transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 clamp(18px,7%,70px), #000 calc(100% - clamp(18px,7%,70px)), transparent 100%);
}
.wheel-area.is-drum .wheel{
  height: calc(var(--wheel-font) * 1.75);
  column-gap: var(--wheel-gap);            /* layout no-op — JS reads the resolved gap */
  perspective: var(--wheel-persp);
  perspective-origin: 50% 50%;
  touch-action: pan-y;
  user-select: none; -webkit-user-select: none;
  cursor: grab;
}
.wheel-area.is-drum .wheel.is-dragging{ cursor: grabbing; }
.wheel-track{
  position: absolute; left: 50%; top: 50%; width: 0; height: 0;
  transform-style: preserve-3d;
  transition: transform .95s var(--ease);
  will-change: transform;
}
.is-dragging .wheel-track, .no-anim .wheel-track{ transition: none; }
.wheel-area.is-drum .wheel-item{
  position: absolute; left: 0; top: 0;
  padding: .1em .05em;
  transform: translate(-50%,-50%);
  font-size: var(--wheel-font); font-weight: 800; line-height: 1.15; letter-spacing: -.02em;
  backface-visibility: hidden;
  opacity: 0;
  transition: opacity .95s var(--ease);
  will-change: opacity, transform;
}
.is-dragging .wheel-item, .no-anim .wheel-item{ transition: none; }
.wheel-area.is-drum .wheel-item.is-front{ cursor: default; }
.wheel-area.is-drum .wheel-num{ display: none; }
/* hairline under the front label */
.wheel-area.is-drum .wheel-bar{
  left: .05em; right: .05em; bottom: -.34em; height: 2px;
  background: var(--sc-line); border-radius: 2px;
  opacity: 0; transition: opacity .5s var(--ease);
}
.wheel-area.is-drum .wheel-item.is-front .wheel-bar{ opacity: 1; }

/* before JS runs (or without it): a quiet static pill row */
.wheel:not(.is-ready){ display: flex; flex-wrap: wrap; gap: 8px 8px; }
.wheel:not(.is-ready) .wheel-item{
  position: static; padding: .7em 1.05em; border-radius: 999px;
  border: 1px solid var(--line-ink, rgba(16,20,16,.12));
  font-size: 15px; font-weight: 700; line-height: 1; opacity: .8;
}
.wheel:not(.is-ready) .wheel-item[aria-selected="true"]{ opacity: 1; border-color: var(--sc-accent); }
.wheel:not(.is-ready) .wheel-bar{ display: none; }

/* ------------------------------------------------------------ caption
   One editorial line in the site's serif-italic voice — the words get
   the same care as the statement above them. */
.captions{
  position: relative;
  margin: clamp(18px, 2.6vh, 26px) 0 0;
  min-height: 3.1em;
}
.showcase .captions .caption{
  position: absolute; left: 0; right: 0; top: 0; margin: 0;
  display: flex; align-items: baseline; gap: .55em;      /* wrapped lines hang past the mark */
  font: italic 400 clamp(19px, 1rem + .62vw, 25px)/1.5 var(--serif);
  letter-spacing: .002em; max-width: 46ch;
  color: color-mix(in srgb, var(--sc-fg) 82%, transparent);
  opacity: 0; transform: translateY(10px); filter: blur(5px);
  transition: opacity .65s var(--ease), transform .65s var(--ease), filter .65s var(--ease);
  pointer-events: none;
}
@supports not (color: color-mix(in srgb, red 50%, blue)){
  .showcase .captions .caption{ color: var(--sc-muted); }
}
.showcase .captions .caption .cap-mark{
  color: var(--sc-accent); font-style: normal; flex: none;
  font-size: .8em; transform: translateY(-.08em);
}
.showcase .captions .caption.is-active{
  opacity: 1; transform: none; filter: none; pointer-events: auto;
  transition-delay: .15s;
}
/* phones: centred under the drum, mark omitted */
.wheel-area.is-drum .captions{ text-align: center; }
.wheel-area.is-drum .captions .caption{
  display: block; margin: 0 auto;
  font-size: clamp(17.5px, 4.6vw, 20px); max-width: 30ch; line-height: 1.5;
}
.wheel-area.is-drum .cap-mark{ display: none; }
/* desktop: left, aligned with the statement */
.wheel-area.is-pills .captions{ text-align: left; }

/* ------------------------------------------------------------ motion */
@media (prefers-reduced-motion: reduce){
  .clip, .wheel-item, .wheel-track, .caption, .wheel-bar{ transition: none !important; }
  .wheel-bar{ display: none; }
  .showcase .captions .caption{ filter: none; }
}
