/* =============================================================
   pages/projects.css — Projects / Case Studies page
   ============================================================= */

/* ── Page wrapper ────────────────────────────────────────────── */
.projects-page {
  padding:    40px 96px 120px 235px;
  min-height: calc(100vh - 52px);
}

/* ── Page header ─────────────────────────────────────────────── */
.projects-page__header {
  margin-bottom: 64px;
}

.projects-page__eyebrow {
  font-family:    var(--font-mono);
  font-size:      var(--fs-11);
  font-weight:    var(--mono-fw-lte20);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color:          var(--purple-900);
  opacity:        0.7;
  margin-bottom:  12px;
}

.projects-page__title {
  font-family:    var(--font-headings);
  font-size:      var(--fs-48);
  font-weight:    var(--fw-display);
  letter-spacing: var(--ls-display);
  line-height:    56px;
  color:          var(--white);
  margin-bottom:  12px;
}

.projects-page__sub {
  font-family:    var(--font-mono);
  font-size:      var(--fs-16);
  font-weight:    var(--mono-fw-lte20);
  letter-spacing: var(--mono-ls-lte20);
  color:          var(--gray-900);
}

/* =============================================================
   FEATURED SECTION
   Full-width horizontal cards — image left, content right.
   Inspired by Apple product cards: large image, bold display
   title, eyebrow label, description, feature callout.
   ============================================================= */
.projects-featured {
  margin-bottom: 80px;
}

.projects-featured__heading {
  font-family:    var(--font-mono);
  font-size:      var(--fs-11);
  font-weight:    var(--mono-fw-lte20);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color:          var(--purple-900);
  opacity:        0.7;
  margin-bottom:  32px;
}

/* Featured list — stacked full-width cards */
.projects-featured__list {
  display:        flex;
  flex-direction: column;
  gap:            24px;
}

/* ── Featured card — horizontal layout ─────────────────────── */
.project-card--featured {
  position:        relative;
  background:      var(--purple-card);
  border:          1px solid var(--purple-card-border);
  border-radius:   20px;
  overflow:        hidden;
  display:         flex;
  flex-direction:  row;
  min-height:      440px;
  cursor:          pointer;
  text-decoration: none;
  transition:      border-color 0.3s ease, box-shadow 0.3s ease;
}

.project-card--featured:hover {
  border-color: var(--purple-border);
  box-shadow:   0 24px 64px rgba(143, 0, 216, 0.20);
}

/* ── Image pane (left ~50%) ─────────────────────────────────── */
.project-card__image {
  width:      50%;
  flex-shrink: 0;
  overflow:   hidden;
  position:   relative;
}

.project-card__image img {
  width:      100%;
  height:     100%;
  object-fit: cover;
  object-position: center;
  filter:     grayscale(0.25) brightness(0.9);
  transition: filter 0.45s ease, transform 0.45s ease;
  display:    block;
}

.project-card--featured:hover .project-card__image img {
  filter:    grayscale(0) brightness(1);
  transform: scale(1.04);
}

/* Placeholder image pane */
.project-card__image--placeholder {
  background: linear-gradient(135deg,
    rgba(143, 0, 216, 0.12) 0%,
    rgba(135, 141, 234, 0.08) 100%);
  border-right: 1px solid var(--purple-card-border);
  display:      flex;
  align-items:  center;
  justify-content: center;
}

.project-card__image-placeholder-inner {
  width:         80px;
  height:        80px;
  border-radius: 50%;
  background:    rgba(143, 0, 216, 0.15);
  border:        1px solid var(--purple-border);
  display:       flex;
  align-items:   center;
  justify-content: center;
  font-size:     36px;
  color:         var(--purple-900);
  opacity:       0.6;
}

/* ── Content pane (right ~50%) ──────────────────────────────── */
.project-card__content {
  flex:           1;
  padding:        52px 56px;
  display:        flex;
  flex-direction: column;
  justify-content: center;
  gap:            20px;
}

