/* ---- tokens ------------------------------------------------------------ */
:root,
html[data-theme="light"] {
  --page:        #ffffff;
  --text-strong: #0e0e0e;
  --text:        #545454;
  --text-muted:  #767676;  /* 4.54:1 on white — AA at 14px */
  --hover:       #f6f6f6;
  --rule:        rgba(0, 0, 0, 0.07);

  /* type scale */
  --font:    12.5px;
  --lh:      20px;
  --font-sm: 11px;
}
html[data-theme="dark"] {
  --page:        #0e0e0e;
  --text-strong: #ffffff;
  --text:        #b0b0b0;
  --text-muted:  #7c7c7c;  /* 4.62:1 on #0e0e0e — AA at 14px */
  --hover:       #171717;
  --rule:        rgba(255, 255, 255, 0.07);
}

html[data-theme="dark"]  { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }

/* ---- base -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }

body {
  min-height: 100dvh;
  background: var(--page);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  font-size: var(--font);
  line-height: var(--lh);
  font-weight: 400;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  /* Theme swaps shouldn't strobe */
  transition: background-color 0.3s ease, color 0.3s ease;
}

::selection { background: var(--text-strong); color: var(--page); }

a { color: inherit; }

/* ---- layout ------------------------------------------------------------ */
.content {
  width: 540px;
  max-width: calc(100% - 48px);
  margin: 0 auto;
  padding: 88px 0 72px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 36px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

/* ---- intro ------------------------------------------------------------- */
.intro {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}
.greeting { color: var(--text-muted); }
.intro em {
  font-style: normal;
  color: var(--text-strong);
}
.intro a,
.connect a {
  color: var(--text-strong);
  text-decoration: none;
  /* Underline sits off the baseline and only fills in on hover */
  box-shadow: inset 0 -1px 0 0 var(--rule);
  transition: box-shadow 0.18s ease;
}
.intro a:hover,
.connect a:hover,
.intro a:focus-visible,
.connect a:focus-visible {
  box-shadow: inset 0 -1px 0 0 currentColor;
}

/* ---- link lists -------------------------------------------------------- */
.link-section {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  width: 100%;
}
.link-section h2 {
  color: var(--text-muted);
  font-size: var(--font);
  line-height: var(--lh);
  font-weight: 400;
  margin-bottom: 8px;
}

.link-row {
  display: flex;
  flex-direction: column;
  /* no wash: rows sit flush with the copy above them */
  /* Negative margin keeps the wash off the text column's alignment */
  padding: 7px 10px;
  margin: 0 -10px;
  border-radius: 6px;
  text-decoration: none;
  background: transparent;
  transition: background-color 0.2s ease;
}
.link-row:hover,
.link-row:focus-visible { outline: none; }
.link-row:hover .row-name,
.link-row:focus-visible .row-name { color: var(--text-strong); }
.link-row:hover .row-meta,
.link-row:focus-visible .row-meta { color: var(--text); }
.row-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 2px 16px;
  width: 100%;
}
.row-name {
  color: var(--text-strong);
  min-width: 0;
}
.row-meta {
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.2s ease;
}
.link-row:hover .row-meta { color: var(--text); }

/* ---- connect + footer -------------------------------------------------- */
.connect { gap: 0; }
.connect p { max-width: 100%; }

footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  width: 100%;
  padding-top: 8px;
  color: var(--text-muted);
}
.clock { white-space: nowrap; }
.clock .tz { margin-right: 6px; }
#clock { font-variant-numeric: tabular-nums; }

