/* --- Control bar --- */
.work-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 8px 0.4%;
  margin-bottom: 8px;
}

.filter-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'SF Pro Display', 'Roboto Mono', monospace;
  font-size: 14px;
  color: #000;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 5px;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}
.filter-toggle-btn:hover {
  background-color: rgba(0,0,0,0.1);
}

/* --- Show/Hide toggle --- */
.toggle-toggle-text {
  font-family: 'Roboto Mono', sans-serif;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.toggle-label {
  cursor: pointer;
  color: #999;
  transition: color 0.2s ease;
}
.toggle-label.active {
  color: #000;
}
.toggle-sep {
  color: #ccc;
  margin: 0 2px;
}

/* --- Layout: sidebar + grid --- */
.work-layout {
  display: flex;
  width: 100%;
  position: relative;
  align-items: flex-start;
  overflow: hidden;
}

/* --- Sidebar --- */
.filter-sidebar {
  width: 224px;
  min-width: 224px;
  overflow: hidden;
  margin-left: -224px;
  opacity: 0;
  transition: margin-left 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.3s ease;
  padding: 0;
  flex: none;
}

.filter-sidebar.open {
  margin-left: 0;
  opacity: 1;
  padding-right: 48px;
}

/* --- Filter sections --- */
.filter-sidebar .filter-section {
  margin-bottom: 28px;
}

.filter-sidebar .filter-section-title {
  font-family: 'Roboto Mono', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #aaa;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.filter-sidebar.open .filter-section-title {
  opacity: 1;
}

.filter-sidebar.open .filter-section:nth-child(1) .filter-section-title { transition-delay: 0s; }
.filter-sidebar.open .filter-section:nth-child(2) .filter-section-title { transition-delay: 0.15s; }
.filter-sidebar.open .filter-section:nth-child(3) .filter-section-title { transition-delay: 0.30s; }

/* --- Filter tags cascade --- */
.filter-sidebar .filter-tag {
  opacity: 0;
}

.filter-sidebar.open .filter-tag {
  opacity: 1;
}

/* Section 1 tags */
.filter-sidebar.open .filter-section:nth-child(1) .filter-tag:nth-child(1) { transition-delay: 0.10s; }
.filter-sidebar.open .filter-section:nth-child(1) .filter-tag:nth-child(2) { transition-delay: 0.15s; }
.filter-sidebar.open .filter-section:nth-child(1) .filter-tag:nth-child(3) { transition-delay: 0.20s; }
.filter-sidebar.open .filter-section:nth-child(1) .filter-tag:nth-child(4) { transition-delay: 0.25s; }
.filter-sidebar.open .filter-section:nth-child(1) .filter-tag:nth-child(5) { transition-delay: 0.30s; }
.filter-sidebar.open .filter-section:nth-child(1) .filter-tag:nth-child(6) { transition-delay: 0.35s; }
.filter-sidebar.open .filter-section:nth-child(1) .filter-tag:nth-child(7) { transition-delay: 0.40s; }
.filter-sidebar.open .filter-section:nth-child(1) .filter-tag:nth-child(8) { transition-delay: 0.45s; }
.filter-sidebar.open .filter-section:nth-child(1) .filter-tag:nth-child(9) { transition-delay: 0.50s; }
.filter-sidebar.open .filter-section:nth-child(1) .filter-tag:nth-child(10) { transition-delay: 0.55s; }

/* Section 2 tags */
.filter-sidebar.open .filter-section:nth-child(2) .filter-tag:nth-child(1) { transition-delay: 0.25s; }
.filter-sidebar.open .filter-section:nth-child(2) .filter-tag:nth-child(2) { transition-delay: 0.30s; }
.filter-sidebar.open .filter-section:nth-child(2) .filter-tag:nth-child(3) { transition-delay: 0.35s; }
.filter-sidebar.open .filter-section:nth-child(2) .filter-tag:nth-child(4) { transition-delay: 0.40s; }
.filter-sidebar.open .filter-section:nth-child(2) .filter-tag:nth-child(5) { transition-delay: 0.45s; }
.filter-sidebar.open .filter-section:nth-child(2) .filter-tag:nth-child(6) { transition-delay: 0.50s; }
.filter-sidebar.open .filter-section:nth-child(2) .filter-tag:nth-child(7) { transition-delay: 0.55s; }
.filter-sidebar.open .filter-section:nth-child(2) .filter-tag:nth-child(8) { transition-delay: 0.60s; }
.filter-sidebar.open .filter-section:nth-child(2) .filter-tag:nth-child(9) { transition-delay: 0.65s; }
.filter-sidebar.open .filter-section:nth-child(2) .filter-tag:nth-child(10) { transition-delay: 0.70s; }

/* Section 3 tags */
.filter-sidebar.open .filter-section:nth-child(3) .filter-tag:nth-child(1) { transition-delay: 0.40s; }
.filter-sidebar.open .filter-section:nth-child(3) .filter-tag:nth-child(2) { transition-delay: 0.45s; }
.filter-sidebar.open .filter-section:nth-child(3) .filter-tag:nth-child(3) { transition-delay: 0.50s; }
.filter-sidebar.open .filter-section:nth-child(3) .filter-tag:nth-child(4) { transition-delay: 0.55s; }
.filter-sidebar.open .filter-section:nth-child(3) .filter-tag:nth-child(5) { transition-delay: 0.60s; }
.filter-sidebar.open .filter-section:nth-child(3) .filter-tag:nth-child(6) { transition-delay: 0.65s; }
.filter-sidebar.open .filter-section:nth-child(3) .filter-tag:nth-child(7) { transition-delay: 0.70s; }
.filter-sidebar.open .filter-section:nth-child(3) .filter-tag:nth-child(8) { transition-delay: 0.75s; }
.filter-sidebar.open .filter-section:nth-child(3) .filter-tag:nth-child(9) { transition-delay: 0.80s; }
.filter-sidebar.open .filter-section:nth-child(3) .filter-tag:nth-child(10) { transition-delay: 0.85s; }

.filter-clear-btn {
  cursor: pointer;
  font-size: 13px;
  color: #999;
  line-height: 1;
  transition: color 0.15s ease;
  user-select: none;
}
.filter-clear-btn:hover {
  color: #000;
}

.filter-sidebar .filter-tag.active::after {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: #999;
  margin-left: 4px;
  vertical-align: middle;
}

.filter-sidebar .filter-tags {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.filter-sidebar .filter-tag {
  font-family: 'Roboto Mono', sans-serif;
  font-size: 12px;
  letter-spacing: -0.02em;
  cursor: pointer;
  color: #000;
  transition: background-color 0.2s ease, color 0.2s ease, opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  /* padding: 2px 4px; */
  border: none;
  background: none;
  border-radius: 0;
  display: block;
}

.filter-sidebar .filter-tag:hover {
  background-color: #000;
  color: #fff;
}

.filter-sidebar .filter-tag.active {
  color: #000;
}

.filter-sidebar .filter-tag.active:hover {
  background-color: #000;
  color: #fff;
}

.filter-sidebar .filter-tag .count {
  color: #666;
  font-size: 12px;
  margin-left: 2px;
}

.filter-sidebar .filter-tag:hover .count {
  color: #fff;
}

.filter-sidebar .filter-tag.active .count {
  color: #666;
}

.filter-sidebar .filter-tag.active:hover .count {
  color: #fff;
}

/* --- Card title / client font --- */
#WORK .section-title-work.static._w-other {
  pointer-events: none;
}

#WORK .title-card-work,
#WORK .text-57 {
  font-family: 'Fragment Mono', monospace;
  font-size: 14px;
  font-weight: 400;
}