/* Eyebrow — accent label above title, analogous to "Running" in the reference */
.project-card__eyebrow {
  font-family:    var(--font-mono);
  font-size:      var(--fs-12);
  font-weight:    var(--mono-fw-lte20);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color:          var(--purple-900);
}

/* Display title — large, bold */
.project-card--featured .project-card__title {
  font-family:    var(--font-headings);
  font-size:      clamp(32px, 3.2vw, 48px);
  font-weight:    var(--fw-display);
  letter-spacing: var(--ls-display);
  line-height:    1.1;
  color:          var(--white);
}

/* Description */
.project-card--featured .project-card__desc {
  font-family: var(--font-text);
  font-size:   var(--fs-15);
  font-weight: var(--fw-body);
  line-height: 1.65;
  color:       var(--gray-900);
  max-width:   480px;
}

/* Role/position callout — sits ABOVE the description so the
   reader gets the role context first. Icon hidden on every
   viewport: the text now reads flush-left with the eyebrow
   above and the description below. */
.project-card__highlight {
  display:     flex;
  align-items: flex-start;
  gap:         0;
  padding-top: 4px;
}

.project-card__highlight > i,
.project-card__highlight > [class*="ph "] {
  display: none;
}

.project-card__highlight-text {
  font-family:  var(--font-text);
  font-size:    var(--fs-15);
  font-weight:  500;
  line-height:  1.4;
  color:        var(--white);
}

/* Visual order inside the featured card content column:
     1. eyebrow  2. title  3. highlight  4. desc
     5. desc toggle  6. sitelinks  7. cta-row */
.project-card--featured .project-card__eyebrow     { order: 1; }
.project-card--featured .project-card__title       { order: 2; }
.project-card--featured .project-card__highlight   { order: 3; }
.project-card--featured .project-card__desc        { order: 4; }
.project-card--featured .project-card__desc-toggle { order: 5; }
.project-card--featured .project-card__sitelinks   { order: 6; }
.project-card--featured .project-card__cta-row     { order: 7; }

/* CTA row */
.project-card__cta-row {
  display:     flex;
  align-items: center;
  margin-top:  8px;
}

.project-card__cta-link {
  display:         inline-flex;
  align-items:     center;
  gap:             6px;
  font-family:     var(--font-text);
  font-size:       var(--fs-14);
  font-weight:     500;
  color:           var(--purple-900);
  text-decoration: none;
  transition:      gap 0.2s ease;
}

.project-card--featured:hover .project-card__cta-link {
  gap: 12px;
}

/* When the image pane and title are anchors (cards with internal links
   to subpages — e.g. Veloque), keep them block-level and inherit color. */
a.project-card__image {
  display:         block;
  text-decoration: none;
  color:           inherit;
}

.project-card__title-link {
  color:           inherit;
  text-decoration: none;
}

/* ── Rich-snippet style sub-links (Google sitelinks aesthetic) ─
   Used inside cards that have sub-pages. Two-column grid with a
   purple link title and a faded breadcrumb URL underneath. */
.project-card__sitelinks {
  display:               grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:                   16px 32px;
  margin-top:            4px;
  padding-top:           20px;
  border-top:            1px solid var(--purple-card-border);
}

.project-sitelink {
  display:         flex;
  flex-direction:  column;
  gap:             4px;
  text-decoration: none;
  color:           inherit;
  transition:      transform 0.2s ease;
}

.project-sitelink__title {
  font-family:           var(--font-text);
  font-size:             var(--fs-15);
  font-weight:           500;
  color:                 #c8b9ff;
  text-decoration:       underline;
  text-decoration-color: rgba(200, 185, 255, 0.32);
  text-underline-offset: 3px;
  letter-spacing:        -0.005em;
  line-height:           1.3;
  transition:            color 0.18s ease, text-decoration-color 0.18s ease;
}

.project-sitelink:hover .project-sitelink__title {
  color:                 #ffffff;
  text-decoration-color: #c8b9ff;
}

