* { box-sizing: border-box; }
:root {
  --font: Arimo, Arial, "Helvetica Neue", Helvetica, sans-serif;
  --blue: #1f4dff;   /* the one colour of all text */
}
html, body { margin: 0; height: 100%; overflow: hidden; background: #7fb2e0; color: var(--blue); font-family: var(--font); -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
#c { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; }

.hud { position: fixed; top: 0; left: 0; z-index: 5; padding: max(14px, env(safe-area-inset-top)) 20px 0; pointer-events: none; }
.name { margin: 0; font-weight: 400; font-size: clamp(30px, 3.2vw, 44px); line-height: 1; letter-spacing: -.02em; }

.ui { position: fixed; z-index: 4; transition: opacity .45s ease, transform .6s cubic-bezier(.2,.9,.3,1); }
.ui.hide { opacity: 0; pointer-events: none; }
.title { margin: 0 0 6px; font-weight: 400; font-size: clamp(30px, 3.2vw, 44px); line-height: 1; letter-spacing: -.02em; }

/* ---------- who is he? ---------- */
.about { left: 20px; right: 20px; top: 38%; pointer-events: none; }
.about.hide { transform: translateY(20px); }
.headline { margin: 0 0 .06em; font-weight: 400; font-size: min(15vw, 32vh); line-height: 1; letter-spacing: -.035em; white-space: nowrap; }
.about .text { margin: 0; text-wrap: pretty; max-width: min(520px, 42vw); font-size: clamp(20px, 1.75vw, 26px); line-height: 1.16; letter-spacing: -.01em; }

/* ---------- socials: floating picture tiles in the bottom-right quarter ---------- */
.socials { right: 20px; bottom: calc(18px + env(safe-area-inset-bottom)); width: min(44vw, 520px); }
.socials.hide { transform: translateY(30px); }
.socials .title { text-align: right; margin-bottom: 26px; }
.tiles { position: relative; height: min(26vh, 250px); }
.tile { position: absolute; left: 0; top: 0; width: var(--w); aspect-ratio: 4 / 5; padding: 0; border: 0; background: none; cursor: pointer;
  transform: translate(var(--x), var(--y)) translate(var(--px, 0px), var(--py, 0px)) rotate(var(--r)) scale(var(--s, 1));
  transition: transform .5s cubic-bezier(.25,1.5,.4,1); z-index: 1; }
.tile .float { display: block; width: 100%; height: 100%; animation: drift 5s ease-in-out infinite; animation-delay: var(--d); }
.tile .pic { display: block; width: 100%; height: 100%; background-size: cover; background-position: center; border: 3px solid #fff; box-shadow: 4px 5px 0 rgba(0,0,0,.2); }
.tile .tag { position: absolute; left: 50%; top: -8px; transform: translate(-50%, -100%) scale(.7); opacity: 0; transition: opacity .2s, transform .35s cubic-bezier(.3,1.7,.5,1);
  color: var(--blue); font-weight: 400; font-size: calc(28px * var(--fs, 1)); line-height: 1.1; letter-spacing: -.02em; white-space: nowrap; pointer-events: none; }
.tile.on { --s: 1.14; --r: 0deg !important; z-index: 3; }
.tile.on .tag, .tile:focus-visible .tag { opacity: 1; transform: translate(-50%, -100%) scale(1); }
.tile:focus-visible { outline: none; }
.tile:focus-visible .pic { outline: 2px solid var(--blue); outline-offset: 3px; }
@keyframes drift { 0%, 100% { transform: translate(0, 0) rotate(0); } 33% { transform: translate(2px, -4px) rotate(.8deg); } 66% { transform: translate(-2px, -2px) rotate(-.6deg); } }

/* ---------- inside a scene ---------- */
.back { position: fixed; z-index: 6; left: 20px; top: calc(max(14px, env(safe-area-inset-top)) + clamp(44px, 4.4vw, 60px)); border: 0; background: none; padding: 4px 0; color: var(--blue); font-family: var(--font); font-size: clamp(30px, 3.2vw, 44px); line-height: 1; letter-spacing: -.02em; cursor: pointer; transition: transform .2s; }
.back:hover { transform: translateX(-4px); }
.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: center; padding: 0 16px calc(30px + env(safe-area-inset-bottom)); pointer-events: none; }
.cta { pointer-events: auto; text-decoration: none; padding: 6px 10px; font-size: calc(clamp(44px, 7vw, 96px) * var(--fs, 1)); line-height: 1.05; letter-spacing: -.03em; color: var(--blue); text-align: center;
  animation: pop .45s cubic-bezier(.2,1.6,.4,1) both; transition: transform .2s; }
.cta:hover { transform: scale(1.04); }
.cta:active { transform: scale(.97); }
@keyframes pop { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: none; } }

.loading { position: fixed; left: 50%; bottom: calc(30px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 6; font-size: 26px; letter-spacing: -.02em; transition: opacity .5s; }
.loading.gone { opacity: 0; pointer-events: none; }
/* photo credit (the panorama's licence requires it): a small "i", the text shows on tap */
.credit { position: fixed; left: 8px; bottom: calc(6px + env(safe-area-inset-bottom)); z-index: 3; display: flex; align-items: center; gap: 6px; font-size: 10px; color: #fff; }
.credit-btn { width: 18px; height: 18px; padding: 0; border: 1px solid rgba(255,255,255,.55); border-radius: 50%; background: rgba(0,0,0,.18); color: rgba(255,255,255,.8);
  font: italic 11px/16px Georgia, serif; cursor: pointer; opacity: .55; }
.credit-btn:hover, .credit-btn[aria-expanded="true"] { opacity: 1; }
.credit-text { padding: 2px 6px; border-radius: 4px; background: rgba(0,0,0,.45); }
.credit a { color: inherit; }

/* phones: name + about on top, socials across the bottom quarter */
@media (max-width: 700px) {
  /* phones: above my head, on the bright background instead of the black hoodie */
  .about { left: 20px; right: 16px; top: calc(max(14px, env(safe-area-inset-top)) + 40px); }
  .headline { font-size: 20vw; }
  .about .text { max-width: none; font-size: 19px; }
  .socials { left: 16px; right: 16px; width: auto; bottom: calc(14px + env(safe-area-inset-bottom)); }
  .tiles { height: 22vh; }
}
.tile .cap { display: none; }

/* phones and tablets: no hover, so every picture shows its name like a polaroid caption,
   and they take turns giving a little hop to say "tap me" */
@media (hover: none) {
  .tile .float { position: relative; display: flex; flex-direction: column; background: #fff; padding: 4px 4px 0; box-shadow: 0 6px 16px rgba(0,0,0,.25);
    animation: nudge 6.5s ease-in-out infinite; animation-delay: var(--nd, 0s); }
  .tile .pic { flex: 1; min-height: 0; border: 0; box-shadow: none; }
  .tile .cap { display: block; padding: 3px 2px 5px; color: var(--blue); text-align: center; white-space: nowrap; overflow: hidden;
    font-size: calc(15px * min(var(--fs, 1), 1.15)); line-height: 1.2; letter-spacing: -.01em; }
  .tile .tag { display: none; }
}
@keyframes nudge {
  0%, 78%, 100% { transform: translate(0, 0) rotate(0); }
  83% { transform: translate(0, -11px) rotate(-3deg); }
  88% { transform: translate(0, 0) rotate(1.5deg); }
  92% { transform: translate(0, -4px) rotate(0); }
}
@media (prefers-reduced-motion: reduce) { .tile .float { animation: none; } }
