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

:root {
  --color-bg: #ebebeb;
  --color-text: #2c2c2c;
  --color-muted: #999999;
  --color-border: #acacac;
  --font-sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --title-font-size: 2.6rem;
  --title-font-weight: 500;
  --title-letter-spacing: -0.03em;
  --meta-font-size: 0.75rem;
  --counter-font-size: 0.75rem;
  --item-height-divisor: 9;
  --mask-height: 30vh;
  --list-padding-top: 120px;
  --list-padding-bottom: 160px;
  --list-padding-side: 64px;
  --transition-speed: 0.3s;
  --inactive-opacity: 0.15;
  --thumb-transition: 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
}

a, a:hover, a:link {
  color: var(--color-text);
  text-decoration: none;
}

img {
  display: block;
  width: 100%;
  height: auto;
}

.noselect {
  -webkit-user-select: none;
  user-select: none;
}

.uppercase {
  text-transform: uppercase;
}

.smallFontSize {
  font-size: 14px;
  line-height: 22px;
  letter-spacing: 0.02em;
}

/* Header */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px;
  background: var(--color-bg);
  border-bottom: 0.5px solid var(--color-border);
}

header .logo {
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  cursor: pointer;
}

header .logo span {
  color: var(--color-muted);
}

header nav {
  display: flex;
  gap: 20px;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

header nav a {
  color: var(--color-muted);
}

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

/* Split-pane layout */
.split-pane {
  display: flex;
  height: 100vh;
  padding-top: 62px;
  position: relative;
  overflow: hidden;
}

/* Left panel - Project titles */
.left-panel {
  width: 50%;
  height: 100%;
  overflow-y: auto;
  position: relative;
  z-index: 10;
  border-right: 0.5px solid var(--color-border);
}

.left-panel::-webkit-scrollbar {
  display: none;
}

.left-panel .project-list {
  width: 100%;
  padding: var(--list-padding-top) var(--list-padding-side) var(--list-padding-bottom) var(--list-padding-side);
}

.left-panel .project-item {
  cursor: pointer;
  height: calc((100vh - 62px) / var(--item-height-divisor));
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  opacity: var(--inactive-opacity);
  transition: opacity var(--transition-speed) ease;
}

.left-panel .project-item.active {
  opacity: 1;
}

.left-panel .project-item .title {
  font-size: var(--title-font-size);
  font-weight: var(--title-font-weight);
  line-height: 1.15;
  letter-spacing: var(--title-letter-spacing);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.left-panel .project-item .meta {
  font-size: var(--meta-font-size);
  color: var(--color-muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
  padding-bottom: 4px;
}

/* Right panel - Thumbnails */
.right-panel {
  width: 50%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.right-panel .thumbnails {
  display: flex;
  flex-direction: column;
  will-change: transform;
  transition: transform var(--thumb-transition);
}

.right-panel .project-thumb {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 40px;
  pointer-events: none;
}

.right-panel .project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

/* Masks */
.top-mask, .bottom-mask {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 11;
  pointer-events: none;
}

.top-mask {
  top: 62px;
  height: var(--mask-height);
  background: linear-gradient(to bottom, var(--color-bg) 0%, transparent 100%);
}

.bottom-mask {
  bottom: 0;
  height: var(--mask-height);
  background: linear-gradient(to top, var(--color-bg) 0%, transparent 100%);
}

/* Counter */
.counter {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--counter-font-size);
  color: var(--color-muted);
  letter-spacing: 0.05em;
  z-index: 50;
}

/* Close link */
.close-link {
  position: fixed;
  bottom: 24px;
  right: 32px;
  font-size: 0.75rem;
  color: var(--color-muted);
  letter-spacing: 0.05em;
  z-index: 50;
  cursor: pointer;
}

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

/* Info page */
.info-page {
  max-width: 640px;
  margin: 0 auto;
  padding: 100px 40px;
}

.info-page h1 {
  font-size: 1.2rem;
  font-weight: 500;
  margin-bottom: 32px;
}

.info-page .info-section {
  margin-bottom: 40px;
}

.info-page .info-section p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--color-muted);
  margin-bottom: 16px;
}

.info-page .info-section .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-muted);
  margin-bottom: 8px;
}

.info-page .info-links {
  list-style: none;
}

.info-page .info-links li {
  margin-bottom: 8px;
}

