/* ar-ui.css — AR experience shell UI
   Imported on every demo page after brand.css. */

/* ─── Hide A-Frame default UI elements ──────────────────────────────────────── */
/* A-Frame injects its own VR/AR buttons and modals — hide all of them */

.a-enter-vr,
.a-enter-ar,
.a-loader-title,
.a-orientation-modal,
.a-dialog-allow-button,
.a-dialog-deny-button,
.a-dialog-container,
[class^="a-enter-vr"],
[class^="a-enter-ar"] {
  display: none !important;
}

/* ─── AR bar ─────────────────────────────────────────────────────────────────── */

.ar-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(to bottom, rgba(12, 15, 16, 0.75) 0%, transparent 100%);
  pointer-events: none;
}

.ar-bar>* {
  pointer-events: auto;
}

.ar-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(20, 26, 28, 0.75);
  border: 1px solid var(--mid);
  color: var(--mist);
  text-decoration: none;
  transition: background 300ms var(--lens), border-color 300ms var(--lens);
  flex-shrink: 0;
}

.ar-back:hover {
  background: rgba(30, 42, 46, 0.9);
  border-color: var(--tealL);
}

.ar-back svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ar-logo {
  display: block;
  height: 24px;
  width: auto;
  object-fit: contain;
  opacity: 0.9;
}

.tech-tag {
  margin-left: auto;
  font-family: var(--B);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tealL);
  background: rgba(2, 168, 203, 0.08);
  border: 1px solid rgba(2, 168, 203, 0.22);
  padding: 4px 10px;
  border-radius: 100px;
}

/* ─── AR canvas ──────────────────────────────────────────────────────────────── */

.ar-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
}

.ar-canvas canvas,
.ar-canvas video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ─── Splash — permission gate + loading state ───────────────────────────────── */
/*
   One overlay handles the entire pre-experience flow:
     idle      → shows permission list + "Allow access" button
     requesting → button disabled, permission row shows "Requesting…"
     loading   → permission granted, spinner active, injecting scene
     error     → shows error message + "Try again"
     hidden    → experience is live, overlay fades out

   JS sets data-state on the button and data-state on each .ar-perm-row.
   Error text is written directly into #perm-error and the .visible class toggled.
*/

.ar-splash {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background: var(--ink);
  text-align: center;
  transition: opacity 550ms var(--lens);
}

.ar-splash.hidden {
  opacity: 0;
  pointer-events: none;
}

.ar-splash-logo {
  height: 20px;
  width: auto;
  opacity: 0.55;
  margin-bottom: 44px;
}

.ar-splash-cap {
  font-family: var(--B);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--tealL);
  margin-bottom: 10px;
}

.ar-splash-title {
  font-family: var(--D);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--mist);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 8px;
}

.ar-splash-sub {
  font-family: var(--B);
  font-size: 0.8rem;
  font-weight: 300;
  color: var(--slate);
  max-width: 270px;
  line-height: 1.65;
  margin-bottom: 36px;
}

/* Permission list */

.ar-perm-list {
  width: 100%;
  max-width: 300px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ar-perm-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  background: var(--surf);
  border: 1px solid var(--mid);
  border-radius: 8px;
  transition: border-color 300ms var(--lens);
}

.ar-perm-row[data-state="requesting"] {
  border-color: rgba(2, 168, 203, 0.2);
}

.ar-perm-row[data-state="granted"] {
  border-color: rgba(2, 168, 203, 0.4);
}

.ar-perm-row[data-state="denied"] {
  border-color: rgba(224, 92, 58, 0.4);
}

.ar-perm-row-icon {
  width: 18px;
  height: 18px;
  color: var(--slate);
  flex-shrink: 0;
  transition: color 300ms var(--lens);
}

.ar-perm-row[data-state="granted"] .ar-perm-row-icon {
  color: var(--tealL);
}

.ar-perm-row[data-state="denied"] .ar-perm-row-icon {
  color: var(--ember);
}

.ar-perm-row-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ar-perm-row-name {
  font-family: var(--B);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--mist);
  flex: 1;
  text-align: left;
}

.ar-perm-row-status {
  font-family: var(--B);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate);
  opacity: 0.45;
  flex-shrink: 0;
  transition: color 300ms var(--lens), opacity 300ms var(--lens);
}

.ar-perm-row[data-state="requesting"] .ar-perm-row-status {
  color: var(--tealL);
  opacity: 1;
}

.ar-perm-row[data-state="granted"] .ar-perm-row-status {
  color: var(--tealL);
  opacity: 1;
}

.ar-perm-row[data-state="denied"] .ar-perm-row-status {
  color: var(--ember);
  opacity: 1;
}

/* Error message */

.ar-perm-error {
  font-family: var(--B);
  font-size: 0.75rem;
  font-weight: 300;
  color: var(--ember);
  max-width: 280px;
  line-height: 1.55;
  margin-bottom: 16px;
  display: none;
  text-align: center;
}

.ar-perm-error.visible {
  display: block;
}

/* CTA button */

.ar-splash-btn {
  width: 100%;
  max-width: 300px;
  font-family: var(--B);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--tealL);
  border: none;
  border-radius: 8px;
  padding: 15px 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 280ms var(--lens), opacity 280ms var(--lens);
}

.ar-splash-btn:hover:not(:disabled) {
  background: var(--teal);
}

.ar-splash-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.ar-splash-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.ar-splash-btn .btn-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(12, 15, 16, 0.25);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: ar-spin 650ms linear infinite;
  display: none;
  flex-shrink: 0;
}

.ar-splash-btn.loading .btn-spinner {
  display: block;
}

@keyframes ar-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ─── In-experience hint (face not detected etc.) ────────────────────────────── */

.ar-hint {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  font-family: var(--B);
  font-size: 0.775rem;
  font-weight: 400;
  color: rgba(232, 236, 238, 0.55);
  letter-spacing: 0.04em;
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 500ms var(--lens);
}

.ar-hint.hidden {
  opacity: 0;
}

/* ─── Reduced motion ─────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {

  .ar-splash-btn .btn-spinner,
  .ar-spinner {
    animation: none;
    opacity: 0.6;
  }

  .ar-back,
  .ar-splash,
  .ar-perm-row,
  .ar-perm-row-icon,
  .ar-perm-row-status,
  .ar-splash-btn,
  .ar-hint {
    transition: none;
  }
}