/* ALLCUT — Products page: "The Machine Reel", white edition.
   Base styles = stacked catalogue (mobile, tablet, reduced motion, no JS).
   The pinned reel layout only applies when JS is on, the viewport is ≥1024 × 620 and motion is allowed
   (same condition as gsap.matchMedia in products.js). */

.reel {
  --cols: minmax(0, 26fr) minmax(0, 48fr) minmax(0, 26fr);
  --rail-gap: clamp(16px, 2.2vw, 36px);
  --dim-room: 60px;                 /* space beside the figure for the dimension line */
  position: relative;
}

/* ───────────── intro ───────────── */
.pp-intro { padding: clamp(28px, 3.2vw, 44px) 0 clamp(24px, 2.6vw, 36px); }
.pp-intro__row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 60ch); align-items: end; gap: 20px 48px;
}
.pp-intro .h1 { margin-top: 18px; }
.pp-intro .lede { margin: 0; font-size: clamp(16px, 1.2vw, 18px); }
.pp-intro__links { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 14px 0 0; font-size: 14px; }
@media (max-width: 860px) { .pp-intro__row { grid-template-columns: 1fr; } }

/* ───────────── range index ───────────── */
.rix {
  position: sticky; top: var(--header-h); z-index: 6;
  background: color-mix(in srgb, var(--paper) 96%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.rix .wrap { padding-inline: 0; }
.rix__list {
  display: flex; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  padding-inline: var(--gutter); scroll-padding-inline: var(--gutter);
}
.rix__list::-webkit-scrollbar { display: none; }
.rix__list { position: relative; } /* contain the .sr-only counts inside the horizontal scroller */
.rix__list li { flex: none; }
.rix__link {
  position: relative; display: flex; align-items: baseline; gap: 6px; height: 100%;
  padding: 13px 14px; white-space: nowrap; font-size: 14px; font-weight: 600; letter-spacing: -0.005em;
  color: var(--ink-2); transition: color .15s;
}
.rix__list li:first-child .rix__link { padding-left: 0; }
.rix__link::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--red);
  transform: scaleX(0); transform-origin: left center; transition: transform .35s var(--ease);
}
.rix__link:hover { color: var(--ink); }
.rix__link[aria-current="true"] { color: var(--ink); }
.rix__link[aria-current="true"]::before { transform: scaleX(1); }
.rix__link:focus-visible { outline-offset: -2px; }
.rix__count { font: 500 11px/1 var(--f-mono); letter-spacing: .04em; color: var(--ink-3); }
.rix__span { display: none; }

/* ───────────── stacked catalogue (default) ───────────── */
.reel__bar { display: none; }

.reel-range {
  padding: clamp(44px, 6vw, 80px) 0 22px; scroll-margin-top: calc(var(--header-h) + 48px);
}
.reel-range:first-child { padding-top: clamp(28px, 4vw, 48px); }
.reel-range__name {
  margin: 14px 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px;
  font-size: clamp(26px, 2.6vw, 38px); font-weight: 800; letter-spacing: -0.03em; line-height: 1;
}
.reel-range__count { font: 500 12px/1.3 var(--f-mono); letter-spacing: .04em; color: var(--ink-3); }
.reel-range__short { margin: 10px 0 0; color: var(--ink-2); max-width: 60ch; }

.reel-item {
  display: flex; flex-direction: column;
  padding: 28px 0 40px; border-top: 1px solid var(--rule);
  scroll-margin-top: calc(var(--header-h) + 48px);
}
.reel-range + .reel-item { border-top-color: var(--ink); }
.ri-left, .ri-right { display: contents; }

