/* ═══════════════════════════════════════════════════
   KAVE — Archive / Our Work Section
   ═══════════════════════════════════════════════════ */

.archive {
  position: relative;
  padding: 120px 0 0;
  background: var(--color-bg-alt);
  color: var(--color-text);
  font-family: var(--font-body);
}

/* ── Hero ── */
.arch-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 var(--gutter) 40px;
  gap: 40px;
  border-bottom: 1px solid var(--color-line);
}

.arch-hero h1 .title-line {
  display: block;
  overflow: hidden;
}

.arch-hero h1 .title-line i {
  display: block;
  font-style: normal;
  will-change: transform;
}

.arch-hero .head-left { max-width: 780px; }

.arch-hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(44px, 5.4vw, 82px);
  line-height: 0.98;
  font-weight: 400;
  letter-spacing: -1px;
}

.arch-hero .head-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 24px;
  padding-bottom: 10px;
  max-width: 300px;
}

.arch-hero .meta {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.6;
  text-align: right;
}

.arch-hero .counter {
  font-family: var(--font-heading);
  font-size: 14px;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.arch-hero .counter .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--color-text-muted);
}

/* ── Sticky Filter Bar ── */
.arch-filters {
  position: sticky;
  top: var(--header-h, 80px);
  z-index: 20;
  background: var(--color-bg-alt);
  padding: 18px var(--gutter);
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  transition: padding 0.4s var(--ease), background 0.4s var(--ease), border-color 0.5s var(--ease);
  border-bottom: 1px solid transparent;
}

.arch-filters::-webkit-scrollbar { display: none; }
.arch-filters.pinned {
  padding: 12px var(--gutter);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.arch-filters .chip {
  padding: 11px 20px;
  border: 1px solid var(--color-line);
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--color-text);
  font-weight: 500;
  background: transparent;
  white-space: nowrap;
  transition: padding 0.4s var(--ease), font-size 0.4s var(--ease), background 0.5s var(--ease), color 0.5s var(--ease), border-color 0.5s var(--ease);
}

.arch-filters.pinned .chip {
  padding: 8px 16px;
  font-size: 10px;
}

.arch-filters.pinned .sep {
  height: 18px;
}

.arch-filters .chip:hover { border-color: var(--color-text); }
.arch-filters .chip.active { background: var(--color-text); color: #fff; border-color: var(--color-text); }
.arch-filters .sep { width: 1px; height: 22px; background: var(--color-line); margin: 0 8px; flex-shrink: 0; }

/* ── Year Marker ── */
.year-strip {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 40px var(--gutter) 20px;
}

.year-strip .year {
  font-family: var(--font-heading);
  font-size: clamp(48px, 6vw, 90px);
  line-height: 1;
  font-weight: 400;
  letter-spacing: -1.5px;
}

.year-strip .line { flex: 1; height: 1px; background: var(--color-line); }

.year-strip .label {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* ── Grid ── */
.arch-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 0 5px;
  margin-bottom: 60px;
}

.arch-row {
  display: grid;
  gap: 5px;
  width: 100%;
}

.arch-row.r-8-4 { grid-template-columns: 8fr 4fr; aspect-ratio: 12 / 5; }
.arch-row.r-4-4-4 { grid-template-columns: repeat(3, 1fr); aspect-ratio: 12 / 4; }
.arch-row.r-6-6 { grid-template-columns: 1fr 1fr; aspect-ratio: 12 / 4.5; }
.arch-row.r-3-3-3-3 { grid-template-columns: repeat(4, 1fr); aspect-ratio: 12 / 3; }

/* ── Piece Card ── */
.piece {
  position: relative;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  display: block;
  background: #f6f6f6;
  min-width: 0;
  min-height: 0;
}

.piece .media {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transform: scale(1.02);
  transition: transform 0.6s var(--ease), filter 0.6s var(--ease);
  will-change: transform;
  filter: brightness(0.94);
}

.piece:hover .media { transform: scale(1.06); filter: brightness(1); }

.piece::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.1) 45%, transparent 100%);
  z-index: 1;
  pointer-events: none;
}

.piece .num {
  position: absolute;
  top: 22px;
  left: 22px;
  z-index: 3;
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

.piece .tag {
  position: absolute;
  top: 22px;
  right: 22px;
  z-index: 3;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  font-family: var(--font-body);
  font-size: 9px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--color-text);
  font-weight: 500;
}

.piece .info {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 2;
  padding: 24px 22px 26px;
  color: #fff;
}

