/* ============================================================
   Works Catalog Page — 1:1 Replica of orchard.framer.website/works
   Supports Masonry, Grid & List views + Service filters + Light/Dark
   ============================================================ */

.works-page-body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

.works-main {
  width: 100%;
  background-color: var(--bg-primary);
  transition: background-color 0.35s ease;
}

/* ---------- 1. Header & Filter Controls Bar (.framer-bbx1f0) ---------- */
.works-header {
  width: 100%;
  max-width: 1920px;
  margin: 0 auto;
  padding: 240px 20px 100px;
  display: grid;
  grid-template-columns: repeat(8, minmax(50px, 1fr));
  grid-auto-rows: min-content;
  gap: 120px 10px;
}

.works-title-wrap {
  grid-column: span 8;
}

.works-page-title {
  font-family: "Open Sauce Sans", var(--font-cjk);
  font-size: clamp(60px, 7.3vw, 140px);
  font-weight: 600;
  letter-spacing: -0.07em;
  line-height: 0.9;
  color: var(--text-primary);
}

html[lang="zh"] .works-page-title {
  letter-spacing: -0.02em;
  line-height: 1.08;
}

.works-title-char {
  display: inline-block;
  opacity: 0.001;
  transform: translate3d(0, 84px, 0);
  will-change: transform, opacity;
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.78s cubic-bezier(0.16, 1, 0.3, 1);
}

.works-title-char.is-shown {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.works-filter-block {
  display: flex;
  align-items: flex-start;
  gap: 80px;
}

.works-filter-service {
  grid-column: 1 / span 2;
}

.works-filter-view {
  grid-column: 5 / span 2;
}

.works-filter-label {
  font-family: "Switzer", var(--font-cjk);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.4;
  color: var(--text-primary);
  white-space: nowrap;
}

.works-filter-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  align-items: flex-start;
}

/* Filter & View buttons with exact 3D dual-text rolling hover */
.filter-btn {
  position: relative;
  display: inline-block;
  height: 20px;
  overflow: clip;
  font-family: "Switzer", var(--font-cjk);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 20px;
  color: var(--text-primary);
  text-align: left;
  perspective: 600px;
  opacity: 0.001;
  transform: translate3d(0, 10px, 0);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.55s cubic-bezier(0.16, 1, 0.3, 1),
    color 0.25s ease;
}

