/* ── TOKENS ── */
:root {
  --bg:        #141418;
  --bg2:       #1c1c22;
  --bg3:       #22222a;
  --border:    rgba(255,255,255,0.09);
  --text:      #ededea;
  --muted:     #b0b0be;
  --dim:       #50505e;
  --accent:    #d4924a;
  --accent2:   #6a9fbe;
  --col-width: 1000px;

  --font-display: 'Syne', sans-serif;
  --font-mono:    'Space Mono', monospace;
  --font-body:    'DM Sans', sans-serif;
}

/* ── UTILITIES ── */
.hidden { display: none !important; }

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: auto;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 20px;
  -webkit-font-smoothing: antialiased;
  overflow: auto;
}
a { color: var(--accent2); text-decoration: none; }
a:hover { color: var(--text); }

/* ── PAGE ── */
.page {
  max-width: var(--col-width);
  margin: 0 auto;
  padding: 0 26px;
  height: auto;
  display: flex;
  flex-direction: column;
}

/* ── HEADER ── */
.header {
  display: flex;
  gap: 35px;
  align-items: flex-start;
  padding: 40px 0 26px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.bio {
  width: 100%;
  display: flex;
  gap: 32px;
  align-items: center;
}
.bio-identity {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-shrink: 0;
}
.bio-photo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--border);
}
.bio-name {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin-bottom: 4px;
  white-space: nowrap;
}
.bio-role {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.bio-text {
  flex: 1;
  font-size: 15px;
  color: var(--muted);
  line-height: 1.65;
}
.bio-links { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.bio-links a {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.bio-links a:hover { color: var(--text); }

/* ── HIGHLIGHTS ── */
.highlights { flex: 1; }
.highlights-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--dim);
  margin-bottom: 11px;
}
.highlights-cards { display: flex; gap: 13px; }
.highlight-card {
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 15px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.highlight-card:hover { border-color: rgba(200,146,58,0.35); }
.hc-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 7px;
  line-height: 1.5;
}
.hc-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 7px;
  line-height: 1.15;
}
.hc-desc { font-size: 14px; color: var(--muted); line-height: 1.6; }

/* ── TABS ── */
.tabs {
  display: flex;
  padding: 18px 0 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tab {
  font-family: var(--font-mono);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 11px 24px;
  cursor: pointer;
  color: var(--dim);
  border-bottom: 1px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s;
  user-select: none;
}
.tab:hover { color: var(--muted); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* ── SORT BAR ── */
.sort-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 0 6px;
  flex-shrink: 0;
}
.sort-btn {
  font-family: var(--font-mono);
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--dim);
  cursor: pointer;
  transition: color 0.15s;
  user-select: none;
}
.sort-btn:hover { color: var(--muted); }
.sort-btn.active { color: var(--accent); }
.sort-sep {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--dim);
}
.sort-label {
  font-family: var(--font-mono);
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--dim);
}

/* ── ABOUT PANEL ── */
#about-panel {
  max-width: var(--col-width);
  padding: 32px 70px 60px;
}
.about-bio {
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.7;
  color: var(--muted);
  max-width: 640px;
  margin-bottom: 40px;
}
.about-section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--dim);
  margin-bottom: 14px;
}
.about-video-wrap {
  width: 100%;
  max-width: 640px;
  aspect-ratio: 16 / 9;
  margin-bottom: 40px;
}
.yt-lite {
  position: relative;
  width: 100%;
  height: 100%;
  cursor: pointer;
  background: #000;
}
.yt-lite img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.9;
}
.yt-lite iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.yt-play-btn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
  pointer-events: none;
}
.yt-lite:hover .yt-play-btn { color: var(--accent); }
#about-panel .gr_grid_container a img {
  display: block;
  opacity: 0.85;
  transition: opacity 0.15s;
}
#about-panel .gr_grid_container a:hover img { opacity: 1; }

/* ── LIST AREA ── */
.list-area {
  flex: none;
  position: relative;
  overflow: visible;
  clip-path: none;
  margin: 0 -26px;
}

.project-list {
  position: static;
  padding: 0 70px;
}
.project-list.hidden { display: none; }

/* ── PROJECT ROW ── */
.project {
  display: grid;
  grid-template-columns: 57px 97px 1fr;
  column-gap: 15px;
  padding: 11px 9px;
  border-radius: 3px;
  cursor: pointer;
  border-left: 2px solid transparent;
  margin-bottom: 1px;
  height: 84px;
  overflow: hidden;
  opacity: 0.75;
  flex-shrink: 0;
  transition: transform 0.12s ease-out, opacity 0.12s ease-out;
}
.project:not(.active):hover {
  transform: scale(1.018);
  opacity: 0.95;
  z-index: 1;
}
.project.active {
  background: var(--bg3);
  border-left-color: rgba(255,255,255,0.15);
  height: auto;
  overflow: visible;
  opacity: 1;
  margin: 0 -20px 0 -162px;
  padding: 20px 20px 20px 171px;
  cursor: default;
}