.piece .info .name {
  font-family: var(--font-heading);
  font-size: clamp(18px, 1.5vw, 24px);
  line-height: 1.2;
  font-weight: 400;
  letter-spacing: -0.2px;
  display: block;
  margin-bottom: 6px;
  background-image: linear-gradient(#fff, #fff);
  background-size: 0 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 0.7s var(--ease);
  padding-bottom: 8px;
}

.piece:hover .info .name { background-size: 100% 1px; }

.piece .info .sub {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  opacity: 0.7;
  font-weight: 500;
}

/* ── Price badge ── */
.piece .price-badge {
  position: absolute;
  bottom: 22px;
  right: 22px;
  z-index: 3;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  letter-spacing: 0.3px;
}

.piece .price-badge small {
  font-size: 11px;
  opacity: 0.5;
  font-weight: 400;
}

/* ── Load-more + empty state (real server-side filtering) ── */
/* .arch-grid sets display:flex, which beats the UA [hidden] rule, so the
   wrappers need an explicit [hidden] override to stay hidden. */
.arch-grid { transition: opacity 0.3s var(--ease); }
.arch-grid.is-loading { opacity: 0.45; pointer-events: none; }

.arch-more {
  display: flex;
  justify-content: center;
  padding: 0 var(--gutter) 100px;
}
.arch-more[hidden] { display: none; }

.arch-more-btn {
  padding: 16px 46px;
  border: 1px solid var(--color-line);
  background: transparent;
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-text);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.5s var(--ease), color 0.5s var(--ease), border-color 0.5s var(--ease), opacity 0.3s var(--ease);
}
.arch-more-btn:hover { background: var(--color-text); color: #fff; border-color: var(--color-text); }
.arch-more-btn:disabled { opacity: 0.5; cursor: default; }

.arch-empty {
  padding: 30px var(--gutter) 120px;
  text-align: center;
  font-family: var(--font-body);
  font-size: 14px;
  letter-spacing: 0.4px;
  color: var(--color-text-muted);
}
.arch-empty[hidden] { display: none; }

/* ── Landing (category / type term page) ── */
.arch-banner {
  height: clamp(220px, 32vw, 440px);
  margin: 0 5px 8px;
  background-color: #f6f6f6;
  background-size: cover;
  background-position: center;
}

.arch-hero .arch-back {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-text);
  font-weight: 500;
  text-decoration: none;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--color-line);
  transition: border-color 0.4s var(--ease);
}
.arch-hero .arch-back:hover { border-color: var(--color-text); }

/* ═══ Responsive ═══ */
@media (max-width: 960px) {
  .archive { padding: 100px 0 0; }
  .arch-hero { padding: 0 var(--gutter) 36px; }
  .arch-row.r-8-4, .arch-row.r-6-6 { grid-template-columns: 1fr 1fr; aspect-ratio: 2 / 1; }
  .arch-row.r-4-4-4 { aspect-ratio: 3 / 1.4; }
  .arch-row.r-3-3-3-3 { grid-template-columns: repeat(2, 1fr); aspect-ratio: 2 / 1.2; }
}

@media (max-width: 640px) {
  .archive { padding: 80px 0 0; }
  .arch-hero { flex-direction: column; align-items: flex-start; gap: 24px; }
  .arch-hero .head-right { align-items: flex-start; max-width: 100%; }
  .arch-hero .meta { text-align: left; }
  .arch-hero h1 { font-size: 38px; }
  .arch-grid { gap: 4px; padding: 0 4px; }
  .arch-row, .arch-row.r-8-4, .arch-row.r-4-4-4, .arch-row.r-6-6, .arch-row.r-3-3-3-3 {
    grid-template-columns: 1fr;
    aspect-ratio: auto;
  }
  .arch-row .piece { aspect-ratio: 4 / 5; }
  .year-strip { padding: 32px var(--gutter) 16px; }
}


/* ── Project archive grid (Phase 4 — /b2b/projects/ + /b2b/sector/<slug>/).
   archive.js (not b2b.js) loads here, so the cards lay out as a STATIC responsive
   grid (not the b2b drag-carousel); the .b2b-project-card cosmetics are mirrored
   from b2b.css so the card never drifts. ── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding: 0 var(--gutter) 100px;
}
.project-grid .b2b-project-card {
  width: 100%; height: 420px; position: relative; display: block;
  overflow: hidden; text-decoration: none; color: #fff; background: #222;
}
.project-grid .b2b-project-card img.b2b-cover {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  filter: brightness(0.75); transition: transform 1.2s var(--ease), filter 0.6s var(--ease);
}
.project-grid .b2b-project-card:hover img.b2b-cover { transform: scale(1.06); filter: brightness(0.6); }
.project-grid .b2b-project-card::after {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.15) 50%, transparent 100%);
}
.project-grid .b2b-project-info {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 2;
  padding: 24px; display: flex; align-items: center; gap: 14px;
}
.project-grid .b2b-project-logo {
  width: 44px; height: 44px; border-radius: 50%; background: #fff; overflow: hidden;
  flex-shrink: 0; box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  display: flex; align-items: center; justify-content: center;
}
.project-grid .b2b-project-logo img { width: 100%; height: 100%; object-fit: cover; }
.project-grid .b2b-project-text { flex: 1; min-width: 0; }
.project-grid .b2b-project-name {
  font-family: var(--font-heading); font-size: 20px; font-weight: 400;
  letter-spacing: -0.2px; color: #fff; display: block; margin-bottom: 3px; padding-bottom: 2px;
}
.project-grid .b2b-project-meta {
  font-family: var(--font-body); font-size: 11px; color: rgba(255,255,255,0.6);
  letter-spacing: 0.5px; display: block;
}
@media (max-width: 960px) { .project-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; } .project-grid .b2b-project-card { height: 360px; } }
@media (max-width: 560px) { .project-grid { grid-template-columns: 1fr; } .project-grid .b2b-project-card { height: 320px; } }

/* ── Search results + 404 (Phase 6B). Reuse the .archive shell + .arch-grid /
   .blog-grid / .b2b-track renderers; only the per-type section frame is new. ── */
.search-group { padding: 0 var(--gutter); margin-top: 56px; }
.search-group:first-of-type { margin-top: 40px; }
.search-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--color-line);
}
.search-group-head .eyebrow { margin: 0; }
.search-group-head .arch-back { white-space: nowrap; }
/* The grids inside search groups sit edge-to-edge of the group's gutter padding. */
.search-group .arch-grid,
.search-group .blog-grid,
.search-group .project-grid { padding-left: 0; padding-right: 0; }

.search-empty { padding: 64px var(--gutter) 0; max-width: 720px; }
.search-empty .arch-empty { margin-bottom: 12px; }
.search-empty .meta { margin-bottom: 28px; }

.error-404 .error-404-links { padding: 48px var(--gutter) 0; }
