/* ============================================================
   Component · Work / Portfolio
   Filter bar (pill toggles) + responsive project grid.
   Filtering is vanilla JS (work-filter.js) — CSS handles transitions.
   ============================================================ */

.filter-bar {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding-block: var(--space-md);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}
@media (min-width: 768px) {
  .filter-bar {
    flex-direction: row;
    gap: var(--space-xl);
    align-items: center;
    flex-wrap: wrap;
  }
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
@media (min-width: 768px) {
  .filter-group { flex-direction: row; align-items: center; gap: var(--space-sm); }
}

.filter-group__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-ink-muted);
}

/* The ink fill wipes in from the left rather than snapping, matching
   the rule-drawing motion used for .deliverable in service-pillar.css.
   It lives on a pseudo-element so `background` itself never animates —
   the label just needs to sit above it. */
.filter {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.85rem;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-ink);
  cursor: pointer;
  transition:
    border-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}
.filter::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--color-ink);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--duration-normal) var(--ease-out);
}
.filter:hover { border-color: var(--color-ink); }
.filter.is-active {
  border-color: var(--color-ink);
  color: var(--color-white);
}
.filter.is-active::before { transform: scaleX(1); }

.filter-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-ink-muted);
}
.filter-count strong { color: var(--color-ink); font-weight: 500; }

/* === Project grid ======================================= */
.work-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl) var(--grid-gutter);
  margin-top: var(--space-xl);
}
@media (min-width: 640px)  { .work-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .work-grid { grid-template-columns: repeat(3, 1fr); } }

/* No transition here on purpose. Entry is owned by [data-reveal] in
   reveal.css; filter enter/exit and the FLIP slide are owned by WAAPI
   in work-filter.js. A `transform` transition at this level would
   outrank reveal.css on source order and fight both. */
.project {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}
.project[hidden] { display: none; }

.project__plate {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  overflow: hidden;
  isolation: isolate;
}
.project__plate-bg {
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 24px,
      rgba(24, 33, 37, 0.04) 24px,
      rgba(24, 33, 37, 0.04) 25px
    );
}
.project__plate-label {
  position: absolute;
  top: var(--space-md);
  left: var(--space-md);
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 4px 10px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-ink-muted);
}
.project__plate-label::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--color-accent);
}
.project__plate-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}
.project__plate-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(24, 33, 37, 0.55));
  z-index: 2;
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out);
}
.project:hover .project__plate-overlay { opacity: 1; }

/* card-cad.js injects .cad at z-index 1, which would bury the crosshair
   and readout under .project__plate-overlay (z-index 2) — and the
   overlay fades in on hover, exactly when the readout is live. */
.project__plate .cad { z-index: 3; }

.project__meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.project__location {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-ink-muted);
}
.project__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--color-ink);
}
.project__specs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-ink-muted);
}
.project__specs span + span::before {
  content: '·';
  margin-right: var(--space-md);
  color: var(--color-border);
}

/* No-results state — draws in rather than appearing, so an empty grid
   reads as a result of the filter rather than as a broken page. */
.work-empty {
  /* Overrides the global `p { max-width: 60ch }` — this is a panel that
     should span the grid it replaces, not a column of body copy. */
  max-width: none;
  margin-top: var(--space-xl);
  padding: var(--space-2xl);
  text-align: center;
  border: 1px dashed var(--color-border);
  color: var(--color-ink-muted);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  animation: work-empty-in var(--duration-normal) var(--ease-out) both;
}
.work-empty[hidden] { display: none; }

@keyframes work-empty-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .work-empty { animation: none; }
  .filter::before { transition: none; }
}