.ri-no { margin: 0; }
.ri-range { margin: 12px 0 0; }
.ri-name { margin-top: 12px; font-size: clamp(30px, 7.4vw, 46px); line-height: .96; letter-spacing: -0.035em; font-stretch: 104%; }
.ri-sub { margin: 10px 0 0; color: var(--ink-2); font-size: 16px; line-height: 1.4; }
.ri-tag { margin: 4px 0 0; color: var(--ink-3); font-size: 14px; line-height: 1.4; }
.ri-kf { margin-top: 22px; }
.ri-kf .kf__value { font-size: clamp(20px, 5vw, 26px); }
.ri-actions { order: 2; margin-top: 24px; }
.ri-speclabel {
  display: flex; justify-content: space-between; gap: 12px; margin: 26px 0 10px;
}
.ri-chips { margin-top: 16px; }
.ri-more { display: none; }
.ri-specs .specs__row { grid-template-columns: max-content minmax(0, 1fr); }
.ri-specs .specs__v { text-wrap: balance; }
.ri-part { display: block; white-space: nowrap; }
.ri-part + .ri-part { margin-top: 2px; }
.ri-kf .kf__item:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* figure: a white panel; the box hugs the machine and stands on the ground line */
.ri-fig {
  order: -1; margin: 0 0 22px; background: var(--white); border: 1px solid var(--rule);
  padding: 24px 20px 22px;
}
.ri-fig__stage {
  height: clamp(260px, 78vw, 440px); container-type: size;
  display: grid; place-items: end center; padding-inline: calc(var(--dim-room) - 20px);
}
.ri-fig__box {
  position: relative; aspect-ratio: var(--ar);
  width: min(100cqw, calc(100cqh * var(--ar)), var(--wmax, 100cqw));
}
.ri-fig__box img { width: 100%; height: 100%; object-fit: contain; }
.is-legacy .ri-fig__box img { translate: 0 2%; }      /* legacy photos have ~2% white margin: stand them on the line */
.is-legacy .ri-fig__box .dim { top: 4%; }
.ri-fig .dim__label { background: var(--white); }
.ri-fig .ground { position: relative; z-index: 1; }

@media (max-width: 759.98px) {
  .ri-specs .specs__row:nth-child(n+7) { display: none; }
  .ri-chips { display: none; }
  .ri-actions .btn { flex: 1 1 auto; }
}

/* tablet: figure left, text right */
@media (min-width: 760px) {
  .reel-item {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "fig left" "fig right";
    column-gap: clamp(24px, 3.4vw, 48px); align-items: start;
  }
  .ri-left, .ri-right { display: block; }
  .ri-left { grid-area: left; }
  .ri-right { grid-area: right; }
  .ri-fig { grid-area: fig; margin: 0; position: sticky; top: calc(var(--header-h) + 64px); }
  .ri-fig__stage { height: clamp(320px, 40vw, 480px); }
  .ri-name { font-size: clamp(30px, 3.6vw, 44px); }
  .ri-kf .kf__value { font-size: clamp(20px, 2.2vw, 26px); }
  .ri-more { display: inline-flex; margin-top: 18px; }
}

/* wide, static (reduced motion / no JS / short viewport): the reel's three columns, in flow */
@media (min-width: 1024px) {
  .reel-item {
    grid-template-columns: var(--cols); grid-template-areas: "left fig right"; column-gap: 0;
    padding: 40px 0 48px;
  }
  .ri-left { padding-right: var(--rail-gap); }
  .ri-right { padding-left: var(--rail-gap); }
  .ri-fig { position: static; background: none; border: 0; padding: 0; }
  .ri-fig__stage { height: clamp(380px, 52vh, 540px); padding-inline: var(--dim-room); }
  .ri-fig .dim__label { background: var(--paper); }
  .ri-speclabel { margin-top: 0; }
  .rix__link { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; column-gap: 6px; row-gap: 4px; }
  .rix__span { display: block; grid-column: 1 / -1; white-space: nowrap; font: 500 11px/1.2 var(--f-mono); letter-spacing: .02em; color: var(--ink-3); }
}