.info-page .info-links a {
  font-size: 0.9rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.info-page .credits {
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
  font-size: 0.75rem;
  color: var(--color-muted);
  line-height: 1.8;
}

.info-page .credits a {
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Portrait grid (Info page) */
.portrait-grid {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
}

.portrait-grid::-webkit-scrollbar {
  height: 4px;
}

.portrait-grid::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 2px;
}

.portrait-grid img {
  height: 140px;
  width: auto;
  object-fit: cover;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.2s;
  flex-shrink: 0;
  scroll-snap-align: start;
}

.portrait-grid img:hover {
  opacity: 1;
}

@media (max-width: 600px) {
  .portrait-grid img {
    height: 100px;
  }
}

/* Lightbox (for project pages) */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.lightbox.open {
  opacity: 1;
  pointer-events: all;
}

.lightbox img {
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
}

.lightbox .close {
  position: absolute;
  top: 24px;
  right: 32px;
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  letter-spacing: 0.05em;
}

.lightbox .nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 20px;
  user-select: none;
}

.lightbox .prev { left: 16px; }
.lightbox .next { right: 16px; }

.lightbox .counter-label {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: #666;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
}

/* Project page (standalone) */
.project-page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 100px 32px 60px;
}

.project-page .project-header {
  margin-bottom: 40px;
}

.project-page .project-title {
  font-size: 1.8rem;
  font-weight: 500;
  margin-bottom: 4px;
}

.project-page .project-meta {
  font-size: 0.85rem;
  color: var(--color-muted);
}

.project-page .video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  margin-bottom: 40px;
  background: var(--color-border);
}

.project-page .video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.project-page .gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}

.project-page .gallery-grid img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  cursor: pointer;
}

.project-page .project-description,
.project-page .project-credits {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--color-muted);
  margin-bottom: 8px;
}

.project-page .project-description {
  font-style: italic;
}

.project-page .project-link {
  margin-bottom: 24px;
}

.project-page .project-link a {
  font-size: 0.85rem;
  color: var(--color-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.project-page .project-link a:hover {
  color: var(--color-text);
}

.project-page .back-link {
  display: inline-block;
  margin-top: 40px;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: var(--color-muted);
}

/* 404 */
.four-oh-four {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  flex-direction: column;
  gap: 16px;
}

.four-oh-four h1 {
  font-size: 1rem;
  font-weight: 500;
}

.four-oh-four p {
  color: var(--color-muted);
  font-size: 0.85rem;
}

.four-oh-four a {
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: var(--color-muted);
}

/* Responsive */
@media (max-width: 900px) {
  :root {
    --color-bg: #111111;
    --color-text: #e8e8e8;
    --color-muted: #777777;
    --color-border: #333333;
    --item-height-divisor: 6;
    --title-font-size: 1.6rem;
    --mask-height: 15vh;
    --list-padding-top: 90px;
    --list-padding-bottom: 90px;
    --list-padding-side: 40px;
  }

  .split-pane {
    flex-direction: column;
    overflow-y: hidden;
  }

  .left-panel {
    width: 100%;
    height: 50%;
    border-right: none;
    border-bottom: 0.5px solid var(--color-border);
    overflow-y: auto;
  }

  .right-panel {
    width: 100%;
    height: 50%;
    display: block;
  }

  .right-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    z-index: 2;
    background: linear-gradient(to bottom, var(--color-bg) 0%, transparent 100%);
    pointer-events: none;
  }

  .right-panel .project-thumb {
    padding: 0 20px;
  }

  .project-page .gallery-grid {
    grid-template-columns: 1fr;
  }

  .counter {
    display: none;
  }
}

@media (max-width: 600px) {
  :root {
    --list-padding-top: 60px;
    --list-padding-bottom: 60px;
    --list-padding-side: 28px;
    --item-height-divisor: 5;
    --title-font-size: 1.2rem;
    --meta-font-size: 0.6rem;
    --mask-height: 12vh;
  }

  header {
    padding: 14px 16px;
  }

  header .logo {
    font-size: 1.1rem;
  }

  header nav {
    gap: 10px;
    font-size: 0.7rem;
  }

  .right-panel .project-thumb {
    padding: 0 12px;
  }

  .info-page {
    padding: 80px 20px;
  }

  .project-page {
    padding: 80px 20px 40px;
  }
}
