/* ============ Base ============ */
:root {
  /* Dark theme (default) */
  --bg: #0f0f0e;
  --text: #ededea;
  --muted: #9c9c95;
  --faint: #6f6f68;
  --border: #2a2a27;
  --card: #1a1a18;
  --accent: #ededea;
  /* Chat "me" bubble + form controls */
  --bubble-me-bg: #1e1e1b;
  --bubble-me-text: #ededea;
  --control-bg: #242421;
  --control-border: #34342f;
  --control-text: #ededea;
  --control-placeholder: #2c2c2a; /* ~10% brighter than --pill-bg */
  --control-hover: #2f2f2c;
  --input-text: #9a9a90;
  --pill-bg: #141412;
  --pill-hover: #1f1f1c;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root.light {
  --bg: #fafaf8;
  --text: #1a1a1a;
  --muted: #6f6f6a;
  --faint: #a3a39c;
  --border: #e6e6e0;
  --card: #ffffff;
  --accent: #1a1a1a;
  --bubble-me-bg: #1a1a1a;
  --bubble-me-text: #fafaf8;
  --control-bg: #2c2c2c;
  --control-border: #3a3a3a;
  --control-text: #fafaf8;
  --control-placeholder: #252525; /* ~10% brighter than --pill-bg */
  --control-hover: #3a3a3a;
  --input-text: #9a9a9a;
  --pill-bg: #0d0d0d;
  --pill-hover: #1c1c1c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: 0.01em; /* +1% tracking on sans text */
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

main {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ============ Header ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
}

.header-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-family: var(--mono);
  font-size: 13px;
}


.est { color: var(--faint); font-size: 11px; letter-spacing: 0.12em; }

.nav { margin-left: auto; display: flex; gap: 16px; }

.nav a {
  text-decoration: none;
  color: var(--muted);
  transition: color 0.15s;
}

.nav a:hover { color: var(--text); }

/* ============ Hero ============ */
.hero { padding: 80px 0 16px; }

.hero-avatar {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(.34, 1.56, .64, 1); /* bouncy */
}

.hero-avatar:hover { transform: scale(1.12); }

/* Crop controls — tune via tune-dp.html */
.hero-avatar-img {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: 50% 20%;   /* pan X Y */
  background-repeat: no-repeat;
  transform: scale(1.22);         /* zoom (tuned via tune-dp.html) */
  transform-origin: 50% 20%;
}

.hero-identity {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.hero-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.verified-badge { flex-shrink: 0; display: block; }

.hero-role {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 20px;
}

.hero-bio { color: var(--muted); max-width: 54ch; }

.hero-bio a { color: var(--text); text-underline-offset: 3px; }

.smallest-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.inline-favicon {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
  vertical-align: -2px;
  flex-shrink: 0;
}

.hint {
  margin-top: 28px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--faint);
}

kbd {
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 6px;
  background: var(--card);
  color: var(--text);
}

#copy-key {
  display: inline-block;
  min-width: 1.1em;
  text-align: center;
}

#copy-key.copied {
  color: #2ea043;
  border-color: #2ea043;
  animation: kbd-pop 0.32s ease;
}

@keyframes kbd-pop {
  0% { transform: scale(0.7); }
  55% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* ============ Sections ============ */
.section { padding: 16px 0; }

.section-label {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--faint);
  margin-bottom: 24px;
}

.section-label.center { text-align: center; }

.section-intro { color: var(--muted); margin: -8px 0 32px; max-width: 50ch; }

/* Total Viewcount — live counter */
.viewcount-section { padding: 16px 0; }
.viewcount-section .section-label { margin-bottom: 24px; }

.viewcount {
  font-family: var(--mono);
  font-size: 32px;
  font-weight: 400;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: normal;
  display: inline-flex;
  align-items: flex-end;
  line-height: 1;
}

.vc-reel { display: inline-block; height: 1em; overflow: hidden; }
.vc-strip {
  display: flex;
  flex-direction: column;
  transition: transform 0.9s cubic-bezier(.2, .7, .2, 1);
  will-change: transform;
}
.vc-cell { height: 1em; display: flex; align-items: flex-end; justify-content: center; }
.vc-comma { display: inline-flex; align-items: flex-end; height: 1em; padding: 0 0.04em; }

/* Stuff I've Done — descriptor line under the heading (matches heading style, 16px) */
/* Heading + keyword line aligned to the content column (section is full-width) */
.stuff-head { max-width: 680px; margin: 0 auto; padding: 0 24px; }

.stuff-sublist {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 400;
  color: var(--faint);
  margin: -8px 0 4px;
}

/* Keyword highlight — turns black when its matching video is hovered */
.stuff-sublist .kw { color: var(--faint); transition: color 0.2s ease; }
.stuff-sublist .kw.active { color: var(--text); }

