/* Products page: the 3D factory stage and the module story beside it. */
#products.page-section {
  background-color: #fff !important;
  color: #0b1d33;
  font-family: var(--mag-sans);
  --fx-blue: #4aa3df;
  --fx-deep: #1f4e8c;
  --fx-navy: #0b1d33;
  --fx-text: #33445a;
  --fx-muted: #5b6b7e;
  --fx-line: #dde4eb;
  --fx-nav: 56px;
  --fx-rail: 46px;
  --fx-rail-gap: 18px;
  --fx-top: var(--fx-nav);
}
#products ::selection { background: var(--fx-blue); color: var(--fx-navy); }
#products :focus-visible { outline: 2px solid var(--fx-deep); outline-offset: 3px; border-radius: 4px; }

/* ---- Module tabs: a pill floating over the page, clear of the main nav ---- */
.fx-rail {
  position: sticky; top: calc(var(--fx-nav) + var(--fx-rail-gap)); z-index: 20;
  width: fit-content; max-width: calc(100% - 32px); height: var(--fx-rail);
  /* Takes up no room in the page: the content runs on beneath it. */
  margin: calc(var(--fx-nav) + var(--fx-rail-gap)) auto calc(-1 * (var(--fx-rail) + var(--fx-rail-gap)));
  display: flex; align-items: center; gap: 2px; padding: 0 5px;
  background: #fff; border: 1px solid #e8edf2; border-radius: 100px;
  box-shadow: 0 1px 2px rgba(11, 29, 51, 0.04), 0 12px 32px -14px rgba(11, 29, 51, 0.22);
}
.fx-rail button {
  padding: 8px 14px; border-radius: 100px; font-size: 13px; font-weight: 600; color: var(--fx-text); white-space: nowrap;
  transition: background-color 150ms ease, color 150ms ease;
}
.fx-rail button[aria-current="true"] { background: var(--fx-blue); color: var(--fx-navy); }
@media (hover: hover) and (pointer: fine) {
  .fx-rail button:not([aria-current="true"]):hover { background: #eef3f8; color: var(--fx-navy); }
}

.fx-layout {
  display: grid;
  grid-template-columns: minmax(0, 42fr) minmax(0, 58fr);
  align-items: start;
}

/* ---- Copy column ---- */
.fx-copy { padding: 0 clamp(24px, 3.4vw, 56px) 0 max(24px, calc((100vw - 1400px) / 2 + 40px)); }
.fx-block { padding-block: 40px; min-height: 66vh; display: flex; flex-direction: column; justify-content: center; }
.fx-intro { min-height: calc(100vh - var(--fx-top)); padding-block: 24px 48px; }
.fx-intro h1 {
  font-family: var(--mag-serif);
  font-weight: 900;
  font-size: clamp(2.5rem, 4.4vw, 4.4rem);
  line-height: 1.04;
  letter-spacing: -0.025em;
  color: var(--fx-navy);
  margin-bottom: 22px;
  text-wrap: balance;
}
.fx-lede { font-size: clamp(1.05rem, 1.3vw, 1.2rem); line-height: 1.6; color: var(--fx-text); max-width: 46ch; margin-bottom: 18px; }
.fx-tailor-note { font-size: 0.92rem; line-height: 1.55; color: var(--fx-muted); max-width: 46ch; margin-top: 18px; }
.fx-tailor-note button { color: var(--fx-text); text-decoration: underline; text-decoration-color: #b4c1cf; text-underline-offset: 3px; transition: color 150ms ease, text-decoration-color 150ms ease; }
.fx-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.fx-eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fx-muted); margin-bottom: 16px; }
.fx-agent .ag-window { max-width: 480px; }
.fx-agent .ag-thread { height: 214px; }
.fx-agent-note { margin-top: 12px; font-size: 0.92rem; color: var(--fx-muted); }
.fx-ask { align-self: flex-start; margin-bottom: 20px; font-size: 0.92rem; color: var(--fx-text); text-decoration: underline; text-decoration-color: #b4c1cf; text-underline-offset: 3px; transition: color 150ms ease, text-decoration-color 150ms ease; }
@media (hover: hover) and (pointer: fine) { .fx-ask:hover { color: var(--fx-navy); text-decoration-color: var(--fx-navy); } }

.fx-ghost {
  display: inline-flex; align-items: center; height: 38px;
  padding: 0 18px; border-radius: 999px;
  border: 1px solid #b4c1cf; color: var(--fx-navy);
  font-weight: 700; font-size: 12px; white-space: nowrap;
  transition: background-color 160ms ease, transform 120ms cubic-bezier(0.23, 1, 0.32, 1);
}
.fx-ghost:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
  .fx-ghost:hover { background: #eef3f8; }
  .fx-tailor-note button:hover { color: var(--fx-navy); text-decoration-color: var(--fx-navy); }
}

.fx-num { font-size: 13px; font-weight: 700; color: var(--fx-muted); letter-spacing: 0.04em; font-variant-numeric: tabular-nums; margin-bottom: 12px; transition: color 200ms ease; }
.fx-block.is-active .fx-num { color: var(--fx-deep); }
.fx-block h2 {
  font-family: var(--mag-serif);
  font-weight: 700;
  font-size: clamp(1.9rem, 3vw, 2.9rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--fx-navy);
  margin-bottom: 14px;
  text-wrap: balance;
}
.fx-desc { color: var(--fx-text); font-size: 1.08rem; line-height: 1.6; max-width: 44ch; margin-bottom: 20px; }
.fx-caps { list-style: none; padding: 0; margin: 0; display: grid; gap: 11px; max-width: 46ch; }
.fx-caps li { position: relative; padding-left: 28px; line-height: 1.45; color: var(--fx-navy); }
.fx-caps li::before {
  content: ""; position: absolute; left: 0; top: 2px; width: 18px; height: 18px; background: var(--fx-deep);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---- Tailor-made block ---- */
.fx-custom { min-height: calc(100vh - var(--fx-top)); padding-bottom: 72px; }
.fx-custom .fx-desc { max-width: 48ch; }
.fx-config-label { font-weight: 700; font-size: 1rem; margin: 10px 0 12px; color: var(--fx-navy); }
.fx-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.fx-chip {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 10px 14px; border-radius: 100px; font-size: 14px; font-weight: 600;
  border: 1px solid #c3ced9; color: var(--fx-muted); background: #fff;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease, transform 120ms cubic-bezier(0.23, 1, 0.32, 1);
}
.fx-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #b4c1cf; transition: background-color 150ms ease; }
.fx-chip:active { transform: scale(0.97); }
.fx-chip[aria-pressed="true"] { background: #e6f3fb; border-color: var(--fx-blue); color: var(--fx-navy); }
.fx-chip[aria-pressed="true"]::before { background: var(--fx-deep); }
.fx-chip--custom { border-style: dashed; }
.fx-summary { color: var(--fx-text); margin-bottom: 22px; min-height: 1.5em; }

/* ---- Sticky stage ---- */
.fx-stage-col { position: sticky; top: var(--fx-top); height: calc(100vh - var(--fx-top)); contain: layout paint; }
.fx-stage { position: relative; width: 100%; height: 100%; overflow: hidden; background: #fff; }
.fx-canvas { position: absolute; inset: 0; outline: none; opacity: 0; transition: opacity 500ms ease; }
.fx-stage.is-ready .fx-canvas { opacity: 1; }
.fx-canvas canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.fx-canvas canvas:active { cursor: grabbing; }
/* Close-up views run past the stage's left side: fade them out instead of a hard cut. */
.fx-stage::after { content: ""; position: absolute; inset: 0 auto 0 0; z-index: 1; width: 40px; background: linear-gradient(to right, #fff, rgba(255, 255, 255, 0)); pointer-events: none; }

.fx-bottom { position: absolute; left: 16px; right: 16px; bottom: 16px; z-index: 4; display: flex; align-items: center; justify-content: center; gap: 8px; }
.fx-modes { display: flex; gap: 2px; padding: 4px; border-radius: 12px; background: #fff; border: 1px solid var(--fx-line); box-shadow: 0 6px 18px -10px rgba(11, 29, 51, 0.35); }
.fx-modes button { padding: 9px 13px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--fx-text); white-space: nowrap; transition: background-color 150ms ease, color 150ms ease; }
.fx-modes button[aria-pressed="true"] { background: var(--fx-blue); color: var(--fx-navy); }
@media (hover: hover) and (pointer: fine) { .fx-modes button:not([aria-pressed="true"]):hover { background: #eef3f8; color: var(--fx-navy); } }
.fx-play { width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center; color: var(--fx-navy); background: #fff; border: 1px solid var(--fx-line); box-shadow: 0 6px 18px -10px rgba(11, 29, 51, 0.35); }
.fx-play .fx-icon-play { display: none; }
.fx-play.is-paused .fx-icon-play { display: block; }
.fx-play.is-paused .fx-icon-pause { display: none; }

.fx-note { position: absolute; left: 50%; transform: translateX(-50%); bottom: 66px; z-index: 3; width: max-content; max-width: calc(100% - 32px); padding: 3px 10px; border-radius: 100px; background: rgba(255, 255, 255, 0.86); font-size: 12px; color: var(--fx-muted); pointer-events: none; text-align: center; line-height: 1.5; transition: opacity 200ms ease; }
.fx-stage.is-focused .fx-note { opacity: 0; }

.fx-journey {
  position: absolute; top: calc(var(--fx-rail) + var(--fx-rail-gap) + 12px); left: 50%; z-index: 4; width: min(420px, calc(100% - 32px));
  padding: 10px 14px; border-radius: 12px; background: #fff; border: 1px solid var(--fx-line); box-shadow: 0 8px 22px -12px rgba(11, 29, 51, 0.4);
  opacity: 0; transform: translate(-50%, -6px); pointer-events: none;
  transition: opacity 220ms ease, transform 220ms cubic-bezier(0.23, 1, 0.32, 1);
}
.fx-journey.visible { opacity: 1; transform: translate(-50%, 0); }
.fx-journey strong { display: block; font-size: 14px; font-weight: 700; color: var(--fx-navy); }
.fx-journey small { display: block; font-size: 12.5px; color: var(--fx-muted); margin-top: 2px; }
.fx-journey-track { height: 3px; margin-top: 9px; background: #e6ecf2; border-radius: 2px; overflow: hidden; }
.fx-journey-track i { display: block; height: 100%; background: var(--fx-blue); transform-origin: left center; transform: scaleX(0); }
.fx-journey.visible ~ .fx-note { display: none; }

.fx-labels { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.fx-label { position: absolute; left: 0; top: 0; opacity: 0; transition: opacity 240ms ease; will-change: transform; }
.fx-label.visible { opacity: 1; }
.fx-label-card { background: #fff; border: 1px solid #c9d6e2; border-radius: 7px; padding: 7px 10px; white-space: nowrap; box-shadow: 0 6px 16px -10px rgba(11, 29, 51, 0.45); }
.fx-label-title { font-size: 12.5px; font-weight: 700; display: flex; gap: 7px; color: var(--fx-navy); }
.fx-label-title span { color: var(--fx-deep); }
.fx-label-meta { font-size: 11px; color: var(--fx-muted); margin-top: 2px; }

.fx-tip { position: absolute; left: 0; top: 0; z-index: 5; max-width: 240px; padding: 10px 13px; border-radius: 8px; background: #fff; border: 1px solid var(--fx-line); box-shadow: 0 10px 26px -14px rgba(11, 29, 51, 0.5); pointer-events: none; opacity: 0; transition: opacity 120ms ease; }
.fx-tip.visible { opacity: 1; }
.fx-tip strong { font-size: 13px; font-weight: 700; color: var(--fx-navy); }
.fx-tip strong span { color: var(--fx-deep); margin-right: 7px; }
.fx-tip p { margin: 4px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--fx-muted); }

.fx-loading, .fx-error { position: absolute; inset: 0; display: none; place-items: center; text-align: center; padding: 24px; z-index: 3; color: var(--fx-muted); font-size: 14px; }
.fx-stage.is-loading .fx-loading { display: grid; }
.fx-stage.is-failed .fx-error { display: grid; }
.fx-stage.is-failed .fx-bottom, .fx-stage.is-failed .fx-note { display: none; }
.fx-error strong { display: block; color: var(--fx-navy); font-size: 16px; margin-bottom: 6px; }

/* Between desktop and phone, seven tabs may not fit: let the bar scroll sideways. */
@media (max-width: 1100px) {
  .fx-rail { justify-content: safe center; overflow-x: auto; scrollbar-width: none; }
  .fx-rail::-webkit-scrollbar { display: none; }
}

/* ---- Narrow screens: the stage sticks on top, the story scrolls beneath it ---- */
@media (max-width: 900px) {
  .fx-rail { display: none; }
  .fx-layout { display: flex; flex-direction: column; }
  .fx-stage-col { order: 2; position: sticky; top: var(--fx-nav); margin-top: var(--fx-nav); height: 46svh; min-height: 300px; width: 100%; z-index: 5; border-bottom: 1px solid var(--fx-line); }
  .fx-copy { order: 3; padding: 0 22px; width: 100%; }
  .fx-bottom { left: 8px; right: 8px; bottom: 8px; justify-content: flex-start; }
  .fx-modes { overflow-x: auto; flex: 1 1 auto; scrollbar-width: none; }
  .fx-modes::-webkit-scrollbar { display: none; }
  .fx-modes button { flex: 1 0 auto; padding: 8px 7px; font-size: 12px; }
  /* Sits above the bar, so all four views fit on a phone. */
  .fx-play { position: absolute; right: 0; bottom: calc(100% + 8px); width: 38px; height: 38px; }
  .fx-note, .fx-stage::after { display: none; }
  .fx-journey { top: 8px; }
  .fx-intro { min-height: 0; padding-top: 28px; padding-bottom: 8px; }
  .fx-block { min-height: 48svh; padding-block: 30px; justify-content: flex-start; }
  .fx-custom { min-height: 0; padding-bottom: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  #products * { transition-duration: 0ms !important; }
}
