/* ===========================
   PROJECTS PAGE — ROW LIST + EXPANDABLE DETAIL
   =========================== */

/* ── PAGE HERO ─────────────────────────────────── */
.page-hero--sm {
  height: 42svh;
  min-height: 280px;
  background: var(--black);
  align-items: flex-end;
  overflow: hidden;
}
.page-hero--sm::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}
.page-hero--sm::after {
  content: '';
  position: absolute;
  bottom: 0; left: var(--pad); right: 0;
  height: 1px;
  background: linear-gradient(to right, rgba(255,255,255,0.15), transparent);
  z-index: 1;
}

/* ── FILTER BAR ─────────────────────────────────── */
.project-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--black);
  color: var(--white);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0;
  margin-left: 6px;
  vertical-align: middle;
  font-family: var(--font-body);
  transition: background 0.25s;
}
.filter-btn.active .project-count-badge {
  background: var(--white);
  color: var(--black);
}
/* ── FILTER BAR ─────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem var(--pad);
  
  /* STICKY BEHAVIOR */
  position: sticky;
  top: var(--nav-h);
  z-index: 50;
  margin-top: 2rem; /* Gap after nav */
  
  /* Solid background (removed glassy effect) */
  margin-bottom: 2rem;
}

.filter-bar__inner {
  display: flex;
  gap: 4px;
  background: rgba(248, 247, 245, 0.6);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 100px;
  padding: 6px;
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.04),
    0 1px 2px rgba(0, 0, 0, 0.02);
  position: relative;
  isolation: isolate;
}

.filter-indicator {
  position: absolute;
  top: 6px;
  left: 6px;
  height: calc(100% - 12px);
  background: var(--black);
  border-radius: 100px;
  z-index: -1;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.filter-btn {
  background: none;
  border: none;
  padding: 0.65rem 1.6rem;
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gray-500);
  cursor: pointer;
  position: relative;
  transition: color 0.4s var(--ease-out);
}

.filter-btn:hover {
  color: var(--black);
}

.filter-btn.active {
  color: var(--white);
}

@media (max-width: 640px) {
  .filter-bar {
    padding: 0.75rem var(--pad); 
    margin-top: var(--nav-h);
    margin-bottom: 0.5rem;
    position: sticky;
    top: var(--nav-h);
    /* background: var(--white); */
    z-index: 50;
    /* border-bottom: 1px solid rgba(0, 0, 0, 0.05); */
  }
  .projects-list {
    margin-top: 0.5rem;
  }
  .filter-bar__inner {
    width: 100%;
    max-width: 100%;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
    padding: 5px;
    gap: 2px;
  }
  .filter-bar__inner::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
  }
  .filter-btn {
    padding: 0.5rem 1rem;
    font-size: 0.65rem;
    white-space: nowrap;
    flex-shrink: 0;
  }
}

/* ===========================================
   PROJECT LIST (rows)
   =========================================== */
.projects-list {
  max-width: 1200px; /* Constrained width for centered, focused layout */
  margin: 0 auto;
  /* padding: 80px var(--pad) 120px; */
  display: flex;
  flex-direction: column;
  gap: 20px; /* Generous vertical rhythm between rows */
  margin-bottom: 20px;
}

/* ── PROJECT ROW ─────────────────────────────── */
.proj-row {
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}

/* ── COLLAPSED STATE ─────────────────────────── */
.proj-row__collapsed {
  display: grid;
  grid-template-columns: 1fr 1fr; /* Balanced ratio matching the screenshot */
  align-items: center;
  gap: 4rem; /* Precise gap between text area and image area */
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: opacity 0.3s var(--ease-out), max-height 0.45s var(--ease-out);
  max-height: 1200px;
  opacity: 1;
}

/* Hide the collapsed row when detail is open */
.proj-row.is-open > .proj-row__collapsed {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Left info column */
.proj-row__info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 0;
  gap: 1rem;
  text-align: right;
  margin-top: 0; /* Centered automatically by flex parent */
}



