/* /spatial — the 3D portfolio. Fonts are the site's own (Abel + Raleway, self-hosted). */
@font-face{font-family:'Abel';font-style:normal;font-weight:400;font-display:swap;src:url(/assets/fonts/abel-normal-latin.woff2) format('woff2')}
@font-face{font-family:'Raleway';font-style:normal;font-weight:400 700;font-display:swap;src:url(/assets/fonts/raleway-normal-latin.woff2) format('woff2')}
@font-face{font-family:'Raleway';font-style:italic;font-weight:400 700;font-display:swap;src:url(/assets/fonts/raleway-italic-latin.woff2) format('woff2')}

:root {
  --ink: #eef3fb;
  --soft: #aab6c8;
  --navy: #253551;
  --deep: #070b14;
  --accent: #8fd6ff;
  --warm: #ffb36b;
  --g2: #6dff8f;
  --glass: rgba(10, 16, 30, .64);
  --line: rgba(255, 255, 255, .13);
  --head: 'Abel', 'Arial Narrow', 'Helvetica Neue', Arial, sans-serif;
  --body: 'Raleway', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --bar: 64px;
}
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--deep); color: var(--ink); scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--body); font-size: 16px; line-height: 1.62; letter-spacing: .01em; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.skip { position: fixed; left: -999px; top: 8px; z-index: 100; background: #fff; color: #000; padding: .5rem 1rem; }
.skip:focus { left: 8px; }

/* ---------- the stage ---------- */
#stage { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100lvh; display: block; z-index: 0; touch-action: pan-y; }
html:not(.js) #stage, .no-webgl #stage { display: none; }
/* without WebGL the page still reads well: a quiet gradient instead of the scene */
html:not(.js) body, .no-webgl body { background: radial-gradient(120% 90% at 70% 30%, #1d2d4d 0%, #0b1220 55%, #05080f 100%) fixed; }

/* ---------- top bar ---------- */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 20; height: var(--bar);
  display: flex; align-items: center; gap: 1.5rem; padding: 0 clamp(16px, 3vw, 40px);
  background: linear-gradient(rgba(7, 11, 20, .78), rgba(7, 11, 20, 0));
}
.brand { font-family: var(--head); font-size: 1.45rem; color: var(--ink); text-decoration: none; margin-right: auto; white-space: nowrap; }
.bar nav { display: flex; gap: 1.25rem; font-size: .92rem; }
.bar nav a { color: var(--soft); text-decoration: none; white-space: nowrap; }
.bar nav a:hover { color: #fff; }
.bar .exit { color: var(--ink); border: 1px solid var(--line); border-radius: 99px; padding: .2rem .8rem; }

/* ---------- chapters ---------- */
main { position: relative; z-index: 10; }
.ch { min-height: 150vh; display: flex; align-items: flex-start; padding: 0 clamp(16px, 4vw, 64px); }
.ch[data-side="right"] { justify-content: flex-end; }
.ch[data-side="center"] { justify-content: center; min-height: 120vh; }
#hero { min-height: 140vh; }
.card {
  position: sticky; top: calc(var(--bar) + 6vh);
  width: min(430px, 100%); margin-top: 22vh; margin-bottom: 30vh;
  padding: 1.6rem 1.7rem 1.4rem; border-radius: 16px;
  background: var(--glass); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
#hero .card { margin-top: 18vh; width: min(470px, 100%); }
.ch[data-side="center"] .card { width: min(620px, 100%); text-align: center; margin-top: 52vh; top: auto; bottom: 90px; }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.kicker { font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); margin: 0 0 .7rem; }
h1, h2 { font-family: var(--head); font-weight: 400; line-height: 1.12; margin: 0 0 .8rem; color: #fff; }
h1 { font-size: clamp(2.2rem, 4.2vw, 3.3rem); }
h2 { font-size: clamp(1.7rem, 2.8vw, 2.3rem); }
.lead { font-family: var(--head); font-size: 1.45rem; line-height: 1.3; color: #fff; }
.card p { margin: 0 0 .9rem; color: #d6deea; }
.card b { color: #fff; font-weight: 600; }
.small { font-size: .82rem; color: var(--soft) !important; }
.hints { list-style: none; padding: 0; margin: 0 0 1.1rem; font-size: .9rem; color: var(--soft); }
.hints li { padding-left: 1.3em; position: relative; margin: .2rem 0; }
.hints li::before { content: ""; position: absolute; left: 0; top: .62em; width: .5em; height: .5em; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.legend { list-style: none; padding: 0; margin: 0 0 1rem; font-size: .92rem; }
.legend li { display: flex; gap: .6rem; align-items: baseline; margin: .3rem 0; color: #d6deea; }
.legend i { flex: none; width: .75em; height: .75em; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); transform: translateY(.05em); }

.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.1rem !important; }
.ch[data-side="center"] .actions { justify-content: center; }
.btn {
  display: inline-flex; align-items: center; min-height: 42px; padding: .45rem 1.05rem; border-radius: 99px;
  background: #fff; color: #0b1220; text-decoration: none; font-weight: 600; font-size: .9rem; letter-spacing: .02em;
  transition: transform .15s ease, background-color .15s ease, color .15s ease;
}
.btn:hover { color: #0b1220; background: var(--accent); transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid rgba(255, 255, 255, .3); }
.btn.ghost:hover { border-color: var(--accent); color: #fff; background: rgba(143, 214, 255, .12); }

/* dwell game */
.game { margin: 0 0 1rem; padding: .85rem 1rem .7rem; border-radius: 12px; border: 1px dashed rgba(255, 179, 107, .55); background: rgba(255, 179, 107, .07); }
.game-title { font-weight: 600; color: var(--warm) !important; margin-bottom: .3rem !important; }
.game-help { font-size: .86rem; }
.game-score { font-size: .86rem; margin: 0 !important; color: #fff !important; }
.game-score output { font-weight: 700; color: var(--warm); }
.no-webgl .game, html:not(.js) .game { display: none; }

/* Malta tooltip line inside the card */
.tip { min-height: 1.5em; font-size: .88rem; color: var(--accent) !important; }
@media (hover: none) { .pointer-only { display: none; } }
@media (hover: hover) { .touch-only { display: none; } }

/* ask JB Proxie */
.ask { margin: 0 0 .6rem; }
.ask label { display: block; font-size: .82rem; color: var(--soft); margin-bottom: .35rem; }
.ask-row { display: flex; gap: .5rem; }
.ask input {
  flex: 1; min-width: 0; min-height: 42px; padding: .4rem .8rem; border-radius: 10px; font: inherit; font-size: .95rem;
  color: #fff; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .22);
}
.ask input::placeholder { color: #8391a6; }
.ask input:focus { outline: none; border-color: var(--g2); box-shadow: 0 0 0 3px rgba(109, 255, 143, .18); }
.ask button { min-height: 42px; padding: 0 1rem; border: 0; border-radius: 10px; background: var(--g2); color: #04140a; font-weight: 700; font: inherit; font-weight: 700; cursor: pointer; }
.ask button:disabled { opacity: .5; cursor: progress; }
.reply { margin: .7rem 0 0 !important; font-size: .9rem; white-space: pre-wrap; max-height: 13em; overflow-y: auto; }
.reply:empty, .reply-links:empty { display: none; }
.reply-links { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 0 !important; }
.reply-links a { font-size: .8rem; padding: .15rem .7rem; border-radius: 99px; border: 1px solid rgba(109, 255, 143, .5); color: var(--g2); text-decoration: none; }
.no-webgl .ask label, html:not(.js) .ask { display: none; }

/* ---------- chapter rail ---------- */
.rail { position: fixed; right: clamp(10px, 1.6vw, 24px); top: 50%; transform: translateY(-50%); z-index: 15; display: flex; flex-direction: column; gap: 12px; }
.rail a { position: relative; display: block; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .55); transition: transform .2s ease, background-color .2s ease; }
.rail a span { position: absolute; right: 22px; top: 50%; transform: translateY(-50%); white-space: nowrap; font-size: .78rem; color: #fff; background: rgba(7, 11, 20, .8); padding: .15rem .55rem; border-radius: 6px; opacity: 0; pointer-events: none; transition: opacity .15s ease; }
.rail a:hover span, .rail a:focus-visible span { opacity: 1; }
.rail a.on { background: var(--accent); border-color: var(--accent); transform: scale(1.25); box-shadow: 0 0 12px var(--accent); }

/* ---------- lens dock ---------- */
.dock {
  position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  display: flex; align-items: center; gap: 4px; padding: 5px; border-radius: 99px;
  background: rgba(10, 16, 30, .78); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.dock-label { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--soft); padding: 0 .6rem 0 .8rem; white-space: nowrap; }
.dock button {
  min-height: 36px; padding: 0 .85rem; border: 0; border-radius: 99px; background: transparent; color: var(--ink);
  font: 600 .84rem/1 var(--body); letter-spacing: .02em; cursor: pointer; white-space: nowrap;
}
.dock button:hover { background: rgba(255, 255, 255, .1); }
.dock button[aria-pressed="true"] { background: #fff; color: #0b1220; }
.dock button.auto-on { box-shadow: inset 0 0 0 1.5px var(--accent); }
.xr-slot:empty { display: none; }
.xr-slot button { position: static !important; left: auto !important; width: auto !important; bottom: auto !important; opacity: 1 !important; min-height: 36px; padding: 0 .9rem !important; border: 0 !important; border-radius: 99px !important; background: var(--accent) !important; color: #0b1220 !important; font: 700 .8rem/1 var(--body) !important; cursor: pointer; }
html:not(.js) .dock, .no-webgl .dock { display: none; }

/* ---------- device HUDs over the view ---------- */
.hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.hud > div { position: absolute; inset: 0; opacity: 0; transition: opacity .5s ease; }
.lens-1 .hud-vr, .lens-2 .hud-ar, .lens-3 .hud-g2 { opacity: 1; }
.hud-vr { display: flex; justify-content: center; gap: 2rem; align-items: flex-start; padding-top: calc(var(--bar) + 14px); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: rgba(255, 255, 255, .55); }
.hud-ar .br { position: absolute; width: 34px; height: 34px; border: 2px solid rgba(160, 230, 255, .7); }
.hud-ar .tl { left: 18%; top: 15%; border-right: 0; border-bottom: 0; }
.hud-ar .tr { right: 18%; top: 15%; border-left: 0; border-bottom: 0; }
.hud-ar .bl { left: 18%; bottom: 15%; border-right: 0; border-top: 0; }
.hud-ar .br2 { right: 18%; bottom: 15%; border-left: 0; border-top: 0; }
.hud-ar-label { position: absolute; left: 50%; top: calc(15% - 26px); transform: translateX(-50%); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: rgba(190, 240, 255, .8); }
.hud-g2 { font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; color: var(--g2); text-shadow: 0 0 8px rgba(109, 255, 143, .6); }
.g2-top { position: absolute; left: 50%; top: calc(var(--bar) + 10px); transform: translateX(-50%); display: flex; gap: 1.4rem; font-size: .8rem; letter-spacing: .08em; }
.g2-body { position: absolute; left: 50%; top: calc(var(--bar) + 40px); transform: translateX(-50%); width: min(520px, 80vw); font-size: .9rem; line-height: 1.5; text-align: center; white-space: pre-wrap; max-height: 9.2em; overflow: hidden; }

/* ---------- tooltip + loader ---------- */
.tooltip {
  position: fixed; z-index: 30; left: 0; top: 0; pointer-events: none; opacity: 0; transition: opacity .12s ease;
  padding: .35rem .65rem; border-radius: 8px; font-size: .8rem; color: #fff; background: rgba(7, 11, 20, .88); border: 1px solid var(--line); white-space: nowrap;
}
.tooltip.on { opacity: 1; }
.loader {
  position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center; gap: 1rem;
  background: radial-gradient(100% 80% at 50% 40%, #13203a 0%, #070b14 70%); transition: opacity .8s ease, visibility .8s;
}
html:not(.js) .loader, .loaded .loader, .no-webgl .loader { opacity: 0; visibility: hidden; }
.loader-ring { position: relative; width: 96px; height: 96px; }
.loader-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.loader-ring circle { fill: none; stroke: rgba(255, 255, 255, .12); stroke-width: 3; }
.loader-ring .p { stroke: var(--accent); stroke-dasharray: 276.5; stroke-dashoffset: 276.5; stroke-linecap: round; transition: stroke-dashoffset .3s ease; }
.loader-ring img { position: absolute; left: 50%; top: 50%; width: 30px; transform: translate(-50%, -50%); opacity: .9; }
.loader p { margin: 0; font-size: .82rem; letter-spacing: .14em; text-transform: uppercase; color: var(--soft); }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  :root { --bar: 54px; }
  .bar nav a:not(.exit) { display: none; }
  .brand { font-size: 1.25rem; }
  .rail { display: none; }
  .ch, .ch[data-side="right"], .ch[data-side="center"] { justify-content: center; min-height: 160vh; padding: 0 12px; }
  .card, #hero .card, .ch[data-side="center"] .card { position: relative; top: auto; margin-top: 62vh; margin-bottom: 20vh; padding: 1.25rem 1.2rem 1.1rem; }
  .card { background: rgba(10, 16, 30, .78); }
  .dock { left: 8px; right: 8px; transform: none; justify-content: space-between; overflow-x: auto; }
  .dock-label { display: none; }
  .dock button { padding: 0 .6rem; font-size: .8rem; }
  .hud-ar .tl, .hud-ar .bl { left: 6%; } .hud-ar .tr, .hud-ar .br2 { right: 6%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .rail a, .hud > div { transition: none; }
}
