/* ---------- tokens ---------- */
:root {
  --bg: #0c0e13;
  --bg-elev: #151824;
  --bg-elev-2: #1c202e;
  --border: rgba(255, 255, 255, 0.08);
  --text: #eef0f5;
  --text-dim: #9199ab;
  --text-faint: #656b7c;
  --accent: #ff6b5c;
  --accent-ink: #2a0f0b;
  --accent-2: #34d1c4;
  --accent-glow: rgba(255, 107, 92, 0.35);
  --danger: #ff5c7a;
  --font-display: 'Sora', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --topbar-h: 60px;
  --tabbar-h: 68px;
  --nowplaying-h: 60px;
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); margin: 0; }
p { margin: 0; line-height: 1.55; color: var(--text-dim); }
button { font-family: inherit; cursor: pointer; }
a { color: var(--accent); }

/* subtle grain texture for warmth without being flat */
.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- topbar ---------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: rgba(12, 14, 19, 0.75);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 40;
}
.topbar__brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
}
.topbar__brand .dot { color: var(--accent); }

.admin-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  transition: border-color .2s, color .2s, background .2s;
}
.admin-btn:hover { border-color: var(--accent); color: var(--accent); }
body[data-authed="true"] .admin-btn {
  border-color: var(--accent-2);
  color: var(--accent-2);
  background: rgba(52, 209, 196, 0.08);
}

/* ---------- tabs (shared) ---------- */
.tabs { position: relative; display: flex; }
.tab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  transition: color .25s ease;
  position: relative;
  z-index: 2;
}
.tab[aria-selected="true"] { color: var(--text); }

.tabs--desktop {
  display: none;
  gap: 4px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
}
.tabs--desktop .tab {
  padding: 8px 20px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
}
.tabs--desktop .tab[aria-selected="true"] { color: #fff; }
.tabs--desktop .tab-indicator {
  position: absolute;
  top: 4px; bottom: 4px; left: 4px;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #ff8f6b);
  box-shadow: 0 4px 16px var(--accent-glow);
  transition: transform .35s cubic-bezier(.22,1,.36,1), width .35s cubic-bezier(.22,1,.36,1);
  z-index: 1;
}

.tabs--mobile {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--tabbar-h);
  background: rgba(12, 14, 19, 0.85);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding: 6px 6px calc(env(safe-area-inset-bottom, 0px) + 4px);
  z-index: 40;
}
.tabs--mobile .tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 0.65rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 4px 0;
}
.tabs--mobile .tab svg { width: 21px; height: 21px; transition: transform .25s cubic-bezier(.22,1,.36,1); }
.tabs--mobile .tab[aria-selected="true"] svg { transform: translateY(-2px) scale(1.05); color: var(--accent); }
.tabs--mobile .tab:active svg { transform: scale(0.88); }
.tabs--mobile .tab-indicator {
  position: absolute;
  top: 4px;
  height: calc(100% - 8px);
  width: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
  transition: transform .35s cubic-bezier(.22,1,.36,1), width .35s cubic-bezier(.22,1,.36,1);
  z-index: 1;
}

/* ---------- layout ---------- */
.views {
  position: relative;
  z-index: 2;
  max-width: 760px;
  margin: 0 auto;
  padding: calc(var(--topbar-h) + 20px) 18px calc(var(--tabbar-h) + var(--nowplaying-h) + 32px);
}
.view { display: none; }
.view.is-active { display: block; animation: viewIn .45s cubic-bezier(.22,1,.36,1); }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-header { margin-bottom: 22px; }
.view-header h1 { font-size: 1.7rem; font-weight: 700; }
.view-header__sub { margin-top: 4px; }

.section-heading {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 28px 0 14px;
}

/* ---------- overview / hero ---------- */
.hero { text-align: center; padding: 12px 0 20px; }
.avatar {
  position: relative;
  width: 84px; height: 84px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 2rem; font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 30px var(--accent-glow);
}
.avatar__img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar.is-uploading { opacity: 0.55; }
.avatar__edit, .avatar__remove {
  position: absolute;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  transition: transform .15s ease, background .2s;
}
.avatar__edit svg, .avatar__remove svg { width: 13px; height: 13px; }
.avatar__edit { bottom: -2px; right: -2px; background: var(--accent); }
.avatar__remove { top: -2px; right: -2px; background: var(--danger); }
.avatar__edit:hover, .avatar__remove:hover { transform: scale(1.1); }
.hero__name { font-size: 2rem; font-weight: 800; }
.hero__tagline { color: var(--accent-2); font-weight: 600; margin-top: 6px; font-size: 0.92rem; }
.hero__bio { max-width: 520px; margin: 16px auto 0; text-align: left; }
.hero__bio em { color: var(--text-faint); font-style: italic; }

