/**
 * twin.css — the launch card for the batch digital twin (js/twin.js).
 * A cinematic navy panel in the visit pass's own palette: the words on
 * the left, the twin's eight stages on the right with batch ORD-016
 * travelling along them. 'banner' on Home, 'card' in the PLANT batch walk.
 */

.twin-launch {
  position: relative; overflow: hidden; isolation: isolate;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); align-items: center;
  gap: clamp(24px, 4vw, 56px);
  padding: clamp(28px, 4.5vw, 56px);
  border-radius: calc(var(--radius-lg) + 6px); color: var(--fw-t90);
  background:
    radial-gradient(90% 120% at 0% 0%, color-mix(in srgb, var(--blue) 50%, transparent), transparent 60%),
    radial-gradient(70% 90% at 100% 100%, color-mix(in srgb, var(--steel) 38%, transparent), transparent 70%),
    var(--chrome);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, .1);
}
.twin-launch.is-card { margin: 0 0 clamp(28px, 4vw, 44px); padding: clamp(22px, 3.4vw, 40px); }

/* the words */
.twin-kicker {
  display: flex; align-items: center; gap: 10px; margin: 0 0 14px;
  font-size: var(--fs-kicker); font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: color-mix(in srgb, var(--accent) 55%, #fff);
}
.twin-badge {
  display: inline-grid; place-items: center; height: 22px; padding: 0 8px; border-radius: 6px;
  background: rgba(255, 255, 255, .14); color: #fff; font-size: 11px; letter-spacing: .06em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2);
}
.twin-title {
  margin: 0 0 14px; font-size: var(--fs-h2); font-weight: 800; line-height: 1.06; letter-spacing: -.03em; color: #fff;
  text-wrap: balance;
}
.is-card .twin-title { font-size: var(--fs-h3); }
.twin-lead { margin: 0; max-width: 52ch; font-size: var(--fs-lead); line-height: 1.6; color: rgba(var(--fw-t90-rgb), .74); text-wrap: pretty; }
.is-card .twin-lead { font-size: 15px; }
.twin-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 26px; }
.twin-cta {
  display: inline-flex; align-items: center; gap: 8px; padding: 13px 22px; font-size: 13.5px;
  background: #fff; color: var(--chrome); box-shadow: 0 8px 24px -10px rgba(0, 0, 0, .5);
}
.twin-cta:hover { background: #fff; color: var(--blue); }
.twin-cta:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.twin-note { font-size: 12.5px; color: rgba(var(--fw-t90-rgb), .55); }

/* ── the preview: eight stages on a line, the batch travelling along it ── */
.twin-preview {
  --at: 0;
  position: relative; min-height: 250px; padding: 26px 18px 22px;
  border-radius: var(--radius-lg); overflow: hidden;
  background: rgba(var(--fw-s90-rgb), .38); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
  display: flex; flex-direction: column; justify-content: center;
}
/* a faint floor grid, in perspective, under the line */
.twin-grid {
  position: absolute; left: -20%; right: -20%; bottom: -30%; height: 75%; z-index: -1;
  background:
    repeating-linear-gradient(90deg, rgba(var(--fw-t40-rgb), .16) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(0deg, rgba(var(--fw-t40-rgb), .16) 0 1px, transparent 1px 44px);
  transform: perspective(380px) rotateX(58deg); transform-origin: 50% 100%;
  -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 90%); mask-image: linear-gradient(to top, #000 10%, transparent 90%);
}

/* the line runs from the first node's centre to the last one's */
.twin-track { position: relative; }
.twin-line {
  --half: calc((100% - (var(--n) - 1) * 4px) / var(--n) / 2);
  position: absolute; left: var(--half); right: var(--half);
  top: 21px; height: 2px; background: rgba(var(--fw-t40-rgb), .22); border-radius: 2px;
}
.twin-line-fill {
  position: absolute; inset: 0 auto 0 0; width: calc(var(--at) * 100%); border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--fw-t50));
  transition: width 1.1s var(--ease-in-out-smooth);
}
.twin-token {
  position: absolute; top: 50%; left: calc(var(--at) * 100%); translate: -50% -50%;
  display: flex; flex-direction: column; align-items: center;
  transition: left 1.1s var(--ease-in-out-smooth);
}
.twin-token i {
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 5px rgba(var(--fw-t40-rgb), .3), 0 0 22px 4px rgba(var(--fw-t40-rgb), .6);
}
.twin-token b {
  position: absolute; bottom: calc(100% + 8px); white-space: nowrap;
  font-size: 10px; letter-spacing: .08em; padding: 3px 7px; border-radius: 6px;
  background: #fff; color: var(--chrome);
}

