/* ─── PAGE RESET ─────────────────────────────────────────── */
.page-works {
  overflow: hidden;
  animation: none;
}

/* ─── LAYOUT ─────────────────────────────────────────────── */
.works-layout {
  display: flex;
  height: 100vh;
  padding-top: var(--nav-height);
}

/* ─── SIDEBAR ────────────────────────────────────────────── */
.works-sidebar {
  width: 280px;
  flex-shrink: 0;
  height: calc(100vh - var(--nav-height));
  display: flex;
  flex-direction: column;
  border-right: 0.5px solid rgba(141, 159, 167, 0.15);
  overflow: hidden;
}

.works-list-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}
.works-list-scroll::-webkit-scrollbar { width: 0; }

/* ─── FILTER BUTTONS ─────────────────────────────────────── */
.works-filters {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding: 28px 28px 20px;
  border-bottom: 0.5px solid rgba(141, 159, 167, 0.15);
}

.filter-btn {
  background: none;
  border: none;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(141, 159, 167, 0.38);
  cursor: pointer;
  padding: 3px 14px;
  transition: color 0.2s ease;
  line-height: 1;
}

.filter-btn:first-child { padding-left: 0; }

.filter-btn + .filter-btn {
  border-left: 0.5px solid rgba(141, 159, 167, 0.18);
}

.filter-btn.is-active    { color: var(--color-gold); }
.filter-btn:hover:not(.is-active) { color: var(--color-white-dim); }

/* ─── PROJECT LIST ───────────────────────────────────────── */
.works-list {
  padding: 12px 0 24px;
}

.group-label {
  padding: 18px 28px 5px;
  font-size: 9px;
  letter-spacing: 0.24em;
  color: rgba(201, 185, 154, 0.35);
  text-transform: uppercase;
  user-select: none;
}

.group-label:first-child { padding-top: 8px; }

.project-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 28px;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}

.project-row:hover          { background: rgba(141, 159, 167, 0.05); }
.project-row.is-active      { background: rgba(141, 159, 167, 0.08); }

.project-num {
  font-size: 9px;
  letter-spacing: 0.08em;
  color: rgba(141, 159, 167, 0.28);
  flex-shrink: 0;
  min-width: 18px;
  font-variant-numeric: tabular-nums;
}

.project-name {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: rgba(141, 159, 167, 0.72);
  line-height: 1.4;
  transition: color 0.15s ease;
}

.project-row:hover .project-name,
.project-row.is-active .project-name { color: var(--color-white); }

.project-built-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--color-gold);
  flex-shrink: 0;
  opacity: 0.55;
  margin-left: auto;
}

/* empty built filter notice */
.list-empty {
  padding: 20px 28px;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: rgba(141, 159, 167, 0.28);
  text-transform: uppercase;
}

/* ─── RIGHT AREA ─────────────────────────────────────────── */
.works-right {
  flex: 1;
  height: calc(100vh - var(--nav-height));
  position: relative;
  overflow: hidden;
}

/* ─── EMPTY STATE ────────────────────────────────────────── */
.works-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.works-empty span {
  font-size: 9px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: rgba(141, 159, 167, 0.18);
}

/* ─── DETAIL PANEL ───────────────────────────────────────── */
.works-detail {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateX(12px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.works-detail::-webkit-scrollbar { width: 0; }

.works-detail.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

/* Close button */
.detail-close {
  position: absolute;
  top: 24px;
  right: 32px;
  z-index: 10;
  background: none;
  border: none;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(141, 159, 167, 0.4);
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.2s ease;
}

.detail-close:hover { color: var(--color-white); }

/* Hero image */
.detail-hero {
  width: 100%;
  height: 55vh;
  flex-shrink: 0;
  object-fit: cover;
  display: block;
}

.detail-hero-ph {
  width: 100%;
  height: 55vh;
  flex-shrink: 0;
  background: rgba(141, 159, 167, 0.04);
}

/* Text body */
.detail-body {
  padding: 36px 48px 16px;
}

.detail-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.07em;
  color: var(--color-white);
  margin-bottom: 10px;
}

.detail-meta {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(141, 159, 167, 0.45);
}

.detail-built-tag {
  display: inline-block;
  margin-top: 14px;
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--color-gold);
  border: 0.5px solid rgba(201, 185, 154, 0.3);
  padding: 3px 9px;
}

.detail-rule {
  width: 28px;
  height: 0.5px;
  background: rgba(141, 159, 167, 0.22);
  margin: 22px 0;
}

.detail-description {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.04em;
  line-height: 1.75;
  color: rgba(141, 159, 167, 0.6);
  max-width: 520px;
}

/* Thumbnail strip */
.detail-strip {
  display: flex;
  gap: 6px;
  padding: 20px 48px 48px;
  overflow-x: auto;
  flex-shrink: 0;
}
.detail-strip::-webkit-scrollbar { height: 0; }

.detail-thumb {
  height: 72px;
  width: auto;
  object-fit: cover;
  cursor: pointer;
  opacity: 0.55;
  flex-shrink: 0;
  transition: opacity 0.2s ease;
}

.detail-thumb:hover,
.detail-thumb.is-active { opacity: 1; }

/* ─── RESPONSIVE ─────────────────────────────────────────── */
/* ── Scroll del documento en móvil ─────────────────────────────────────
   Safari en iOS sólo repliega su barra si el que se desplaza es el
   DOCUMENTO. Esta página lo permite sin perder nada: su scroll ya vive en
   .works-list-scroll, así que basta con soltar las alturas fijas y dejar
   que la lista fluya. index.html y office.html no pueden hacer esto — son
   pantallas fijas con secciones internas — y por eso el desbloqueo va aquí
   y no en css/home.css.

   900px, no 768: el corte lo marca cuándo interesa recuperar esa barra,
   que es en cualquier tableta o móvil, no sólo donde cambia el layout. */
@media (max-width: 900px) {
  html,
  body.page-works {
    height: auto;
    overflow: visible;
  }

  .page-works { overflow: visible; }

  .works-layout {
    display: block;
    height: auto;
  }

  .works-sidebar {
    height: auto;
    overflow: visible;
  }

  /* La lista deja de tener scroll propio: ahora se desplaza la página. Dos
     scrolls anidados en un móvil se pelean por el gesto. */
  .works-list-scroll {
    overflow: visible;
  }

  /* Hueco inferior por el home indicator, que con viewport-fit=cover queda
     sobre el contenido. */
  .works-layout { padding-bottom: calc(1.4rem + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 768px) {
  .works-sidebar { width: 100%; border-right: none; }

  .works-right {
    display: none;
  }

  .works-detail.is-open {
    position: fixed;
    inset: 0;
    top: var(--nav-height);
    background: var(--color-dark);
    z-index: 80;
  }

  .detail-body { padding: 28px 24px 12px; }
  .detail-strip { padding: 16px 24px 40px; }
}
