/* ============================================================
   Work page — ghost hero, folder tabs, project grid
   ============================================================ */

/* --work-bg: the warm gray that fills the content area and active tab */
:root {
  --work-bg: color-mix(in srgb, var(--depth) 14%, var(--surface) 86%);
}

/* ---- Hero section (light, holds ghost title + tabs) ---- */

.work-hero {
  background: var(--surface);
  padding-top: clamp(1.5rem, 4vw, 3rem);
  /* No bottom padding — the tab row sits flush with the content area */
  overflow: hidden; /* clips the overflowing ghost title on the right */
}

/* ---- Ghost "Works" title ---- */

.work-title-ghost {
  /* Very large Abril Fatface, barely visible against the surface background */
  font-size: clamp(8rem, 26vw, 22rem);
  line-height: 0.85;
  /* Blend the text-primary color into the background so it reads as a ghost */
  color: color-mix(in srgb, var(--text-primary) 11%, var(--surface) 89%);
  white-space: nowrap; /* single line — lets it bleed off the right */
  user-select: none;
  pointer-events: none;
  margin: 0;
  letter-spacing: -0.01em;
}

/* ---- Tab row — sits at the bottom of .work-hero ---- */

.work-tabs-row {
  margin-top: clamp(1.5rem, 4vw, 3rem);
}

.work-tabs {
  display: flex;
  gap: 6px;
  /* No extra padding — aligns to the container's left edge */
}

/* Each tab looks like a folder tab (rounded top corners, flat bottom) */
.work-tab {
  padding: 0.65rem 1.65rem;
  min-width: 130px;
  border: 1px solid var(--border);
  border-bottom: none;            /* bottom is open — merges with content area */
  border-radius: 8px 8px 0 0;
  /* Inactive: slightly lighter than the surface */
  background: color-mix(in srgb, var(--surface) 62%, white 38%);
  color: var(--depth);
  font-family: "Poppins", "Segoe UI", sans-serif;
  font-size: 0.82rem;
  font-weight: 300;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-align: left;
  transition:
    background 160ms ease,
    color 160ms ease;
}

/* Active tab: same color as the content area, visually "open" */
.work-tab.is-active {
  background: var(--work-bg);
  color: var(--depth);
  font-weight: 400;
  border-color: color-mix(in srgb, var(--border) 60%, var(--work-bg) 40%);
}

.work-tab:hover:not(.is-active) {
  background: color-mix(in srgb, var(--surface) 42%, white 58%);
}

/* ---- Content area (warm gray, below the tabs) ---- */

.work-content {
  background: var(--work-bg);
  padding-block: var(--section-space);
  /* Top border matches the tab border color for a seamless join */
  border-top: 1px solid color-mix(in srgb, var(--border) 60%, var(--work-bg) 40%);
}

/* ---- Tab panels — show/hide ---- */

.work-panel {
  display: none;
}

.work-panel.is-active {
  display: block;
}

/* ---- Project grid (2-column editorial) ---- */

.work-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2xl) var(--space-lg);
}

/* ---- Cards ---- */

.work-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  cursor: pointer;
}

/* Featured card spans both columns, with a cinematic wide ratio */
.work-card.is-featured {
  grid-column: 1 / -1;
}

/* ---- Card image ---- */

.work-card-img-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  /* Subtle placeholder color for images that are still loading */
  background: color-mix(in srgb, var(--work-bg) 70%, var(--depth) 30%);
}

.work-card.is-featured .work-card-img-wrap {
  aspect-ratio: 21 / 9;
}

.work-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 540ms var(--ease-standard);
}

.work-card:hover .work-card-img-wrap img {
  transform: scale(1.04);
}

/* ---- Hover overlay ---- */

.work-card-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: var(--space-sm);
  pointer-events: none;
  background: rgba(44, 30, 32, 0);
  transition: background 300ms ease;
}

.work-card:hover .work-card-overlay {
  background: rgba(44, 30, 32, 0.09);
}

/* "View project" hint badge */
.work-card-hint {
  display: inline-flex;
  align-items: center;
  padding: 0.38rem 0.78rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--depth);
  font-size: 0.67rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  opacity: 0;
  transform: translateY(5px);
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.work-card:hover .work-card-hint {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Card text below image ---- */

.work-card-meta {
  display: grid;
  gap: var(--space-2xs);
  padding-top: var(--space-xs);
}

/* Deep red kicker on the warm gray background */
.work-card-meta .kicker {
  color: var(--text-primary);
}

.work-card-title {
  font-family: "Abril Fatface", serif;
  font-size: clamp(1.35rem, 2.2vw, 1.9rem);
  color: var(--text-primary);
  line-height: 1.04;
  letter-spacing: 0.01em;
  margin: 0;
}

.work-card.is-featured .work-card-title {
  font-size: clamp(1.9rem, 3.8vw, 3rem);
}

/* ---- Responsive ---- */

@media (max-width: 900px) {
  .work-tab {
    min-width: 110px;
    padding: 0.6rem 1.2rem;
    font-size: 0.78rem;
  }
}

@media (max-width: 640px) {
  .work-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .work-card.is-featured {
    grid-column: auto;
  }

  .work-card.is-featured .work-card-img-wrap {
    aspect-ratio: 4 / 3;
  }

  .work-tabs {
    gap: 4px;
  }

  .work-tab {
    min-width: 80px;
    padding: 0.55rem 0.85rem;
    font-size: 0.73rem;
  }
}

/* ---- Reduced motion ---- */

@media (prefers-reduced-motion: reduce) {
  .work-card-img-wrap img,
  .work-card-hint {
    transition: none;
  }

  .work-card:hover .work-card-img-wrap img {
    transform: none;
  }

  .work-card:hover .work-card-hint {
    opacity: 1;
    transform: none;
  }
}