.project-sitelink__url {
  font-family:    var(--font-mono);
  font-size:      var(--fs-11);
  color:          rgba(200, 185, 255, 0.55);
  letter-spacing: 0.02em;
  line-height:    1.3;
  overflow:       hidden;
  text-overflow:  ellipsis;
  white-space:    nowrap;
}

/* =============================================================
   ALL PROJECTS SECTION
   Standard grid with filter bar above.
   ============================================================= */
.projects-all {
  /* intentionally no extra top margin — featured section provides separation */
}

.projects-all__heading {
  font-family:    var(--font-mono);
  font-size:      var(--fs-11);
  font-weight:    var(--mono-fw-lte20);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color:          var(--purple-900);
  opacity:        0.7;
  margin-bottom:  24px;
}

/* ── Filter bar ──────────────────────────────────────────────── */
.filter-bar {
  position:       sticky;
  top:            0;
  z-index:        50;
  display:        flex;
  flex-wrap:      wrap;
  align-items:    center;
  gap:            10px;
  padding:        16px 0 20px;
  background:     var(--bg-main);
  /* fade out edges to signal stickiness */
  margin-bottom:  32px;
}

/* Narrow separator between search and chips */
.filter-bar__sep {
  width:       1px;
  height:      24px;
  background:  var(--purple-card-border);
  flex-shrink: 0;
}

/* Search input */
.filter-bar__search {
  position:    relative;
  flex-shrink: 0;
}

.filter-bar__search-icon {
  position:    absolute;
  left:        12px;
  top:         50%;
  transform:   translateY(-50%);
  color:       var(--gray-900);
  opacity:     0.5;
  pointer-events: none;
  font-size:   15px;
  line-height: 1;
}

.filter-bar__input {
  height:         40px;
  padding:        0 12px 0 36px;
  width:          220px;
  background:     var(--purple-card);
  border:         1px solid var(--purple-card-border);
  border-radius:  8px;
  font-family:    var(--font-text);
  font-size:      var(--fs-14);
  font-weight:    var(--fw-body);
  color:          var(--white);
  outline:        none;
  transition:     border-color 0.2s ease;
}

.filter-bar__input::placeholder { color: rgba(200, 200, 200, 0.4); }

.filter-bar__input:focus {
  border-color: var(--purple-border);
}

/* Filter chip group */
.filter-chips {
  display:  flex;
  flex-wrap: wrap;
  gap:      8px;
}

/* Filter chip */
.filter-chip {
  display:        inline-flex;
  align-items:    center;
  height:         32px;
  padding:        0 12px;
  background:     #1B1834;
  border:         1px solid var(--purple-card-border);
  border-radius:  20px;
  font-family:    var(--font-mono);
  font-size:      var(--fs-12);
  font-weight:    var(--mono-fw-lte20);
  letter-spacing: 0.04em;
  color:          var(--gray-900);
  cursor:         pointer;
  user-select:    none;
  transition:     background 0.18s ease, border-color 0.18s ease,
                  color 0.18s ease, transform 0.18s ease;
  white-space:    nowrap;
}

.filter-chip:hover {
  border-color: var(--purple-border);
  color:        var(--white);
}

.filter-chip--active {
  background:   rgba(143, 0, 216, 0.22);
  border-color: var(--purple-border);
  color:        var(--purple-900);
}

.filter-chip:focus-visible {
  outline:        2px solid var(--purple-border);
  outline-offset: 2px;
}

/* "All" chip — slightly different look to signal reset */
.filter-chip--all {
  background:   #1B1834;
  border-color: rgba(250, 250, 250, 0.12);
  color:        var(--gray-900);
}

.filter-chip--all.filter-chip--active {
  background:   rgba(250, 250, 250, 0.12);
  border-color: rgba(250, 250, 250, 0.35);
  color:        var(--white);
}

/* ── Projects grid ───────────────────────────────────────────── */
/* 3-column responsive grid of vertical cards on desktop.
   Columns collapse to 2 at ≤960px and ≤640px. */
.projects-grid {
  display:               grid;
  grid-template-columns: repeat(3, 1fr);
  gap:                   20px;
  align-items:           stretch;
}