body.is-loaded .filter-btn {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.filter-btn.is-active {
  color: var(--text-faint);
  cursor: default;
}

.filter-btn-track {
  display: flex;
  flex-direction: column;
  gap: 25px;
  transform: translate3d(0, 0, 0);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.filter-btn-text {
  display: block;
  height: 20px;
  line-height: 20px;
  white-space: nowrap;
  transform-style: preserve-3d;
  transform-origin: left center;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.filter-btn-text.is-primary {
  transform: rotate(0deg) rotateY(0deg);
}

.filter-btn-text.is-secondary {
  transform: rotate(25deg) rotateY(25deg);
}

.filter-btn:not(.is-active):hover .filter-btn-track {
  transform: translate3d(0, -45px, 0);
}

.filter-btn:not(.is-active):hover .filter-btn-text.is-primary {
  transform: rotate(25deg) rotateY(25deg);
}

.filter-btn:not(.is-active):hover .filter-btn-text.is-secondary {
  transform: rotate(0deg) rotateY(0deg);
}

/* ---------- 2. Catalog Wrapper ---------- */
.works-catalog-wrap {
  width: 100%;
  max-width: 1920px;
  margin: 0 auto;
  padding: 0 20px 200px;
}

/* --- A. Masonry View (4 Columns, Alternating Aspect Ratios) --- */
.works-masonry {
  display: grid;
  grid-template-columns: repeat(4, minmax(50px, 1fr));
  grid-auto-rows: min-content;
  gap: 120px 10px;
}

/* --- B. Grid View (3 Columns, Uniform Tall Aspect Ratio) --- */
.works-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(50px, 1fr));
  grid-auto-rows: min-content;
  gap: 120px 10px;
}

/* Shared Card Anatomy (Masonry & Grid) */
.works-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  opacity: 0.001;
  transform: translate3d(0, 64px, 0);
  will-change: transform, opacity;
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.works-card.is-entered {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.works-card-media-box {
  position: relative;
  width: 100%;
  overflow: clip;
  background-color: var(--bg-primary);
  transition: background-color 0.35s ease;
}

/* Even cards in Masonry: aspect-ratio 1.01852 */
.works-card.is-square .works-card-media-box {
  aspect-ratio: 1.01852;
}

/* Odd cards in Masonry & ALL cards in Grid: aspect-ratio 0.763889 */
.works-card.is-tall .works-card-media-box {
  aspect-ratio: 0.763889;
}

/* Signature 100x100 gray "+" crosshair revealed at bottom when media lifts -120px */
.works-card-plus {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 100px;
  z-index: 0;
  pointer-events: none;
}

.works-card-plus::before,
.works-card-plus::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  background-color: var(--text-subtle);
  transform: translate(-50%, -50%);
}

.works-card-plus::before {
  width: 100px;
  height: 1px;
}

.works-card-plus::after {
  width: 1px;
  height: 100px;
}

/* Lifts straight up by -120px on hover (1:1 orchard.framer.website/works) */
.works-card-lift {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  transform: translate3d(0, 0, 0);
  will-change: transform;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.works-card:hover .works-card-lift {
  transform: translate3d(0, -120px, 0);
}

.works-card-asset {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Card Metadata Row: Title • Industry/Client */
.works-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 10px;
  font-family: "Switzer", var(--font-cjk);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.works-card-title {
  color: var(--text-primary);
}

.works-card-dot {
  width: 3px;
  height: 3px;
  border-radius: 10px;
  background-color: var(--text-primary);
  flex-shrink: 0;
}

.works-card-sub {
  color: var(--text-muted);
}

/* --- C. List View (6-Column Table Rows + Date->View Swap + 400x400 Cursor Preview) --- */
.works-list-view {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding-top: 20px;
}

.works-list-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(50px, 1fr));
  gap: 0 5px;
  width: 100%;
  min-height: 50px;
  align-items: end;
  opacity: 0.001;
  transform: translate3d(0, 20px, 0);
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

.works-list-row.is-entered {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.list-cell {
  padding: 14px 0 10px;
  border-bottom: 1px solid var(--text-faint);
  font-family: "Switzer", var(--font-cjk);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.4;
  transition: border-color 0.25s ease, color 0.25s ease;
}

.list-cell-title {
  grid-column: span 3;
  color: var(--text-primary);
}

.list-cell-services {
  grid-column: span 2;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--text-faint);
}

.list-cell-action {
  grid-column: span 1;
  display: flex;
  justify-content: flex-end;
  color: var(--text-subtle);
}

.list-action-clip {
  display: inline-block;
  height: 20px;
  overflow: clip;
  text-align: right;
}

.list-action-track {
  display: flex;
  flex-direction: column;
  gap: 20px;
  transform: translate3d(0, 0, 0);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.list-action-date,
.list-action-view {
  display: block;
  height: 20px;
  line-height: 20px;
  white-space: nowrap;
}

.list-action-view {
  color: var(--text-primary);
}

.works-list-row:hover .list-cell {
  border-bottom-color: var(--text-primary);
}

.works-list-row:hover .list-cell-services {
  color: var(--text-primary);
}

.works-list-row:hover .list-action-track {
  transform: translate3d(0, -40px, 0);
}

/* Floating 400x400 Cursor Preview Portal for List View */
.list-preview-portal {
  position: fixed;
  top: 0;
  left: 0;
  width: 400px;
  height: 400px;
  z-index: 90;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transform: translate3d(-999px, -999px, 0) translate(-50%, -50%) scale(0.92);
  transition: opacity 0.22s ease-out;
  will-change: transform, opacity;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
}

.list-preview-portal.is-visible {
  opacity: 1;
}

.list-preview-portal img,
.list-preview-portal video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .works-header {
    padding: 180px 20px 80px;
    gap: 64px 10px;
  }

  .works-filter-service {
    grid-column: 1 / span 4;
  }

  .works-filter-view {
    grid-column: 5 / span 4;
  }

  .works-masonry {
    grid-template-columns: repeat(2, minmax(50px, 1fr));
    gap: 80px 10px;
  }

  .works-grid {
    grid-template-columns: repeat(2, minmax(50px, 1fr));
    gap: 80px 10px;
  }
}

@media (max-width: 720px) {
  .works-header {
    padding: 140px 16px 56px;
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .works-title-wrap,
  .works-filter-service,
  .works-filter-view {
    grid-column: span 1;
  }

  .works-filter-block {
    gap: 40px;
  }

  .works-catalog-wrap {
    padding: 0 16px 120px;
  }

  .works-masonry,
  .works-grid {
    grid-template-columns: 1fr;
    gap: 56px;
  }

  .works-list-row {
    grid-template-columns: 1fr auto;
  }

  .list-cell-title {
    grid-column: span 1;
  }

  .list-cell-services {
    display: none;
  }

  .list-preview-portal {
    display: none;
  }
}
