/* The XR add-on page (/xr/): the live preview stage, glasses mode, devices,
   immersive mode, early access and questions. Night theme tokens from site.css. */

.xr { --xr-glass: rgba(15, 17, 24, .72); --xr-edge: inset 0 0 0 1px rgba(255, 255, 255, .07); }
.xr [hidden] { display: none !important; }
.xr-needs-js { display: none !important; }
.xr.is-ready .xr-needs-js { display: revert !important; }
.xr.is-ready .btn-row.xr-needs-js, .xr.is-ready .xr-opts.xr-needs-js { display: flex !important; }
.xr.is-ready .xr-controls.xr-needs-js { display: grid !important; }
.xr.is-ready .btn.xr-needs-js { display: inline-flex !important; }

.xr-kicker {
  display: inline-flex; align-items: center; gap: 10px; justify-self: start; width: max-content; max-width: 100%;
  padding: 8px 14px; border-radius: 999px; background: rgba(131, 148, 255, .14); color: var(--accent-ink);
  font-size: .8125rem; font-weight: 500; letter-spacing: .02em;
}
.xr-kicker::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 12px currentColor; flex: none; }
.xr-hero .btn-row { margin-top: 6px; }

/* ------------------------------------------------------------ the preview */
.xr-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 20px 48px; margin-block-end: clamp(24px, 4vw, 48px); }
.xr-top > div { display: grid; gap: 14px; }
.xr-intro { max-width: 34em; color: var(--ink-2); }

.xr-stage {
  position: relative; isolation: isolate; overflow: hidden; width: 100%;
  aspect-ratio: 16 / 9; min-height: 420px; max-height: 82vh;
  border-radius: var(--radius); background: #05060A;
  box-shadow: var(--xr-edge), 0 50px 140px -50px rgba(131, 148, 255, .35);
}
@media (max-width: 720px) { .xr-stage { aspect-ratio: 4 / 5; min-height: 0; max-height: 78svh; } }
.xr-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: pan-y; cursor: grab; outline: none; }
.xr-canvas:active { cursor: grabbing; }
.xr-canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); border-radius: var(--radius); }

.xr-poster {
  position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; align-content: center; gap: 20px; padding: 24px; text-align: center;
  background: radial-gradient(ellipse 70% 60% at 50% 58%, rgba(131, 148, 255, .16), rgba(5, 6, 10, 0) 70%), #05060A;
  transition: opacity 1.1s var(--ease-cine), visibility 0s 1.1s;
}
.xr-poster .orbit { justify-self: center; width: min(440px, 78%); max-width: none; color: var(--ink-2); }
.xr-poster-note { color: var(--ink-2); font-size: .875rem; max-width: 30em; }
.is-live .xr-poster { opacity: 0; visibility: hidden; pointer-events: none; }