/* ============ Timeline ============ */
.timeline { list-style: none; display: flex; flex-direction: column; gap: 32px; }

.timeline-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 20px;
}

.years {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
  padding-top: 4px;
  white-space: nowrap;
}

.timeline-row h3 { font-size: 15px; font-weight: 500; margin-bottom: 6px; }

.timeline-row h3 .company { text-underline-offset: 3px; }

.timeline-row p { color: var(--muted); font-size: 15px; }

.timeline-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 0;
}

.timeline-bullets li {
  color: var(--muted);
  font-size: 15px;
  padding-left: 14px;
  position: relative;
}

.timeline-bullets li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: var(--faint);
}

.timeline-bullets a {
  color: inherit; /* same colour as the bullet text, even when hyperlinked */
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ============ Stuff I've Done (video stack) ============ */
.stuff-section {
  width: 100vw;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  padding: 16px 0;
  overflow: hidden;
}



.video-stack {
  display: flex;
  align-items: center;
  padding: 40px 0;
  overflow: hidden;
  position: relative;
}

/* Wrapper that slides the whole row to centre the focused clip (cover-flow) */
.video-track {
  width: max-content;
  transition: transform 0.45s cubic-bezier(.2, .75, .25, 1);
}

/* Auto-scrolling marquee — pauses while the row is hovered */
.video-deck {
  display: flex;
  align-items: center;
  width: max-content;
  animation: vc-marquee 90s linear infinite;
}
.video-stack:hover .video-deck { animation-play-state: paused; }

@keyframes vc-marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(-1 * var(--vc-shift, 50%))); }
}

.video-card {
  flex: 0 0 auto;
  display: block;
  width: 240px;
  margin-right: -40px;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  box-shadow: -8px 12px 28px rgba(0, 0, 0, 0.22);
  transform: perspective(700px) rotateY(18deg);
  transition: transform 0.35s cubic-bezier(.2, .75, .25, 1), filter 0.35s ease, box-shadow 0.35s ease;
  cursor: pointer;
  backface-visibility: hidden;
}

/* Hover: dim the row; JS centers + scales the focused clip (.focused stays bright) */
.video-stack:hover .video-card { filter: brightness(0.4); }
.video-stack:hover .video-card.focused {
  filter: brightness(1);
  z-index: 50;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

/* Hovered-clip caption (desktop) — plain grey text */
.video-caption {
  text-align: center;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  margin: 12px 0 0;
  min-height: 16px;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.video-caption.show { opacity: 1; }

/* Plain prev/next arrows — only visible in the hover (focused) state */
.video-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0 6px;
  font-family: var(--mono);
  font-size: 36px;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 60;
}
.video-arrow.prev { left: calc(50% - 215px); }
.video-arrow.next { right: calc(50% - 215px); }
.video-arrow:hover { opacity: 0.6; }
.video-stack.show-arrows .video-arrow { opacity: 1; pointer-events: auto; }

.video-card video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* Carousel arrow nav — hidden on desktop, shown on mobile */
.carousel-nav { display: none; justify-content: center; gap: 16px; margin-top: 14px; }
.carousel-arrow {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-family: var(--mono);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.carousel-arrow:active { background: var(--bg); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .video-deck { animation: none; }
}

/* ============ Stack ============ */
.stack-logos {
  list-style: none;
  display: flex;
  flex-wrap: nowrap;
  gap: 20px;
  align-items: center;
}

.stack-icon {
  width: 38.4px;
  height: 38.4px;
  display: block;
}

/* ============ My Songs ============ */
.songs-grid {
  display: flex;
  gap: 28px;
  justify-content: center;
  padding: 16px 0;
}

.song-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.album-art {
  width: 180px;
  height: 180px;
  border-radius: 6px;
  box-shadow: -6px 6px 18px rgba(0,0,0,0.18);
  transform: perspective(700px) rotateY(-22deg) rotateX(8deg);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.song-card:hover .album-art {
  transform: perspective(700px) rotateY(0deg) rotateX(0deg);
  box-shadow: 0 8px 28px rgba(0,0,0,0.14);
}

.song-title {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
  transition: color 0.2s;
}

.song-card:hover .song-title { color: var(--text); }

/* ============ Writing ============ */
.writing-list { list-style: none; }

.writing-list a {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 16px;
  align-items: baseline;
  padding: 14px 0;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}

.writing-list li:last-child a { border-bottom: none; }

.post-date, .post-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
}

.post-title { font-size: 15px; transition: color 0.15s; }

.writing-list a:hover .post-title { color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-kicker {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--faint);
}

.card h3 { font-size: 15px; font-weight: 500; }

.card-sub { color: var(--muted); font-size: 14px; }

.card-link {
  margin-top: auto;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
}

.card-link:hover { color: var(--text); }


/* ============ Contact / chat ============ */
.chat { display: flex; flex-direction: column; gap: 10px; max-width: 400px; margin: 0 auto; }

.bubble {
  max-width: 250px;
  padding: 10px;
  border-radius: 16px;
  font-size: 15px;
}

/* Bubbles that hold interactive content (form / social buttons) */
.form-bubble,
.social-bubble { display: flex; flex-direction: column; gap: 10px; }
.bubble-text { margin: 0; }

.bubble.them {
  align-self: flex-end;
  background: #007AFF;
  border-bottom-right-radius: 4px;
  color: #fff;
}

.bubble.me {
  align-self: flex-start;
  background: var(--bubble-me-bg);
  color: var(--bubble-me-text);
  border-bottom-left-radius: 4px;
}

.email-bubble {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 13px;
}

.email-bubble button {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--control-bg);
  color: var(--control-text);
  border: 1px solid var(--control-border);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
}

.email-bubble button:hover { opacity: 0.85; }

.chat-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}

