/* === Works Section === */

/* Filters */
.filters {
  margin-bottom: var(--sp-lg);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 0 var(--sp-sm);
}

.filter-row--secondary {
  margin-top: var(--sp-xs);
}

.filters button {
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-muted);
  transition: all var(--duration-fast) var(--ease-out);
  position: relative;
}

/* Type buttons (primary) */
.filter-row:not(.filter-row--secondary) button {
  padding: 8px 20px;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-body);
  background: var(--bg-light);
  border-color: rgba(0, 0, 0, 0.06);
}

.filter-row:not(.filter-row--secondary) button[selected] {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(var(--accent-rgb), 0.3);
}

.filter-row:not(.filter-row--secondary) button:hover:not([selected]) {
  background: var(--bg-dark);
  border-color: var(--bg-dark);
}

/* Skill buttons (secondary) */
.filter-row--secondary button {
  padding: 4px 12px;
  font-size: 0.78rem;
}

.filter-row--secondary button:not([selected]):not(#collapseButton) {
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.05);
}

.filter-row--secondary button[selected] {
  background: var(--accent-secondary);
  color: white;
  border-color: var(--accent-secondary);
}

.filter-row--secondary button:hover:not([selected]):not(#collapseButton) {
  color: var(--text-body);
  background: rgba(0, 0, 0, 0.06);
}

/* Collapse behavior */
#myWorkSkills[collapsed="true"] {
  max-height: 99px;
  overflow: hidden;
  position: relative;
  transition: max-height var(--duration-slow) var(--ease-out);
}

#myWorkSkills[collapsed="true"]::before {
  content: "";
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 75%;
  background: linear-gradient(to top, var(--bg-white) 30%, transparent);
  pointer-events: none;
  z-index: 1;
  transition: opacity var(--duration-slow) var(--ease-out);
}

#myWorkSkills[collapsed="false"] {
  /* max-height: 600px; */
  overflow: hidden;
  position: relative;
  transition: max-height var(--duration-slow) var(--ease-out);
}

#myWorkSkills[collapsed="false"]::before {
  content: "";
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 0;
  background: transparent;
  pointer-events: none;
  transition: opacity var(--duration-slow) var(--ease-out);
}

#collapseButton {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  margin-top: var(--sp-xs);
  background: var(--bg-white);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: var(--shadow-sm);
  font-weight: 500;
  color: var(--text-muted);
}

/* When expanded, force onto its own centered line */
#myWorkSkills[collapsed="false"]::after {
  content: "";
  flex-basis: 100%;
  height: 0;
  order: 998;
}

#myWorkSkills[collapsed="false"] #collapseButton {
  position: relative;
  left: auto;
  transform: none;
  order: 999;
}

#collapseButton:hover {
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.2);
}

/* Soft transition to next section */
#myWork {
  position: relative;
  box-shadow: 0 40px 60px -20px rgba(0, 0, 0, 0.08);
  z-index: 1;
}

/* Work grid wrapper (collapsible) */
.work-grid-wrapper {
  position: relative;
  overflow: hidden;
  transition: max-height var(--duration-slow) var(--ease-out);
}

.work-grid-wrapper::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 150px;
  background: linear-gradient(to top, var(--bg-white) 20%, transparent);
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity var(--duration-slow) var(--ease-out);
}

.work-grid-wrapper[data-collapsed="true"]::after {
  opacity: 1;
}

.works-expand-btn {
  display: block;
  margin: var(--sp-md) auto 0;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 8px 24px;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-full);
  background: var(--bg-white);
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-fast) var(--ease-out);
}

.works-expand-btn:hover {
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.2);
}

.works-expand-btn[hidden] {
  display: none;
}

/* Work grid (masonry columns) */
.work-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--sp-sm);
}

.myWorkColumn {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

/* === Work Card === */
.work {
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--duration-normal) var(--ease-out),
    box-shadow var(--duration-normal) var(--ease-out);
}

.work:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* Card image */
.workImage {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  display: block;
  transition: transform 0.5s var(--ease-out);
}

.work:hover .workImage {
  transform: scale(1.03);
}

/* Image container clips the zoom */
.work > img {
  overflow: hidden;
}

/* Card body */
.work-body {
  padding: var(--sp-md);
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}

.work .workTitle {
  padding: 0 var(--sp-md);
  padding-top: var(--sp-md);
}

.work .workTitle h3 {
  font-size: 1.15rem;
  margin: 0;
  transition: color var(--duration-fast) var(--ease-out);
}

.work .workTitle.workTitleLink {
  cursor: pointer;
}

.work .workTitle.workTitleLink:hover h3 {
  color: var(--accent);
}

.work .workDate {
  padding: 0 var(--sp-md);
}

.work .workDate > * {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.work .workDescription {
  padding: 0 var(--sp-md);
}

.work .workDescription p {
  font-size: 0.88rem;
  line-height: var(--leading-relaxed);
  text-align: left;
}

.work .workDescription p:not(:last-child) {
  margin-bottom: 0.5em;
}

/* Card skills */
.work .workSkills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 var(--sp-md);
  padding-bottom: var(--sp-sm);
}

.work .workSkills button {
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: var(--bg-light);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.work .workSkills button[selected] {
  background: var(--accent-secondary);
  color: white;
  border-color: var(--accent-secondary);
}

.work .workSkills button:hover:not([selected]) {
  background: var(--bg-dark);
  color: var(--text-body);
}

/* Card links */
.work .workLinks {
  display: flex;
  gap: 6px;
  padding: 0 var(--sp-md);
  padding-bottom: var(--sp-md);
}

.work .workLinks a {
  display: flex;
  transition: transform var(--duration-fast) var(--ease-spring);
}

.work .workLinks a:hover {
  transform: translateY(-2px);
}

.work .workLinks img {
  width: 24px;
  height: 24px;
  opacity: 0.5;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.work .workLinks a:hover img {
  opacity: 0.8;
}

/* Card spacing for non-image children */
.work > :not(img):not(:last-child) {
  margin-bottom: 4px;
}

/* Entrance animation for cards */
@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.work {
  animation: cardIn 0.4s var(--ease-out) both;
}
