/* ──────────────────────────────────────────────────────────────
   experience.css — Project 2 (/projects/experience/) only.
   Consumes brand tokens from core.css (remapped to the Cornerstone palette:
   steel blue #C8502D · navy #1A1D21 · graphite #1A1D21 · slate #6B6560);
   never edits it.
   Layout: fixed app shell, canvas fills the stage, floating
   control panels. No page scroll, no horizontal overflow.
   ────────────────────────────────────────────────────────────── */

html, body.xp {
  height: 100%;
  overflow: hidden;               /* the stage is the app; panels scroll internally */
  overscroll-behavior: none;
}

/* The hidden attribute must ALWAYS win — several components set an explicit
   display (flex/inline-flex) which would otherwise override it. */
[hidden] { display: none !important; }

body.xp {
  background: var(--cs-secondary, #1A1D21);
  display: flex;
  flex-direction: column;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--cs-primary, #C8502D); color: var(--cs-secondary, #1A1D21);
  padding: .6rem 1rem; border-radius: 0 0 8px 0; font-weight: 600; text-decoration: none;
}
.skip:focus-visible { left: 0; }

/* ── Top bar ─────────────────────────────────────────────── */
.xp-top {
  display: flex; align-items: center; gap: .9rem;
  padding: .55rem clamp(.8rem, 2.5vw, 1.5rem);
  background: var(--cs-secondary, #1A1D21);
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex: none; min-height: 54px;
}
.xp-top__brand { display: flex; align-items: center; flex: none; } /* never squeeze the logo (aspect-ratio) */
.xp-top__brand img { height: 22px; width: auto; display: block; }
.xp-top__title {
  font-family: var(--cs-font-display, 'Archivo', sans-serif);
  font-weight: 600; font-size: .95rem; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.xp-top__tag {
  font-size: .68rem; letter-spacing: .13em; text-transform: uppercase;
  color: var(--cs-accent-3, #A8A099); white-space: nowrap;
}
.xp-top__actions { margin-left: auto; display: flex; gap: .5rem; align-items: center; }

/* ── Mode tabs ───────────────────────────────────────────── */
.xp-modes {
  display: flex; gap: .25rem;
  padding: .4rem clamp(.8rem, 2.5vw, 1.5rem);
  background: var(--cs-secondary, #1A1D21);
  border-bottom: 1px solid rgba(255,255,255,.08);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  flex: none;
  scrollbar-width: none;
}
.xp-modes::-webkit-scrollbar { display: none; }
.xp-mode {
  appearance: none; border: 1.5px solid transparent; cursor: pointer;
  background: transparent; color: rgba(255,255,255,.72);
  font-family: var(--cs-font-display, 'Archivo', sans-serif);
  font-weight: 600; font-size: .92rem; line-height: 1;
  padding: .65rem 1.05rem; border-radius: 999px;
  min-height: 40px; white-space: nowrap;
  transition: background .15s ease, color .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.xp-mode:hover { color: #fff; background: rgba(255,255,255,.08); }
.xp-mode.is-active {
  background: var(--cs-primary, #C8502D);
  color: var(--cs-secondary, #1A1D21);
}

/* ── Stage ───────────────────────────────────────────────── */
.xp-stage {
  position: relative; flex: 1; min-height: 0;
  background: var(--cs-light, #EDE8E0);
  background-position: center; background-size: cover;
}
#scene3d {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block; outline: none;
  touch-action: none;
}

/* Loading veil */
.xp-loading {
  position: absolute; inset: 0; z-index: 30;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem;
  background: var(--cs-light, #EDE8E0);
  color: var(--cs-info, #6B6560); font-size: .95rem;
  transition: opacity .35s ease;
}
.xp-loading.is-done { opacity: 0; pointer-events: none; }
.xp-loading__spin {
  width: 42px; height: 42px; border-radius: 50%;
  border: 3.5px solid rgba(26, 29, 33,.15);
  border-top-color: var(--cs-primary, #C8502D);
  animation: cs-spin .8s linear infinite;
}

/* WebGL failure card */
.xp-fail {
  position: absolute; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.xp-fail__card { max-width: 460px; background: #fff; border-radius: 12px; padding: 1.75rem; box-shadow: var(--cs-shadow-2); }

/* ── Floating panels (shared) ────────────────────────────── */
.xp-panel {
  position: absolute; z-index: 20;
  left: clamp(.6rem, 2vw, 1.25rem); bottom: clamp(.6rem, 2vw, 1.25rem);
  width: min(400px, calc(100% - 2 * clamp(.6rem, 2vw, 1.25rem)));
  max-height: min(62%, 480px);
  overflow-y: auto; overscroll-behavior: contain;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(26, 29, 33,.12);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(26, 29, 33,.18);
  padding: 1rem 1.1rem 1.1rem;
}
.xp-panel[hidden] { display: none; }
.xp-panel__group { margin-bottom: .85rem; }
.xp-panel__group:last-child { margin-bottom: 0; }
.xp-panel__group[hidden] { display: none; }
.xp-panel__label {
  display: block; margin-bottom: .4rem;
  font-family: var(--cs-font-display, 'Archivo', sans-serif);
  font-weight: 700; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--cs-info, #6B6560);
}

/* Segmented buttons + toggle chips */
.seg { display: flex; flex-wrap: wrap; gap: .4rem; }
.seg button, .chip-toggle {
  appearance: none; cursor: pointer;
  border: 1.5px solid var(--cs-gray-400, #C9C0B2);
  background: #fff; color: var(--cs-dark, #1A1D21);
  font-family: var(--cs-font-display, 'Archivo', sans-serif);
  font-weight: 600; font-size: .86rem; line-height: 1.15;
  padding: .55rem .85rem; border-radius: 8px; min-height: 42px;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.seg button:hover, .chip-toggle:hover { border-color: var(--cs-primary, #C8502D); background: var(--cs-primary-soft, #F9E7DF); }
.seg button.is-active,
.chip-toggle[aria-pressed="true"] {
  background: var(--cs-secondary, #1A1D21);
  border-color: var(--cs-secondary, #1A1D21);
  color: #fff;
}

/* Range sliders */
.xp-panel input[type="range"] {
  width: 100%; accent-color: var(--cs-primary, #C8502D);
  min-height: 34px; margin: 0; cursor: ew-resize;
}
.xp-slider-hint { font-size: .8rem; color: var(--cs-info, #6B6560); margin: .2rem 0 0; }

/* ── Assemble panel bits ─────────────────────────────────── */
.xp-caption-text {
  margin: 0 0 .75rem; min-height: 2.9em;
  font-family: var(--cs-font-display, 'Archivo', sans-serif);
  font-weight: 600; font-size: .98rem; line-height: 1.45;
  color: var(--cs-secondary, #1A1D21);
}
.xp-timeline { display: flex; gap: .6rem; align-items: center; margin-bottom: .85rem; }
.xp-timeline input[type="range"] { flex: 1; }
.xp-timeline .btn { flex: none; min-width: 88px; }

#panel-assemble .fine-print { margin: 0; }

/* ── Compare panel ───────────────────────────────────────── */
#panel-compare { width: min(560px, calc(100% - 2 * clamp(.6rem, 2vw, 1.25rem))); }
.xp-story { margin: 0 0 .85rem; font-size: .92rem; line-height: 1.55; color: var(--cs-gray-800, #2E2B28); }
.xp-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.stat-col {
  background: var(--cs-gray-100, #FAF8F5);
  border: 1px solid var(--cs-gray-300, #DCD5CA);
  border-radius: 10px; padding: .65rem .7rem; min-width: 0;
}
.stat-col h3 {
  font-size: .9rem; line-height: 1.2; margin: 0 0 .1rem;
  color: var(--cs-secondary, #1A1D21);
}
.stat-col .fam { font-size: .72rem; color: var(--cs-info, #6B6560); margin: 0 0 .55rem; }
.stat-row { margin-bottom: .5rem; }
.stat-row .lbl {
  display: flex; justify-content: space-between; gap: .4rem;
  font-size: .72rem; font-weight: 700; color: var(--cs-gray-700, #4A4540);
  margin-bottom: .2rem; font-variant-numeric: tabular-nums;
}
.stat-row .bar { height: 8px; border-radius: 999px; background: var(--cs-gray-300, #DCD5CA); overflow: hidden; }
.stat-row .bar > div { height: 100%; border-radius: 999px; background: var(--cs-primary, #C8502D); }
.stat-row .bar > div.yield { background: var(--cs-accent-2, #6B6560); }
.stat-col .pos { font-size: .74rem; line-height: 1.45; color: var(--cs-info, #6B6560); margin: .35rem 0 0; }

/* ── Applications panel ──────────────────────────────────── */
#panel-scenes { width: min(430px, calc(100% - 2 * clamp(.6rem, 2vw, 1.25rem))); }
.xp-scene-caption {
  margin-top: .8rem; padding: .8rem .9rem;
  background: var(--cs-gray-100, #FAF8F5);
  border: 1px solid var(--cs-gray-300, #DCD5CA); border-radius: 10px;
}
.xp-scene-caption p { margin: .5rem 0 0; font-size: .88rem; line-height: 1.55; color: var(--cs-gray-800, #2E2B28); }
.xp-scene-caption .fine-print { margin-top: .5rem; }

/* ── Capabilities & Certifications panel ─────────────────── */
#panel-capabilities { width: min(440px, calc(100% - 2 * clamp(.6rem, 2vw, 1.25rem))); }
.xp-caps__list { list-style: none; margin: 0 0 .85rem; padding: 0; }
.xp-caps__list li {
  position: relative;
  padding: .34rem 0 .34rem 1.05rem;
  font-size: .86rem; line-height: 1.45;
  color: var(--cs-gray-800, #2E2B28);
  border-bottom: 1px solid var(--cs-gray-200, #F0EBE3);
  font-variant-numeric: tabular-nums;
}
.xp-caps__list li:last-child { border-bottom: 0; }
.xp-caps__list li::before {
  content: ""; position: absolute; left: 0; top: .8em;
  width: 6px; height: 6px; border-radius: 2px;
  background: var(--cs-primary, #C8502D);
}
.xp-caps__tol {
  margin: 0 0 .85rem; padding: .6rem .75rem;
  background: var(--cs-primary-soft, #FBEDE8);
  border-left: 3px solid var(--cs-primary, #C8502D);
  border-radius: 0 8px 8px 0;
  font-size: .82rem; line-height: 1.55;
  color: var(--cs-secondary, #1A1D21);
  font-variant-numeric: tabular-nums;
}
.xp-caps__certs { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0 0 .6rem; }
.xp-caps__pill {
  display: inline-flex; align-items: baseline; gap: .35rem;
  background: var(--cs-secondary, #1A1D21); color: #fff;
  font-family: var(--cs-font-display, 'Archivo', sans-serif);
  font-weight: 700; font-size: .78rem; line-height: 1;
  padding: .45rem .75rem; border-radius: 999px;
}
.xp-caps__pill small { font-weight: 500; font-size: .66rem; color: rgba(255,255,255,.68); }
#panel-capabilities .fine-print { margin: 0; }

/* ── QR hand-off card ────────────────────────────────────── */
.xp-qr {
  position: absolute; z-index: 22;
  right: clamp(.6rem, 2vw, 1.25rem); bottom: clamp(.6rem, 2vw, 1.25rem);
  width: 250px; max-width: calc(100% - 2 * clamp(.6rem, 2vw, 1.25rem));
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(26, 29, 33,.12); border-radius: 14px;
  box-shadow: 0 10px 30px rgba(26, 29, 33,.18);
  padding: .9rem 1rem 1rem; text-align: center;
}
.xp-qr[hidden] { display: none; }
.xp-qr h2 { font-size: 1rem; margin: 0 0 .55rem; }
.xp-qr canvas {
  width: 150px; height: 150px; image-rendering: pixelated;
  background: #fff; border-radius: 8px; margin-inline: auto; display: block;
}
.xp-qr__chips { display: flex; flex-wrap: wrap; gap: .3rem; justify-content: center; margin: .65rem 0 .4rem; }
.xp-qr__chips button {
  appearance: none; cursor: pointer;
  border: 1.5px solid var(--cs-gray-400, #C9C0B2); background: #fff;
  font-size: .72rem; font-weight: 600; padding: .35rem .55rem; border-radius: 999px;
  min-height: 32px; color: var(--cs-dark, #1A1D21);
}
.xp-qr__chips button.is-active {
  background: var(--cs-secondary, #1A1D21); border-color: var(--cs-secondary, #1A1D21); color: #fff;
}
.xp-qr p { margin: 0; font-size: .74rem; color: var(--cs-info, #6B6560); line-height: 1.45; }

/* ── Phone (no WebXR) banner ─────────────────────────────── */
.xp-banner {
  position: absolute; z-index: 26;
  top: .7rem; left: 50%; transform: translateX(-50%);
  width: min(480px, calc(100% - 1.4rem));
  display: flex; align-items: center; gap: .7rem;
  background: var(--cs-secondary, #1A1D21); color: #fff;
  border-left: 4px solid var(--cs-primary, #C8502D);
  border-radius: 10px; padding: .7rem .85rem;
  box-shadow: var(--cs-shadow-2);
  font-size: .85rem; line-height: 1.45;
}
.xp-banner a { color: var(--cs-primary, #C8502D); font-weight: 600; }
.xp-banner button {
  appearance: none; margin-left: auto; flex: none; cursor: pointer;
  background: transparent; border: 0; color: rgba(255,255,255,.7);
  font-size: 1.15rem; line-height: 1; padding: .4rem; min-width: 40px; min-height: 40px;
}
.xp-banner button:hover { color: #fff; }

/* ── Kiosk attract loop ──────────────────────────────────── */
.xp-attract {
  position: absolute; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.4rem; text-align: center; padding: 2rem;
  background: linear-gradient(180deg, rgba(26, 29, 33,.86), rgba(26, 29, 33,.55) 40%, rgba(26, 29, 33,.86));
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.xp-attract[hidden] { display: none; }
.xp-attract img { height: 40px; width: auto; }
.xp-attract h1 {
  color: #fff; font-size: clamp(1.7rem, 5vw, 3.2rem); line-height: 1.1;
  margin: 0; max-width: 18ch; letter-spacing: -.015em;
}
.xp-attract p { color: rgba(255,255,255,.8); margin: 0; font-size: clamp(.95rem, 2vw, 1.15rem); max-width: 46ch; }
.xp-attract__cta {
  margin-top: .5rem;
  font-family: var(--cs-font-display, 'Archivo', sans-serif);
  font-weight: 700; font-size: clamp(1.05rem, 2.6vw, 1.4rem);
  color: var(--cs-secondary, #1A1D21);
  background: var(--cs-primary, #C8502D);
  border: 0; border-radius: 999px; cursor: pointer;
  padding: 1.1rem 2.6rem; min-height: 64px;
  box-shadow: 0 12px 32px rgba(0,0,0,.35);
  animation: attract-pulse 2.4s ease-in-out infinite;
}
@keyframes attract-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Kiosk mode: bigger touch targets, no hub-escape links */
body.xp--kiosk .xp-top__brand,
body.xp--kiosk #btn-qr-toggle,
body.xp--kiosk .xp-banner { display: none; }
body.xp--kiosk .xp-mode { min-height: 52px; font-size: 1.02rem; padding: .8rem 1.3rem; }
body.xp--kiosk .seg button, body.xp--kiosk .chip-toggle { min-height: 50px; font-size: .95rem; }
body.xp--kiosk .xp-qr { display: block; }

/* ── Small screens ───────────────────────────────────────── */
@media (max-width: 720px) {
  .xp-top__tag { display: none; }
  .xp-top__title { font-size: .85rem; }
  .xp-panel { max-height: 48%; }
  .xp-qr {
    right: .6rem; bottom: auto; top: .6rem; width: 176px; padding: .6rem;
  }
  .xp-qr h2 { font-size: .82rem; }
  .xp-qr canvas { width: 110px; height: 110px; }
  .xp-qr p { display: none; }
  .xp-stats { grid-template-columns: 1fr; }
  #panel-compare { max-height: 52%; }
}

@media (prefers-reduced-motion: reduce) {
  .xp-attract__cta { animation: none; }
  .xp-loading__spin { animation-duration: 1.6s; }
}

/* ── Forced colors (Windows High Contrast) ───────────────── */
/* Active/pressed states rely on background fills, which forced-colors strips —
   restate them as outlines so the selected control stays distinguishable. */
@media (forced-colors: active) {
  .xp-mode.is-active,
  .seg button.is-active,
  .chip-toggle[aria-pressed="true"],
  .xp-qr__chips button.is-active { outline: 3px solid; outline-offset: 1px; }
}