/* --- Single-row project info (title + subtitle + tags) --- */
#WORK .box-text-4 {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

#WORK .frame-59 {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  width: auto;
}

#WORK .tag-row-cont {
  width: 34%;
  flex-shrink: 0;
  justify-content: flex-end;
}

#WORK .second-row-subtitle {
  flex: 1;
}

#WORK .title-card-work {
  flex: 1;
}

/* --- Work grid (cards area) --- */
.work-grid {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.work-grid > .card-work,
.work-grid > .row-double-work {
  margin-bottom: 16px;
  transition: margin-bottom 0.3s ease;
}

.work-grid > .card-work:last-child,
.work-grid > .row-double-work:last-child {
  margin-bottom: 0;
}

.hide-mode .work-grid > .card-work,
.hide-mode .work-grid > .row-double-work {
  margin-bottom: 0 !important;
}

/* --- Hide-mode list view --- */
.card-work {
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease;
}

.card-work .box-text-4 {
  order: -1;
  border-top: 1px solid #0003;
  margin-top: 6px;
  padding-top: 6px;
}

.card-work .content,
.card-work .content-copy {
  overflow: hidden;
}

.hide-mode .card-work {
  height: auto !important;
  min-height: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  border-bottom-color: #0003;
  row-gap: 0px;
}

.hide-mode .card-work .box-text-4 {
  border-top: none !important;
  margin-top: 0 !important;
  padding-top: 4px !important;
  padding-bottom: 4px !important;
}

.hide-mode .card-work .content,
.hide-mode .card-work .content-copy {
  min-height: 0 !important;
}

.hide-mode.section-grid-work-view {
  grid-row-gap: 0;
}

.hide-mode .row-double-work {
  flex-direction: column !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  gap: 0 !important;
  grid-row-gap: 0 !important;
}

.row-double-work {
  grid-row-gap: 8px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .filter-sidebar {
    width: 200px;
    min-width: 200px;
    margin-left: -200px;
  }
  .filter-sidebar.open {
    margin-left: 0;
    padding-right: 24px;
  }
}

@media (max-width: 478px) {
  .filter-toggle-btn {
    display: none;
  }
  .filter-sidebar {
    display: none !important;
  }
  .work-controls {
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
  }
  .work-layout {
    flex-direction: column;
  }
  #WORK .title-card-work,
  #WORK .text-57 {
    font-size: 12px;
  }
  .work-grid > .card-work,
  .work-grid > .row-double-work {
    margin-bottom: 8px;
  }
  .hide-mode .row-double-work {
    grid-row-gap: 4px !important;
  }
}