.proj-row__title {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.2vw, 1.8rem); /* Slightly larger for impact */
  font-weight: 700; /* Medium weight like the screenshot */
  color: var(--black);
  line-height: 1.1;
  letter-spacing: -0.01em;
  transition: color 0.3s;
}
.proj-row__loc {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gray-500);
  font-weight: 400;
}
.proj-row__expand-hint {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: var(--gray-500);
  margin-top: 0.5rem;
  transition: color 0.3s, transform 0.4s var(--ease-out);
}
.proj-row__expand-hint svg {
  transition: transform 0.4s var(--ease-out);
}
.proj-row__plus-h {
  transition: opacity 0.3s, transform 0.3s;
  transform-origin: center;
}

/* Hover state */
.proj-row__collapsed:hover .proj-row__title { color: var(--gray-700); }
.proj-row__collapsed:hover .proj-row__expand-hint { color: var(--black); }

/* Open state */
.proj-row.is-open .proj-row__plus-h {
  opacity: 0;
  transform: scaleX(0);
}
.proj-row.is-open .proj-row__expand-hint svg {
  transform: rotate(45deg);
}

/* Cover image — right side */
.proj-row__cover-wrap {
  position: relative;
  overflow: hidden;
  height: auto; /* Remove fixed height for perfectly clean 'contain' fit */
  min-height: 380px; /* Reduced for more compact layout */
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  background: transparent;
  flex: 1;
}
.proj-row__cover {
  width: 100%;
  height: 100%;
  object-fit: contain; /* USER REQUESTED: Keep full image visible */
  object-position: center;
  display: block;
  transition: transform 0.9s var(--ease-out);
}
.proj-row__collapsed:hover .proj-row__cover {
  transform: scale(1.04);
}

/* Overlay label on cover */
.proj-row__cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10,10,10,0.55) 0%, transparent 60%);
  display: flex;
  align-items: flex-end;
  padding: 1.5rem 2rem;
  opacity: 0;
  transition: opacity 0.35s var(--ease-out);
  z-index: 2;
}
.proj-row__collapsed:hover .proj-row__cover-overlay { opacity: 1; }
.proj-row__cover-label {
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.9);
  border-bottom: 1px solid rgba(255,255,255,0.45);
  padding-bottom: 3px;
}

/* ===========================================
   EXPANDED DETAIL PANEL
   =========================================== */
.proj-detail {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.65s var(--ease-out);
  overflow: hidden;
  background: var(--white);
}
.proj-row.is-open .proj-detail {
  grid-template-rows: 1fr;
}

.proj-detail__inner {
  min-height: 0;
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  gap: 0;
  overflow: hidden;
}

/* ── SIDEBAR ─────────────────────────────────── */
.proj-detail__sidebar {
  padding: 1.5rem 2.5rem 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  /* border-right: 1px solid rgba(0,0,0,0.07); */
}



.proj-detail__name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 300;
  color: var(--black);
  line-height: 1.2;
  margin-bottom: 0.2rem;
}
.proj-detail__subloc {
  font-size: 0.63rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gray-500);
  margin-bottom: 1.5rem;
}
.proj-detail__year {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 300;
  color: var(--gray-300);
  line-height: 1;
  margin-bottom: 2rem;
}

/* Meta list */
.proj-detail__meta-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.proj-detail__meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.85rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.07);
}
.proj-detail__meta-label {
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gray-500);
  font-weight: 400;
}
.proj-detail__meta-val {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--black);
  letter-spacing: 0.03em;
}

/* Share bar */
.proj-detail__share {
  margin-top: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.proj-detail__share-label {
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gray-500);
}
.proj-detail__share-icons {
  display: flex;
  gap: 1rem;
  align-items: center;
}
.proj-share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  transition: color 0.25s, transform 0.25s;
}
.proj-share-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}
.proj-share-btn:hover {
  color: var(--black);
  transform: translateY(-2px);
}