.chip-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  margin-top: 8px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  min-width: 140px;
  transition: border-color .2s, transform .2s;
}
.chip:hover { border-color: var(--accent-2); transform: translateY(-2px); }
.chip__label { display: block; font-size: 0.68rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; }
.chip__value { display: block; font-size: 0.88rem; font-weight: 600; margin-top: 2px; }

/* ---------- timeline (overview + work) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline__item {
  position: relative;
  padding: 0 0 26px 30px;
  border-left: 2px solid var(--border);
  margin-left: 6px;
}
.timeline__item:last-child { border-color: transparent; }
.timeline__dot {
  position: absolute;
  left: -7px; top: 2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--bg);
}
.timeline__year {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.timeline__content h3 { font-size: 1.02rem; margin-top: 4px; }
.timeline__org { color: var(--text-faint); font-size: 0.85rem; margin-top: 2px; }
.timeline__content p { margin-top: 6px; font-size: 0.9rem; }

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
}

/* ---------- work ---------- */
.job-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 18px;
}
.job-card__period {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.job-card h3 { font-size: 1.1rem; margin-top: 4px; }
.job-card__org { color: var(--text-faint); font-size: 0.85rem; margin-top: 2px; }
.job-card p { margin-top: 10px; font-size: 0.9rem; }

/* ---------- contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.contact-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 16px;
  text-decoration: none;
  color: var(--text);
  transition: transform .25s cubic-bezier(.22,1,.36,1), border-color .25s, background .25s;
}
.contact-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  background: var(--bg-elev-2);
}
.contact-card__icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-elev-2);
  color: var(--accent);
  margin-bottom: 6px;
  transition: background .25s, color .25s;
}
.contact-card:hover .contact-card__icon { background: var(--accent); color: #fff; }
.contact-card__icon svg { width: 20px; height: 20px; }
.contact-card__label { font-weight: 700; font-size: 0.9rem; }
.contact-card__handle { font-size: 0.78rem; color: var(--text-faint); }

@media (min-width: 768px) {
  .contact-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- photo galleries (work + hobbies) ---------- */
.photo-gallery { margin-top: 14px; }
.photo-gallery[hidden] { display: none; }
.photo-gallery__heading {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.photo-gallery__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.photo-tile {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  padding: 0;
  cursor: pointer;
}
.photo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-tile__delete {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(10, 10, 14, 0.75);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.photo-tile__delete:hover { background: var(--danger); }
.photo-add-tile {
  width: 76px;
  height: 76px;
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--border);
  background: transparent;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .2s, color .2s;
}
.photo-add-tile:hover { border-color: var(--accent); color: var(--accent); }
.photo-add-tile svg { width: 20px; height: 20px; }
.photo-add-tile.is-uploading { opacity: 0.5; pointer-events: none; }

/* ---------- lightbox ---------- */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 5, 8, 0.9);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  animation: fadeIn .2s ease;
}
.lightbox-backdrop[hidden] { display: none; }
.lightbox-backdrop img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-sm);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.lightbox__close, .lightbox__prev, .lightbox__next {
  position: absolute;
  border: none;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.lightbox__close:hover, .lightbox__prev:hover, .lightbox__next:hover { background: rgba(255,255,255,0.25); }
.lightbox__close { top: 16px; right: 16px; }
.lightbox__prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 16px; top: 50%; transform: translateY(-50%); }

/* ---------- reveal-on-scroll ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s cubic-bezier(.22,1,.36,1); }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ---------- music: upload zone ---------- */
.upload-zone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 22px 16px;
  text-align: center;
  margin-bottom: 16px;
  transition: border-color .2s, background .2s;
  cursor: pointer;
}
.upload-zone:hover, .upload-zone.is-dragover {
  border-color: var(--accent);
  background: rgba(255, 107, 92, 0.06);
}
.upload-zone__inner { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-dim); }
.upload-zone__inner svg { color: var(--accent); }
.upload-zone__inner strong { color: var(--text); }
.upload-zone__hint { font-size: 0.75rem; color: var(--text-faint); }
.upload-progress { margin-top: 14px; height: 6px; border-radius: 999px; background: var(--bg-elev-2); overflow: hidden; }
.upload-progress__bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s ease; }

/* ---------- music: track list ---------- */
.track-list { display: flex; flex-direction: column; gap: 12px; }
.track-list__empty { color: var(--text-faint); text-align: center; padding: 30px 0; font-size: 0.9rem; }

