/* ALLCUT — /features/ ("Why choose ALLCUT").
   A scroll story: the 8 points scroll on one side, a sticky machine stage stays on the other
   (on phones: a smaller sticky stage on top). The stage shows a poster first (the 3D viewer's own picture of
   the intro view); features.js swaps in the 3D machine (machine-splat.js) and turns it to each point's part. */

/* ───────────── head ───────────── */
.ft-head { border-bottom: 0; padding-bottom: clamp(36px, 4vw, 64px); }
.ft-head__grid {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 36px clamp(32px, 5vw, 96px); align-items: end;
}
.ft-head__title { margin-top: 22px; }
.page-head .ft-head__title { max-width: 13ch; }
.ft-index ol { margin-top: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; border-top: 1px solid var(--ink); }
.ft-index a {
  display: flex; align-items: baseline; gap: 12px; padding: 11px 0 12px; border-bottom: 1px solid var(--rule);
  font-weight: 600; color: var(--ink); transition: color .15s;
}
.ft-index a:hover { color: var(--red-ink); }
.ft-index__n { flex: none; min-width: 22px; font-weight: 700; color: var(--ink-2); }
.ft-js { display: none; }
.js .ft-js { display: inline; }
@media (max-width: 900px) { .ft-head__grid { grid-template-columns: 1fr; } }

/* ───────────── story: points + sticky stage ───────────── */
.ft-story { border-top: 1px solid var(--rule); }
.ft-story__grid {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-areas: "points stage";
  column-gap: clamp(32px, 5vw, 96px);
}
.ft-points { grid-area: points; }
.ft-stage-col { grid-area: stage; }
.ft-stage {
  position: sticky; top: calc(var(--header-h) + 20px);
  height: calc(100svh - var(--header-h) - 40px); min-height: 480px; max-height: 1000px;
  display: flex; flex-direction: column; margin-block: 20px;
}

/* the picture box */
.ft-stage__view {
  position: relative; flex: 1; min-height: 0; overflow: hidden; container-type: size;
  background: var(--white); border: 1px solid var(--rule);
}
.ft-stage__view.crop::before { left: 10px; top: 10px; z-index: 2; }
.ft-stage__view.crop::after { right: 10px; bottom: 10px; z-index: 2; }

/* poster (no JS, no WebGL, or until the 3D takes over). It sits in the box the way the 3D canvas frames the
   machine (as big as fits, centred; 742 / 1000 is splat.json "poster_aspect"), so at the intro view the two
   are the same picture. It zooms to the part of the point in view. */
.ft-photo {
  position: absolute; left: 50%; top: 50%; width: min(100cqw, 74.2cqh); aspect-ratio: 742 / 1000; translate: -50% -50%;
  transform: scale(var(--zs, 1)) translate(var(--zx, 0%), var(--zy, 0%));
  transition: transform 1.2s var(--ease), opacity .7s var(--ease);
}
.ft-photo img { width: 100%; height: 100%; object-fit: contain; }

/* 3D canvas over the poster: it can be dragged before it shows (the first drag brings it in). It comes in
   with a cut, not a fade: at the intro view the two pictures are the same, and at a point the zoomed poster
   only roughly matches the 3D view, so a fade would show both at once. */
.ft-gl { position: absolute; inset: 0; opacity: 0; }
.ft-gl canvas { display: block; width: 100% !important; height: 100% !important; cursor: grab; outline: none; }
.ft-gl canvas:active { cursor: grabbing; }
.ft-gl canvas:focus-visible { outline: 3px solid var(--red); outline-offset: -3px; }
/* canvas in, then the poster out underneath it */
.is-3d .ft-gl { opacity: 1; }
.is-3d .ft-photo { opacity: 0; transition: opacity 0s .2s; }