/* ── CLOSE BUTTON ────────────────────────────── */
.proj-detail__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: 1px solid rgba(0,0,0,0.14);
  border-radius: 50%;
  padding: 0;
  color: var(--gray-500);
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s, background 0.25s;
  /* Top-right of the sidebar (desktop) */
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 10;
}
.proj-detail__close svg {
  flex-shrink: 0;
  transition: transform 0.25s;
  width: 12px;
  height: 12px;
}
.proj-detail__close:hover {
  color: var(--black);
  border-color: rgba(0,0,0,0.5);
  background: rgba(0,0,0,0.03);
}
.proj-detail__close:hover svg {
  transform: rotate(90deg);
}

/* ── GALLERY AREA (center) ────────────────────── */
.proj-detail__gallery-area {
  overflow: hidden;
  position: relative;
  /* border-right: 1px solid rgba(0,0,0,0.07); */
}

.proj-detail__slider-wrap {
  position: relative;
  height: 600px;   /* FIXED HEIGHT */
  overflow: hidden;
}

.proj-detail__slider {
  display: flex;
  height: 100%;
  width: 100%;
  overflow: hidden; /* JS handles scroll */
  gap: 0;
}

/* ── SLIDES ─────────────────────────────────── */
.proj-slide {
  position: relative;
  flex-shrink: 0;
  height: 100%;
  overflow: hidden;
  /* background: #fdfdfd;   */
  transition: width 0.55s var(--ease-out);
}
/* Landscape: wider */
.proj-slide--landscape {
  width: 100%;   /* full when shown alone; JS handles sizing in multi-view */
}
/* Portrait: narrower, natural ratio */
.proj-slide--portrait {
  width: 100%;   /* full column */
}
/* Only show one at a time — JS will toggle visibility/translate */
.proj-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;  /* SHOW FULL IMAGE */
  display: block;
}

.proj-slide__caption {
  position: absolute;
  bottom: 1rem;
  left: 1.25rem;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.75);
  background: rgba(0,0,0,0.38);
  padding: 4px 10px;
  backdrop-filter: blur(4px);
}

/* ── SLIDER NAVIGATION BUTTONS ────────────────── */
.proj-slider__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(248,247,245,0.9);
  border: 1px solid rgba(0,0,0,0.1);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: background 0.25s, transform 0.25s;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}
.proj-slider__btn svg {
  width: 18px;
  height: 18px;
  color: var(--black);
}
.proj-slider__btn--prev { left: 16px; }
.proj-slider__btn--next { right: 16px; }
.proj-slider__btn:hover {
  background: var(--white);
  transform: translateY(-50%) scale(1.08);
}
.proj-slider__btn:active {
  transform: translateY(-50%) scale(0.96);
}
.proj-slider__btn:disabled {
  opacity: 0.3;
  cursor: default;
}

/* ── DESCRIPTION (right column) ───────────────── */
.proj-detail__description {
  padding: 1.5rem 0 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.proj-detail__description p {
  font-size: 0.88rem;
  line-height: 1.9;
  color: var(--gray-700);
  font-weight: 300;
  max-height: 480px; /* Slightly taller to fit more text */
  overflow-y: auto;
  padding-right: 1.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-300) transparent;
}

/* Custom scrollbar for description */
.proj-detail__description p::-webkit-scrollbar {
  width: 4px;
}
.proj-detail__description p::-webkit-scrollbar-track {
  background: transparent;
}
.proj-detail__description p::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 10px;
}

.proj-detail__text-wrap {
  position: relative;
}

.proj-detail__read-more {
  display: none;
  background: none;
  border: none;
  padding: 0;
  color: var(--black);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
  z-index: 2;
}
.proj-detail__read-more svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}
.proj-detail__read-more:hover {
  opacity: 0.7;
}

.proj-detail__view-full {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--black);
  border-bottom: 1px solid currentColor;
  padding-bottom: 3px;
  margin-top: 2rem;
  align-self: flex-start;
  transition: opacity 0.2s, gap 0.25s;
}
.proj-detail__view-full svg {
  width: 16px;
  height: 16px;
  transition: transform 0.25s;
}
.proj-detail__view-full:hover svg {
  transform: translateX(4px);
}
.proj-detail__view-full:hover {
  gap: 12px;
}

/* ===========================================
   RESPONSIVE
   =========================================== */