.chat-form input,
.chat-form textarea {
  font-family: var(--sans);
  font-size: 15px;
  padding: 5px 7px;
  border: 1px solid var(--pill-bg);
  border-radius: 10px;
  background: var(--pill-bg);
  color: var(--input-text);
  resize: vertical;
}

.chat-form input::placeholder,
.chat-form textarea::placeholder { color: var(--control-placeholder); }

.chat-form input:focus,
.chat-form textarea:focus { outline: none; border-color: var(--control-hover); }

.chat-form button {
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 13px;
  background: var(--control-bg);
  color: var(--control-text);
  border: 1px solid var(--control-border);
  border-radius: 10px;
  padding: 5px 14px;
  cursor: pointer;
}

.chat-form button:hover { opacity: 0.85; }

.social-row { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.social-row .pill { text-align: center; }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  color: var(--control-text);
  border: 1px solid var(--pill-bg);
  background: var(--pill-bg);
  border-radius: 10px;
  padding: 8px 14px;
  transition: background 0.15s, border-color 0.15s;
}

.pill svg { flex-shrink: 0; }
.pill:hover { background: var(--pill-hover); border-color: var(--pill-hover); }

/* ============ Footer ============ */
.site-footer {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 24px 32px;
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
}

/* ============ Theme switch (footer) ============ */
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--faint);
}

.switch-icon { font-size: 12px; line-height: 1; }

.switch-track {
  position: relative;
  width: 38px;
  height: 20px;
  border-radius: 999px;
  background: var(--control-bg);
  border: 1px solid var(--border);
  transition: background 0.2s;
}

.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text);
  transition: transform 0.2s;
}

:root.light .switch-thumb { transform: translateX(18px); }

/* ============ Toast ============ */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 12px);
  background: var(--text);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============ Reveal on scroll ============ */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ============ Responsive ============ */
@media (max-width: 768px) {
  main { padding: 0 16px; }

  /* ---- Video carousel: static 2D, horizontal scroll + arrows ---- */
  .stuff-section { width: 100%; left: auto; transform: none; }
  .video-stack {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .video-stack::-webkit-scrollbar { display: none; }
  .video-deck {
    animation: none !important;
    transform: none !important;
    width: max-content;
  }
  .video-card[aria-hidden="true"] { display: none; } /* drop the marquee clones */
  .video-card {
    width: 78vw;
    max-width: 320px;
    margin-right: 12px;
    transform: none;            /* flat 2D */
    scroll-snap-align: center;
  }
  /* no hover focus/dim on touch */
  .video-deck:hover .video-card { filter: none; }
  .video-deck .video-card:hover {
    filter: none;
    transform: none;
    z-index: auto;
    box-shadow: -8px 12px 28px rgba(0, 0, 0, 0.22);
  }

  /* ---- Songs: horizontal scroll + arrows ---- */
  .songs-grid {
    justify-content: flex-start;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 16px;
    padding: 8px 4px 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .songs-grid::-webkit-scrollbar { display: none; }
  .song-card { flex: 0 0 auto; scroll-snap-align: center; }
  .album-art { transform: none; }

  /* ---- Chat: fit thin screens ---- */
  .chat { max-width: 100%; }
  .email-bubble { flex-wrap: wrap; }
  #email-text { overflow-wrap: anywhere; }

  /* ---- Stack: wrap instead of overflowing ---- */
  .stack-logos { flex-wrap: wrap; justify-content: center; row-gap: 16px; }

  .carousel-nav { display: flex; }
  .video-caption { display: none; }
  .video-arrow { display: none; }
}

@media (max-width: 560px) {
  .est { display: none; }
  .nav { gap: 12px; }
  .hero { padding: 56px 0 16px; }
  .timeline-row { grid-template-columns: 1fr; gap: 4px; }
}