.twin-stages {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 4px; padding-top: 16px;
}
.twin-stages li { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.twin-node {
  width: 12px; height: 12px; border-radius: 50%; margin-bottom: 18px;
  background: var(--chrome); box-shadow: inset 0 0 0 2px rgba(var(--fw-t40-rgb), .45);
  transition: background-color .5s var(--ease-out-quart), box-shadow .5s var(--ease-out-quart);
}
.twin-stage-n { font-size: 10px; color: rgba(var(--fw-t90-rgb), .4); transition: color .5s var(--ease-out-quart); }
.twin-stage-t {
  font-size: 11px; font-weight: 600; line-height: 1.25; color: rgba(var(--fw-t90-rgb), .5);
  transition: color .5s var(--ease-out-quart);
}
.twin-stages li.is-on .twin-node { background: var(--accent); box-shadow: 0 0 0 3px rgba(var(--fw-t40-rgb), .25); }
.twin-stages li.is-on .twin-stage-n { color: color-mix(in srgb, var(--accent) 60%, #fff); }
.twin-stages li.is-on .twin-stage-t { color: rgba(var(--fw-t90-rgb), .85); }
.twin-stages li.is-now .twin-stage-t { color: #fff; }
/* the deviation: the one red, as everywhere on the site */
.twin-stages li.is-flag.is-on .twin-node { background: var(--red); box-shadow: 0 0 0 3px rgba(226, 83, 107, .3); }
.twin-stages li.is-flag.is-now .twin-stage-t { color: #FFB3C0; }

/* stacked below 980px; on a phone the stage names give way to numbers */
@media (max-width: 980px) {
  .twin-launch { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .twin-stage-t { display: none; }
  .twin-preview { min-height: 140px; }
}
@media (prefers-reduced-motion: reduce) {
  .twin-line-fill, .twin-token { transition: none; }
}

/* ══════════════ the twin, in place (js/twin.js openTwin) ══════════════
   A full-screen layer over the page. It opens out of the button that
   launched it (a clip-path from the button's pill to the whole screen),
   and closes back into it. The twin runs in its frame; until it has
   loaded, the layer shows a quiet loading state and its own close. */
.twin-layer {
  position: fixed; inset: 0; z-index: 9800;
  background: var(--fw-s90);
  clip-path: inset(0 0 0 0 round 0px);
  transition: clip-path .62s cubic-bezier(.7, 0, .2, 1);
}
.twin-layer.is-closing { transition-duration: .5s; }
.twin-frame {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block;
  opacity: 0; transition: opacity .6s var(--ease-out-quart) .1s;
}
.twin-layer.is-ready .twin-frame { opacity: 1; }
.twin-layer.is-closing .twin-frame { opacity: 0; transition-delay: 0s; transition-duration: .2s; }

.twin-status {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  color: rgba(var(--fw-t90-rgb), .7); font-size: 14px; font-weight: 600; letter-spacing: .02em; text-align: center; padding: 24px;
  transition: opacity .4s var(--ease-out-quart);
}
.twin-status a { color: var(--fw-t50); }
.twin-layer.is-ready .twin-status { opacity: 0; pointer-events: none; }
.twin-spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2.5px solid rgba(var(--fw-t40-rgb), .2); border-top-color: var(--fw-t40);
  animation: twin-spin .9s linear infinite;
}
@keyframes twin-spin { to { transform: rotate(360deg); } }

/* the layer's own close: shown until the twin (with its Close) is up */
.twin-close {
  position: absolute; top: 18px; right: 18px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .08); color: var(--fw-t90); font-size: 15px; cursor: pointer;
  transition: opacity .3s var(--ease-out-quart), background-color var(--dur-fast) var(--ease-out-quart);
}
.twin-close:hover { background: rgba(255, 255, 255, .16); }
.twin-close:focus-visible { outline: 2px solid var(--fw-t40); outline-offset: 2px; }
.twin-layer.is-ready .twin-close { opacity: 0; pointer-events: none; }

/* the site's own cursor stays out of the frame */
html.is-twin-open :is(.cursor-dot, .cursor-ring) { opacity: 0 !important; }

@media (prefers-reduced-motion: reduce) {
  .twin-layer, .twin-frame { transition: none; }
  .twin-spinner { animation: none; }
}
/* …and the native one comes back on the layer (the site hides it for its own) */
body.custom-cursor .twin-layer, body.custom-cursor .twin-layer * { cursor: auto !important; }
body.custom-cursor .twin-layer :is(button, a) { cursor: pointer !important; }
/* in the light theme the twin is light: so is the layer while it loads */
[data-theme="light"] .twin-layer { background: var(--fw-t90); }
[data-theme="light"] .twin-status { color: var(--text-muted); }
[data-theme="light"] .twin-status a { color: var(--blue); }
[data-theme="light"] .twin-close { color: var(--navy-deep); background: rgba(var(--fw-s60-rgb), .06); border-color: var(--border); }
[data-theme="light"] .twin-spinner { border-color: rgba(var(--fw-s10-rgb), .18); border-top-color: var(--blue); }
