/* Tokens */
:root {
  --ground: #030508;
  --panel: #060a10;
  --screen-top: #0b1622;
  --screen: #05090f;
  --line: #101a26;
  --line-2: #1a2735;
  --text: #e4eaf1;
  --text-hi: #f2f6fa;
  --text-2: #c3cedb;
  --text-3: #a9b6c5;
  --muted: #8e9aaa;
  --dim: #8593a4;
  --accent: #9fd4ff;
  --chip: #bfd3e6;
  --warn: #ffb86b;
  --display: "Archivo", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --gutter: clamp(16px, 3vw, 40px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--ground); }
body { margin: 0; background: var(--ground); color: var(--text); font: 14px/1.55 var(--mono); }
a { color: var(--accent); }
a:hover { color: #d6eeff; }
button { font: inherit; color: inherit; }
img { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Scenes */
.scene { position: relative; width: 100%; aspect-ratio: 16 / 9; min-height: 420px; overflow: hidden; background: var(--ground); container-type: inline-size; }
.scene > img, .cam > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scene-fade { position: absolute; inset: 0 0 auto 0; height: 18%; background: linear-gradient(180deg, var(--ground), transparent); pointer-events: none; }
.scene-label { position: absolute; left: var(--gutter); top: var(--gutter); padding: 4px 8px; background: rgba(3,5,8,.78); font-size: 12px; letter-spacing: .16em; color: var(--text-3); }
.scene-hint { position: absolute; left: var(--gutter); bottom: 20px; margin: 0; padding: 4px 8px; background: rgba(3,5,8,.72); font-size: 12px; letter-spacing: .08em; color: var(--muted); }

.cam { position: absolute; left: 50%; translate: -49.9% 0; top: -16.3%; height: 140%; width: auto; aspect-ratio: 16 / 9; transform-origin: 49.9% 44.5%; animation: push 2.8s cubic-bezier(.2,.7,.1,1) both; }
@keyframes push { from { transform: scale(.714); } to { transform: scale(1); } }

.at { position: absolute; }
.hot { padding: 0; background: transparent; border: 1px solid transparent; border-radius: 6px; cursor: pointer; transition: box-shadow .25s, border-color .25s; }
.hot:hover, .hot:focus-visible { border-color: rgba(159,212,255,.7); box-shadow: 0 0 24px rgba(159,212,255,.35); outline: none; }

.screen { container-type: inline-size; overflow: hidden; background: radial-gradient(ellipse at 50% 0%, var(--screen-top) 0%, var(--screen) 70%); box-shadow: inset 0 0 40px rgba(0,0,0,.8), 0 0 60px rgba(159,212,255,.10); }
.screen-on { animation: on .5s 2.2s both; }
@keyframes on { from { filter: brightness(2.2); } to { filter: none; } }

/* Desk main screen */
.desk-ui { display: flex; flex-direction: column; height: 100%; padding: 2.4cqw 3cqw; gap: 1.6cqw; font-size: 2.05cqw; line-height: 1.45; }
.ui-bar { display: flex; justify-content: space-between; color: var(--dim); letter-spacing: .12em; font-size: 1.85cqw; }
.on-dot { color: var(--accent); }
.ui-name { margin: 0; font: 700 4.4cqw/1.1 var(--display); font-stretch: 125%; color: var(--text-hi); }
.ui-sub { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 1cqw; }
.chip { padding: .55cqw 1.3cqw; background: rgba(159,212,255,.05); border: 1px solid rgba(159,212,255,.28); color: var(--chip); font-size: 1.9cqw; cursor: pointer; transition: background .2s, border-color .2s, color .2s; }
.chip:hover, .chip:focus-visible { background: rgba(159,212,255,.16); border-color: rgba(159,212,255,.8); color: #fff; outline: none; }
.prompt { margin: auto 0 0; display: flex; align-items: center; gap: 1cqw; border-top: 1px solid #142030; padding-top: 1.2cqw; }
.prompt label { color: var(--accent); }
.prompt input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--text-hi); font: inherit; padding: .4cqw 0; }
.prompt input:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }
.cursor { color: var(--accent); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.side { padding: 1.4% 1.2%; background: rgba(5,9,15,.86); border-color: rgba(159,212,255,.12); color: var(--muted); text-align: left; overflow: hidden; container-type: inline-size; border-radius: 0; }
.side-ui { display: flex; flex-direction: column; gap: 3cqw; height: 100%; font-size: 5.3cqw; line-height: 1.3; }
.side-ui .k { letter-spacing: .14em; color: var(--dim); }
.side-ui .row { display: flex; justify-content: space-between; color: var(--chip); }
.side-ui .go { margin-top: auto; color: var(--chip); }

/* Header */
.site-head { position: absolute; inset: 0 0 auto 0; z-index: 2; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 20px var(--gutter); background: linear-gradient(180deg, rgba(3,5,8,.75), transparent); }
.brand { white-space: nowrap; color: var(--text-hi); text-decoration: none; font: 600 22px/1 'Cormorant Garamond', Georgia, serif; letter-spacing: .32em; }
@media (max-width: 480px) { .brand { font-size: 16px; letter-spacing: .18em; } .site-head { flex-wrap: nowrap; } .nav { gap: 0; flex-wrap: nowrap; } .nav a { padding: 10px 7px; } .btn-line { padding: 10px 10px; margin-left: 4px; } }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { padding: 10px 12px; color: var(--chip); text-decoration: none; font-size: 12px; letter-spacing: .12em; }
.btn-line { padding: 10px 14px; background: transparent; border: 1px solid rgba(159,212,255,.4); color: var(--text-hi); font-size: 12px; letter-spacing: .12em; cursor: pointer; }

/* Lab + gym screens */
.lab-ui, .gym-ui { display: flex; flex-direction: column; height: 100%; }
.lab-ui { gap: 1.6cqw; padding: 3.6cqw 4.6cqw; font-size: 3.9cqw; line-height: 1.35; }
.lab-ui .ui-bar, .gym-ui .ui-bar { font-size: 3.9cqw; letter-spacing: .14em; }
.big { font: 800 7cqw/1.02 var(--display); font-stretch: 125%; color: var(--text-hi); }
.lab-list { display: flex; flex-direction: column; margin-top: auto; }
.lab-list button { display: flex; justify-content: space-between; padding: .9cqw 1.4cqw; background: transparent; border: 0; border-top: 1px solid #142030; color: var(--chip); text-align: left; cursor: pointer; }
.lab-list button:hover, .lab-list button:focus-visible { background: rgba(159,212,255,.12); outline: none; }
.gym-screen { padding: 0; text-align: left; color: var(--text); border-color: rgba(159,212,255,.10); border-radius: 0; }
.gym-ui { gap: 1.4cqw; padding: 3.4cqw 4.6cqw; font-size: 3.9cqw; line-height: 1.4; }
.gym-ui .big { font-size: 6.6cqw; }
.gym-ui .ui-sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gym-ui .go { margin-top: auto; color: var(--chip); }
.frame { overflow: hidden; background: #1a1d21; border-radius: 0; }
.frame img { width: 100%; height: 100%; object-fit: cover; filter: brightness(.82) contrast(1.05); }

/* Phone consoles */
.console { display: none; flex-direction: column; gap: 10px; padding: 20px 16px; border-bottom: 1px solid var(--line); }
.console .chips { gap: 8px; }
.console .chip { min-height: 44px; padding: 8px 12px; font-size: 13px; }
.console .menu-btn { min-height: 44px; padding: 8px 12px; background: transparent; border: 1px solid var(--line-2); text-align: left; cursor: pointer; }
.console form { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); padding: 0 12px; }
.console input { flex: 1; min-width: 0; min-height: 44px; background: transparent; border: 0; color: var(--text-hi); font: inherit; }
.console-name { margin: 0; font: 700 26px/1.1 var(--display); font-stretch: 120%; }
.k-label { font-size: 11px; letter-spacing: .16em; color: var(--dim); }
.narrow-only { display: none; }
@media (max-width: 1099px) {
  .wide-only { display: none !important; }
  .narrow-only { display: flex; }
  .console { display: flex; }
}
.mini { flex-direction: column; justify-content: center; gap: 2cqw; padding: 4cqw 5cqw; }
.mini .ui-bar { font-size: 3.4cqw; }
.mini .ui-name { font-size: 7.4cqw; }

/* Dialog */
dialog { width: min(960px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; background: rgba(6,10,16,.97); color: var(--text); border: 1px solid rgba(159,212,255,.35); box-shadow: 0 30px 120px rgba(0,0,0,.7), 0 0 80px rgba(159,212,255,.10); }
dialog::backdrop { background: rgba(2,4,7,.66); }
dialog[open] { animation: rise .35s cubic-bezier(.2,.7,.1,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.dlg-bar { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 6px 6px 18px; background: rgba(6,10,16,.98); border-bottom: 1px solid #142030; font-size: 12px; color: var(--dim); }
.dlg-bar b { color: var(--text-hi); font-weight: 400; }
.close { width: 44px; height: 44px; background: transparent; border: 1px solid var(--line-2); font-size: 16px; cursor: pointer; }
.view { display: none; flex-direction: column; gap: 18px; padding: 28px 24px; }
.view.on { display: flex; }
.eyebrow { font-size: 11px; letter-spacing: .16em; color: var(--accent); }
.view h2 { margin: 0; font: 800 44px/1 var(--display); font-stretch: 125%; }
.view p { margin: 0; color: var(--text-2); }
.note { font-size: 12px; color: var(--dim) !important; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px; background: var(--panel); border: 1px solid #142030; }
.grid > * { outline: 1px solid #142030; }
.cell { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; background: var(--panel); }
.cell .k { font-size: 11px; letter-spacing: .1em; color: var(--dim); }
.cell .v { font-size: 20px; color: var(--text-hi); font-variant-numeric: tabular-nums; }
.cell .d { font-size: 13px; color: var(--text-3); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { padding: 4px 10px; border: 1px solid var(--line-2); font-size: 12px; color: var(--text-3); }
.rows { display: flex; flex-direction: column; }
.rows > * { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 4px 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.rows .when { color: var(--dim); }
.rows .org { color: var(--text-hi); }
.rows .role { color: var(--text-3); }
.cmd-list button { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; background: transparent; border: 0; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; width: 100%; }
.cmd-list .hint { color: var(--dim); }
.proj { display: flex; flex-direction: column; gap: 6px; padding: 18px; background: var(--panel); border: 0; text-align: left; cursor: pointer; }
.proj .top { display: flex; justify-content: space-between; font-size: 11px; letter-spacing: .14em; color: var(--dim); }
.proj .name { font: 800 24px var(--display); font-stretch: 125%; }
.proj .blurb { color: var(--text-3); }
.slot { aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; border: 1px dashed #1e2c3c; color: var(--dim); font-size: 12px; }
.solid { align-self: flex-start; padding: 12px 18px; background: var(--accent); color: var(--ground); text-decoration: none; font-size: 12px; letter-spacing: .12em; }
.line-link { padding: 12px 16px; border: 1px solid var(--line-2); color: var(--text-hi); text-decoration: none; font-size: 12px; letter-spacing: .12em; }
.photos { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.photos figure { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.photos img { width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: cover; }
.photos figcaption { font-size: 12px; color: var(--muted); }
.trophies { display: flex; flex-direction: column; gap: 10px; padding: 18px; background: var(--panel); }
.trophies .sport { font: 800 20px var(--display); font-stretch: 125%; }
.trophies span:not(.sport) { color: var(--text-3); font-size: 13px; border-top: 1px solid var(--line); padding-top: 8px; }

/* Index */
.index { max-width: 1200px; margin: 0 auto; padding: 64px var(--gutter); display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 32px; }
.index div { display: flex; flex-direction: column; gap: 10px; }
.index button { padding: 0; min-height: 32px; background: none; border: 0; text-align: left; cursor: pointer; }
.index .meta { color: var(--dim); font-size: 12px; }

@media (prefers-reduced-motion: reduce) {
  .cam, .screen-on, .cursor, dialog[open] { animation: none; }
}

/* Windows High Contrast: borderless controls get their shape back */
@media (forced-colors: active) {
  button, input { border: 1px solid ButtonText !important; }
}

/* Hotspot markers: every clickable object gets bold glowing corner brackets that pulse, plus a solid call-to-action tag.
   Brackets and tags sit outside the object's box, so the hotspots must not clip them. */
.hot { overflow: visible; --c: #bfe4ff; --l: 26px; --t: 3px; }
.hot::before {
  content: ""; position: absolute; inset: -6px; pointer-events: none;
  background:
    linear-gradient(var(--c),var(--c)) top left / var(--l) var(--t) no-repeat,
    linear-gradient(var(--c),var(--c)) top left / var(--t) var(--l) no-repeat,
    linear-gradient(var(--c),var(--c)) top right / var(--l) var(--t) no-repeat,
    linear-gradient(var(--c),var(--c)) top right / var(--t) var(--l) no-repeat,
    linear-gradient(var(--c),var(--c)) bottom left / var(--l) var(--t) no-repeat,
    linear-gradient(var(--c),var(--c)) bottom left / var(--t) var(--l) no-repeat,
    linear-gradient(var(--c),var(--c)) bottom right / var(--l) var(--t) no-repeat,
    linear-gradient(var(--c),var(--c)) bottom right / var(--t) var(--l) no-repeat;
  filter: drop-shadow(0 0 6px rgba(159,212,255,.9));
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .55; inset: -11px; } }
.hot:hover::before, .hot:focus-visible::before { animation: none; }
/* bare objects (no screen of their own) get a faint tint so the whole target reads as a button */
.hot.pin:not(.screen) { background: rgba(159,212,255,.07); }
.hot.pin:not(.screen):hover, .hot.pin:not(.screen):focus-visible { background: rgba(159,212,255,.14); }
.lbl {
  position: absolute; z-index: 3; left: -6px; top: -6px; translate: 0 -100%; padding: 6px 10px;
  background: var(--accent); color: #03111d; white-space: nowrap; pointer-events: none;
  font: 600 12px/1 var(--mono); letter-spacing: .1em; box-shadow: 0 4px 18px rgba(0,0,0,.55);
}
.hot:hover .lbl, .hot:focus-visible .lbl { background: #fff; }
.lbl.in { top: 16px; left: 16px; translate: none; }   /* objects at the very top of a room keep their tag inside the frame */
@media (max-width: 1099px) {
  .hot { --l: 16px; --t: 2px; }
  .hot::before { inset: -4px; }
  @keyframes pulse { 50% { opacity: .55; inset: -7px; } }
  .lbl { left: -4px; top: -4px; padding: 5px 7px; font-size: 10px; letter-spacing: .06em; }
  .lbl.in { top: 10px; left: 10px; }
  .side .lbl, .gym-screen .lbl { display: none; }   /* these screens already read "BUILDS ▸" / "About me ▸" on phones */
}
@media (prefers-reduced-motion: reduce) { .hot::before { animation: none; } }

/* Readable dialog body: prose in Archivo at 15px; mono stays for UI, labels and commands */
.view p, .proj .blurb, .cell .d, .trophies span:not(.sport), .photos figcaption {
  font-family: var(--display); font-stretch: 100%; font-size: 15px; line-height: 1.6; letter-spacing: 0;
}
.view p { max-width: none; }
.view .note { font-size: 13px; }

/* CV jobs */
.job { display: flex; flex-direction: column; gap: 6px; padding: 16px 0; border-top: 1px solid var(--line); }
.job-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.job .org { color: var(--text-hi); }
.job .when { color: var(--dim); }
.job .role { color: var(--accent); font-size: 13px; }
.job ul { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font: 15px/1.55 var(--display); color: var(--text-2); }
@media (max-width: 760px) { .site-head { background: linear-gradient(180deg, rgba(3,5,8,.92) 55%, transparent); } .nav a { color: var(--text-hi); } }

/* Phone polish (iPhone Safari) */
@media (max-width: 480px) {
  .brand { font-size: 15px; letter-spacing: .14em; }
  .nav a { padding: 10px 6px; font-size: 11px; letter-spacing: .06em; }
  .btn-line { padding: 9px 9px; font-size: 11px; letter-spacing: .06em; }
}
/* Phones and tablets: each room is a full-height photo you swipe across, with the same tappable objects as desktop */
@media (max-width: 1099px) {
  .scene { aspect-ratio: auto; min-height: 0; height: clamp(342px, 53.5vw, 610px); }
  .scene:first-of-type { height: clamp(304px, 49.5vw, 570px); }
  .pan { overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .pan::-webkit-scrollbar { display: none; }
  .cam, .stage { position: relative; left: 0; top: 0; translate: none; height: 100%; width: auto; aspect-ratio: 16 / 9; animation: none; }
  .pin::after { content: ""; position: absolute; inset: -10px; }   /* bigger tap target than the drawn object */
  .side svg, .side .row, .side-ui .on-dot { display: none; }
  .side-ui { font-size: max(11px, 12.5cqw); line-height: 1.2; gap: 6cqw; justify-content: space-between; }
  .pin { min-height: 28px; min-width: 28px; }
  .side-ui .k { color: var(--text-hi); }
  .side-ui .k::after { content: " ▸"; }
  .side .go { display: none; }
  .side-ui { justify-content: center; }
  .swipe-hint { position: absolute; right: var(--gutter); bottom: 12px; margin: 0; padding: 4px 8px; background: rgba(3,5,8,.78); font-size: 11px; letter-spacing: .06em; color: var(--text-3); pointer-events: none; }
}
.pan, .stage { position: absolute; inset: 0; }
.stage > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mini-btn, .mini-in { flex-direction: column; justify-content: center; gap: 3cqw; width: 100%; height: 100%; box-sizing: border-box; padding: 5cqw 6cqw; background: transparent; border: 0; color: var(--text-hi); text-align: left; cursor: pointer; }
.mini-btn .ui-bar, .mini-in .ui-bar { font-size: max(11px, 6.5cqw); letter-spacing: .12em; }
.mini-btn .ui-name, .mini-in .ui-name { font: 800 12cqw/1 var(--display); font-stretch: 125%; color: var(--text-hi); }
@media (max-width: 600px) {
  dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .view { padding: 20px 16px; gap: 14px; }
  .view h2 { font-size: 28px; line-height: 1.05; }
  .view p, .job ul { font-size: 15px; }
  .cell .v { font-size: 18px; }
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dlg-prompt { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); padding: 0 12px; }
.dlg-prompt input { flex: 1; min-width: 0; min-height: 44px; background: transparent; border: 0; color: var(--text-hi); font: inherit; }
.view[data-view="desk"] .chip { min-height: 44px; padding: 8px 12px; font-size: 13px; }
.mini-btn.screen { padding: 4cqw 5cqw; align-items: center; justify-content: center; gap: 4.5cqw; text-align: center; border-radius: 0; }
.mini-btn.screen .ui-bar { justify-content: center; gap: 4cqw; font-size: 11px; letter-spacing: .1em; color: var(--text-3); }
.mini-btn.screen .ui-name.cta { display: inline-flex; align-items: center; gap: .4em; padding: 2.6cqw 5cqw; background: var(--accent); color: var(--ground); font-size: max(13px, 7.4cqw); white-space: nowrap; letter-spacing: 0; box-shadow: 0 0 0 0 rgba(159,212,255,.55); animation: cta 2.4s ease-out infinite; }
@keyframes cta { 0% { box-shadow: 0 0 0 0 rgba(159,212,255,.55); } 70% { box-shadow: 0 0 0 4cqw rgba(159,212,255,0); } 100% { box-shadow: 0 0 0 0 rgba(159,212,255,0); } }
@media (prefers-reduced-motion: reduce) { .mini-btn.screen .ui-name.cta { animation: none; } }
@media (min-width: 1100px) { .narrow-h1 { display: none; } }