/* ---- theme toggle ------------------------------------------------------ */
.theme-toggle {
  position: fixed;
  top: max(20px, env(safe-area-inset-top, 0px));
  right: max(20px, env(safe-area-inset-right, 0px));
  z-index: 10;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-muted);
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.2s ease, color 0.2s ease, transform 0.14s cubic-bezier(0.22, 1, 0.36, 1);
}
.theme-toggle:hover,
.theme-toggle:focus-visible {
  opacity: 1;
  color: var(--text-strong);
  outline: none;
}
.theme-toggle:active { transform: scale(0.92); }
.theme-toggle svg {
  width: 16px;
  height: 16px;
  display: block;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
html[data-theme="dark"] .theme-toggle svg { transform: rotate(180deg); }

/* ---- entrance ---------------------------------------------------------- */
.appear {
  opacity: 0;
  animation: appear 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--i, 0) * 70ms);
}
@keyframes appear {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ---- narrow ------------------------------------------------------------ */
@media (max-width: 600px) {
  .content { padding: 64px 0 56px; gap: 32px; }
  footer { flex-direction: column; align-items: flex-start; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .appear { opacity: 1; animation: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}

/* ======================================================================
   Nav — avatar, signature, links
   ====================================================================== */
.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.brand { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }

/* Ring + glare, carried over from v4 */
.avatar-wrap {
  position: relative;
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  padding: 3px;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
  transition: background 0.2s ease;
}
.avatar-wrap:hover,
.avatar-wrap:focus-visible {
  background: conic-gradient(from 135deg, #0F6DFF, #00C6FF, #0040FF, #006FFF, #0F6DFF);
  outline: none;
}
/* Gap between ring and photo — picks up the page colour in either theme */
.avatar-wrap::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: var(--page);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.avatar-wrap:hover::after,
.avatar-wrap:focus-visible::after { opacity: 1; }

@keyframes glare {
  0%   { background-position: 200% 0; }
  18%  { background-position: -200% 0; }
  100% { background-position: -200% 0; }
}
.avatar-wrap::before {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: linear-gradient(120deg, transparent 20%, rgba(255,255,255,0.55) 50%, transparent 80%);
  background-size: 200% 100%;
  background-position: 200% 0;
  z-index: 2;
  pointer-events: none;
  animation: glare 5s ease 2s infinite;
}
.avatar-wrap:hover::before {
  animation: none;
  background-position: -200% 0;
  transition: background-position 0.5s ease;
}
.avatar {
  position: relative;
  z-index: 1;
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.sig {
  width: 54px;
  height: 54px;
  display: block;
  flex-shrink: 0;
  color: var(--text-strong);
  transition: color 0.3s ease;
}
.sig-path { stroke-dasharray: 1200; stroke-dashoffset: 1200; }

.nav-links { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  padding: 6px 8px;
  border-radius: 6px;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--text-strong);
  outline: none;
}

/* ======================================================================
   Now playing
   ====================================================================== */
.player { width: 100%; }
.player-tag {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  max-width: 100%;
  padding: 8px 12px 8px 8px;
  margin-left: -8px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.player-tag:hover,
.player-tag:focus-visible { background: var(--hover); outline: none; }

.vinyl {
  position: relative;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  background: repeating-radial-gradient(circle at center,
    #1f1f1f 0px, #1f1f1f 1.5px, #0a0a0a 1.5px, #0a0a0a 3px);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  animation: spin 4s linear infinite;
  animation-play-state: paused;
}
.vinyl.spinning { animation-play-state: running; }
@keyframes spin { to { transform: rotate(360deg); } }

.vinyl-art {
  position: absolute;
  left: 50%; top: 50%;
  width: 46%; height: 46%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  object-fit: cover;
  background: #333;
  border: 0.5px solid rgba(255,255,255,0.2);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.35);
  z-index: 1;
}
.vinyl-hole {
  position: absolute;
  left: 50%; top: 50%;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
  z-index: 2;
}
.player-lines { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.player-state { color: var(--text-muted); font-size: var(--font-sm); line-height: 1.3; }
.player-track {
  color: var(--text-muted);
  font-size: var(--font-sm);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-track strong { font-weight: 500; color: var(--text-strong); }

/* ======================================================================
   Lightbox — constrained, not full-bleed
   ====================================================================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--page) 78%, transparent);
  backdrop-filter: blur(20px) saturate(1.1);
  -webkit-backdrop-filter: blur(20px) saturate(1.1);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.lightbox.is-open { opacity: 1; }

.lb-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: min(520px, 85vw);
}
.lb-img {
  width: 100%;
  max-height: 60vh;
  object-fit: contain;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.12);
}
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: var(--page);
  color: var(--text-strong);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease;
}
.lb-nav:hover { transform: translateY(-50%) scale(1.08); }
.lb-prev { left: -44px; }
.lb-next { right: -44px; }

.lb-close {
  position: absolute;
  top: -40px;
  right: 0;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: color 0.15s ease;
}
.lb-close:hover { color: var(--text-strong); }

.lb-dots { display: flex; gap: 5px; align-items: center; }
.lb-dot {
  width: 5px;
  height: 5px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.4;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.lb-dot:hover { opacity: 0.7; }
.lb-dot.is-on { opacity: 1; background: var(--text-strong); transform: scale(1.3); }

@media (max-width: 680px) {
  .lb-prev { left: 8px; }
  .lb-next { right: 8px; }
  .lb-img  { max-height: 65vh; }
  .lb-inner { max-width: 92vw; }
}

/* ======================================================================
   About — breadcrumb, collage, strips
   ====================================================================== */
.crumb { display: flex; align-items: center; gap: 8px; color: var(--text-muted); }
.crumb a { color: var(--text-muted); text-decoration: none; transition: color 0.15s ease; }
.crumb a:hover { color: var(--text-strong); }
.crumb [aria-current] { color: var(--text-strong); }

.section-label {
  color: var(--text-muted);
  font-size: var(--font);
  line-height: var(--lh);
  font-weight: 400;
  margin-bottom: -6px;
}

.collage-section, .strip-section { width: 100%; }

/* Full-bleed out of the 540px column so the canvas has room */
.collage-outer, .movie-strip, .album-grid {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  padding-inline: max(24px, calc(50vw - 270px));
  overflow-x: auto;
  scrollbar-width: none;
}
.collage-outer::-webkit-scrollbar,
.movie-strip::-webkit-scrollbar,
.album-grid::-webkit-scrollbar { display: none; }

.collage-outer { padding-top: 56px; padding-bottom: 16px; }
.collage-canvas {
  position: relative;
  width: 880px;
  height: 420px;
  flex-shrink: 0;
}
.collage-item {
  position: absolute;
  cursor: grab;
  will-change: transform;
  touch-action: none;
}
.collage-item.is-dragging { cursor: grabbing; }
.collage-img {
  display: block;
  max-width: none;
  opacity: 0;
  transform: scale(0.88);
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  user-select: none;
}
.collage-img.is-in { opacity: 1; transform: none; }
.collage-hint { color: var(--text-muted); margin-top: 4px; }

.movie-strip, .album-grid { display: flex; gap: 12px; padding-block: 4px; }
.movie {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 136px;
  flex-shrink: 0;
  text-decoration: none;
}
.movie img {
  width: 136px;
  height: 196px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.movie:hover img { transform: translateY(-4px); }
.movie-title { color: var(--text-muted); font-size: var(--font-sm); line-height: 1.35; transition: color 0.15s ease; }
.movie:hover .movie-title { color: var(--text-strong); }

.album { width: 104px; height: 104px; flex-shrink: 0; display: block; }
.album img {
  width: 104px;
  height: 104px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
a.album:hover img { transform: translateY(-4px); }

@media (max-width: 600px) {
  .nav { flex-direction: column; align-items: flex-start; gap: 12px; }
  .nav-links { margin-left: -8px; }
  .collage-canvas { height: 380px; }
}


/* ======================================================================
   Greeting — rotates through languages, click to advance
   ====================================================================== */
.greeting {
  display: inline-block;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-muted);
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
  cursor: pointer;
  transition: color 0.15s ease;
}
.greeting:hover, .greeting:focus-visible { color: var(--text-strong); outline: none; }
.greeting-text {
  display: inline-block;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.greeting-text.is-out { opacity: 0; transform: translateY(-3px); }

/* ======================================================================
   Chrome cluster — audio + theme
   ====================================================================== */
.chrome {
  position: fixed;
  top: max(20px, env(safe-area-inset-top, 0px));
  right: max(20px, env(safe-area-inset-right, 0px));
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 4px;
}
.chrome .theme-toggle { position: static; top: auto; right: auto; }

.audio-toggle {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-muted);
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.2s ease, color 0.2s ease, transform 0.14s cubic-bezier(0.22, 1, 0.36, 1);
}
.audio-toggle:hover, .audio-toggle:focus-visible { opacity: 1; color: var(--text-strong); outline: none; }
.audio-toggle:active { transform: scale(0.92); }
.audio-toggle svg { width: 16px; height: 16px; display: block; }
.audio-toggle .ico-on  { display: none; }
.audio-toggle .ico-off { display: block; }
.audio-toggle[aria-pressed="true"] .ico-on  { display: block; }
.audio-toggle[aria-pressed="true"] .ico-off { display: none; }

@media (prefers-reduced-motion: reduce) {
}


/* ======================================================================
   Project rows — the icon is the hover indicator
   ====================================================================== */
/* Names start flush with the section labels; the mark hangs outside the
   column in the left margin, so nothing indents and nothing shifts */
.row-head { position: relative; }

.row-mark {
  position: absolute;
  left: -26px;
  top: 0;
  width: 16px;
  height: var(--lh);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.row-mark img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  display: block;
}
.is-project:hover .row-mark,
.is-project:focus-visible .row-mark { opacity: 1; transform: none; }

/* ======================================================================
   Gallery strip — avatar opens it inline, pushing the page down
   ====================================================================== */
.gallery {
  width: 100%;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.gallery.is-open { max-height: 230px; }

.gallery-track {
  display: flex;
  gap: 8px;
  padding: 16px 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.gallery-track::-webkit-scrollbar { display: none; }

.gallery-card {
  width: 149px;
  height: 190px;
  flex-shrink: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-24px);
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.34, 1.3, 0.64, 1);
  scroll-snap-align: start;
  border: none;
  padding: 0;
  background: none;
  cursor: pointer;
}
.gallery-card.is-in { opacity: 1; transform: none; }
.gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}
.gallery-card:hover img { transform: scale(1.04); }

/* Avatar keeps its ring while the strip is open */
.avatar-wrap.is-active {
  background: conic-gradient(from 135deg, #0F6DFF, #00C6FF, #0040FF, #006FFF, #0F6DFF);
}
.avatar-wrap.is-active::after { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .gallery { transition: none; }
  .gallery-card { transition: none; opacity: 1; transform: none; }
  .row-mark { transition: none; }
}

/* The left margin runs out on narrow screens, and there's no hover there
   anyway, so the mark simply doesn't appear */
@media (max-width: 640px) {
  .row-mark { display: none; }
}