/* ── HIGHLIGHT TREATMENT ── */
.project.highlight {
  height: 96px;
  background: rgba(212, 146, 74, 0.04);
  border-left-color: rgba(212, 146, 74, 0.3);
  opacity: 0.9;
  margin: 0 -40px;
  padding: 11px 49px;
}
.project.highlight:nth-child(even) {
  background: rgba(212, 146, 74, 0.08);
}
.project.highlight:not(.active):hover {
  opacity: 1;
}
.project.highlight .title {
  color: #b87d38;
}
.project.highlight.active {
  height: auto;
  background: rgba(212, 146, 74, 0.07);
  border: 1px solid rgba(212, 146, 74, 0.55);
  margin: 0 -20px 0 -162px;
  padding: 20px 20px 20px 171px;
}
.project.highlight.active .title {
  color: var(--accent);
  font-size: 26px;
  letter-spacing: -0.01em;
}

/* thumbnail */
.project .thumb {
  width: 97px; height: 62px;
  flex-shrink: 0;
  border-radius: 3px;
  overflow: hidden;
  background: var(--bg2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.project .thumb img { width: 100%; height: 100%; object-fit: cover; }
.yt-iframe { display: none; border: 0; }

/* Stack thumbnail and iframe for cross-fade */
.thumb.yt-playing > * {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.thumb.yt-playing img { object-fit: cover; z-index: 2; transition: opacity 0.5s; }
.thumb.yt-playing .thumb-placeholder {
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s;
}
.thumb.yt-playing .yt-iframe { display: block; z-index: 1; opacity: 0; transition: opacity 0.5s; }

/* Trigger the cross-fade */
.thumb.yt-fading img,
.thumb.yt-fading .thumb-placeholder { opacity: 0; pointer-events: none; }
.thumb.yt-fading .yt-iframe { opacity: 1; }

/* Cover blocks hover-triggered controls until thumbnail finishes fading */
.yt-cover { display: none; position: absolute; inset: 0; z-index: 10; }
.yt-cover.active { display: block; }

/* Video playing: inherits same layout as other active rows; just fix height for 16:9 */
.project.active.has-video .thumb.yt-playing {
  height: 180px; /* 16:9 at 320px width */
  aspect-ratio: unset;
}
.thumb-placeholder {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--dim);
}
.project.active .thumb-col {
  width: 320px;
  margin-left: -223px; /* grow leftward - keeps title at same x as collapsed rows */
  position: relative;
  z-index: 1;
  align-self: center;
}
.project.active .thumb {
  width: 100%;
  height: auto;
  border-radius: 6px;
  position: relative;
}
.project.active .thumb:not(.yt-playing) img { height: auto; }
.project.active .year { opacity: 0; } /* covered by expanded thumb */
.project.active .thumb-placeholder { font-size: 72px; }

/* year / rank position */
.rank-pos { display: none; }
.sort-rank .project:not(.active) .rank-pos { display: block; }
.sort-rank .project:not(.active) .year-val { display: none; }

/* year */
.project .year {
  width: 57px;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--dim);
  padding-top: 4px;
  text-align: right;
  line-height: 1.5;
}
.project.active .year { color: var(--muted); }

.year-active { display: none; }
.project.active .year-active { display: inline; }

/* main content */
.project .main { overflow: hidden; min-width: 0; }

.project .title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 2px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project.active .title {
  color: var(--text);
  font-size: 24px;
  white-space: normal;
}

.project .meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project.active .meta { color: var(--accent2); white-space: normal; }

.project .blurb { display: none; }
.project.active .blurb {
  display: block;
  font-size: 14px;
  color: var(--muted);
  margin: 5px 0 9px;
  line-height: 1.6;
}

/* ── DETAILS ── */
.details { display: none; }
.project.active .details {
  display: block;
  margin-top: 11px;
}
.details-inner {
  padding: 11px 13px;
  background: rgba(0,0,0,0.25);
  border-radius: 3px;
  border-left: 2px solid rgba(200,146,58,0.2);
}
.details-inner p {
  font-size: 14px;
  color: #b8b8c4;
  line-height: 1.7;
  margin-bottom: 9px;
}
.details-links { display: flex; gap: 13px; flex-wrap: wrap; margin-bottom: 9px; }
.details-links a {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.details-links a:hover { color: var(--text); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--dim);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 2px 7px;
}

/* ── VIDEO CAPTION ── */
.video-caption {
  display: none;
  padding-top: 5px;
  font-size: 12px;
  font-style: italic;
  color: var(--muted);
  text-align: center;
  line-height: 1.4;
}
.project.active .video-caption { display: block; }

/* ── LIST SCROLLBAR ── */
.list-scrollbar { display: none; }
.list-scrollbar {
  position: absolute;
  right: 26px;
  top: 10px;
  bottom: 10px;
  width: 24px;
  cursor: pointer;
  z-index: 4;
}
.list-scrollbar::before {
  content: '';
  position: absolute;
  right: 0;
  top: 0; bottom: 0;
  width: 3px;
  background: rgba(255,255,255,0.05);
  border-radius: 2px;
  transition: width 0.15s ease-out, background 0.15s;
}
.list-scrollbar:hover::before,
.list-scrollbar.dragging::before {
  width: 6px;
  background: rgba(255,255,255,0.08);
}
.list-scrollbar-thumb {
  position: absolute;
  right: 0;
  width: 3px;
  background: var(--dim);
  border-radius: 2px;
  transition: top 0.18s ease-out, height 0.18s ease-out, width 0.15s ease-out, background 0.15s;
  cursor: grab;
}
.list-scrollbar:hover .list-scrollbar-thumb,
.list-scrollbar.dragging .list-scrollbar-thumb {
  width: 6px;
  background: var(--muted);
}
.list-scrollbar-thumb:active { cursor: grabbing; }
.list-scrollbar.dragging .list-scrollbar-thumb { transition: width 0.15s ease-out, background 0.15s; }

/* ── SCROLL HINT ── */
.scroll-hint {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--dim);
  text-align: center;
  padding: 9px 0 11px;
  flex-shrink: 0;
  letter-spacing: 0.08em;
  transition: opacity 0.4s;
}
.scroll-hint.hidden { opacity: 0; pointer-events: none; }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  /* Native page scroll - undo the fixed-viewport approach */
  html, body { overflow: auto; height: auto; }
  .page { height: auto; padding: 0 14px; }
  .list-area { clip-path: none; flex: none; overflow: visible; margin: 0 -14px; }
  .list-area::before, .list-area::after { display: none; }
  .project-list { position: static; padding: 0 14px; }
  .list-scrollbar { display: none; }
  .scroll-hint { display: none; }

  /* Header */
  .header { padding: 18px 0 14px; gap: 16px; }
  .bio { flex-direction: column; align-items: flex-start; gap: 10px; }
  .bio-name { font-size: 22px; }
  .bio-text { font-size: 13px; }
  .bio-links { flex-direction: row; gap: 14px; }

  /* Tabs */
  .tab { padding: 9px 16px; font-size: 13px; }

  /* Compact inactive rows */
  .project {
    grid-template-columns: 40px 68px 1fr;
    column-gap: 10px;
    height: 68px;
    padding: 8px 6px;
  }
  .project .thumb { width: 68px; height: 43px; }
  .project .year { width: 40px; font-size: 11px; }
  .project .title { font-size: 17px; }
  .project .meta { font-size: 11px; }

  /* Highlight rows - remove desktop bleed */
  .project.highlight { height: 78px; margin: 0; padding: 8px 6px; }

  /* Active project - stack thumb above content, no bleed tricks */
  .project.active,
  .project.highlight.active {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0 -14px;
    padding: 14px;
    height: auto;
  }

  /* Year is shown inline in the meta line; hide the column */
  .project.active .year { display: none; }

  /* Full-width thumb */
  .project.active .thumb-col {
    width: 100%;
    margin-left: 0;
    align-self: unset;
  }
  .project.active .thumb {
    width: 100%;
    height: auto;
    border-radius: 6px;
    position: relative;
  }
  .project.active .thumb:not(.yt-playing) img { height: auto; }
  /* Video: use aspect-ratio instead of fixed px height */
  .project.active.has-video .thumb.yt-playing {
    height: auto;
    aspect-ratio: 16 / 9;
  }
  .project.active .thumb-placeholder { font-size: 48px; height: 140px; }

  /* Title sizes */
  .project.active .title { font-size: 20px; }
  .project.highlight.active .title { font-size: 22px; letter-spacing: 0; }

  /* About panel */
  #about-panel { padding: 24px 14px 48px; }
  .about-bio { font-size: 15px; }
}

/* ── PAGE FOOTER ── */
.page-footer-rule {
  border: none;
  border-top: 1px solid var(--border);
  margin: 48px 0 32px;
}