/* Empty state when search/filter has no results */
.projects-grid__empty {
  display:        none;
  grid-column:    1 / -1;
  padding:        48px 0;
  text-align:     center;
  font-family:    var(--font-mono);
  font-size:      var(--fs-14);
  font-weight:    var(--mono-fw-lte20);
  letter-spacing: var(--mono-ls-lte20);
  color:          var(--gray-900);
  opacity:        0.6;
}

/* =============================================================
   STANDARD PROJECT CARD — horizontal layout
   Image pane (left ~38%) + content pane (right) with vertically
   centered copy, generous padding, refined hover.
   Scoped with :not(.project-card--featured) so the larger Featured
   cards keep their own dimensions.
   ============================================================= */
.project-card:not(.project-card--featured) {
  position:        relative;
  background:      var(--purple-card);
  border:          1px solid var(--purple-card-border);
  border-radius:   18px;
  overflow:        hidden;
  display:         flex;
  flex-direction:  row;
  align-items:     stretch;
  min-height:      260px;
  transition:      border-color 0.3s ease, transform 0.3s ease,
                   box-shadow 0.3s ease;
  cursor:          pointer;
  text-decoration: none;
  opacity:         1;
  transform-origin: top center;
}

.project-card:not(.project-card--featured):hover {
  border-color: var(--purple-border);
  transform:    translateY(-3px);
  box-shadow:   0 16px 44px rgba(143, 0, 216, 0.16);
}

/* Card hidden state — driven by JS filter logic */
.project-card--hidden {
  display: none;
}

/* Cover pane (left ~38%) — full card height, no aspect ratio */
.project-card__cover {
  width:           38%;
  flex-shrink:     0;
  background:      rgba(143, 0, 216, 0.08);
  display:         flex;
  align-items:     center;
  justify-content: center;
  border-right:    1px solid var(--purple-card-border);
  overflow:        hidden;
  position:        relative;
}

.project-card__cover img {
  width:           100%;
  height:          100%;
  object-fit:      cover;
  object-position: center;
  filter:          grayscale(0.2) brightness(0.92);
  transition:      opacity 0.3s ease, transform 0.5s ease, filter 0.45s ease;
  opacity:         0.95;
  display:         block;
}

.project-card:hover .project-card__cover img {
  filter:    grayscale(0) brightness(1);
  opacity:   1;
  transform: scale(1.03);
}

.project-card__cover-placeholder {
  font-family:    var(--font-mono);
  font-size:      var(--fs-12);
  font-weight:    var(--mono-fw-lte20);
  letter-spacing: var(--mono-ls-lte20);
  color:          var(--gray-900);
  text-align:     center;
  padding:        20px;
  opacity:        0.5;
}

/* Content pane (right) — vertically centered, generous padding */
.project-card__body {
  flex:            1;
  padding:         36px 44px;
  display:         flex;
  flex-direction:  column;
  justify-content: center;
  gap:             14px;
  min-width:       0;
}

/* Tags */
.project-card__tags {
  display:       flex;
  flex-wrap:     wrap;
  gap:           6px;
  margin-bottom: 0;
}

.project-tag {
  display:        inline-flex;
  align-items:    center;
  height:         22px;
  padding:        0 8px;
  background:     #1B1834;
  border:         1px solid var(--purple-card-border);
  border-radius:  4px;
  font-family:    var(--font-mono);
  font-size:      var(--fs-11);
  font-weight:    var(--mono-fw-lte20);
  letter-spacing: var(--mono-ls-lte20);
  color:          var(--purple-900);
  text-transform: uppercase;
  transition:     background 0.2s ease, border-color 0.2s ease;
}

.project-card:hover .project-tag,
.project-card--featured:hover .project-tag {
  background:   rgba(143, 0, 216, 0.18);
  border-color: var(--purple-border);
}