.xr-hud {
  position: absolute; inset: 0; z-index: 1; pointer-events: none; display: grid; grid-template-rows: auto 1fr auto; gap: 12px;
  padding: clamp(12px, 2vw, 20px); opacity: 0; transition: opacity .8s var(--ease) .5s;
}
.is-live .xr-hud { opacity: 1; }
.xr-hud-top { display: flex; justify-content: space-between; align-items: start; gap: 10px; flex-wrap: wrap; }
.xr-hud button, .xr-hud .btn { pointer-events: auto; }
.xr-glass { background: var(--xr-glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: var(--xr-edge); }
.xr-now { padding: 10px 16px; border-radius: 999px; font-size: .875rem; font-weight: 500; }
.xr-view { display: flex; gap: 2px; padding: 4px; border-radius: 999px; }
.xr-view .chip { border: 0; min-height: 36px; padding: 0 14px; }
@media (pointer: coarse) { .xr-view .chip { min-height: 44px; } }
.xr-hud-bottom { grid-row: 3; display: grid; gap: 8px; justify-items: start; align-self: end; }
.xr-message { font-size: .875rem; color: var(--ink); text-shadow: 0 1px 12px rgba(0, 0, 0, .9); max-width: 36em; min-height: 1.4em; }

/* controls under the stage */
.xr-controls { gap: 22px; margin-top: 12px; padding: clamp(18px, 2.6vw, 32px); border-radius: var(--radius); background: var(--xr-glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: var(--xr-edge); }
.xr-field { display: grid; gap: 10px; min-width: 0; }
.xr-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.xr-chips .chip { min-height: 44px; }
.xr-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 26px; }
.xr-hint { font-size: .875rem; color: var(--ink-2); }
.xr-notes { display: flex; flex-wrap: wrap; gap: 6px; }
.xr-note {
  display: inline-grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 9px; align-items: center; text-align: start;
  min-height: 52px; padding: 7px 16px 7px 12px; border-radius: 16px; border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer;
  font: inherit; transition: background-color .3s var(--ease), border-color .3s var(--ease);
}
.xr-note .xr-dot { grid-row: 1 / 3; }
.xr-note b { font-weight: 500; font-size: 1rem; line-height: 1.2; }
.xr-note small { font-size: .75rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.xr-note:hover { border-color: var(--ink-2); background: rgba(242, 243, 247, .04); }
.xr-note:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.xr-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 20px 40px; }
.xr-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: .8125rem; color: var(--ink-2); }
.xr-legend li { display: inline-flex; align-items: center; gap: 8px; }
.xr-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; box-shadow: 0 0 10px currentColor; }
.xr-dot-tonic { background: var(--xr-tonic, #F2F3F7); color: var(--xr-tonic, #F2F3F7); }
.xr-dot-piano { background: var(--xr-piano, #8394FF); color: var(--xr-piano, #8394FF); }
.xr-dot-between { background: var(--xr-between, #3FCFC4); color: var(--xr-between, #3FCFC4); }
.xr-dot-voice { background: var(--xr-voice, rgb(255, 214, 153)); color: var(--xr-voice, rgb(255, 214, 153)); }

/* ------------------------------------------------------------ glasses mode: pure black, large, high contrast */
.xr-stage.is-glasses, .xr-stage:fullscreen {
  position: fixed; inset: 0; z-index: 300; width: 100vw; height: 100vh; height: 100dvh; max-height: none; min-height: 0;
  aspect-ratio: auto; border-radius: 0; background: #000; box-shadow: none;
}
.xr-stage.is-glasses .xr-canvas { touch-action: none; }
.xr-glasses-on, .xr-glasses-on body { overflow: hidden; }
.xr-glasses-on main { z-index: 100; }
.xr-glasses-on .site-header, .xr-glasses-on .next-page, .xr-glasses-on .chapters { visibility: hidden; }
.xr-gbar { grid-row: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.xr-gbar[hidden] { display: none; }
.is-glasses .xr-hud-top { display: none; }
.is-glasses .xr-gbar .btn { background: #000; color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .85); min-height: 48px; font-size: 1rem; }
.is-glasses .xr-gbar .btn:hover, .is-glasses .xr-gbar .btn:focus-visible { background: #fff; color: #000; }
.is-glasses .xr-gbar .toggle { color: #fff; font-size: 1rem; }
.xr-gtime { padding: 10px 16px; border-radius: 999px; box-shadow: inset 0 0 0 1.5px rgba(255, 214, 153, .9); color: rgb(255, 214, 153); font-variant-numeric: tabular-nums; font-size: 1rem; }
.is-glasses .xr-glass { background: #000; -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .6); }
.is-glasses .xr-message { font-size: clamp(1.25rem, 1rem + 1.2vw, 2rem); color: #fff; text-shadow: none; }
.is-glasses .xr-hud { padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }

/* ------------------------------------------------------------ devices */
.xr-devices { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 960px) { .xr-devices { grid-template-columns: minmax(0, 1fr); } }
.xr-device {
  display: grid; gap: 12px; align-content: start; padding: clamp(22px, 3vw, 36px); border-radius: var(--radius);
  background: var(--xr-glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: var(--xr-edge);
}
.xr-device svg { width: 56px; height: 56px; color: var(--accent); margin-block-end: 8px; }
.xr-device h3 { font-size: var(--t1); letter-spacing: -.02em; line-height: 1.15; }
.xr-who { color: var(--ink); }
.xr-device p:not(.label):not(.xr-who):not(.xr-via) { color: var(--ink-2); }
.xr-via { justify-self: start; margin-top: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: .8125rem; color: var(--ink-2); }

/* ------------------------------------------------------------ immersive mode */
.xr-imm {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 88px);
  padding: clamp(24px, 4.4vw, 64px); border-radius: var(--radius); position: relative; overflow: hidden;
  background: radial-gradient(circle at 88% 18%, rgba(131, 148, 255, .16), rgba(131, 148, 255, 0) 46%), var(--xr-glass);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: var(--xr-edge);
}
[dir="rtl"] .xr-imm { background: radial-gradient(circle at 12% 18%, rgba(131, 148, 255, .16), rgba(131, 148, 255, 0) 46%), var(--xr-glass); }
@media (max-width: 900px) { .xr-imm { grid-template-columns: minmax(0, 1fr); } }
.xr-imm-copy { display: grid; gap: 20px; align-content: start; justify-items: start; }
.xr-imm-p { color: var(--ink-2); max-width: 36em; }
.xr-ent { font-size: .875rem; color: var(--ink-2); padding-inline-start: 14px; border-inline-start: 2px solid var(--line); }
.xr-ent.is-on { color: var(--ink); border-color: var(--accent); }
.xr-support { font-size: .9375rem; color: var(--ink-2); max-width: 38em; transition: color .4s var(--ease); }
.xr-support.is-none { color: var(--ink); }
.xr-support.is-flash { color: var(--accent-ink); }
.xr-opts { flex-direction: column; align-items: start; gap: 4px; }
.xr-imm .caption { margin-top: 0; }
.xr-game { display: grid; gap: 14px; align-content: start; }
.xr-game-h { font-size: var(--t2); letter-spacing: -.025em; line-height: 1.1; font-weight: 300; }
.xr-steps { list-style: none; margin: 8px 0 0; padding: 0; counter-reset: xr-step; border-top: 1px solid var(--line); }
.xr-steps li { counter-increment: xr-step; display: grid; grid-template-columns: 3rem minmax(0, 1fr); gap: 4px 14px; padding-block: 20px; border-bottom: 1px solid var(--line); }
.xr-steps li::before { content: counter(xr-step, decimal-leading-zero); grid-row: 1 / 3; font-size: 1.5rem; font-weight: 300; line-height: 1.1; color: var(--accent); font-variant-numeric: tabular-nums; }
.xr-steps h4 { margin: 0; font-size: 1.125rem; font-weight: 500; }
.xr-steps p { color: var(--ink-2); }

/* ------------------------------------------------------------ early access */
.xr-form { padding: clamp(20px, 3vw, 32px); border-radius: var(--radius); background: var(--xr-glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: var(--xr-edge); max-width: 480px; }
.xr-form .field input { width: 100%; background: rgba(5, 6, 10, .6); }
.xr-hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.xr-lang { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.xr-lang legend { padding: 0; margin-block-end: 8px; width: 100%; }
.xr-lang .chip { position: relative; display: inline-flex; align-items: center; min-height: 44px; cursor: pointer; }
.xr-lang input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.xr-lang .chip:has(input:checked) { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.xr-lang .chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.xr-lang [lang="ar"] { font-family: var(--serif); font-size: 1.05rem; }

/* ------------------------------------------------------------ questions */
.xr-faq { border-top: 1px solid var(--line); max-width: 60rem; }
.xr-faq details { border-bottom: 1px solid var(--line); }
.xr-faq summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 20px;
  min-height: 64px; padding-block: 18px; font-size: clamp(1.0625rem, 1rem + .4vw, 1.3rem); letter-spacing: -.01em;
}
.xr-faq summary::-webkit-details-marker { display: none; }
.xr-faq summary::after { content: ""; flex: none; width: 10px; height: 10px; margin-inline-end: 6px; border-inline-end: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform .4s var(--ease-cine); }
.xr-faq details[open] summary::after { transform: rotate(-135deg); }
.xr-faq summary:hover { color: var(--accent-ink); }
.xr-faq summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 8px; }
.xr-faq details p { padding-block-end: 24px; color: var(--ink-2); max-width: 44em; }

/* ------------------------------------------------------------ call to action */
.xr-cta { display: grid; justify-items: center; gap: 22px; text-align: center; }
.xr-cta-p { color: var(--ink-2); max-width: 32em; }

/* ------------------------------------------------------------ the add-on card */
.xr-addon { border: 0; padding: 0; background: transparent; color: var(--ink); width: min(520px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px); }
.xr-addon::backdrop { background: rgba(5, 6, 10, .72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.xr-addon-in {
  display: grid; gap: 16px; padding: clamp(22px, 4vw, 36px); border-radius: var(--radius);
  background: radial-gradient(ellipse at 50% 0%, rgba(131, 148, 255, .18), rgba(131, 148, 255, 0) 60%), rgba(15, 17, 24, .96);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .09), 0 40px 100px rgba(0, 0, 0, .6);
}
.xr-addon .orbit { width: min(300px, 80%); justify-self: center; color: var(--ink-2); }
.xr-addon-h { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem); font-weight: 300; letter-spacing: -.03em; line-height: 1.1; }
:lang(ar) .xr-addon-h { letter-spacing: 0; line-height: 1.3; }
.xr-addon-list { margin: 0; padding-inline-start: 1.1em; display: grid; gap: 8px; color: var(--ink-2); }
.xr-addon-list li::marker { color: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .xr-addon[open] .xr-addon-in { animation: xr-rise .6s var(--ease-cine); }
}
@keyframes xr-rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* ------------------------------------------------------------ the phone AR overlay (WebXR dom-overlay) */
.xr-overlay { display: none; }
.xr-overlay.is-on { display: grid; position: fixed; inset: auto 0 0 0; gap: 12px; padding: 20px max(16px, env(safe-area-inset-left)) max(20px, env(safe-area-inset-bottom)); background: linear-gradient(to top, rgba(0, 0, 0, .72), rgba(0, 0, 0, 0)); color: #fff; }
.xr-overlay-msg { font-size: 1.125rem; }

@media (max-width: 560px) {
  .xr-actions { gap: 10px 20px; }
  .xr-foot .tune { max-width: none; }
}

.xr-joined { color: var(--ink); background: var(--accent-soft); border-radius: 12px; padding: 12px 16px; }

/* ------------------------------------------------------------ round 2: zoom, the dial, the demo, comfort */
.xr-hud-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.xr-zoom { display: flex; gap: 2px; padding: 4px; border-radius: 999px; }
.xr-zbtn {
  display: grid; place-items: center; width: 40px; height: 36px; border: 0; border-radius: 999px; background: transparent; color: var(--ink);
  cursor: pointer; transition: background-color .3s var(--ease);
}
.xr-zbtn svg { width: 14px; height: 14px; }
.xr-zbtn:hover { background: rgba(242, 243, 247, .1); }
.xr-zbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (pointer: coarse) { .xr-zbtn { width: 44px; height: 44px; } }
.xr-gzoom { display: inline-flex; gap: 6px; }
.is-glasses .xr-zbtn { width: 48px; height: 48px; background: #000; color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .85); }
.is-glasses .xr-zbtn:hover, .is-glasses .xr-zbtn:focus-visible { background: #fff; color: #000; }

/* the caption of the demo: centred, calm, readable over the scene */
.xr-caption {
  justify-self: center; max-width: min(34em, 100%); padding: 12px 20px; border-radius: 18px; text-align: center;
  font-size: clamp(1rem, .9rem + .4vw, 1.25rem); line-height: 1.45; color: var(--ink);
  background: rgba(10, 12, 18, .72); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: var(--xr-edge);
}
@media (prefers-reduced-motion: no-preference) { .xr-caption:not([hidden]) { animation: xr-fade .9s var(--ease); } }
@keyframes xr-fade { from { opacity: 0; } }
.xr-hud-bottom:has(.xr-caption:not([hidden])) { justify-items: stretch; }

/* the pitch dial: needle, bar or arc; flat on the left, always */
.xr-dial { --dw: 190px; display: grid; gap: 4px; justify-items: center; width: calc(var(--dw) + 28px); padding: 12px 14px 10px; border-radius: 20px; }
.xr-dial-s { --dw: 140px; } .xr-dial-l { --dw: 250px; }
.is-glasses .xr-dial { --dw: 250px; } .is-glasses .xr-dial-l { --dw: 320px; }
.xr-dial .d-face { width: var(--dw); }
.xr-dial svg { width: 100%; height: auto; overflow: visible; }
.xr-dial .d-track { fill: none; stroke: rgba(242, 243, 247, .22); stroke-width: 3; stroke-linecap: round; }
.xr-dial .d-zone { fill: none; stroke: var(--xr-tonic, #F2F3F7); stroke-opacity: .16; stroke-width: 14; stroke-linecap: round; }
.xr-dial-bar .d-zone { fill: var(--xr-tonic, #F2F3F7); fill-opacity: .12; stroke: none; }
.xr-dial .d-tick { stroke: rgba(242, 243, 247, .45); stroke-width: 1.5; stroke-linecap: round; }
.xr-dial .d-tick.is-0 { stroke: var(--xr-tonic, #F2F3F7); stroke-width: 2.5; }
.xr-dial .d-needle { stroke: var(--xr-voice, #FFD699); stroke-width: 3; stroke-linecap: round; }
.xr-dial .d-pivot, .xr-dial .d-mark { fill: var(--xr-voice, #FFD699); }
.xr-dial .d-sweep { fill: none; stroke: var(--xr-voice, #FFD699); stroke-width: 6; stroke-linecap: round; }
.xr-dial.is-in .d-zone { stroke-opacity: .34; fill-opacity: .26; }
.xr-dial .d-read { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 2px 10px; text-align: center; }
.xr-dial .d-read b { font-weight: 500; font-size: .9375rem; }
.xr-dial .d-read span { font-size: .8125rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.xr-dial-l .d-read b, .is-glasses .xr-dial .d-read b { font-size: 1.125rem; }
.xr-dial-s .d-read span { display: none; }
@media (prefers-reduced-motion: no-preference) { .xr:not(.is-calm) .xr-dial .d-zone { transition: stroke-opacity .5s var(--ease), fill-opacity .5s var(--ease); } }

.xr-actions [data-xr-demo][aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* make it comfortable: the shared display settings */
.xr-comfort {
  margin-top: 12px; padding: clamp(18px, 2.6vw, 32px); border-radius: var(--radius); background: var(--xr-glass);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: var(--xr-edge);
}
.xr.is-ready .xr-comfort.xr-needs-js { display: grid !important; grid-template-columns: minmax(0, .8fr) minmax(0, 1.4fr); gap: 20px clamp(24px, 4vw, 64px); }
@media (max-width: 860px) { .xr.is-ready .xr-comfort.xr-needs-js { grid-template-columns: minmax(0, 1fr); } }
.xr-comfort-head { display: grid; gap: 10px; align-content: start; }
.xr-comfort-h { font-size: var(--t1); font-weight: 400; letter-spacing: -.02em; line-height: 1.15; }
.xr-comfort-head p { color: var(--ink-2); font-size: .9375rem; }
