/* ============================================================
   Features page — construction hoist + live mockups (Nov 17 2026)
   A material/personnel hoist rides a lattice mast down the gap
   between the two columns (≥1024px). It stops at each feature
   like a floor; when it lands, that feature's app mockup powers
   on (tiles rise, numbers count up, rows slide in, charts draw).
   Page-only: linked from features.html, driven by js/features-fx.js.
   Hidden start states only apply under html.ff-motion.
   ============================================================ */

:root {
  --ff-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ff-orange: #FE5D01;
}

/* ---------- Hoist overlay ---------- */

.ff-hoist {
  position: absolute;
  z-index: 20;
  width: 0;
  pointer-events: none;
}

/* The unit cost display passes in front of the mast */
.uc-display {
  position: relative;
  z-index: 25;
}

.ff-mast {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -8px;
  width: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='20'%3E%3Cpath d='M1.5 0v20M12.5 0v20' stroke='%2394a3b8' stroke-width='2'/%3E%3Cpath d='M2 1h10M2 1l10 18' stroke='%23cbd5e1' stroke-width='1.2'/%3E%3Cpath d='M13.5 2h2M13.5 7h2M13.5 12h2M13.5 17h2' stroke='%2364748b' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: repeat-y;
  background-size: 16px 20px;
}

/* Mast head: cap + slow amber beacon */
.ff-head {
  position: absolute;
  top: -14px;
  left: -11px;
  width: 22px;
  height: 14px;
  border-radius: 3px 3px 0 0;
  background-color: #334155;
}

.ff-head::after {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background-color: var(--ff-orange);
  box-shadow: 0 0 0 0 rgba(254, 93, 1, 0.5);
}

.ff-motion .ff-head::after {
  animation: ff-beacon 2.4s ease-out infinite;
}

@keyframes ff-beacon {
  0% { box-shadow: 0 0 0 0 rgba(254, 93, 1, 0.55); }
  70% { box-shadow: 0 0 0 10px rgba(254, 93, 1, 0); }
  100% { box-shadow: 0 0 0 0 rgba(254, 93, 1, 0); }
}

/* Base enclosure at the foot of the mast */
.ff-base {
  position: absolute;
  bottom: 0;
  left: -28px;
  width: 56px;
  height: 34px;
  border: 2px solid #94a3b8;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  background-image: repeating-linear-gradient(45deg, rgba(148, 163, 184, 0.45) 0 1px, transparent 1px 6px),
    repeating-linear-gradient(-45deg, rgba(148, 163, 184, 0.45) 0 1px, transparent 1px 6px);
}

.ff-base::after {
  content: "";
  position: absolute;
  inset: auto -8px -6px;
  height: 6px;
  border-radius: 2px;
  background-color: #cbd5e1;
}

/* Landings: one tie-in beam per feature, numbered */
.ff-landing {
  position: absolute;
  left: -26px;
  width: 52px;
  height: 4px;
  border-radius: 2px;
  background-color: #475569;
}

.ff-landing::before,
.ff-landing::after {
  content: "";
  position: absolute;
  top: -3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #cbd5e1;
  transition: background-color 0.4s ease, box-shadow 0.4s ease;
}

.ff-landing::before { left: -3px; }
.ff-landing::after { right: -3px; }

.ff-landing.is-here::before,
.ff-landing.is-here::after {
  background-color: var(--ff-orange);
  box-shadow: 0 0 0 4px rgba(254, 93, 1, 0.18);
}

.ff-landing-num {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: #94a3b8;
  transition: color 0.3s ease;
}

.ff-landing.is-here .ff-landing-num {
  color: #C24600;
}

/* Cage */
.ff-cage {
  position: absolute;
  top: 0;
  left: -25px;
  width: 50px;
  height: 64px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  pointer-events: auto;
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
}

.ff-cage svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 8px 10px rgba(15, 23, 42, 0.25));
}

.ff-door {
  transition: transform 0.45s var(--ff-ease);
}

.ff-cage.is-open .ff-door {
  transform: translateY(-30px);
}

.ff-cage-glow {
  opacity: 0;
  transition: opacity 0.45s ease;
}

.ff-cage.is-open .ff-cage-glow {
  opacity: 1;
}

.ff-cage-num {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1;
  color: var(--ff-orange);
}

/* Little arrow in the display while travelling */
.ff-cage-dir {
  position: absolute;
  top: 3px;
  left: 6px;
  font-size: 8px;
  line-height: 1;
  color: #cbd5e1;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ff-cage.is-moving .ff-cage-dir {
  opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
  .ff-cage:hover svg {
    filter: drop-shadow(0 8px 10px rgba(15, 23, 42, 0.25)) drop-shadow(0 0 6px rgba(254, 93, 1, 0.45));
  }
}

