:root {
  --bg: #ffffff;
  --fg: #111111;
  --gray: #7e7e7e;
  --border: #ececec;
  --sidebar-w: 16.6667vw; /* 2 of 12 grid columns */
  --font: "narkiss-tam", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: underline; }
a:hover { color: var(--gray); }

ul, ol { list-style: none; margin: 0; padding: 0; }
p { margin: 0 0 1em 0; }

.gray { color: var(--gray); }
.bold { font-weight: 700; }

/* ---------- Sidebar ---------- */

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar .top-group {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.site-name {
  color: var(--fg);
  font-weight: 600;
}

.site-name-fixed {
  position: fixed;
  top: 24px;
  left: 28px;
  z-index: 2001;
  cursor: pointer;
}

.tab-btn {
  background: none;
  border: none;
  font: inherit;
  color: var(--gray);
  cursor: pointer;
  padding: 0;
}

.tab-btn:hover,
.tab-btn.active {
  color: var(--fg);
}

.about-tab-fixed {
  position: fixed;
  top: 24px;
  left: calc(var(--sidebar-w) + 48px);
  z-index: 2001;
}

.about-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.93);
  z-index: 2000;
}

.about-overlay.open {
  display: block;
}

.main-top-overlay {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.93);
  z-index: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.main-top-overlay.visible {
  opacity: 1;
}

.cover-item img,
.cover-item .cover-number {
  transition: opacity 0.3s ease;
}

.cover-item.dimmed img,
.cover-item.dimmed .cover-number {
  opacity: 0.05;
}

.about-content {
  margin-left: var(--sidebar-w);
  padding: 64px 48px;
  display: grid;
  grid-template-columns: 3fr 7fr;
  gap: 48px;
  align-items: start;
}

.about-col-left {
  max-width: 280px;
}

.about-col-right {
  max-width: 280px;
  text-align: left;
}

.about-content .bio {
  color: var(--fg);
  font-weight: 700;
  white-space: pre-line;
}

.cover-list {
  margin-top: 24px;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cover-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  flex: 1 1 0;
  min-height: 0;
}

.cover-item img {
  flex: 0 0 auto;
  min-width: 0;
  width: 60%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cover-number {
  flex: 0 0 auto;
  color: var(--fg);
}

.about-content .experience-block .heading {
  color: var(--fg);
  font-weight: 300;
  margin-bottom: 8px;
}

.about-content .experience-block .lines {
  color: var(--fg);
  font-size: 14px;
  margin-bottom: 14px;
}

.about-content .experience-block .entry { margin-bottom: 0; }
.about-content .experience-block .entry-date {
  color: var(--fg);
  padding-left: 14px;
  text-indent: -14px;
}
.about-content .experience-block .entry-date::before { content: "• "; }
.about-content .experience-block .entry-text {
  color: var(--fg);
  padding-left: 14px;
}

.about-content .cv a { font-size: 14px; }

.about-email {
  margin-top: 40px;
  font-size: 14px;
  color: var(--fg);
}

.about-email + .about-email {
  margin-top: 6px;
}

.contact-bar {
  position: fixed;
  top: 24px;
  right: 28px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-weight: 700;
  z-index: 2001;
}

.contact-bar a {
  font-size: 14px;
}

/* ---------- Main / project sections ---------- */

.main {
  margin-left: var(--sidebar-w);
}

.project {
  display: grid;
  grid-template-columns: 3fr 7fr; /* 3 of 10 remaining columns for text, 7 for images */
  align-items: start;
  gap: 48px;
  padding: 64px 48px;
  border-bottom: 1px solid var(--border);
  min-height: 100vh;
}

.project:last-child { border-bottom: none; }

.project .info {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.project .info .title {
  color: var(--fg);
  font-weight: 700;
  margin-bottom: 12px;
}

.project .info .meta-lines {
  color: var(--gray);
  margin-bottom: 14px;
}

.project .info .meta-lines div,
.project .info .credit-line { margin-bottom: 2px; }

.project .info .credit-line .label { color: var(--fg); font-weight: 400; }
.project .info .credit-line .value { color: var(--gray); }

.project .info .credits-block { margin-bottom: 14px; }

.project .info .description {
  color: var(--gray);
  margin-bottom: 14px;
}

.project .info .description p {
  white-space: pre-line;
}

.project .info .year {
  color: var(--fg);
  font-weight: 400;
  margin-bottom: 24px;
}

/* ---------- Gallery / slideshow ---------- */

.project .gallery-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.project .gallery {
  min-width: 0;
  position: relative;
}

/* ---------- Ticker ---------- */

.gallery-bottom-row {
  margin-top: 4px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.gallery-bottom-row .counter {
  margin-top: 0;
  flex: 0 0 auto;
}

.gallery-ticker {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-top: 4px;
  margin-left: auto;
  overflow: hidden;
  min-width: 0;
  width: 40%;
  font-size: 13px;
}

.gallery-bottom-row .gallery-ticker {
  margin-top: 0;
}

.gallery-ticker .ticker-label {
  font-weight: 700;
  color: var(--gray);
  white-space: nowrap;
  flex: 0 0 auto;
}

.gallery-ticker .ticker-scroll {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.gallery-ticker .ticker-track {
  display: inline-flex;
  white-space: nowrap;
  animation: ticker-scroll 18s linear infinite;
}

.gallery-ticker .ticker-track span {
  color: var(--gray);
}

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-16.6667%); }
}

.gallery.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr;
  gap: 0;
  background: #000;
  padding: 24px;
}