/* Card title */
.project-card__title {
  font-family:    var(--font-headings);
  font-size:      var(--fs-24);
  font-weight:    var(--fw-heading);
  letter-spacing: var(--ls-heading);
  color:          var(--white);
  margin-bottom:  0;
  line-height:    1.25;
}

/* Card description */
.project-card__desc {
  font-family:    var(--font-text);
  font-size:      var(--fs-15);
  font-weight:    var(--fw-body);
  letter-spacing: var(--ls-body);
  line-height:    1.6;
  color:          var(--gray-900);
  max-width:      560px;
}

/* "Coming soon" state */
.project-card--wip {
  opacity: 0.55;
  pointer-events: none;
}

.project-card--wip .project-card__cover-placeholder::after {
  content:     ' — Coming Soon';
  color:       var(--purple-900);
  font-weight: 500;
}

/* ── Featured coming-soon modifier (Delta) ───────────────────── */
.project-card--featured.project-card--coming-soon {
  opacity:        0.6;
  pointer-events: none;
  cursor:         default;
}

.project-card__cta-link--soon {
  opacity: 0.5;
  cursor:  default;
}

/* =============================================================
   GRID-SCOPED VERTICAL CARD OVERRIDES
   Force all cards inside .projects-grid to vertical layout
   (image on top, body below). Featured cards are untouched
   because these selectors are scoped to .projects-grid.
   Placed AFTER .project-card:not(.project-card--featured) so
   equal-specificity rules win for grid cards.
   ============================================================= */
.projects-grid .project-card {
  flex-direction: column;
  align-items:    stretch;
  min-height:     0;
  height:         100%;
}

.projects-grid .project-card__cover {
  width:         100%;
  flex-shrink:   0;
  aspect-ratio:  16 / 10;
  border-right:  none;
  border-bottom: 1px solid var(--purple-card-border);
}

.projects-grid .project-card__body {
  flex:    1;
  padding: 22px 24px 26px;
  gap:     12px;
}

.projects-grid .project-card__title {
  font-size: var(--fs-20);
}

/* =============================================================
   FIXED PIXEL-GRID BACKGROUND
   Pins the interactive pixel grid to the viewport so page
   content scrolls over a stationary background. The dark
   gradient is carried here (home keeps it on .hero).
   ============================================================= */
.pixeled-bg--fixed {
  position:   fixed;
  inset:      0;
  width:      100vw;
  height:     100vh;
  z-index:    0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    #0A014C 0%,
    #080C1D 23.56%,
    #080C1D 73.56%,
    #0A014C 100%
  );
}

/* Re-enable per-pixel hover inside the fixed grid */
.pixeled-bg--fixed .bg-pixel { pointer-events: auto; }

/* Reveal the fixed grid through the main content area */
.main { background: transparent; }

/* Pass hover through non-interactive content to gutters,
   then re-enable everything that must stay clickable. */
.projects-page,
.projects-page * { pointer-events: none; }

.projects-page a,
.projects-page button,
.projects-page input,
.projects-page .project-card,
.projects-page .filter-chip,
.projects-page .filter-bar__input,
.projects-page .project-card__cta-link:not(.project-card__cta-link--soon),
.projects-page .project-sitelink { pointer-events: auto; }

/* Stack all content above the z-index:0 fixed grid.
   `.site-footer` needs the same treatment or the fixed pixel-grid
   covers it and the footer disappears visually on /projects. */
.projects-page { position: relative; z-index: 1; }
.tech-stack    { position: relative; z-index: 1; }
.site-footer   { position: relative; z-index: 1; }

/* =============================================================
   REDUCED MOTION SUPPORT
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .project-card,
  .project-card--featured,
  .project-card__image img,
  .filter-chip,
  .filter-bar__input,
  .project-card__cta-link {
    transition: none;
  }

  .project-card:hover,
  .project-card--featured:hover {
    transform: none;
  }
}

/* =============================================================
   RESPONSIVE — 1200px (wide sidebar offset)
   ============================================================= */
@media (max-width: 1200px) {
  .projects-page {
    padding-left: 100px;
  }
}

