/* The HTML around the room. Colours per section follow the paintings' frames. */
:root {
  --bg: #05070c;
  --panel: rgba(12, 14, 19, 0.86);
  --line: rgba(255, 255, 255, 0.09);
  --ink: #ece7dc;
  --dim: #9aa0a8;
  --amber: #ffb547;
  --accent: var(--amber);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--sans); }
body { overflow: hidden; -webkit-font-smoothing: antialiased; }
#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; outline: none; touch-action: none; cursor: grab; }
body.looked .hint .drag { opacity: 0.55; }
a { color: inherit; }
kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; background: rgba(255,255,255,0.05); }

/* ---------------------------------------------------------------- top bar */
.top { position: fixed; z-index: 5; inset: 0 0 auto 0; display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; padding: 20px 28px; pointer-events: none; background: linear-gradient(rgba(5,7,12,0.55), rgba(5,7,12,0)); }
.top > * { pointer-events: auto; }
.brand { text-decoration: none; display: flex; flex-direction: column; gap: 4px; }
.brand b { font: 700 19px/1 var(--sans); letter-spacing: 0.08em; text-shadow: 0 1px 12px rgba(5,7,12,0.9), 0 0 2px rgba(5,7,12,0.8); }
.brand span { font: 400 12px/1.2 var(--mono); color: #c6cad0; letter-spacing: 0.02em; text-shadow: 0 1px 8px rgba(5,7,12,0.95), 0 0 2px rgba(5,7,12,0.9); }
/* the wall lights sit right behind the name: the scrim is a little deeper on the left, where the text is */
.top::before { content: ""; position: absolute; inset: 0 auto -40px 0; width: min(520px, 60vw); z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse 100% 100% at 0 0, rgba(5,7,12,0.9), rgba(5,7,12,0.7) 45%, rgba(5,7,12,0) 85%); }
.menu { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.menu a { font: 500 13px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none; color: #cfd2d6;
  padding: 9px 11px; border-radius: 6px; transition: background .2s, color .2s; }
.menu a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.menu a[aria-current] { background: var(--ink); color: #111; }

/* ---------------------------------------------------------------- the card */
.card { position: fixed; z-index: 6; top: 84px; right: 24px; bottom: 64px; width: min(440px, 42vw);
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  backdrop-filter: blur(14px) saturate(1.1); -webkit-backdrop-filter: blur(14px) saturate(1.1);
  box-shadow: 0 30px 80px rgba(0,0,0,0.45); animation: cardIn .38s cubic-bezier(.2,.8,.2,1) var(--cd, 0ms) both; overflow: hidden; }
/* the card's entries follow it in, one after another (--i set in main.js), once the camera has started to settle */
.card .body .item, .card .body .lead, .card .body .links { animation: itemIn .3s cubic-bezier(.2,.8,.2,1) both;
  animation-delay: calc(var(--cd, 0ms) + 140ms + var(--i, 0) * 70ms); }
@keyframes itemIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.card[hidden] { display: none; }
@keyframes cardIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
.card[data-section="work"] { --accent: #d9b36a; }
.card[data-section="education"] { --accent: #c98d5d; }
.card[data-section="projects"] { --accent: #e9e5dc; }
.card[data-section="hobbies"] { --accent: #ef8a6b; }
.card[data-section="about"] { --accent: var(--amber); }
.card header { position: relative; padding: 22px 26px 16px; border-bottom: 1px solid var(--line); }
.kicker { font: 500 11px/1.3 var(--mono); letter-spacing: 0.16em; color: var(--accent); text-transform: uppercase; }
.card h2 { font: 600 34px/1.05 var(--serif); margin: 8px 0 0; letter-spacing: -0.01em; }
.card .close { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(255,255,255,0.04); color: var(--ink); font-size: 14px; cursor: pointer; }
.card .close:hover { background: rgba(255,255,255,0.12); }
.card .to-painting { display: none; margin-top: 10px; font: 500 11px/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent); background: none; border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; cursor: pointer; }
.card.at-terminal .to-painting { display: inline-block; }
.card .body { flex: 1; overflow-y: auto; padding: 18px 26px 26px; scrollbar-width: thin; }
.card footer { display: flex; justify-content: space-between; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.card footer button { font: 500 12px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim);
  background: none; border: 1px solid transparent; border-radius: 6px; padding: 9px 10px; cursor: pointer; }
.card footer button:hover { color: var(--ink); border-color: var(--line); }
.lead { font: 400 19px/1.45 var(--serif); color: #f3efe6; margin: 2px 0 14px; }
.card p, .flat-page p { font-size: 14.5px; line-height: 1.6; color: #d4d0c7; margin: 0 0 10px; }
.links a { display: inline-block; margin: 6px 14px 0 0; font: 500 13px/1 var(--mono); color: var(--accent); text-decoration: none; }

.items { display: flex; flex-direction: column; gap: 12px; }
.item { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: rgba(255,255,255,0.025); }
.item h3 { font: 600 16.5px/1.3 var(--sans); margin: 4px 0 2px; color: #fff; }
.item .org { font-size: 13px; color: var(--dim); margin-bottom: 8px; }
.item p { font-size: 14px; margin: 6px 0 0; }
.item ul { margin: 8px 0 0; padding-left: 18px; }
.item li { font-size: 13.5px; line-height: 1.55; color: #cfcbc2; margin: 3px 0; }
.item .meta { display: flex; justify-content: space-between; font: 500 11px/1.4 var(--mono); letter-spacing: 0.08em; color: var(--accent); }
.item .show { color: var(--dim); opacity: 0; transition: opacity .2s; }
.item.clickable { cursor: pointer; transition: border-color .2s, background .2s; }
.item.clickable:hover, .item.clickable:focus-visible { border-color: color-mix(in srgb, var(--accent) 55%, transparent); outline: none; }
.item.clickable:hover .show, .item.active .show { opacity: 1; }
.item.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.item.active .show { color: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tags span { font: 500 11px/1 var(--mono); padding: 5px 7px; border-radius: 5px; background: rgba(255,255,255,0.06); color: #c9c6bf; }
.metric { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.metric b { font: 600 26px/1 var(--serif); color: var(--accent); }
.metric span { font: 500 12px/1.3 var(--mono); color: var(--dim); }
.item.row { display: flex; justify-content: space-between; gap: 14px; }
.item .year { font: 500 12px/1.4 var(--mono); color: var(--accent); white-space: nowrap; }
.items.hobbies { display: grid; grid-template-columns: 1fr 1fr; }

/* ---------------------------------------------------------------- tooltip + hint */
#tip { position: fixed; z-index: 7; left: 0; top: 0; pointer-events: none; font: 500 12px/1 var(--mono); letter-spacing: 0.12em;
  padding: 8px 10px; border-radius: 6px; background: rgba(10,12,16,0.88); border: 1px solid var(--line); color: var(--ink); white-space: nowrap; }
.hint { position: fixed; z-index: 4; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: center;
  padding: 14px 28px; font: 400 12px/1 var(--mono); color: var(--dim); pointer-events: none;
  background: linear-gradient(rgba(5,7,12,0), rgba(5,7,12,0.6)); text-shadow: 0 1px 8px rgba(5,7,12,0.95), 0 0 2px rgba(5,7,12,0.9); }
.hint > * { pointer-events: auto; }
/* the hint sits on the lit floor: its own dark backing, like the buttons on the right */
.hint .keys { background: rgba(5,7,12,0.68); padding: 7px 10px; border-radius: 6px; line-height: 1.5; }
.flatlink { text-decoration: none; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; letter-spacing: 0.08em; text-transform: uppercase; font-size: 11px; }
.flatlink:hover { color: var(--ink); }
.hint .side { display: flex; gap: 8px; align-items: center; }
.hint .contact { text-decoration: none; border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent); color: var(--amber); border-radius: 6px;
  padding: 8px 10px; letter-spacing: 0.08em; text-transform: uppercase; font-size: 11px; background: rgba(5,7,12,0.55); }
.hint .contact:hover, .hint .contact:focus-visible { background: color-mix(in srgb, var(--amber) 14%, rgba(5,7,12,0.7)); outline: none; }
.flatlink { background: rgba(5,7,12,0.55); }
/* the sound switch: same size as the links beside it; amber when on */
.soundbtn { display: inline-flex; align-items: center; gap: 6px; font: 400 11px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--dim); background: rgba(5,7,12,0.55); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; cursor: pointer; }
.soundbtn:hover, .soundbtn:focus-visible { color: var(--ink); outline: none; border-color: rgba(255,255,255,0.25); }
.soundbtn[aria-pressed="true"] { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, transparent); }
.hint .side > * , .hint .keys { white-space: nowrap; }
/* phones: the row has to fit 360 px, so the labels get shorter (Text, LinkedIn, the speaker alone) */
@media (max-width: 759px) { .soundbtn span, .hint .long { display: none; } .hint .side { gap: 6px; } .hint .contact, .flatlink, .soundbtn { padding: 8px 8px; } }

/* ---------------------------------------------------------------- loader */
#loader { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: var(--bg); transition: opacity .8s ease; }
#loader.done { opacity: 0; pointer-events: none; }
#loader .box { width: min(340px, 80vw); }
#loader .title { font: 600 15px/1 var(--mono); letter-spacing: 0.3em; color: var(--ink); margin-bottom: 18px; }
#loader .bar { height: 3px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; }
#loader .bar i { display: block; height: 100%; width: 0; background: var(--amber); transition: width .25s; }
#loader .row { display: flex; justify-content: space-between; margin-top: 10px; font: 400 12px/1 var(--mono); color: var(--dim); }
#loader.failed .bar i { background: #ff6b6b; }

/* ---------------------------------------------------------------- phones: the card is a bottom sheet */
@media (max-width: 759px) {
  .top { padding: 14px 16px; flex-direction: column; gap: 10px; }
  .brand span { display: none; }
  .menu { justify-content: flex-start; gap: 2px; }
  .menu a { font-size: 11px; padding: 7px 7px; letter-spacing: 0.08em; }
  .card { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 50vh; border-radius: 16px 16px 0 0; animation-name: sheetIn; }
  @keyframes sheetIn { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }
  .card header { padding: 16px 18px 12px; }
  .card h2 { font-size: 26px; }
  .card .body { padding: 14px 18px 20px; }
  .hint .keys .more { display: none; }
  .hint { padding: 12px 16px; }
  body:not([data-page="home"]) .hint { display: none; }
  .items.hobbies { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- text version */
html.flat body { overflow: auto; }
html.flat #gl, html.flat .top, html.flat .hint, html.flat #card { display: none; }
.flat-page { max-width: 760px; margin: 0 auto; padding: 56px 24px 96px; }
.flat-page h1 { font: 700 44px/1.05 var(--serif); margin: 0; }
.flat-page .role { font: 500 13px/1.4 var(--mono); color: var(--amber); letter-spacing: 0.06em; margin: 10px 0 18px; }
.flat-page section { margin-top: 52px; }
.flat-page h2 { font: 600 30px/1.1 var(--serif); margin: 6px 0 16px; }
.flat-page .switch a { font: 500 13px/1 var(--mono); color: var(--dim); }
.flat-page .item .show { display: none; }

@media (prefers-reduced-motion: reduce) { .card, .card .body .item, .card .body .lead, .card .body .links { animation: none; } #loader { transition: none; } }

/* ---------------------------------------------------------------- case studies, workshop, hobby tiles */
h4.group { font: 500 11px/1.3 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--dim); margin: 18px 0 10px;
  display: flex; align-items: center; gap: 8px; }
h4.group:first-child { margin-top: 2px; }
h4.group span { color: var(--accent); }
.card p.note, .flat-page p.note { font-size: 12.5px; color: var(--dim); margin: -4px 0 10px; }
.chip { font: 500 10.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; padding: 4px 6px; border-radius: 4px;
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.item.workshop { border-style: dashed; }
.item.workshop .chip { background: rgba(88,166,255,0.14); color: #8ec5ff; }
dl.case { margin: 8px 0 0; display: grid; grid-template-columns: 74px 1fr; gap: 4px 10px; }
dl.case dt { font: 500 10.5px/1.6 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
dl.case dd { margin: 0; font-size: 13.5px; line-height: 1.5; color: #d4d0c7; }
.item.tile .meta { margin-bottom: 2px; }
.item.tile.clickable::after { content: "SEE IT IN THE ROOM ▸"; display: block; margin-top: 8px; font: 500 10.5px/1 var(--mono); letter-spacing: .1em; color: var(--dim); }
.item.tile.clickable.active::after, .item.tile.clickable:hover::after { color: var(--accent); }
.items.hobbies .item.tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
.flat-page .item.tile.clickable::after { display: none; }
.flat-page .item .show { display: none; }

/* ---------------------------------------------------------------- easter eggs */
/* diving into the monitor: the UI steps aside first (fast), then the page takes over from the screen */
body.diving .top, body.diving .card, body.diving .hint, body.diving #tip, body.diving #caption { opacity: 0; pointer-events: none; transition: opacity .22s ease-in; }
.top, .card, .hint { transition: opacity .3s ease-out; }
#flat.overlay { position: fixed; inset: 0; z-index: 30; overflow-y: auto; background: #05070c; opacity: 0; outline: none;
  transition: opacity .22s ease-out; }
#flat.overlay.in { opacity: 1; }
#flat.overlay.out { transition: opacity .22s ease-in .14s; }
/* the monitor's scanlines and vignette, handed over to the page, then fading out once it has settled */
#flat.overlay::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background: repeating-linear-gradient(rgba(0,0,0,0.22) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.55));
  opacity: 1; transition: opacity .7s ease-out; }
#flat.overlay.settled::before { opacity: 0; }
#flat.overlay.out::before { opacity: 1; transition-duration: .14s; }
#flat.overlay .flat-page > * { opacity: 0; transform: translateY(14px);
  transition: opacity .32s cubic-bezier(.2,.8,.2,1), transform .32s cubic-bezier(.2,.8,.2,1); transition-delay: calc(var(--i, 0) * 70ms + 120ms); }
#flat.overlay.in .flat-page > * { opacity: 1; transform: none; }
#flat.overlay.out .flat-page > * { opacity: 0; transform: translateY(-8px); transition-duration: .14s; transition-delay: 0s; }

/* looking out of the window */
#caption { position: fixed; z-index: 5; left: 50%; bottom: 96px; transform: translateX(-50%); text-align: center; pointer-events: none; padding: 22px 48px;
  white-space: nowrap; }
/* a soft scrim so the caption stays readable over a bright skyline (WCAG AA against the lit towers) */
#caption::before { content: ""; position: absolute; inset: -10px -30px; z-index: -1; border-radius: 50%; opacity: 0; transition: opacity .4s ease-out;
  background: radial-gradient(closest-side, rgba(5,7,12,0.78), rgba(5,7,12,0.5) 60%, rgba(5,7,12,0)); }
#caption.show::before { opacity: 1; }
#caption b, #caption span { display: block; opacity: 0; transform: translateY(10px); transition: opacity .4s ease-out, transform .4s cubic-bezier(.2,.8,.2,1); }
#caption b { font: 600 30px/1.1 var(--serif); color: #f3efe6; text-shadow: 0 2px 18px rgba(0,0,0,0.7); }
#caption span { margin-top: 8px; font: 600 12px/1.4 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: #e3e6ea; text-shadow: 0 1px 10px rgba(0,0,0,0.8); transition-delay: .1s; }
#caption.show b, #caption.show span { opacity: 1; transform: none; }
body:has(#caption.show) .hint .more { display: none; }
#caption:not(.show) b, #caption:not(.show) span { transition-duration: .15s; transition-delay: 0s; }

/* the bubble-tea speech bubble */
.bubble { position: fixed; z-index: 8; left: 0; top: 0; pointer-events: none; font: 600 26px/1 "Caveat", cursive; color: #1b1410;
  background: #f6efe3; padding: 8px 14px 10px; border-radius: 18px; white-space: nowrap; opacity: 0; transform: translate(-50%, -100%) scale(.6); }
.bubble::after { content: ""; position: absolute; left: 22px; bottom: -7px; border: 8px solid transparent; border-top-color: #f6efe3; border-bottom: 0; }
.bubble.pop { animation: bubble 1.6s cubic-bezier(.2,.8,.2,1) forwards; }
@keyframes bubble { 0% { opacity: 0; transform: translate(-50%, -100%) scale(.6); } 12% { opacity: 1; transform: translate(-50%, -100%) scale(1.05); }
  20% { transform: translate(-50%, -100%) scale(1); } 75% { opacity: 1; transform: translate(-50%, calc(-100% - 14px)); } 100% { opacity: 0; transform: translate(-50%, calc(-100% - 26px)); } }

/* the About terminal: no card, the monitor is the page. The keyboard field is invisible but real (phones need one). */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
#term { position: fixed; left: 0; bottom: 0; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
#term input { font-size: 16px; }                      /* 16px: iOS would zoom the page into a smaller field */
#term-tap { display: none; position: fixed; z-index: 6; left: 50%; bottom: 22px; transform: translateX(-50%); font: 500 13px/1 var(--mono);
  letter-spacing: .06em; color: var(--ink); background: rgba(12,14,19,0.86); border: 1px solid var(--line); border-radius: 999px; padding: 11px 16px; }
@media (pointer: coarse) { body[data-page="about"] #term-tap { display: block; } }
.hint .termhint { display: none; }
body[data-page="about"] .hint .more { display: none; }
body[data-page="about"] .hint .termhint { display: inline; }
@media (prefers-reduced-motion: reduce) {
  #flat.overlay .flat-page > *, #caption b, #caption span { transition: none; transform: none; }
  .bubble.pop { animation-duration: 1.2s; }
}

@media (max-width: 759px) { #caption { white-space: normal; width: min(92vw, 420px); bottom: 64px; padding: 16px 20px; } #caption b { font-size: 26px; } }

/* the 3D view failed (GPU reset, a frame kept throwing): a plain notice instead of a black screen */
#trouble { position: fixed; z-index: 40; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 32px));
  padding: 20px 22px; border-radius: 14px; background: rgba(12, 15, 22, 0.94); border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 30px 80px rgba(0,0,0,0.5); color: var(--ink); font: 14px/1.5 var(--sans); display: grid; gap: 12px; }
#trouble[hidden] { display: none; }
#trouble b { font: 600 16px/1.3 var(--sans); }
#trouble .acts { display: flex; gap: 12px; align-items: center; }
#trouble button, #trouble a { font: 500 13px/1 var(--mono); letter-spacing: 0.06em; padding: 10px 14px; border-radius: 8px; cursor: pointer; text-decoration: none; }
#trouble button { background: #ffb547; color: #120d05; border: 0; }
#trouble a { color: var(--ink); border: 1px solid rgba(255,255,255,0.2); }
#trouble button:focus-visible, #trouble a:focus-visible { outline: 2px solid #ffb547; outline-offset: 2px; }
#trouble small { color: #9aa3ad; font: 12px/1.45 var(--mono); word-break: break-word; }


/* easter egg found: a small toast, bottom centre, above the hint line */
#egg { position: fixed; z-index: 9; left: 50%; bottom: 58px; transform: translate(-50%, 12px); pointer-events: none; opacity: 0;
  display: grid; gap: 4px; justify-items: center; padding: 10px 16px 11px; border-radius: 10px; background: rgba(12,14,19,0.9);
  border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent); box-shadow: 0 16px 40px rgba(0,0,0,0.4);
  transition: opacity .18s ease-in, transform .18s ease-in; }
#egg.on { opacity: 1; transform: translate(-50%, 0); transition: opacity .26s ease-out, transform .32s cubic-bezier(.2,.8,.2,1); }
#egg small { font: 500 10.5px/1 var(--mono); letter-spacing: .14em; color: var(--amber); }
#egg b { font: 600 17px/1.15 var(--serif); color: #f3efe6; }
@media (max-width: 759px) { #egg { bottom: 18px; } body:not([data-page="home"]) #egg { bottom: calc(50vh + 14px); } }
@media (prefers-reduced-motion: reduce) { #egg, #egg.on { transition: opacity .2s linear; transform: translate(-50%, 0); } }