.gallery-grid .grid-cell {
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: #000;
}

.gallery-grid .grid-cell img,
.gallery-grid .grid-cell video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery .stage {
  position: relative;
  background: #f4f4f4;
  width: 100%;
  aspect-ratio: 3 / 2; /* fallback until the first slide's media loads and sets the real ratio */
  overflow: hidden;
}

.gallery .track {
  position: relative;
  width: 100%;
  height: 100%;
}

.gallery .slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery .slide.inset {
  padding: 32px;
}

.gallery .slide img,
.gallery .slide video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.gallery .slide img,
.gallery-grid .grid-cell img {
  cursor: zoom-in;
}

.gallery .slide-group {
  display: flex;
  width: 100%;
  height: 100%;
  gap: 8px;
}

.gallery .slide-group.row {
  flex-direction: row;
}

.gallery .slide-group.column {
  flex-direction: column;
}

.gallery .slide-group.inset {
  padding: 16px 0;
}

.gallery .slide-group.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr;
  gap: 12px;
  background: #000;
  padding: 24px;
}

.gallery .slide-group img,
.gallery .slide-group video {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  cursor: zoom-in;
}

.gallery .slide-group.grid img,
.gallery .slide-group.grid video {
  object-fit: contain;
}

.gallery .arrow-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.85);
  color: var(--fg);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

.gallery .arrow-btn:hover { background: #fff; }
.gallery .arrow-btn.prev { left: 12px; }
.gallery .arrow-btn.next { right: 12px; }

.gallery .counter {
  margin-top: 0;
  font-size: 13px;
  color: var(--gray);
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  :root { --sidebar-w: 200px; }
  .project { padding: 40px 24px; gap: 28px; }
}

@media (max-width: 640px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    flex-direction: column;
    gap: 24px;
    border-bottom: 1px solid var(--border);
  }
  .main { margin-left: 0; }
  .project {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 32px 20px;
  }
  .project .info { width: 100%; }
}

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.lightbox.open {
  display: flex;
}

.lightbox-stage {
  position: relative;
  max-width: 92vw;
  max-height: 92vh;
  width: 92vw;
  height: 92vh;
  overflow: hidden;
}

.lightbox-track {
  position: relative;
  width: 100%;
  height: 100%;
}

.lightbox-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-slide img,
.lightbox-slide video {
  max-width: 92vw;
  max-height: 92vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  color: #fff;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  z-index: 1001;
}

.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #fff;
  font-size: 40px;
  line-height: 1;
  cursor: pointer;
  padding: 12px;
  z-index: 1001;
}

.lightbox-arrow.prev { left: 12px; }
.lightbox-arrow.next { right: 12px; }
.lightbox-arrow:hover,
.lightbox-close:hover { color: var(--gray); }