/* =============================================================
   RESPONSIVE — 960px (tablet)
   ============================================================= */
@media (max-width: 960px) {
  .projects-page {
    padding: 48px 40px 80px;
  }

  .projects-page__title {
    font-size: var(--fs-36);
    line-height: 44px;
  }

  /* Stack featured card to column on tablet */
  .project-card--featured {
    flex-direction: column;
    min-height: unset;
  }

  .project-card__image {
    width:        100%;
    aspect-ratio: 16/9;
  }

  .project-card__content {
    padding: 36px 36px 40px;
  }

  .project-card__sitelinks {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Stack standard horizontal card on tablet — image top, body below */
  .project-card {
    flex-direction: column;
    min-height:     unset;
  }

  .project-card__cover {
    width:         100%;
    aspect-ratio:  16/9;
    border-right:  none;
    border-bottom: 1px solid var(--purple-card-border);
  }

  .project-card__body {
    padding: 24px 28px 28px;
    gap:     10px;
  }

  .project-card__title {
    font-size: var(--fs-20);
  }

  .filter-bar__input {
    width: 180px;
  }

  /* 2-column grid at tablet */
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
}

/* =============================================================
   RESPONSIVE — 640px (mobile)
   ============================================================= */
@media (max-width: 640px) {
  .projects-page {
    padding: 32px 20px 64px;
  }

  .projects-page__title {
    font-size: var(--fs-32);
    line-height: 40px;
  }

  .projects-featured {
    margin-bottom: 48px;
  }

  .projects-featured__list {
    gap: 16px;
  }

  .project-card__content {
    padding: 28px 24px 32px;
    gap: 16px;
  }

  .project-card--featured .project-card__title {
    font-size: var(--fs-28);
  }

  .filter-bar {
    gap: 8px;
    padding-bottom: 16px;
  }

  .filter-bar__input {
    width: 100%;
  }

  .filter-bar__sep {
    display: none;
  }

  .filter-bar__search {
    width: 100%;
  }

  .project-card__body {
    padding: 20px 22px 24px;
  }

  .project-card--featured .project-card__title {
    font-size: var(--fs-20);
  }

  /* Single-column grid at mobile so non-featured projects stack
     vertically (each card spans the full width). */
  .projects-grid { grid-template-columns: 1fr; gap: 16px; }

  /* ─────────────────────────────────────────────────────────
     COLLAPSIBLE DESCRIPTION (featured cards, phone only)
     The description is clamped to ~5 lines with a gradient
     mask that fades the bottom to suggest more content. The
     "Know more / Know less" toggle is injected by
     project-cards.js immediately after the description and
     swaps the class `is-expanded` on click.
     ───────────────────────────────────────────────────────── */
  .project-card--featured .project-card__desc {
    position:           relative;
    overflow:           hidden;
    /* Shorter peek: ~3 lines visible instead of ~5. Mask fades
       earlier (35% solid, then ramp to transparent) so the cut
       reads more clearly as "there's more below". */
    max-height:         5em;
    -webkit-mask-image: linear-gradient(to bottom, #000 35%, transparent 100%);
            mask-image: linear-gradient(to bottom, #000 35%, transparent 100%);
    transition:         max-height 0.4s ease;
  }
  .project-card--featured .project-card__desc.is-expanded {
    max-height:         2000px;  /* effectively uncapped */
    -webkit-mask-image: none;
            mask-image: none;
  }

  .project-card__desc-toggle {
    display:        inline-flex;
    align-items:    center;
    gap:            6px;
    align-self:     flex-start;
    padding:        4px 0;
    margin-top:     -4px;        /* tuck under the fade edge */
    background:     transparent;
    border:         none;
    cursor:         pointer;
    font-family:    var(--font-text);
    font-size:      13px;
    font-weight:    500;
    color:          var(--purple-900);
    letter-spacing: 0.02em;
    transition:     color 0.15s ease;
  }
  .project-card__desc-toggle:hover { color: var(--white); }
  .project-card__desc-toggle i.ph  { font-size: 14px; }
}