.ff-cage:focus-visible {
  outline: 2px solid var(--ff-orange);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Live mockups ---------- */

.ff-motion .ff-sec .app .app-card,
.ff-motion .ff-sec .app tbody tr,
.ff-motion .ff-sec .app .app-pill {
  opacity: 0;
}

.ff-motion .ff-sec.ff-live .app .app-card {
  animation: ff-card 0.65s var(--ff-ease) calc(0.1s + var(--k, 0) * 70ms) both;
}

.ff-motion .ff-sec.ff-live .app tbody tr {
  animation: ff-row 0.55s var(--ff-ease) calc(0.35s + var(--k, 0) * 80ms) both;
}

.ff-motion .ff-sec.ff-live .app .app-pill {
  animation: ff-pop 0.45s cubic-bezier(0.34, 1.5, 0.5, 1) calc(0.7s + var(--k, 0) * 40ms) both;
}

.ff-motion .ff-sec .ff-draw {
  stroke-dasharray: var(--len);
  stroke-dashoffset: var(--len);
}

.ff-motion .ff-sec.ff-live .ff-draw {
  animation: ff-draw 1.3s cubic-bezier(0.45, 0, 0.2, 1) calc(0.5s + var(--k, 0) * 120ms) both;
}

.ff-motion .ff-sec .ff-grow-y,
.ff-motion .ff-sec .ff-grow-x {
  transform-box: fill-box;
}

.ff-motion .ff-sec .ff-grow-y {
  transform-origin: 50% 100%;
  transform: scaleY(0);
}

.ff-motion .ff-sec .ff-grow-x {
  transform-origin: 0 50%;
  transform: scaleX(0);
}

.ff-motion .ff-sec.ff-live .ff-grow-y,
.ff-motion .ff-sec.ff-live .ff-grow-x {
  animation: ff-grow 0.8s var(--ff-ease) calc(0.45s + var(--k, 0) * 60ms) both;
}

/* Captured app screens: dark until the hoist arrives, then the screen powers on */
.ff-motion .ff-sec .app > img {
  opacity: 0;
}

.ff-motion .ff-sec.ff-live .app > img {
  animation: ff-screen 0.6s var(--ff-ease) calc(0.03s + var(--k, 0) * 140ms) both;
}

@keyframes ff-screen {
  0% { opacity: 0; transform: translateY(14px) scale(0.985); filter: brightness(0.35) saturate(0.6); }
  55% { opacity: 1; filter: brightness(1.12) saturate(1); }
  100% { opacity: 1; transform: none; filter: none; }
}

/* While a mockup waits for the hoist: a thin loading bar on its top edge */
.ff-motion .ff-sec .app {
  position: relative;
}

.ff-motion .ff-sec .app::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  width: 32%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--ff-orange), transparent);
  animation: ff-load 1.1s ease-in-out infinite;
  pointer-events: none;
}

.ff-motion .ff-sec.ff-live .app::after {
  animation: ff-loaded 0.5s ease forwards;
}

@keyframes ff-load {
  from { transform: translateX(-100%); }
  to { transform: translateX(320%); }
}

@keyframes ff-loaded {
  from { opacity: 1; transform: translateX(320%); }
  to { opacity: 0; transform: translateX(320%); }
}

@keyframes ff-card {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes ff-row {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: none; }
}

@keyframes ff-pop {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: none; }
}

@keyframes ff-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes ff-grow {
  to { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ff-door,
  .ff-cage-glow,
  .ff-landing::before,
  .ff-landing::after {
    transition: none;
  }
}

/* ---------- Every preview fits on one screen (Nov 19 2026) ----------
   On desktop each feature's screenshots fit inside the window beside
   their copy, so nothing is cut off at the top or bottom when the
   section sits mid-screen. Tall captures shrink to the window height
   (whole screen, same proportions); the two-screen features lay their
   pair out as a diagonal cascade instead of a tall stack. */
@media (min-width: 1024px) {
  main > section[id] {
    --fit-h: calc(100vh - 12rem);
  }

  /* one screenshot: as wide as the column allows, never taller than the window */
  main > section[id] > .grid > .min-w-0:not(.mockup-stack) {
    display: flex;
    justify-content: center;
  }
  main > section[id] > .grid > .min-w-0:not(.mockup-stack) > .app {
    width: fit-content;
    max-width: 100%;
  }
  main > section[id] > .grid > .min-w-0:not(.mockup-stack) > .app > img {
    width: auto;
    max-width: 100%;
    max-height: var(--fit-h);
  }

  /* two screenshots: a diagonal cascade, front card lower and to the side */
  main > section[id] .mockup-stack {
    --cascade-w: 64%;
    --cascade-drop: 26%;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    padding-top: 0;
    zoom: 1;
    /* the cascade is about as tall as it is wide: on short windows it
       narrows so its height still fits */
    width: 100%;
    max-width: calc(var(--fit-h) * 1.03);
    margin-inline: auto;
  }
  main > section[id] .mockup-stack > .mockup-card,
  main > section[id] .mockup-stack > .mockup-card:first-child,
  main > section[id] .mockup-stack > .mockup-card:last-child {
    grid-area: 1 / 1;
    width: var(--cascade-w);
    margin: 0;
    padding-bottom: 0;
    align-self: start;
  }
  main > section[id] .mockup-stack > .mockup-card:first-child { justify-self: start; }
  main > section[id] .mockup-stack > .mockup-card:last-child {
    justify-self: end;
    margin-top: var(--cascade-drop);
  }
  main > section[id] .mockup-stack-mirror > .mockup-card:first-child { justify-self: end; }
  main > section[id] .mockup-stack-mirror > .mockup-card:last-child { justify-self: start; }
}

/* The hoist rail reached 3px past a 1280px window and gave the page a sideways
   scrollbar (Nov 23 2026). Clipping changes nothing that can be seen. */
html { overflow-x: clip; }