@media (max-width: 1100px) {
  .proj-detail__inner {
    grid-template-columns: 240px 1fr 260px;
  }
}

@media (max-width: 900px) {
  .proj-row__collapsed {
    grid-template-columns: 240px 1fr;
  }
  .proj-detail__inner {
    grid-template-columns: 220px 1fr;
    grid-template-rows: auto auto;
  }
  .proj-detail__description {
    grid-column: 1 / -1;
    padding: 1.5rem 1.2rem;
    border-top: 1px solid rgba(0,0,0,0.07);
  }
  .proj-detail__description p {
    padding-right: 0;
  }
  .proj-detail__gallery-area {
    border-right: none;
  }
}

@media (max-width: 640px) {
  .projects-list {
    gap: 12px;
  }
  .proj-row__collapsed {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: 0;
  }
  .proj-row__info {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    text-align: left;
    padding: 1.2rem 1.2rem 1rem;
    order: 2;
    gap: 0.3rem 1rem;
  }
  .proj-row__title {
    font-size: 1.35rem;
    grid-column: 1;
    grid-row: 1;
  }
  .proj-row__loc {
    grid-column: 1;
    grid-row: 2;
  }
  .proj-row__expand-hint {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin-top: 0;
  }
  .proj-row__cover-wrap {
    height: auto;
    aspect-ratio: 16 / 10;
    min-height: 0;
    order: 1;
  }
  .proj-detail__inner {
    display: flex;
    flex-direction: column;
  }
  .proj-detail__gallery-area {
    order: 1;
  }
  .proj-detail__sidebar {
    order: 2;
    border-right: none;
    border-bottom: 1px solid rgba(0,0,0,0.07);
    padding: 2.5rem 1.2rem 1.5rem;
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
  }
  .proj-detail__name {
    font-size: 1.1rem;
    padding-right: 0;
    grid-column: 1;
    grid-row: 1;
  }
  .proj-detail__subloc {
    grid-column: 1;
    grid-row: 2;
    margin-bottom: 0;
  }
  .proj-detail__year {
    font-size: 2rem;
    margin-bottom: 0;
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    line-height: 1;
    text-align: right;
  }
  .proj-detail__meta-list {
    grid-column: 1 / -1;
    grid-row: 3;
    margin-top: 1.5rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem 1rem;
    align-items: center;
  }
  .proj-detail__meta-item {
    padding: 0.5rem 0;
    border-bottom: none;
  }
  .proj-detail__share {
    grid-column: 1 / -1;
    grid-row: 4;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    /* margin-top: 1.5rem; */
    padding-top: 1rem;
    /* border-top: 1px solid rgba(0,0,0,0.07); */
  }
  .proj-detail__share-icons {
    gap: 1.5rem;
  }
  .proj-detail__close {
    top: 0.8rem;
    right: 0.8rem;
  }
  .proj-detail__slider-wrap {
    height: auto;
    aspect-ratio: 4 / 3;
    max-height: 50vh;
  }
  .proj-detail__description {
    order: 3;
    padding: 1.5rem 1.2rem;
  }
  .proj-detail__description p {
    font-size: 0.85rem;
    line-height: 1.8;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .proj-detail__description p.is-expanded {
    -webkit-line-clamp: unset;
  }
  .proj-detail__description p.is-expanded + .proj-detail__read-more svg {
    transform: rotate(180deg);
  }
  .proj-detail__read-more {
    display: flex;
    position: absolute;
    bottom: 3px; /* align vertically with the last line text */
    right: 0;
    background: var(--white);
    padding-left: 8px; /* space over the ellipsis */
    box-shadow: -4px 0 8px var(--white); /* fade effect */
  }
  .proj-detail__view-full {
    margin-top: 1.2rem;
  }
}

/* iPhone SE & Smaller */
@media (max-width: 375px) {
  .filter-bar {
    padding-left: 16px;
    padding-right: 16px;
  }
  .proj-row__title {
    font-size: 1.2rem;
  }
  .proj-detail__year {
    font-size: 1.75rem;
  }
  .proj-detail__slider-wrap {
    aspect-ratio: 1 / 1;
    max-height: 40vh;
  }
}