.track-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  transition: border-color .25s, background .25s;
}
.track-card.is-active { border-color: var(--accent); background: var(--bg-elev-2); }

.track-card__row { display: flex; align-items: center; gap: 12px; }
.track-card__play {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--bg-elev-2);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, transform .15s, color .2s;
}
.track-card__play:hover { background: var(--accent); color: #fff; }
.track-card__play:active { transform: scale(0.9); }
.track-card.is-active .track-card__play { background: var(--accent); color: #fff; }

.track-card__meta { flex: 1 1 auto; min-width: 0; }
.track-card__title { font-weight: 600; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-card__sub { font-size: 0.72rem; color: var(--text-faint); margin-top: 2px; }

.track-card__delete {
  flex: 0 0 auto;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-faint);
  display: flex; align-items: center; justify-content: center;
  transition: color .2s, background .2s;
}
.track-card__delete:hover { color: var(--danger); background: rgba(255, 92, 122, 0.1); }

.waveform {
  margin-top: 12px;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.waveform__scroll {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  scrollbar-width: thin;
}
.waveform__canvas { display: block; height: 56px; touch-action: pan-x; cursor: pointer; }
.waveform__playhead {
  display: none;
  position: absolute;
  top: 0; bottom: 0;
  left: 0;
  width: 0;
  pointer-events: none;
  z-index: 2;
}
.waveform__playhead::before, .waveform__playhead::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.5));
}
.waveform__playhead::before {
  top: 0;
  border-top: 6px solid #fff;
}
.waveform__playhead::after {
  bottom: 0;
  border-bottom: 6px solid #fff;
}
.track-card.is-active .waveform__playhead { display: block; }
.waveform__skeleton {
  height: 56px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--bg-elev-2) 25%, var(--bg) 37%, var(--bg-elev-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ---------- now playing bar ---------- */
.now-playing {
  position: fixed;
  left: 8px; right: 8px;
  bottom: calc(var(--tabbar-h) + 6px);
  height: var(--nowplaying-h);
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  z-index: 39;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  animation: npIn .3s cubic-bezier(.22,1,.36,1);
}
@keyframes npIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.now-playing__play {
  flex: 0 0 auto;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.now-playing__meta { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.now-playing__title { font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-playing__time { font-size: 0.68rem; color: var(--text-faint); }
.now-playing__volume { display: none; align-items: center; gap: 6px; color: var(--text-dim); }
.now-playing__volume input { width: 70px; accent-color: var(--accent); }

/* ---------- admin modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(4, 5, 8, 0.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 60;
  padding: 20px;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 340px;
  animation: modalIn .25s cubic-bezier(.22,1,.36,1);
}
@keyframes modalIn { from { opacity: 0; transform: scale(.95) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal h2 { font-size: 1.1rem; }
.modal__sub { font-size: 0.82rem; margin-top: 4px; }
.modal__error { color: var(--danger); font-size: 0.8rem; margin-top: 8px; }
#adminForm { margin-top: 16px; }
#adminPassword {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font-size: 0.9rem;
}
#adminPassword:focus { outline: none; border-color: var(--accent); }
.modal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.btn { border-radius: 999px; padding: 8px 18px; font-size: 0.85rem; font-weight: 600; border: none; transition: transform .15s, opacity .2s; }
.btn:active { transform: scale(0.95); }
.btn--ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn--primary { background: var(--accent); color: #fff; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  top: calc(var(--topbar-h) + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 80;
  white-space: nowrap;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.is-error { border-color: var(--danger); color: var(--danger); }

/* [hidden] has the same specificity as these class rules' `display`
   declarations, and loses the cascade tie since it comes first (UA sheet) —
   restate it here so toggling the attribute actually hides these. */
.modal-backdrop[hidden], .now-playing[hidden], .avatar__edit[hidden], .avatar__remove[hidden],
.lightbox__close[hidden], .lightbox__prev[hidden], .lightbox__next[hidden] { display: none; }

/* ---------- desktop breakpoint ---------- */
@media (min-width: 768px) {
  :root { --tabbar-h: 0px; }
  .tabs--desktop { display: flex; }
  .tabs--mobile { display: none; }
  .views { padding-bottom: calc(var(--nowplaying-h) + 40px); }
  .now-playing { left: 50%; right: auto; transform: translateX(-50%); width: min(520px, calc(100% - 32px)); bottom: 18px; }
  .now-playing__volume { display: flex; }
  .hero__name { font-size: 2.4rem; }
}
