/* Tokens — values measured from the Framer build (Sphere Folio remix). */
:root {
  --bg: #141414;            /* page */
  --surface: #1a1a1a;       /* pill + about panel */
  --white: #ffffff;
  --text: #ededed;
  --muted: #999999;
  --hairline: rgba(255, 255, 255, 0.1);
  --tile-bg: rgba(255, 255, 255, 0.06);
  --radius: 16px;
  --font: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --nav-pad: 24px;
  --pill-w: 250px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--white);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
a { color: inherit; }

.sr-only, .skip:not(:focus) {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip:focus {
  position: fixed; z-index: 100; top: 12px; left: 12px; padding: 10px 14px;
  background: var(--white); color: var(--surface); border-radius: 10px; text-decoration: none;
}
:focus-visible { outline: 2px solid var(--white); outline-offset: 3px; }

/* ---------- Globe ---------- */
.stage {
  position: fixed; inset: 0;
  overflow: hidden;
  touch-action: none;           /* free drag on touch — the page never scrolls */
  cursor: grab;
  -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none;
}
.stage.is-dragging { cursor: grabbing; }
.stage__lens { position: absolute; inset: 0; perspective-origin: 50% 50%; }
.stage__world { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-style: preserve-3d; }

.tile {
  position: absolute;
  visibility: hidden;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--tile-bg);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  cursor: pointer;
}
.tile img {
  width: 100%; height: 100%; object-fit: cover;
  pointer-events: none; user-select: none; -webkit-user-drag: none;
  opacity: 0; transition: opacity 0.5s ease;
}
.tile img.is-loaded { opacity: 1; }

/* Accessible index of all photos (visible only when focused into). */
.photo-index {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 12px; background: var(--surface);
  transform: translateY(100%);
}
.photo-index:focus-within { transform: none; }
.photo-index ul { display: flex; gap: 8px; margin: 0; padding: 0; list-style: none; overflow-x: auto; }
.photo-index button {
  flex: none; width: 54px; height: 72px; padding: 0; border: 0; border-radius: 8px;
  overflow: hidden; background: var(--tile-bg); cursor: pointer;
}
.photo-index button img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Navbar pill ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: center;
  padding: var(--nav-pad);
  padding-top: max(var(--nav-pad), env(safe-area-inset-top));
  pointer-events: none;
}
.pill {
  pointer-events: auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: var(--pill-w);
  padding: 8px 12px;
  background: var(--surface);
  color: var(--white);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  transition: background-color 0.35s var(--ease-out), color 0.35s var(--ease-out), width 0.45s var(--ease-out);
}
.pill__logo {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 600; font-size: 16px; line-height: 1.2; letter-spacing: 0;
  text-decoration: none; white-space: nowrap;
}
.pill__globe { flex: none; }
.pill__toggle {
  position: relative; flex: none;
  width: 32px; height: 32px; padding: 0;
  background: none; border: 0; cursor: pointer;
}
.pill__toggle span {
  position: absolute; right: 5px; height: 2px; border-radius: 2px;
  background: currentColor;
  transition: transform 0.4s var(--ease-out), opacity 0.25s ease, width 0.4s var(--ease-out), top 0.4s var(--ease-out);
}
.pill__toggle span:nth-child(1) { top: 9px;  width: 22px; }
.pill__toggle span:nth-child(2) { top: 15px; width: 16px; }
.pill__toggle span:nth-child(3) { top: 21px; width: 22px; }

body.menu-open .pill { background: var(--white); color: var(--surface); width: 208px; }
/* While the panel is open, text scrolling under the pill fades out instead of showing around it. */
.nav::before {
  content: ""; position: absolute; inset: 0 0 -24px;
  background: linear-gradient(var(--surface) 65%, rgba(26, 26, 26, 0));
  opacity: 0; transition: opacity 0.35s var(--ease-out);
}
body.menu-open .nav::before { opacity: 1; }
.pill { position: relative; }
body.menu-open .pill__toggle span:nth-child(1) { top: 15px; transform: rotate(45deg); }
body.menu-open .pill__toggle span:nth-child(2) { opacity: 0; width: 0; }
body.menu-open .pill__toggle span:nth-child(3) { top: 15px; transform: rotate(-45deg); }