/* labels on the stage */
.ft-stage__tag, .ft-stage__hint {
  position: absolute; z-index: 3; margin: 0; pointer-events: none;
  display: flex; align-items: center; gap: 10px;
  font: 700 calc(15px * var(--fs))/1.3 var(--f-sans); color: var(--ink);
}
.ft-stage__tag, .ft-stage__hint { background: color-mix(in srgb, var(--white) 92%, transparent); padding: 7px 12px; }
.ft-stage__tag { left: 20px; top: 20px; padding-left: 0; }
.ft-stage__tag::before { content: ""; width: 28px; height: 3px; background: var(--red); flex: none; }
.ft-stage__tag .num:empty { display: none; }
.ft-stage__hint { right: 20px; top: 20px; font-weight: 500; color: var(--ink-2); }
.ft-stage__hint svg { width: 22px; height: 15px; flex: none; color: var(--ink-3); }
.ft-stage__hint[hidden] { display: none; }

/* step bar: one box per point, plus the product link */
.ft-steps { display: flex; border: 1px solid var(--rule); border-top: 0; background: var(--white); }
.ft-steps__a {
  position: relative; flex: 1 1 0; min-width: 0; min-height: 48px; display: grid; place-items: center;
  border-right: 1px solid var(--rule); font-weight: 700; font-size: calc(15px * var(--fs)); color: var(--ink-2);
  transition: background-color .15s, color .15s;
}
.ft-steps__a::before {
  content: ""; position: absolute; left: -1px; right: 0; top: -1px; height: 3px; background: var(--red);
  transform: scaleX(0); transform-origin: left; transition: transform .25s var(--ease);
}
.ft-steps__a:hover { color: var(--ink); background: var(--tint); }
.ft-steps__a[aria-current="step"] { color: var(--ink); background: var(--tint); }
.ft-steps__a[aria-current="step"]::before { transform: scaleX(1); }
.ft-steps__more {
  flex: none; display: flex; align-items: center; gap: 10px; padding: 0 18px;
  font-weight: 600; font-size: calc(15px * var(--fs)); color: var(--ink); white-space: nowrap; transition: color .15s;
}
.ft-steps__more svg { width: 16px; height: 16px; }
.ft-steps__more:hover { color: var(--red-ink); }
@media (max-width: 1240px) { .ft-steps__more { display: none; } .ft-steps__a:nth-last-child(2) { border-right: 0; } }

/* ───────────── the points ───────────── */
.ft-point {
  min-height: calc(100svh - var(--header-h)); display: grid; align-content: center;
  padding-block: clamp(48px, 8vh, 96px); outline: none;
}
.ft-point:first-child { min-height: calc(86svh - var(--header-h)); align-content: start; padding-top: clamp(56px, 12vh, 140px); }
.ft-point:last-child { padding-bottom: clamp(80px, 16vh, 180px); }
.ft-point__body { max-width: 600px; border-top: 1px solid var(--ink); padding-top: 18px; }
.ft-point__idx { display: flex; align-items: center; gap: 12px; margin: 0; font-weight: 700; color: var(--ink); }
.ft-point__idx::before { content: ""; width: 28px; height: 3px; background: var(--red); flex: none; transition: background-color .3s; }
.js .ft-point:not(.is-on) .ft-point__idx::before { background: var(--ink-4); }
.ft-point__idx .num { font-variant-numeric: tabular-nums; }
.ft-point__part { color: var(--ink-2); font-weight: 400; }
.ft-point__part::before { content: "·"; margin-right: 12px; color: var(--ink-3); }
.ft-point__title {
  margin-top: 18px; font-size: calc(clamp(30px, 2.8vw, 44px) * var(--fs)); line-height: 1.06; letter-spacing: -0.018em; max-width: 17ch;
}
.ft-point__text { margin: 18px 0 0; color: var(--ink-2); max-width: 52ch; text-wrap: pretty; }
.ft-point__text + .ft-point__text { margin-top: 12px; }
.ft-figs { margin-top: 28px; }
.ft-figs .kf__value { font-size: calc(clamp(22px, 1.8vw, 28px) * var(--fs)); }
.ft-chips { margin-top: 24px; }
.ft-figs + .ft-chips { margin-top: 18px; }
.ft-point__actions { margin-top: 24px; }

