/* Home: directions bento (DEV-3514, spec DEV-3512).
   The HTML is the final frame: without JS and with reduced motion everything is shown as is.
   bento.js adds .bn-js (entry possible), .in (card seen), .done (entry over), .cue (one hover pass). */
.bento {
  --ink: #231f20;
  --muted: #595c63;
  --blue: #008ef0;
  --mint: #3fe88b;
  --paper: #fff;
  --edge: #d7dee2;
  --focus: #005a96;
  --radius-card: 16px;
  --radius-panel: 8px;
  --pad: 16px;
  background: var(--paper);
  padding: 48px 0;
}
.bento *,
.bento *::before,
.bento *::after {
  min-width: 0;
  box-sizing: border-box;
}
.bn-wrap {
  width: calc(100% - 32px);
  max-width: 1200px;
  margin-inline: auto;
}
.bn-title {
  max-width: 880px;
  margin: 0 0 24px;
  font-size: 32px;
  line-height: 36px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.bn-cont {
  color: var(--muted);
  font-weight: 400;
}
.bn-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

/* ---- card */
.bn-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--edge);
  border-radius: var(--radius-card);
  background: var(--paper);
  overflow: hidden;
  scroll-margin-top: 88px;
}
.bn-head {
  flex: 1 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 80px;
  padding: 16px;
}
.bn-head h3 {
  flex: 1;
  font-size: 22px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  overflow-wrap: break-word;
}
.bn-open {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: -6px -6px 0 0;
  border: 1px solid var(--ink);
  border-radius: 50%;
  color: var(--ink);
  background: var(--paper);
  transition: background-color 0.16s ease-out, color 0.16s ease-out;
}
/* the whole card is the link's hit area */
.bn-open::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-card);
  z-index: 1;
}
.bn-open svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.1s ease-out;
}
.bn-card:hover .bn-open,
.bn-open:hover,
.bn-open:active {
  background: var(--ink);
  color: #fff;
}
.bn-open:active svg {
  transform: translate(1px, -1px);
}
.bn-open:focus-visible {
  outline: none;
}
.bn-open:focus-visible::after {
  inset: 3px;
  outline: 3px solid var(--focus);
  outline-offset: 0;
  box-shadow: 0 0 0 3px #fff inset;
  border-radius: calc(var(--radius-card) - 3px);
}
.bn-card:has(.bn-open:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.bn-card:has(.bn-open:focus-visible) .bn-open::after {
  outline: none;
  box-shadow: none;
}
.bn-vh {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- scene: gradient only here, the demo is centred, never cut */
.bn-scene {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 208px;
  padding: var(--pad);
  overflow: hidden;
  font-size: 14px;
  line-height: 20px;
  color: var(--ink);
}
.bn-services .bn-scene { background: linear-gradient(135deg, #008ef0 0%, #3fe88b 100%); }
.bn-hardware .bn-scene { background: linear-gradient(135deg, #231f20 0%, #008ef0 100%); }
.bn-factory .bn-scene { background: linear-gradient(135deg, #008ef0 0%, #231f20 100%); }
.bn-acadix .bn-scene { background: linear-gradient(135deg, #3fe88b 0%, #008ef0 100%); }
.bn-kyv .bn-scene { background: linear-gradient(135deg, #231f20 0%, #3fe88b 100%); }
.bn-scene > * {
  width: 100%;
  max-width: 312px;
}
.bn-services .bn-scene > * {
  max-width: 608px;
}
.bn-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border-radius: var(--radius-panel);
  background: var(--paper);
  box-shadow: 0 8px 24px rgb(35 31 32 / 12%);
}
.bn-cap {
  color: var(--muted);
}
.bn-num {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.bn-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.bn-grow {
  flex: 1 1 auto;
}
.bn-st {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.bn-ck {
  flex: none;
  width: 16px;
  height: 16px;
}
.bn-ck circle {
  fill: var(--mint);
}
.bn-ck path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.bn-ic {
  flex: none;
  fill: none;
  stroke: var(--blue);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.bn-scene :where(svg:not(.bn-ck, .bn-ic)) {
  display: block;
  width: 100%;
}
.bn-scene path,
.bn-scene polyline {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
.bn-ic path,
.bn-ck path {
  stroke-dasharray: none;
}
.bn-track {
  position: relative;
  display: block;
  height: 8px;
  border-radius: 4px;
  background: var(--edge);
}
.bn-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transform-origin: left center;
}
.bn-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px var(--blue), 0 0 10px 2px rgb(255 255 255 / 80%);
  opacity: 0;
  pointer-events: none;
}

/* Services: two sources → application → record */
.bn-svc {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr);
  grid-template-areas: "src l1 app" "src l1 l2" ". . rcpt";
  align-items: center;
}
.bn-src {
  grid-area: src;
  display: grid;
  grid-template-rows: 1fr 1fr;
  align-self: stretch;
}
.bn-src .bn-node {
  align-self: center;
  margin: 4px 0;
}
.bn-node {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
}
.bn-l1 {
  grid-area: l1;
  align-self: stretch;
  height: 100%;
}
.bn-l1 path,
.bn-l2 path,
.bn-rail path {
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.bn-app {
  grid-area: app;
}
.bn-app b {
  font-weight: 600;
}
.bn-l2 {
  grid-area: l2;
  position: relative;
  height: 16px;
}
.bn-l2 svg {
  position: absolute;
  inset: 0;
  height: 100%;
}
.bn-l2 .bn-h {
  display: none;
}
.bn-l2 .bn-dot {
  left: calc(50% - 4px);
  top: -4px;
}
.bn-rcpt {
  grid-area: rcpt;
  gap: 2px;
}
.bn-rcpt .bn-num {
  font-size: 16px;
}

/* Hardware: rack of three, load chart */
.bn-rack {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.bn-rack li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border: 1px solid var(--edge);
  border-radius: 6px;
}
.bn-n {
  color: var(--muted);
  font-weight: 400;
}
.bn-led {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 2px rgb(63 232 139 / 30%);
}
.bn-load {
  margin-top: 2px;
}
.bn-chart {
  height: auto;
  overflow: visible;
}
.bn-chart polyline {
  fill: none;
  stroke: var(--blue);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.bn-pt {
  fill: #fff;
  stroke: var(--blue);
  stroke-width: 2.5;
  stroke-dasharray: none;
  transform-box: fill-box;
  transform-origin: center;
}

/* AI Dark Factory: brief → code → tests, rail on the left */
.bn-fac {
  position: relative;
  padding-left: 32px;
}
/* one segment per step, from the middle of a row to the middle of the next row's first line */
.bn-rail {
  position: absolute;
  left: -20px;
  top: 10px;
  width: 10px;
  height: calc(100% + 10px);
}
.bn-rail path {
  stroke: var(--edge);
}
.bn-fac > .bn-dot {
  left: 13px;
  top: 18px;
}
.bn-fac ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.bn-fac li {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
}
.bn-fac b {
  font-weight: 600;
}
.bn-code {
  display: grid;
  gap: 4px;
  flex: 1 0 100%;
}
.bn-code span {
  display: block;
  height: 6px;
  border-radius: 3px;
  background: var(--ink);
  transform-origin: left center;
}
.bn-code span:nth-child(1) { width: 78%; }
.bn-code span:nth-child(2) { width: 52%; margin-left: 12%; background: var(--blue); }
.bn-code span:nth-child(3) { width: 64%; }
.bn-tests {
  display: inline-flex;
  gap: 4px;
}
.bn-tests > span {
  display: inline-flex;
}

/* Acadix: schedule → parent portal → payment */
.bn-acx {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}
.bn-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border: 1px solid var(--edge);
  border-radius: 6px;
}
.bn-sel {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue);
}
.bn-mk {
  display: inline-flex;
  margin-left: auto;
}
.bn-pay {
  justify-content: space-between;
}

/* KYV: dossier with checks and score, decision plaque */
.bn-kyv {
  display: grid;
  gap: 8px;
}
.bn-docs .bn-doc {
  position: relative;
  display: inline-flex;
}
.bn-doc > span {
  position: absolute;
  right: -5px;
  bottom: -3px;
  display: inline-flex;
}
.bn-doc .bn-ck {
  width: 12px;
  height: 12px;
}
.bn-kyv .bn-track {
  margin: 2px 0 4px;
}
.bn-kyv .bn-fill {
  width: 72%;
}
.bn-mark {
  position: absolute;
  left: calc(72% - 8px);
  top: -4px;
  width: 16px;
  height: 16px;
  border: 3px solid var(--blue);
  border-radius: 50%;
  background: #fff;
}
.bn-dec {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 8px;
}

/* ---- sizes */
@media (min-width: 390px) {
  .bn-scene { min-height: 224px; }
}
@media (max-width: 767px) {
  .bn-acx .bn-slot { flex-wrap: wrap; }
  /* the vertical line runs from the application's bottom edge to the record's top edge */
  .bn-app { align-self: end; }
  .bn-l2 { align-self: stretch; height: auto; min-height: 16px; }
  .bn-rcpt { align-self: start; }
}
@media (min-width: 768px) {
  .bento { --pad: 24px; }
  .bn-wrap { width: calc(100% - 48px); }
  .bn-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bn-services { grid-column: 1 / -1; }
  .bn-head { min-height: 88px; padding: 24px; }
  .bn-scene { min-height: 256px; }
  .bn-svc {
    grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr) 40px minmax(0, 1fr);
    grid-template-areas: "src l1 app l2 rcpt";
  }
  .bn-l2 { height: 100%; align-self: stretch; }
  .bn-l2 .bn-h { display: inline; }
  .bn-l2 .bn-v { display: none; }
  .bn-l2 .bn-dot { left: -4px; top: calc(50% - 4px); }
  .bn-acx { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bn-acx .bn-slot { flex-direction: column; align-items: flex-start; gap: 0; }
  .bn-acx .bn-mk { position: absolute; right: 6px; top: 6px; }
  .bn-sel { position: relative; }
  .bn-acx .bn-sch .bn-sel { padding-right: 26px; }
  .bn-pay { flex-direction: column; align-items: flex-start; gap: 0; }
}
@media (min-width: 1024px) {
  .bento { padding: 80px 0; }
  .bn-wrap { width: calc(100% - 64px); }
  .bn-title { margin-bottom: 40px; font-size: 48px; line-height: 56px; }
  .bn-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px; }
  .bn-services { grid-column: span 8; }
  .bn-hardware { grid-column: span 4; }
  .bn-factory,
  .bn-acadix,
  .bn-kyv { grid-column: span 4; }
  .bn-head h3 { font-size: 24px; line-height: 32px; }
  .bn-services .bn-scene,
  .bn-hardware .bn-scene { min-height: 304px; }
}
@media (min-width: 1280px) {
  .bn-wrap { width: calc(100% - 240px); }
}

/* ---- motion: only when allowed; JS sets .bn-js, the first frame waits paused until .in */
@media (prefers-reduced-motion: no-preference) {
  .bn-js .bn-card:not(.done) :is(.fx-fade, .fx-draw, .fx-bar, .fx-pop, .fx-on, .fx-sel) {
    animation-duration: var(--t, 240ms);
    animation-delay: var(--d, 0ms);
    animation-timing-function: ease-out;
    animation-fill-mode: both;
  }
  .bn-js .bn-card:not(.in) * {
    animation-play-state: paused !important;
  }
  .bn-js .bn-card:not(.done) .fx-fade { animation-name: bn-fade; }
  .bn-js .bn-card:not(.done) .fx-draw { animation-name: bn-draw; }
  .bn-js .bn-card:not(.done) .fx-bar { animation-name: bn-bar; }
  .bn-js .bn-card:not(.done) .fx-pop { animation-name: bn-pop; }
  .bn-js .bn-card:not(.done) .fx-on { animation-name: bn-on; }
  .bn-js .bn-card:not(.done) .fx-sel { animation-name: bn-sel; }
  .bn-pt,
  .bn-mark,
  .bn-tests > span,
  .bn-doc > span,
  .bn-mk {
    transform-origin: center;
  }

  /* one response per pointer entry (or keyboard focus), after the entry */
  .bn-card.done.cue .bn-l2 .bn-dot { animation: bn-run-v 0.48s ease-out; }
  .bn-card.done.cue .bn-fac > .bn-dot { animation: bn-run-rail 0.48s ease-out; }
  .bn-card.done.cue .bn-pt { animation: bn-ring 0.36s ease-out; }
  .bn-card.done.cue .bn-sel { animation: bn-glow 0.32s ease-out; }
  .bn-card.done.cue .bn-mark { animation: bn-grow 0.32s ease-out; }
}
@media (prefers-reduced-motion: no-preference) and (min-width: 768px) {
  .bn-card.done.cue .bn-l2 .bn-dot { animation-name: bn-run-h; }
}
@media (prefers-reduced-motion: reduce) {
  .bn-open,
  .bn-open svg { transition: none; }
  .bn-open:active svg { transform: none; }
}
@keyframes bn-fade { from { opacity: 0; transform: translateY(8px); } }
@keyframes bn-draw { from { stroke-dashoffset: 1; } }
@keyframes bn-bar { from { transform: scaleX(0); } }
@keyframes bn-pop { from { opacity: 0; transform: scale(0.4); } }
@keyframes bn-on { from { background: var(--edge); box-shadow: none; } }
@keyframes bn-sel { from { border-color: var(--edge); box-shadow: none; } }
@keyframes bn-run-v {
  from { opacity: 1; top: -4px; }
  to { opacity: 1; top: calc(100% - 4px); }
}
@keyframes bn-run-h {
  from { opacity: 1; left: -4px; }
  to { opacity: 1; left: calc(100% - 4px); }
}
@keyframes bn-run-rail {
  from { opacity: 1; top: 18px; }
  to { opacity: 1; top: calc(100% - 26px); }
}
@keyframes bn-ring { 50% { transform: scale(1.75); } }
@keyframes bn-glow { 50% { box-shadow: inset 0 0 0 1px var(--blue), 0 0 0 4px rgb(0 142 240 / 35%); } }
@keyframes bn-grow { 50% { transform: scale(1.5); } }