/* ---------- About panel ---------- */
.panel {
  position: fixed; inset: 0; z-index: 15;
  display: flex; justify-content: center; align-items: center;
  padding: 112px 0 64px;
  background: var(--surface);
  overflow-y: auto; overscroll-behavior: contain;
  opacity: 0;
  transition: opacity 0.35s var(--ease-out);
}
.panel[hidden] { display: none; }
.panel:focus { outline: none; }
.panel.is-open { opacity: 1; }
.panel__inner {
  display: flex; align-items: center; gap: 64px;
  width: 80%; max-width: 1100px;
  margin: auto 0;
}
.panel__text { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 32px; }
.panel__name {
  margin: 0;
  font-weight: 700; font-size: 64px; line-height: 1.2; letter-spacing: 0;
  color: var(--white);
}
.panel__name .w {
  display: inline-block; opacity: 0; transform: translateY(10px);
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
  transition-delay: calc(var(--i) * 70ms + 80ms);
}
.panel.is-open .panel__name .w { opacity: 1; transform: none; }

.panel__meta, .panel__bio p, .arrow-link {
  font-weight: 500; font-size: 18px; line-height: 1.6; letter-spacing: -0.02em;
}
.panel__meta { margin: 0; color: var(--muted); }
.panel__bio { display: flex; flex-direction: column; gap: 16px; }
.panel__bio p { margin: 0; color: var(--white); }
.panel__bio a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255, 255, 255, 0.4); }
.panel__bio a:hover { text-decoration-color: currentColor; }

.panel__links { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0; padding: 0; list-style: none; }
.arrow-link { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.arrow-link .email-short { display: none; }
/* Arrow swap on hover: the arrow exits up-right while a twin enters from bottom-left. */
.arrow-link i {
  position: relative; width: 24px; height: 24px; overflow: hidden; flex: none;
}
.arrow-link i::before, .arrow-link i::after {
  content: ""; position: absolute; inset: 5px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12 12 2M4 2h8v8'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12 12 2M4 2h8v8'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 0.4s var(--ease-out);
}
.arrow-link i::after { transform: translate(-24px, 24px); }
.arrow-link:hover i::before, .arrow-link:focus-visible i::before { transform: translate(24px, -24px); }
.arrow-link:hover i::after,  .arrow-link:focus-visible i::after  { transform: none; }

.panel__portrait {
  flex: none; margin: 0;
  height: min(68vh, 640px);
  aspect-ratio: 576 / 1246;   /* shown uncropped, at its natural proportions */
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--tile-bg);
  opacity: 0; transform: translateY(14px);
  transition: opacity 0.5s var(--ease-out) 0.15s, transform 0.5s var(--ease-out) 0.15s;
}
.panel.is-open .panel__portrait { opacity: 1; transform: none; }
.panel__portrait img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 50; }
.lightbox[hidden] { display: none; }
.lightbox:focus { outline: none; }
.lightbox__backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.75);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  opacity: 0; transition: opacity 0.35s ease;
}
.lightbox__img {
  position: fixed; object-fit: cover; border-radius: var(--radius);
  user-select: none; -webkit-user-select: none; cursor: zoom-out;
  transition: left 0.45s var(--ease-out), top 0.45s var(--ease-out), width 0.45s var(--ease-out), height 0.45s var(--ease-out);
  touch-action: pan-y;
}
.lightbox__count {
  position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); margin: 0;
  transform: translateX(-50%);
  font-size: 14px; font-weight: 500; letter-spacing: 0.02em; color: rgba(255, 255, 255, 0.7);
  opacity: 0; transition: opacity 0.3s ease;
  font-variant-numeric: tabular-nums;
}
.lb-btn {
  position: fixed; width: 48px; height: 48px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, 0.65); color: var(--white);
  cursor: pointer; opacity: 0; transition: opacity 0.3s ease, background-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.lb-btn:hover { background: rgba(40, 40, 40, 0.85); }
.lb-btn--close { top: 16px; right: 16px; }
.lb-btn--prev  { left: 16px;  top: 50%; margin-top: -24px; }
.lb-btn--next  { right: 16px; top: 50%; margin-top: -24px; }
.lightbox.is-open .lightbox__backdrop,
.lightbox.is-open .lb-btn,
.lightbox.is-open .lightbox__count { opacity: 1; }

/* ---------- Tablet / phone ---------- */
@media (max-width: 1199.98px) {
  .panel__inner { width: 88%; gap: 48px; }
}
@media (max-width: 809.98px) {
  .panel { align-items: flex-start; padding: 96px 0 48px; }
  .panel__inner { flex-direction: column-reverse; align-items: flex-start; gap: 32px; width: 90%; }
  .panel__text { gap: 24px; }
  .panel__name { font-size: clamp(44px, 14vw, 64px); }
  .panel__portrait { height: min(62vh, 560px); }
  .arrow-link .email-long { display: none; }
  .arrow-link .email-short { display: inline; }
  .lb-btn--prev, .lb-btn--next { top: auto; bottom: max(12px, env(safe-area-inset-bottom)); margin-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; transition-delay: 0s !important; }
}