/* ───────────── the pinned reel ───────────── */
@media (min-width: 1024px) and (min-height: 620px) and (prefers-reduced-motion: no-preference) {
  .js .reel:not(.reel--static) {
    --bar-h: 56px;
    --pad-t: clamp(20px, 4.2vh, 44px);
    --pad-b: clamp(18px, 3.4vh, 36px);
    background: var(--white);
  }
  .js .reel:not(.reel--static) .reel__stage {
    height: calc(100vh - var(--header-h) + 1px);
    height: calc(100svh - var(--header-h) + 1px);
    display: flex; flex-direction: column; background: var(--white);
    border-top: 1px solid var(--rule);
  }

  /* range index: 8 equal cells */
  .js .reel:not(.reel--static) .rix {
    position: relative; top: auto; flex: none; background: none; border-top: 0;
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .js .reel:not(.reel--static) .rix .wrap { padding-inline: var(--gutter); }
  .js .reel:not(.reel--static) .rix__list {
    display: grid; grid-template-columns: repeat(8, auto); overflow: visible; padding-inline: 0;
  }
  .js .reel:not(.reel--static) .rix__list li + li { border-left: 1px solid var(--rule); }
  .js .reel:not(.reel--static) .rix__link { padding: 12px 12px 13px; }
  .js .reel:not(.reel--static) .rix__list li:first-child .rix__link { padding-left: 0; }

  /* stage: every machine stacked in the same grid */
  .js .reel:not(.reel--static) .reel__items { position: relative; flex: 1 1 auto; min-height: 0; }
  .js .reel:not(.reel--static) .reel-range { display: none; }
  .js .reel:not(.reel--static) .reel-item {
    position: absolute; inset: 0 var(--gutter); display: grid;
    grid-template-columns: var(--cols); grid-template-areas: "left fig right"; grid-template-rows: minmax(0, 1fr);
    padding: var(--pad-t) 0 var(--pad-b); border: 0; align-items: stretch;
  }
  .js .reel:not(.reel--static) .reel-item ~ .reel-item { opacity: 0; visibility: hidden; } /* until JS takes over */

  .js .reel:not(.reel--static) .ri-left,
  .js .reel:not(.reel--static) .ri-right { display: flex; flex-direction: column; min-height: 0; }
  .js .reel:not(.reel--static) .ri-head { margin-bottom: 20px; }
  .js .reel:not(.reel--static) .ri-kf { margin-top: auto; }
  .js .reel:not(.reel--static) .ri-actions { margin-top: clamp(16px, 2.6vh, 24px); gap: 8px; }
  .js .reel:not(.reel--static) .ri-actions .btn { flex: 1 1 auto; padding-inline: 14px; }
  .js .reel:not(.reel--static) .ri-more { margin-top: auto; align-self: flex-start; }
  .js .reel:not(.reel--static) .ri-chips { margin-top: clamp(12px, 2vh, 18px); }

  .js .reel:not(.reel--static) .ri-name { font-size: clamp(32px, min(3.3vw, 6.4vh), 58px); margin-top: clamp(10px, 1.6vh, 16px); }
  .js .reel:not(.reel--static) .ri-kf .kf__value { font-size: clamp(20px, min(1.8vw, 3.4vh), 28px); }
  .js .reel:not(.reel--static) .ri-kf .kf__item { padding: clamp(9px, 1.5vh, 14px) 12px clamp(10px, 1.6vh, 16px) 0; }
  .js .reel:not(.reel--static) .ri-specs .specs__row { padding: clamp(6px, 1.05vh, 10px) 0; }

  .js .reel:not(.reel--static) .ri-fig {
    display: flex; flex-direction: column; min-height: 0; background: none; border: 0; padding: 0;
  }
  .js .reel:not(.reel--static) .ri-fig__stage { flex: 1 1 auto; height: auto; min-height: 0; padding: 0 var(--dim-room); }
  .js .reel:not(.reel--static) .ri-fig .dim__label { background: var(--white); }
  .js .reel:not(.reel--static) .ri-fig__box { transform-origin: 50% 100%; }

  /* position bar: counter · ticks · index link, on the same three columns */
  .js .reel:not(.reel--static) .reel__bar {
    flex: none; display: grid; grid-template-columns: var(--cols); align-items: center;
    height: var(--bar-h); border-top: 1px solid var(--rule);
  }
  .reel__count { margin: 0; display: flex; align-items: baseline; gap: 2px; }
  .reel__now { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
  .reel__total { margin-left: 6px; font: 500 12px/1 var(--f-mono); letter-spacing: .04em; color: var(--ink-3); }
  .reel__skip { justify-self: end; color: var(--ink-3); transition: color .15s; }
  .reel__skip:hover { color: var(--red-ink); }

  .ticks { display: flex; justify-content: center; align-items: flex-end; height: 100%; }
  .ticks__group { display: flex; }
  .ticks__group + .ticks__group { margin-left: 9px; }
  .tick {
    position: relative; width: 13px; height: 34px; padding: 0 0 12px; margin: 0; border: 0; background: none;
    display: flex; align-items: flex-end; justify-content: center;
  }
  .tick::before {
    content: ""; width: 2px; height: 20px; background: var(--ink-4);
    transform: scale(.5, .5); transform-origin: 50% 100%;
    transition: transform .35s var(--ease), background-color .2s;
  }
  .tick.is-past::before { background: var(--ink-2); }
  .tick:hover::before { background: var(--ink); transform: scale(.5, .75); }
  .tick[aria-current="true"]::before { background: var(--red); transform: none; }
  .tick::after {
    content: attr(aria-label); position: absolute; left: 50%; bottom: calc(100% + 4px); z-index: 3;
    padding: 6px 8px; background: var(--ink); color: var(--white); white-space: nowrap; pointer-events: none;
    font: 500 11px/1 var(--f-mono); letter-spacing: .04em; text-transform: uppercase;
    opacity: 0; transform: translate(-50%, 4px); transition: opacity .15s, transform .2s var(--ease);
  }
  .tick:hover::after, .tick:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
  .tick:focus-visible { outline-offset: -1px; }
}

/* narrower desktops: give the rails more room; range spans only where all eight fit on one line */
@media (min-width: 1024px) and (max-width: 1359.98px) {
  .reel { --cols: minmax(0, 28fr) minmax(0, 44fr) minmax(0, 28fr); --dim-room: 52px; }
  .js .reel:not(.reel--static) .rix__span { display: none; }
}
@media (min-width: 1024px) and (max-width: 1151.98px) {
  .reel { --cols: minmax(0, 30fr) minmax(0, 40fr) minmax(0, 30fr); }
}
/* short desktop viewports: tighten the rails; features become a compact marked list */
@media (min-width: 1024px) and (max-height: 820px) and (prefers-reduced-motion: no-preference) {
  .js .reel:not(.reel--static) { --bar-h: 50px; }
  .js .reel:not(.reel--static) .rix__span { display: none; }
  .js .reel:not(.reel--static) .rix__link { padding-top: 12px; padding-bottom: 12px; }
  .js .reel:not(.reel--static) .ri-sub { font-size: 15px; margin-top: 8px; }
  .js .reel:not(.reel--static) .ri-tag { font-size: 13px; }
  .js .reel:not(.reel--static) .ri-chips { gap: 5px 14px; }
  .js .reel:not(.reel--static) .ri-chips .chip { padding: 0; border: 0; background: none; font-size: 10.5px; line-height: 1.3; }
}

/* ───────────── index table ───────────── */
.ix { border-top: 1px solid var(--rule); }
.ix-table { min-width: 820px; }
.ix-table col, .ix-table th, .ix-table td { vertical-align: baseline; }
.ix-no { width: 64px; font: 500 12px/1.3 var(--f-mono); color: var(--ink-3); letter-spacing: .04em; }
.ix-model { font-weight: 600; text-transform: none; letter-spacing: -0.005em; color: var(--ink); white-space: normal; }
.ix-table tbody th.ix-model { font: 600 16px/1.3 var(--f-sans); letter-spacing: -0.01em; color: var(--ink); text-transform: none; white-space: normal; }
.ix-model a { transition: color .15s; }
.ix-model a:hover { color: var(--red-ink); }
.ix-c-no { width: 64px; }
.ix-c-model { width: 22%; }
.ix-c-cap { width: 34%; }
.ix-c-pw, .ix-c-wt { width: 12%; }
.ix-v { font-weight: 600; font-variant-numeric: tabular-nums; }
.ix-cap .ix-v { margin-right: 10px; }
.ix-k { font: 500 11px/1.3 var(--f-mono); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; }
.ix-na { color: var(--ink-4); font-weight: 400; }
.ix-doc {
  display: inline-flex; align-items: center; gap: 8px; font: 500 12px/1.2 var(--f-mono); letter-spacing: .03em;
  color: var(--ink-2); border-bottom: 1px solid var(--rule-2); padding-bottom: 2px; white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.ix-doc svg { width: 14px; height: 14px; }
.ix-doc:hover { color: var(--red-ink); border-color: var(--red); }

.ix-range th {
  padding: 30px 16px 10px 0; border-bottom: 1px solid var(--ink-4);
  font: 700 18px/1.2 var(--f-sans); letter-spacing: -0.015em; color: var(--ink); text-transform: none; white-space: normal;
}
.ix-table tbody:first-of-type .ix-range th { padding-top: 22px; }
.ix-range a { transition: color .15s; }
.ix-range a:hover { color: var(--red-ink); }
.ix-range__meta { margin-left: 12px; font: 500 11px/1.3 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.ix-table tbody tr.ix-range:hover { background: none; }

/* review aid (?reel=N&still): first frame = machine N, no scrolling needed */
.reel-still .pp-intro, .reel-still .reel .is-before { display: none; }

/* index on small screens: the table scrolls sideways, model names stay put */
@media (max-width: 759.98px) {
  .ix-table { min-width: 680px; }
  .ix-c-no, .ix-no { display: none; }
  .ix-table .ix-model {
    position: sticky; left: 0; z-index: 1; background: var(--paper);
    box-shadow: inset -1px 0 0 var(--rule); padding-right: 12px; width: 150px;
  }
  .ix-table tbody tr:hover .ix-model { background: var(--white); }
  .ix-range__in { position: sticky; left: 0; display: inline-block; max-width: calc(100vw - 2 * var(--gutter)); }
  .ix-range__meta { display: block; margin: 4px 0 0; }
}

/* ── range colour codes on the white catalogue ── */
.rix__link::before { background: var(--rc, var(--red)); }
.rix__name .swatch { width: 8px; height: 8px; margin-right: 8px; }
.ix-range__in .swatch { margin-right: 10px; }
.reel-item .ri-range::before, .reel-range .label-rule::before { background: var(--rc); }