/* drill / cut / ream / tap */
.ft-jobs { margin-top: 24px; border-top: 1px solid var(--ink); }
.ft-jobs__row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 20px; align-items: baseline;
  padding: 14px 0 16px; border-bottom: 1px solid var(--rule);
}
.ft-jobs__name { font-weight: 700; font-size: calc(18px * var(--fs)); }
.ft-jobs__value { margin: 0; font-weight: 700; font-size: calc(clamp(19px, 1.5vw, 22px) * var(--fs)); letter-spacing: -0.01em; text-align: right; }
.ft-jobs__note { grid-column: 1 / -1; margin: 0; color: var(--ink-2); font-size: calc(16px * var(--fs)); line-height: 1.5; max-width: 52ch; }

/* ───────────── phones and tablets: stage on top, sticky, smaller ───────────── */
@media (max-width: 999px) {
  .ft-story__grid { display: block; }          /* block, not grid: a sticky grid item could not leave its own row */
  .ft-stage-col {
    --stage-h: clamp(250px, 40svh, 420px);
    position: sticky; top: var(--header-h); z-index: 5;
    margin-inline: calc(var(--gutter) * -1); padding: 10px var(--gutter) 0;
    background: var(--paper); border-bottom: 1px solid var(--rule);
  }
  .ft-stage { position: static; height: var(--stage-h); min-height: 0; margin: 0 0 10px; }
  .ft-stage__tag { left: 12px; top: 12px; }
  .ft-stage__hint { right: 12px; top: 12px; }
  .ft-steps__a { min-height: 44px; }
  .ft-point, .ft-point:first-child {
    min-height: 0; display: block; padding: 44px 0 52px;
    scroll-margin-top: calc(var(--header-h) + var(--stage-h, 40svh) + 24px);
  }
  .ft-point:first-child { padding-top: 32px; }
  .ft-point:last-child { padding-bottom: 72px; }
  .ft-points { --stage-h: clamp(250px, 40svh, 420px); }
}
@media (max-width: 999px) and (min-width: 600px) {
  .ft-stage-col { --stage-h: clamp(300px, 46svh, 520px); }
  .ft-points { --stage-h: clamp(300px, 46svh, 520px); }
}
@media (max-width: 480px) {
  .ft-stage__tag::before { width: 20px; }
  .ft-stage__hint span { display: none; }      /* the arrows alone say it on small phones */
  .ft-point__title { font-size: calc(28px * var(--fs)); }
}

/* ───────────── closing band ───────────── */
.ft-close__grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 48px clamp(32px, 5vw, 96px); align-items: end; }
.ft-close__title { margin-top: 18px; max-width: 16ch; }
.ft-close__text { margin-top: 18px; }
.ft-close__ctas { margin-top: 28px; }
.ft-machine { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr); gap: 24px; align-items: end; border-top: 1px solid var(--ink); padding-top: 20px; }
.ft-machine__img img { width: 100%; height: auto; max-height: 260px; object-fit: contain; }
.ft-machine__name { margin-top: 6px; font-size: calc(clamp(24px, 2vw, 30px) * var(--fs)); font-weight: 800; letter-spacing: -0.015em; }
.ft-machine__name a:hover { color: var(--red-ink); }
.ft-machine__kf { margin-top: 16px; }
.ft-machine__kf .kf__value { font-size: calc(20px * var(--fs)); }
.ft-machine__links { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin: 20px 0 0; }
@media (max-width: 900px) { .ft-close__grid { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .ft-machine { grid-template-columns: 96px minmax(0, 1fr); gap: 16px; align-items: center; } }
