.projects {
  padding: var(--section-pad) var(--page-gutter);
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.projects-inner {
  width: 100%;
  max-width: none;
  margin: 0 auto;
}

/* The section heading must stay inside the page grid; only the filter strip and
   the row list are allowed to break out to full bleed. */
.projects-inner > .section-heading {
  margin-inline: auto;
  width: calc(100% - 2 * var(--page-gutter));
}

/* Full-bleed project rows — same treatment as .skills-layout: the filter
   strip and the row list break out of the section's page-gutter so the
   project panels touch the right and left edges of the viewport. The heading
   above stays aligned with the page grid, and the modal list is untouched. */
.projects-inner .projects-filter,
.projects-inner .projects-list {
  margin-inline: calc(50% - 50vw);
  padding-inline: 20px;
}

/* Let the row panels fill the full bleed width (the shared 90vw cap on
   .project-row-link would keep them inset on wide screens). */
.projects-inner .projects-list .project-row-link {
  width: 100%;
}

/* Make the filter strip genuinely full-bleed on its own line: position it so
   it breaks out of .projects-inner's content box on both sides, with horizontal
   padding so the buttons never touch the viewport edges, and clamp the inner
   scroll area so nothing overflows — full width, always its own row. */
.js-filter .projects-filter {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  width: calc(100% + (2 * var(--page-gutter)));
  margin-inline: calc(var(--page-gutter) * -1);
  padding-block: 14px 8px;
  padding-inline: 20px;
  margin-bottom: clamp(28px, 4vw, 44px);
  gap: 10px;
  border-top: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  cursor: grab;
  outline: 0;
}

.projects-filter {
  display: none;
}

.js-filter .projects-filter.is-grabbing {
  cursor: grabbing;
}

.js-filter .projects-filter::-webkit-scrollbar {
  display: none;
}

/* Keep the filter full-bleed on narrow screens too; the inner padding protects
   the buttons without shrinking the strip itself. */
@media (max-width: 640px) {
  .js-filter .projects-filter {
    width: calc(100% + (2 * var(--page-gutter)));
    margin-inline: calc(var(--page-gutter) * -1);
    padding-block: 14px 8px;
    padding-inline: 20px;
  }
}

.js-filter .projects-filter-arrow {
  position: sticky;
  z-index: 3;
  flex: 0 0 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.js-filter .projects-filter-arrow--back {
  inset-inline-start: 0;
}

.js-filter .projects-filter-arrow--forward {
  inset-inline-end: 0;
}

.js-filter .projects-filter-arrow-glyph {
  position: absolute;
  top: 0; 
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  box-shadow: var(--shadow-sm);
  color: var(--accent-strong);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-50%);
  transition: opacity 0.28s var(--ease), visibility 0s linear 0.28s;
}

.js-filter .projects-filter-arrow--back .projects-filter-arrow-glyph {
  inset-inline-start: 4px;
  animation: filter-arrow-nudge-start 2.4s var(--ease) infinite;
}

.js-filter .projects-filter-arrow--forward .projects-filter-arrow-glyph {
  inset-inline-end: 4px;
  animation: filter-arrow-nudge-end 2.4s var(--ease) infinite;
}

.js-filter .projects-filter-arrow.is-visible .projects-filter-arrow-glyph {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.28s var(--ease), visibility 0s;
}

.js-filter .projects-filter-arrow-glyph svg {
  display: block;
  width: 1em;
  height: 1em;
  font-size: 0.82rem;
}

.js-filter .projects-filter-arrow--back .projects-filter-arrow-glyph svg {
  transform: scaleX(-1);
}

@keyframes filter-arrow-nudge-end {
  0%, 100% { translate: 0 0; }
  50%      { translate: -4px 0; } 
}

@keyframes filter-arrow-nudge-start {
  0%, 100% { translate: 0 0; }
  50%      { translate: 4px 0; } 
}

.js-filter .projects-filter-note {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding-inline: 2px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  margin-inline-end: 4px;
  white-space: nowrap;
}

.js-filter .projects-filter-note::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px 1px var(--success-shadow);
  animation: dot-pulse 2.6s ease-in-out infinite;
}

.js-filter .projects-filter-btn {
  flex: 0 0 auto;
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0 19px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border-strong));
  border-radius: 14px;
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--surface-raised, var(--surface-alt)) 96%, var(--accent-tint)),
      color-mix(in srgb, var(--surface-alt) 92%, var(--accent-tint)));
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  outline: 0;
  white-space: nowrap;
  transition:
    transform 0.25s var(--ease-spring),
    background 0.3s var(--ease),
    border-color 0.3s var(--ease),
    color 0.3s var(--ease),
    box-shadow 0.3s var(--ease);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #ffffff 72%, transparent),
    0 2px 4px color-mix(in srgb, var(--border-strong) 48%, transparent),
    0 9px 20px color-mix(in srgb, var(--accent) 9%, transparent);
}

.js-filter .projects-filter-btn::before {
  content: "";
  position: absolute;
  inset: 1px;
  border: 1px solid color-mix(in srgb, var(--accent) 13%, transparent);
  border-radius: 13px;
  opacity: 0.75;
  pointer-events: none;
  z-index: 0;
}

.js-filter .projects-filter-btn:hover {
  transform: translateY(-3px) scale(1.025);
  border-color: color-mix(in srgb, var(--accent) 54%, var(--border-strong));
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--accent-tint-strong) 52%, var(--surface-alt)),
      color-mix(in srgb, var(--surface-alt) 88%, var(--accent-tint)));
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #ffffff 86%, transparent),
    0 4px 8px color-mix(in srgb, var(--accent) 14%, transparent),
    0 14px 28px color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--text);
}

.js-filter .projects-filter-btn:focus-visible {
  transform: translateY(-3px) scale(1.025);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-tint-strong) 48%, var(--surface-alt));
  outline: none;
  box-shadow:
    0 0 0 3px var(--surface),
    0 0 0 5px color-mix(in srgb, var(--accent) 68%, transparent),
    0 12px 26px color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--text);
}

.js-filter .projects-filter-btn.is-active {
  border-color: color-mix(in srgb, var(--on-accent) 42%, transparent);
  background: var(--gradient);
  color: var(--on-accent);
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #ffffff 42%, transparent),
    0 4px 8px color-mix(in srgb, var(--accent-strong) 22%, transparent),
    0 14px 30px color-mix(in srgb, var(--accent) 30%, transparent);
}

.js-filter .projects-filter-btn.is-active::before {
  border-color: color-mix(in srgb, var(--on-accent) 34%, transparent);
  opacity: 0.9;
}

.js-filter .projects-filter-btn.is-active:hover {
  border-color: color-mix(in srgb, var(--on-accent) 62%, transparent);
  background: var(--gradient);
  transform: translateY(-3px) scale(1.035);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #ffffff 52%, transparent),
    0 5px 10px color-mix(in srgb, var(--accent-strong) 26%, transparent),
    0 18px 36px color-mix(in srgb, var(--accent) 38%, transparent);
  color: var(--on-accent);
}

/* Entry animation for filter buttons — defaults to visible so buttons
   never stay hidden if the animation doesn't fire. */
.js-filter .projects-filter-btn {
  opacity: 1;
  transform: none;
}

.js-filter .projects-filter-btn.is-animating {
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  animation: btn-pop-in 0.45s var(--ease-spring) forwards;
}

.js-filter .projects-filter-btn:nth-child(1).is-animating { animation-delay: 0.02s; }
.js-filter .projects-filter-btn:nth-child(2).is-animating { animation-delay: 0.06s; }
.js-filter .projects-filter-btn:nth-child(3).is-animating { animation-delay: 0.10s; }
.js-filter .projects-filter-btn:nth-child(4).is-animating { animation-delay: 0.14s; }
.js-filter .projects-filter-btn:nth-child(5).is-animating { animation-delay: 0.18s; }
.js-filter .projects-filter-btn:nth-child(6).is-animating { animation-delay: 0.22s; }
.js-filter .projects-filter-btn:nth-child(7).is-animating { animation-delay: 0.26s; }
.js-filter .projects-filter-btn:nth-child(8).is-animating { animation-delay: 0.30s; }

@keyframes btn-pop-in {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.94);
  }
  60% {
    opacity: 1;
    transform: translateY(-2px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Ripple effect on click */
.js-filter .projects-filter-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--gradient);
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  z-index: 0;
}

.js-filter .projects-filter-btn:active::after {
  opacity: 0.25;
  transform: scale(1.1);
  transition: opacity 0s, transform 0.35s var(--ease-spring);
}

@media (max-width: 900px) {
  .js-filter .projects-filter {
    gap: 8px;
  }

  .js-filter .projects-filter-btn {
    padding: 0 14px;
    border-radius: 12px;
    font-size: 0.86rem;
  }
}

.projects-modal .projects-filter {
  flex: none;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 14px 24px;
  flex-wrap: nowrap;
  gap: 0.5rem;
  border-top: none;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
  box-shadow: none;
}

.project-row.is-hidden {
  display: none;
}

.js-projects .projects-list.is-filtered {
  max-height: none;
  overflow: visible;
}

.js-projects .projects-list {
  position: relative;
  overflow: hidden;
}

.js-projects .projects-list.is-filtered::after,
.js-projects--full .projects-list::after {
  display: none;
}

.js-projects--full .projects-list {
  max-height: none;
  overflow: visible;
}

.projects-list.is-switching .project-row:not(.is-hidden) {
  animation: project-in 0.45s var(--ease) backwards;
}

@keyframes project-in {
  from { opacity: 0; transform: translateY(14px); }
}

.projects-empty {
  position: relative;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: clamp(250px, 28vw, 320px);
  margin-top: clamp(24px, 3vw, 36px);
  padding: clamp(44px, 6vw, 64px) 24px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent-tint) 70%, transparent), transparent 48%),
    linear-gradient(180deg, var(--surface-alt) 0%, var(--surface) 100%);
  box-shadow: var(--shadow-sm);
  text-align: center;
  isolation: isolate;
}

.projects-empty::before {
  content: "";
  position: absolute;
  inset: 16px;
  z-index: -1;
  border: 1px dashed color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: calc(var(--radius-md) - 4px);
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--accent) 16%, transparent) 1px, transparent 0);
  background-size: 18px 18px;
  opacity: 0.48;
  pointer-events: none;
}

.projects-empty::after {
  content: "";
  position: absolute;
  top: -92px;
  inset-inline-end: -54px;
  z-index: -1;
  width: 220px;
  height: 220px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  border-radius: 50%;
  box-shadow: 0 0 24px 4px color-mix(in srgb, var(--accent) 5%, transparent),
              0 0 48px 10px color-mix(in srgb, var(--accent) 3%, transparent);
  pointer-events: none;
}

.projects-empty.is-visible {
  display: flex;
  animation: empty-in 0.4s var(--ease) backwards;
}

.projects-empty-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--accent-tint) 72%, var(--surface));
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--accent-strong);
}

.projects-empty-mark::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px 1px color-mix(in srgb, var(--accent) 10%, transparent);
}

.projects-empty-title {
  max-width: 30ch;
  color: var(--text);
  font-size: clamp(1.05rem, 1.8vw, 1.3rem);
  font-weight: 700;
  line-height: 1.85;
}

.projects-empty-category {
  color: var(--accent-strong);
}

.projects-empty-sub {
  max-width: 42ch;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.95;
}

@keyframes empty-in {
  from { opacity: 0; transform: translateY(10px); }
}

.projects-list {
  list-style: none;
}

.project-row + .project-row {
  position: relative;
  margin-block-start: clamp(14px, 1.8vw, 24px);
}

.project-row + .project-row::before {
  content: "";
  position: absolute;
  inset-inline: clamp(4px, 1vw, 12px);
  top: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--row-border) 16%,
    var(--row-border) 84%,
    transparent
  );
}

.project-row:first-child .project-row-link {
  padding-top: 0;
}

/* The first *visible* row of a filtered list must look like the list head — no
   divider above it, no leading gap and no top padding — even when rows placed
   earlier in the DOM are hidden by the current filter. The is-first class is
   kept in sync with the active filter by js/projects/filter.js. */
.project-row.is-first {
  margin-block-start: 0;
}

.project-row.is-first::before {
  display: none;
}

.project-row.is-first .project-row-link {
  padding-top: 0;
}

.project-row-link {
  display: grid;
  width: min(90vw, 100%);
  max-width: 100%;
  margin-inline: auto;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "body"
    "foot";
  align-items: stretch;
  column-gap: 0;
  row-gap: clamp(20px, 2.8vw, 34px);
  padding: clamp(48px, 6vw, 76px) 0;
}

.project-row {
  --row-accent: var(--accent);
  --row-accent-strong: var(--accent-strong);
  --row-accent-2: var(--accent-2);
  --row-grad: var(--gradient);
  --row-tint: var(--accent-tint);
  --row-tint-strong: var(--accent-tint-strong);
  --row-border: color-mix(in srgb, var(--row-accent) 22%, var(--border));
  --row-border-strong: color-mix(in srgb, var(--row-accent) 38%, var(--border-strong));
  --row-ring: color-mix(in srgb, var(--row-accent) 30%, transparent);
  --row-shadow: color-mix(in srgb, var(--row-accent) 28%, transparent);
}

.project-row--cafe {
  --row-accent: #9a5b32;
  --row-accent-strong: #70401f;
  --row-accent-2: #c8874d;
  --row-grad: linear-gradient(135deg, #9a5b32 0%, #70401f 100%);
  --row-tint: rgba(154, 91, 50, 0.1);
  --row-tint-strong: rgba(154, 91, 50, 0.22);
}

.project-row--profile {
  --row-accent: #3978c8;
  --row-accent-strong: #24549d;
  --row-accent-2: #63a5ed;
  --row-grad: linear-gradient(135deg, #3978c8 0%, #24549d 100%);
  --row-tint: rgba(57, 120, 200, 0.1);
  --row-tint-strong: rgba(57, 120, 200, 0.22);
}

.project-row--tech {
  --row-accent: #8558d6;
  --row-accent-strong: #6031a9;
  --row-accent-2: #b18bf0;
  --row-grad: linear-gradient(135deg, #8558d6 0%, #6031a9 100%);
  --row-tint: rgba(133, 88, 214, 0.1);
  --row-tint-strong: rgba(133, 88, 214, 0.22);
}

.project-row-body {
  grid-area: body;
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: visible;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "head         head"
    "description  side"
    "case         case";
  align-items: start;
  align-self: stretch;
  column-gap: clamp(28px, 4vw, 56px);
  row-gap: clamp(26px, 3vw, 40px);
  /* Break the rows' columns out to the list edges: don't keep them centered in
     the list. */
  justify-self: stretch;
}

.project-row-head {
  grid-area: head;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  min-width: 0;
  width: 100%;
}

/* ————— Row title · editorial folio poster —————
   Frameless: pure typography on the section background. A hairline folio
   line (type · eyebrow · number), a giant duotone-ink Farsi headline, and
   an oversized outlined index numeral in Kapiler dissolving behind it —
   the Farsi title itself stays in Vazirmatn (Kapiler has no Arabic-script
   glyphs). */

.project-row-title {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  max-width: 100%;
  margin-block-start: clamp(24px, 3.4vw, 44px);
  padding: clamp(20px, 3vw, 36px) clamp(14px, 3vw, 40px) clamp(24px, 3.4vw, 44px);
  transition: transform var(--dur-base) var(--ease-spring);
}

/* Oversized folio numeral, dissolving behind the headline. */
.project-row-title-no {
  position: absolute;
  top: 50%;
  inset-inline-start: 50%;
  z-index: -1;
  transform: translate(-50%, -54%);
  font-family: "Kapiler", var(--font-mono);
  font-weight: 300;
  font-size: clamp(9rem, 26vw, 24rem);
  line-height: 1;
  letter-spacing: 0.04em;
  color: transparent;
  -webkit-text-stroke: 1px color-mix(in srgb, var(--row-accent) 15%, transparent);
  -webkit-mask-image: radial-gradient(closest-side, #000 30%, transparent 76%);
  mask-image: radial-gradient(closest-side, #000 30%, transparent 76%);
  user-select: none;
  pointer-events: none;
  transition: -webkit-text-stroke-color var(--dur-slow) var(--ease);
}

@supports not (-webkit-text-stroke: 1px black) {
  .project-row-title-no {
    color: color-mix(in srgb, var(--row-accent) 8%, transparent);
    -webkit-mask-image: none;
    mask-image: none;
  }
}

/* Folio line: type · eyebrow · number. */
.project-row-title-folio {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(10px, 1.6vw, 16px);
  width: 100%;
  margin-bottom: clamp(14px, 2vw, 22px);
}

.project-row-title-folio-type {
  color: color-mix(in srgb, var(--text) 55%, transparent);
  font-family: var(--font-mono);
  font-size: clamp(0.75rem, 1.3vw, 0.9rem);
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  line-height: 1.6;
}

.project-row-title-folio-gem {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border: 1px solid color-mix(in srgb, var(--row-accent) 55%, transparent);
  background: color-mix(in srgb, var(--row-accent) 25%, transparent);
  transform: rotate(45deg);
}

.project-row-title-eyebrow {
  margin: 0;
  color: var(--row-accent-strong);
  font-size: clamp(0.85rem, 1.5vw, 1rem);
  font-weight: 700;
  line-height: 1.6;
}

.project-row-title-folio-no {
  color: color-mix(in srgb, var(--text) 45%, transparent);
  font-family: var(--font-mono);
  font-size: clamp(0.75rem, 1.3vw, 0.9rem);
  font-weight: 600;
  letter-spacing: 0.22em;
  line-height: 1.6;
}

/* Headline: duotone ink — one accent band drifting through solid text. */
.project-row-title-text {
  position: relative;
  z-index: 1;
  min-width: 0;
  margin: 0;
  font-size: clamp(2.4rem, 6.2vw, 5rem);
  font-weight: 900;
  line-height: 1.22;
  letter-spacing: -0.01em;
  text-wrap: balance;
  color: transparent;
  background:
    linear-gradient(90deg,
      var(--text) 22%,
      color-mix(in srgb, var(--row-accent-strong) 78%, var(--text)) 50%,
      var(--text) 78%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: title-ink-sway 9s var(--ease) infinite;
}

@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .project-row-title-text {
    color: var(--text);
    -webkit-text-fill-color: currentColor;
    animation: none;
  }
}

/* Print-style baseline rule with an accent gem. */
.project-row-title-baseline {
  position: relative;
  z-index: 1;
  display: block;
  width: clamp(120px, 16vw, 220px);
  height: 1px;
  margin-top: clamp(16px, 2.4vw, 26px);
  background: linear-gradient(90deg,
    transparent,
    color-mix(in srgb, var(--row-accent) 55%, transparent) 30%,
    color-mix(in srgb, var(--row-accent-2) 55%, transparent) 70%,
    transparent);
}

.project-row-title-baseline::after {
  content: "";
  position: absolute;
  top: 50%;
  inset-inline-start: 50%;
  width: 5px;
  height: 5px;
  transform: translate(-50%, -50%) rotate(45deg);
  background: var(--row-accent);
}

.project-row-title:hover,
.project-row-title:focus-visible {
  transform: translateY(-2px);
}

.project-row-title:hover .project-row-title-no,
.project-row-title:focus-visible .project-row-title-no {
  -webkit-text-stroke-color: color-mix(in srgb, var(--row-accent) 28%, transparent);
}

/* Scroll-reveal choreography (runs from .js-reveal in base.css). */
.js-reveal .project-row.is-visible .project-row-title-no {
  animation: title-no-in 1s var(--ease-out) 0.05s backwards;
}

.js-reveal .project-row.is-visible .project-row-title-folio {
  animation: folio-in 0.55s var(--ease) 0.1s backwards;
}

.js-reveal .project-row.is-visible .project-row-title-folio-gem {
  animation: gem-pop 0.5s var(--ease-spring) backwards;
}

.js-reveal .project-row.is-visible .project-row-title-folio span:nth-of-type(2) { animation-delay: 0.2s; }
.js-reveal .project-row.is-visible .project-row-title-folio span:nth-of-type(4) { animation-delay: 0.26s; }

.js-reveal .project-row.is-visible .project-row-title-text {
  animation: title-ink-in 0.6s var(--ease-out) 0.14s backwards;
}

.js-reveal .project-row.is-visible .project-row-title-baseline {
  animation: baseline-in 0.7s var(--ease-out) 0.3s backwards;
}

.js-reveal .project-row.is-visible .project-row-title-baseline::after {
  animation: gem-pop 0.5s var(--ease-spring) 0.55s backwards;
}

@keyframes folio-in {
  from { opacity: 0; transform: translateY(-8px); }
}

@keyframes gem-pop {
  0% { opacity: 0; transform: rotate(45deg) scale(0.2); }
  100% { opacity: 1; transform: rotate(45deg) scale(1); }
}

@keyframes title-ink-in {
  from { opacity: 0; transform: translateY(16px); }
}

@keyframes baseline-in {
  from { opacity: 0; transform: scaleX(0); }
}

@keyframes title-no-in {
  from { opacity: 0; transform: translate(-50%, -48%) scale(1.05); }
}

@keyframes title-ink-sway {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.project-row-side {
  grid-area: side;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  align-self: stretch;
  gap: clamp(26px, 3vw, 40px);
  width: 100%;
}

.project-row-story {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 12px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  margin-inline: 0;
  padding: clamp(18px, 2vw, 28px) clamp(20px, 2.4vw, 32px);
  border: 1px solid color-mix(in srgb, var(--row-accent-strong) 65%, transparent);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--row-accent) 60%, transparent), transparent 55%),
    linear-gradient(135deg, color-mix(in srgb, var(--row-accent-strong) 82%, #050505 18%) 0%, color-mix(in srgb, var(--row-accent-strong) 52%, #0a0a0a 48%) 100%);
  box-shadow:
    0 2px 6px color-mix(in srgb, var(--row-accent) 14%, transparent),
    0 14px 28px var(--row-shadow);
  overflow: visible;
}

.project-row-story::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, #ffffff 16%, transparent), transparent 48%),
    repeating-linear-gradient(135deg, color-mix(in srgb, #ffffff 11%, transparent) 0 1px, transparent 1px 22px);
  opacity: 0.6;
  pointer-events: none;
}

.project-row-lede {
  position: relative;
  z-index: 1;
  max-width: 100%;
  padding-inline-start: 16px;
  color: var(--text);
  font-size: clamp(1.06rem, 1.8vw, 1.28rem);
  font-weight: 700;
  line-height: 1.85;
}

.project-row-lede::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0.22em;
  bottom: 0.22em;
  width: 3px;
  border-radius: 3px;
  background: var(--row-grad);
}

.project-row-story .project-row-lede {
  color: color-mix(in srgb, #ffffff 90%, var(--row-accent));
}

.project-row-story .project-row-lede::before {
  background: linear-gradient(180deg, color-mix(in srgb, #ffffff 80%, var(--row-accent)), color-mix(in srgb, #ffffff 28%, var(--row-accent)));
}

.project-row-description {
  max-width: 58ch;
  color: var(--text);
  font-size: 0.98rem;
  line-height: 2.05;
}

.project-description-wrapper {
  --description-rail: clamp(76px, 13vw, 138px);
  position: relative;
  display: grid;
  grid-template-columns: var(--description-rail) minmax(0, 1fr);
  align-items: stretch;
  width: 100%;
  max-width: 100%;
  margin-inline: 0;
  border: 1px solid var(--row-border);
  border-radius: 4px var(--radius-md) var(--radius-md) 4px;
  background: var(--surface);
  box-shadow:
    0 2px 6px color-mix(in srgb, var(--row-accent-strong) 8%, transparent),
    0 14px 28px var(--row-shadow);
}

.project-description-wrapper::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--row-accent) 6%, transparent) 0%, transparent 50%),
    linear-gradient(135deg, color-mix(in srgb, var(--row-accent) 4%, transparent) 0%, transparent 40%, color-mix(in srgb, var(--row-accent-2) 3%, transparent) 100%),
    repeating-linear-gradient(90deg, var(--row-border) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(0deg, var(--row-border) 0 1px, transparent 1px 28px);
  opacity: 0.5;
  pointer-events: none;
}



.project-description-pattern {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  color: color-mix(in srgb, var(--row-accent-strong) 26%, transparent);
  pointer-events: none;
}

.project-description-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: clamp(14px, 2vw, 22px) clamp(8px, 1.4vw, 16px);
  overflow: hidden;
  color: var(--row-accent-strong);
  justify-content: center;
  /* Room between the icon and the // brief label so the icon's drop-shadow
     never gets covered or flattened by the label underneath it. */
  gap: 14px;
}

.project-description-visual::before {
  content: "";
  position: absolute;
  inset: 12px 8px;
  border: 1px solid color-mix(in srgb, var(--row-accent) 24%, transparent);
  border-radius: 3px 14px 3px 14px;
  pointer-events: none;
}

.project-description-visual::after {
  content: "";
  position: absolute;
  /* Keep the accent glow inside the rail: anchoring it at the outer
     (inline-start) edge with a width that fits the rail means its soft edge
     never crosses into the text column, so it can't look sliced/flat at that
     boundary. The small outward bleeds sit against the card's own edge. */
  inset-inline-start: -8px;
  inset-block-end: -16px;
  width: min(96px, calc(100% - 8px));
  aspect-ratio: 1;
  height: auto;
  border-radius: 50%;
  background: var(--row-accent);
  opacity: 0.08;
  filter: blur(14px);
  pointer-events: none;
}

.project-description-visual-icon {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  /* Shrink with the narrow visual rail so the icon and its drop-shadow never
     get clipped by the rail's overflow: hidden (rail can be 68-76px wide). */
  width: min(72px, calc(100% - 6px));
  aspect-ratio: 1;
  height: auto;
  color: var(--row-accent);
  filter: drop-shadow(0 8px 8px color-mix(in srgb, var(--row-accent) 18%, transparent));
  opacity: 0.85;
}

.project-description-visual-icon svg {
  width: 100%;
  height: 100%;
  stroke-width: 1.2;
}

.project-description-visual-code {
  position: relative;
  z-index: 1;
  padding-top: 10px;
  border-top: 1px solid color-mix(in srgb, var(--row-accent) 24%, transparent);
  color: var(--row-accent-strong);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.project-description-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: clamp(18px, 2.4vw, 30px) clamp(18px, 2.4vw, 30px);
  width: 100%;
}

.project-description-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: clamp(12px, 1.7vw, 18px);
  color: var(--row-accent-strong);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.project-description-kicker-line {
  width: 42px;
  height: 1px;
  background: var(--row-accent);
  opacity: 0.55;
}

.project-row-description {
  position: relative;
  z-index: 1;
  max-width: 58ch;
}

.project-row-case {
  grid-area: case;
  position: relative;
  z-index: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  gap: 0;
  overflow: visible;
  border: 0;
  border-top: 1px solid var(--row-border-strong);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.project-row-case:hover,
.project-row-case:focus-visible {
  transform: none;
  border-color: var(--border-strong);
  box-shadow: none;
}

.project-case-caption {
  position: absolute;
  top: -10px;
  inset-inline-end: 0;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 2px 8px;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--row-accent-strong);
}

.project-case-caption::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--row-accent);
}

.project-case-row {
  position: relative;
  display: grid;
  grid-template-columns: clamp(40px, 5vw, 64px) minmax(0, 1fr);
  align-items: start;
  gap: clamp(14px, 2vw, 24px);
  min-width: 0;
  min-height: 124px;
  padding: clamp(22px, 2.6vw, 30px) clamp(4px, 1vw, 12px) clamp(20px, 2.4vw, 28px);
}

.project-case-row + .project-case-row {
  border-inline-start: 0;
  border-top: 0;
}

.project-case-index {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  width: auto;
  height: auto;
  min-height: 68px;
  padding: 3px 8px 5px 0;
  border: 0;
  border-inline-end: 1px solid var(--row-border-strong);
  border-radius: 0;
  background: transparent;
  color: var(--row-accent-strong);
  font-family: var(--font-mono);
  transform: none;
}

.project-case-index::after {
  content: "↘";
  color: var(--row-accent);
  font-size: 0.72rem;
  line-height: 1;
}

.project-case-index-kind {
  color: var(--text-faint);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-case-index-number {
  font-size: clamp(1.15rem, 2vw, 1.7rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.02em;
}

.project-case-index:hover,
.project-case-index:focus-visible {
  border-color: var(--border-strong);
  background: transparent;
  color: var(--row-accent-strong);
  transform: none;
}

.project-case-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  padding-top: 1px;
  transition: transform 0.3s var(--ease);
}

.project-case-label {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.55;
}

.project-case-text {
  max-width: 42ch;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.95;
}

.project-case-copy::after {
  content: "";
  width: 28px;
  height: 1px;
  margin-top: 4px;
  background: var(--row-accent);
  opacity: 0.58;
}

@media (max-width: 768px) {
  .project-row-case {
    grid-template-columns: 1fr;
  }

  .project-case-row {
    grid-template-columns: 46px minmax(0, 1fr);
    min-height: 106px;
    padding-block: 20px;
  }

  .project-case-row + .project-case-row {
    border-top: 0;
  }
}

@media (max-width: 640px) {
  .project-case-row {
    grid-template-columns: 1fr;
    gap: 12px;
    min-height: 0;
    padding-block: 20px 22px;
  }

  .project-case-index {
    min-height: 0;
    padding: 0 0 8px;
    border-inline-end: 0;
    border-bottom: 1px solid var(--row-border-strong);
  }

  .project-case-copy {
    padding-top: 0;
  }

  .project-case-label,
  .project-case-text {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 400px) {
  .project-case-caption {
    inset-inline-end: 4px;
  }

  .project-case-row {
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: 0;
    padding-block: 18px 20px;
  }

  .project-case-index {
    min-height: 0;
    padding-bottom: 7px;
  }

  .project-case-label {
    font-size: 0.84rem;
  }

  .project-case-text {
    font-size: 0.82rem;
  }
}

.project-case-copy:hover,
.project-case-copy:focus-visible {
  transform: translateX(-3px);
}

.js-reveal .project-row.is-visible .project-case-caption {
  animation: case-drop 0.4s var(--ease) 0.06s backwards;
}

.js-reveal .project-row.is-visible .project-case-row {
  animation: case-rise 0.5s var(--ease) backwards;
}

.js-reveal .project-row.is-visible .project-case-row:nth-of-type(2) {
  animation-delay: 0.12s;
}

.js-reveal .project-row.is-visible .project-case-index {
  animation: chip-pop 0.45s var(--ease) 0.16s backwards;
}

.js-reveal .project-row.is-visible .project-case-row:nth-of-type(2) .project-case-index {
  animation-delay: 0.28s;
}

@keyframes case-drop {
  from { opacity: 0; transform: translateY(-6px); }
}

@keyframes case-rise {
  from { opacity: 0; transform: translateY(10px); }
}

@keyframes chip-pop {
  0%   { opacity: 0; transform: scale(0.6); }
  70%  { transform: scale(1.07); }
  100% { opacity: 1; transform: scale(1); }
}

.project-row-foot {
  grid-area: foot;
  z-index: 1;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  align-self: stretch;
  width: 100%;
  margin-inline: 0;
  gap: clamp(20px, 4vw, 64px);
  padding: clamp(6px, 1vw, 12px) 0;
}

.project-row-cta {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-height: 50px;
  padding-block: 9px;
  padding-inline: clamp(16px, 2vw, 24px) clamp(9px, 1vw, 12px);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--row-accent) 30%, transparent);
  border-radius: var(--radius-pill);
  background: var(--row-grad);
  color: var(--on-accent);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  box-shadow: 0 6px 16px var(--row-shadow);
  transition: box-shadow 0.2s var(--ease);
}

.project-row-cta--upcoming {
  opacity: 0.55;
}

.project-row-cta-arrow {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--on-accent-border);
  border-radius: 50%;
  background: var(--on-accent-surface);
  transition: background 0.25s var(--ease), color 0.25s var(--ease),
              transform 0.25s var(--ease), border-color 0.25s var(--ease);
}

.project-row-cta-arrow svg {
  display: block;
  width: 0.9em;
  height: 0.9em;
}

.project-row-cta:hover,
.project-row-cta:focus-visible {
  box-shadow:
    0 8px 22px var(--row-shadow),
    0 0 8px 1px color-mix(in srgb, var(--row-accent) 12%, transparent);
}

/* Fast back-and-forth wiggle for the arrow while hovering the CTA. */
.project-row-cta:hover .project-row-cta-arrow,
.project-row-cta:focus-visible .project-row-cta-arrow {
  animation: cta-arrow-wiggle 0.35s ease-in-out infinite;
}

@keyframes cta-arrow-wiggle {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  50% {
    transform: translateX(2px);
  }
  75% {
    transform: translateX(-2px);
  }
}

.project-row-body > [data-description-project] {
  grid-area: description;
  /* height follows content only, and the card centers against the build card on the side */
  align-self: center;
  width: 100%;
}

.project-row-side .project-row-build {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  /* height follows content only: no stretch to match description height */
  align-self: start;
  justify-content: center;
  cursor: default;
  padding: clamp(8px, 1.2vw, 14px) clamp(10px, 1.5vw, 18px);
  border: 1px solid var(--row-border);
  border-radius: var(--radius-md);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--row-accent) 5%, transparent), transparent 48%),
    linear-gradient(180deg, var(--surface-alt) 0%, var(--surface) 100%);
  box-shadow: var(--shadow-sm);
}

.project-row-side .project-row-build .project-build-strand {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding-block: 10px;
}

.project-row-side .project-row-build .project-build-strand + .project-build-strand {
  border-top: 1px solid var(--row-border);
}

.project-row-side .project-row-build .project-build-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
}  .project-row-side .project-row-build .project-build-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 16px;
  min-width: 0;
}  .project-row-side .project-row-build .project-build-system {
  min-width: 0;
  color: var(--row-accent-strong);
  font-size: clamp(0.86rem, 1.15vw, 1rem);
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}  .project-row-side .project-row-build .project-build-state {
  min-width: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.3;
  overflow-wrap: anywhere;
  text-align: end;
}

.project-row-side .project-row-build .project-build-strand[data-build-state="ready"] .project-build-state,
.project-row-side .project-row-build .project-build-strand[data-build-state="ready"] .project-build-code {
  color: var(--row-accent-strong);
}

.project-row-side .project-row-build .project-build-meter {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.project-row-side .project-row-build .project-build-seg {
  flex: 1;
  min-width: 0;
  height: 5px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
}

.project-row-side .project-row-build .project-build-seg.is-on {
  border-color: transparent;
  background: var(--row-grad);
  box-shadow: 0 0 8px color-mix(in srgb, var(--row-accent) 26%, transparent);
}

.project-row-side .project-row-build .project-build-code {
  margin-inline-start: auto;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

.js-reveal .project-row.is-visible .project-build-strand {
  animation: build-rise 0.55s var(--ease) 0.08s backwards;
}

.js-reveal .project-row.is-visible .project-build-strand:nth-of-type(2) {
  animation-delay: 0.16s;
}

.js-reveal .project-row.is-visible .project-build-seg {
  animation: build-seg-in 0.45s var(--ease) 0.28s backwards;
  transform-origin: right center;
}

.js-reveal .project-row.is-visible .project-build-seg:nth-of-type(2) {
  animation-delay: 0.36s;
}

.js-reveal .project-row.is-visible .project-build-seg:nth-of-type(3) {
  animation-delay: 0.44s;
}

@keyframes build-rise {
  from { opacity: 0; transform: translateY(8px); }
}

@keyframes build-seg-in {
  from { opacity: 0; transform: scaleX(0); }
}

.js-projects .projects-list {
  position: relative;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.45s var(--ease);
}

.js-projects .projects-list::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: clamp(80px, 10vw, 140px);
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--surface) 82%);
}

.js-projects .projects-list + .projects-expand {
  position: relative;
  z-index: 3;
}

.projects-expand {
  display: none;
}

.js-projects .projects-expand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-inline: auto;
  margin-top: clamp(20px, 3vw, 34px);
  padding: 6px 14px;
  border: none;
  background: none;
  color: var(--text);
  font-family: var(--font-sans);
  cursor: pointer;
}

.projects-expand-arrow {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  font-size: 1.15rem;
  color: var(--accent-strong);
  animation: expand-arrow-bob 2.4s var(--ease) infinite;
  transition: color 0.25s var(--ease);
}

.projects-expand-arrow svg {
  display: block;
  width: 1em;
  height: 1em;
  transform: rotate(-90deg); 
}

.projects-expand-label {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.25s var(--ease);
}

.projects-expand:hover .projects-expand-arrow,
.projects-expand:focus-visible .projects-expand-arrow {
  color: var(--accent);
}

.projects-expand:hover .projects-expand-label,
.projects-expand:focus-visible .projects-expand-label {
  color: var(--accent-strong);
}

@keyframes expand-arrow-bob {
  0%,
  100% { transform: translateY(-3px); }
  50%   { transform: translateY(3px); }
}

.projects-modal {
  position: fixed;
  inset: 0;
  z-index: 1200; 
  display: grid;
  place-items: center;
  padding: clamp(16px, 3vw, 40px);
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s var(--ease), visibility 0s linear 0.3s;
}

.projects-modal.is-open {
  visibility: visible;
  opacity: 1;
  transition: opacity 0.3s var(--ease);
}

.projects-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 26, 36, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

@supports not (backdrop-filter: blur(1px)) {
  .projects-modal-backdrop {
    background: rgba(23, 26, 36, 0.8);
    background-color: rgba(23, 26, 36, 0.8);
  }
}

.projects-modal-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(100%, 1100px);
  height: min(100%, 860px);
  max-width: 100%;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow:
    0 1px 2px rgba(23, 26, 36, 0.04),
    0 8px 24px rgba(23, 26, 36, 0.08),
    0 24px 56px rgba(23, 26, 36, 0.12);
  overflow: hidden;
  transform: translateY(24px) scale(0.98);
  opacity: 0;
  transition: transform 0.45s var(--ease), opacity 0.3s var(--ease);
}

.projects-modal.is-open .projects-modal-panel {
  transform: none;
  opacity: 1;
}

.projects-modal-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}

.projects-modal-title {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent-strong);
}

.projects-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  outline: 0;
  transition: color 0.22s var(--ease),
              background 0.22s var(--ease),
              border-color 0.22s var(--ease),
              transform 0.28s var(--ease),
              box-shadow 0.22s var(--ease);
}

.projects-modal-close-icon {
  width: 14px;
  height: 14px;
  pointer-events: none;
  transition: transform 0.28s var(--ease);
}

.projects-modal-close:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: var(--accent-tint);
  transform: scale(1.1);
}

.projects-modal-close:hover .projects-modal-close-icon {
  transform: rotate(90deg);
}

.projects-modal-close:focus-visible {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: var(--accent-tint);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
}

.projects-modal-close:active {
  transform: scale(0.92);
  transition-duration: 0.1s;
}

.projects-modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(18px, 2.5vw, 32px) clamp(14px, 2vw, 28px);
}

.projects-modal-body {
  direction: ltr; 
  scrollbar-width: thin;
  scrollbar-color: var(--accent-strong) transparent; 
}

.projects-modal-body .projects-modal-list {
  direction: rtl; 
}

.projects-modal-body::-webkit-scrollbar {
  width: 10px;
}

.projects-modal-body::-webkit-scrollbar-button {
  display: none;
}

.projects-modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.projects-modal-body::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  
  background: linear-gradient(
    135deg,
    var(--modal-sb-from, rgba(59, 91, 253, 0.45)),
    var(--modal-sb-to, rgba(44, 63, 214, 0.45))
  );
  background-clip: padding-box;
  transition: background 0.08s linear;
}

.projects-modal-body::-webkit-scrollbar-thumb:hover,
.projects-modal-body::-webkit-scrollbar-thumb:active {
  background: linear-gradient(
    135deg,
    var(--modal-sb-from-hover, var(--modal-sb-from, #3b5bfd)),
    var(--modal-sb-to-hover, var(--modal-sb-to, #2c3fd6))
  );
  background-clip: padding-box;
}

.projects-modal-list {
  list-style: none;
  max-width: var(--container-max);
  margin-inline: auto;
}

.projects-modal .project-row {
  opacity: 1;
  transform: none;
  transition: none;
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 1100px) {
  .project-row-link {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "body"
      "foot";
    gap: 20px 24px;
  }

  .project-row-body {
    width: 100%;
    max-width: 760px;
    margin-inline: auto;
    align-self: start;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(28px, 4vw, 56px) clamp(20px, 2.8vw, 34px);
    align-items: start;
  }

  .project-row-side {
    gap: clamp(28px, 4vw, 56px);
  }

  .project-row-foot {
    max-width: 760px;
    margin-inline: auto;
  }
}

@media (max-width: 768px) {
  .project-row-case {
    grid-template-columns: 1fr;
  }

  .project-case-row + .project-case-row {
    border-inline-start: none;
    border-top: 0;
  }
}

@media (max-width: 640px) {
  
  .js-filter .projects-filter-note {
    flex: 0 0 auto;
    min-height: 32px;
    margin-inline-end: 2px;
  }

  .js-filter .projects-filter-btn {
    flex: 0 0 auto;
    padding: 0 0.95em;
    font-size: 0.85rem;
  }

  .project-row-link {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "body"
      "foot";
    align-items: start;
    gap: 12px;
    padding-block: 28px;
  }

  .project-row-title {
    width: 100%;
    margin-block-start: 22px;
    padding: 18px 8px 22px;
  }

  .project-row-title-no {
    font-size: 7.5rem;
  }

  .project-row-title-folio {
    gap: 8px;
    margin-bottom: 12px;
  }

  .project-row-title-folio-type,
  .project-row-title-folio-no {
    font-size: 0.72rem;
    letter-spacing: 0.16em;
  }

  .project-row-title-text {
    font-size: clamp(1.9rem, 9vw, 2.8rem);
    line-height: 1.3;
  }

  .project-row-title-baseline {
    width: 96px;
    margin-top: 14px;
  }

  .project-row-body {
    width: 100%;
    max-width: none;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "head"
      "side"
      "description"
      "case";
    column-gap: 0;
    row-gap: clamp(20px, 2.8vw, 34px);
  }

  .project-row-side {
    gap: clamp(20px, 2.8vw, 34px);
  }

  .project-row-foot {
    align-items: stretch;
    gap: 14px;
    padding-top: 14px;
  }

.project-row-cta {
  margin-inline: 0;
  width: 100%;
  justify-content: space-between;
  padding-inline: clamp(16px, 2vw, 24px) clamp(9px, 1vw, 12px);
}

}

@media (max-width: 400px) {
  .projects {
    padding-inline: var(--page-gutter);
  }

  .projects-modal {
    padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  }

  .projects-modal-bar {
    padding-inline: 14px;
  }

  .projects-modal-body {
    padding-inline: 10px;
  }

  .project-row-link {
    padding-block: 24px;
  }

  .project-case-caption {
    inset-inline-end: 12px;
  }

  .project-case-row {
    gap: 12px;
    padding: 18px 16px;
  }

  .project-row-cta {
    padding-inline-start: 18px;
    font-size: 0.9rem;
  }

  .project-row-side .project-row-build {
    padding: 8px 10px;
  }

  .project-row-side .project-row-build .project-build-system {
    font-size: 0.9rem;
  }

  .project-row-side .project-row-build .project-build-state {
    font-size: 0.78rem;
  }

  .project-row-side .project-row-build .project-build-strand {
    gap: 8px;
    padding-block: 8px;
  }

  .project-description-wrapper {
    --description-rail: 68px;
  }

  .project-description-content {
    padding: 16px;
  }

  .project-description-kicker {
    margin-bottom: 10px;
  }
}

/* Rebuilt filter controls: compact category chips that size themselves to the
   label instead of forcing every button into a tall fixed-height box. */
.js-filter .projects-filter-btn {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: auto;
  height: auto;
  min-height: 0;
  padding: 8px 26px 8px 14px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border-strong));
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-alt) 92%, var(--accent-tint));
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #ffffff 78%, transparent),
    0 2px 0 color-mix(in srgb, var(--border-strong) 58%, transparent);
  transition:
    transform 0.24s var(--ease-spring),
    background 0.24s var(--ease),
    border-color 0.24s var(--ease),
    color 0.24s var(--ease),
    box-shadow 0.24s var(--ease);
}

.js-filter .projects-filter-btn::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  inset-block-end: 0;
  width: 100%;
  height: 2px;
  border: 0;
  border-radius: 0;
  background: var(--gradient);
  opacity: 0;
  transform: scaleX(0);
  transform-origin: right center;
  transition: opacity 0.24s var(--ease), transform 0.34s var(--ease-out);
}

.js-filter .projects-filter-btn::after {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: -70%;
  width: 54%;
  border: 0;
  border-radius: 0;
  background: linear-gradient(105deg, transparent, color-mix(in srgb, #ffffff 48%, transparent), transparent);
  opacity: 0;
  pointer-events: none;
  transform: skewX(-18deg);
  transition: opacity 0.18s var(--ease), inset-inline-start 0.55s var(--ease-out);
}

.js-filter .projects-filter-btn:hover {
  transform: none;
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-tint-strong) 72%, var(--surface-alt));
  color: var(--accent-strong);
  box-shadow:
    inset 0 -2px 0 var(--accent),
    inset 0 1px 0 color-mix(in srgb, #ffffff 88%, transparent),
    0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}

.js-filter .projects-filter-btn:hover::before {
  opacity: 1;
  transform: scaleX(1);
}

.js-filter .projects-filter-btn:hover::after {
  inset-inline-start: 120%;
  opacity: 1;
}

.js-filter .projects-filter-btn:focus-visible {
  transform: none;
  border-color: var(--accent);
  outline: none;
  box-shadow:
    0 0 0 3px var(--surface),
    0 0 0 5px color-mix(in srgb, var(--accent) 68%, transparent),
    inset 0 -2px 0 var(--accent);
}

.js-filter .projects-filter-btn.is-active {
  border-color: var(--accent-strong);
  background: var(--gradient);
  color: var(--on-accent);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #ffffff 42%, transparent),
    0 3px 0 color-mix(in srgb, var(--accent-strong) 64%, #263b9f),
    0 9px 18px color-mix(in srgb, var(--accent) 24%, transparent);
}

.js-filter .projects-filter-btn.is-active::before {
  background: var(--on-accent);
  opacity: 0.9;
  transform: scaleX(1);
}

.js-filter .projects-filter-btn.is-active::after {
  background: linear-gradient(105deg, transparent, color-mix(in srgb, #ffffff 34%, transparent), transparent);
}

.js-filter .projects-filter-btn.is-active:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--on-accent) 78%, var(--accent));
  color: var(--on-accent);
  box-shadow:
    inset 0 -2px 0 var(--on-accent),
    inset 0 1px 0 color-mix(in srgb, #ffffff 58%, transparent),
    0 0 0 1px color-mix(in srgb, var(--on-accent) 24%, transparent),
    0 10px 20px color-mix(in srgb, var(--accent) 22%, transparent);
}

.js-filter .projects-filter-btn.is-animating {
  opacity: 0;
  transform: translateY(10px) scale(0.96);
  transform-origin: center bottom;
  animation: filter-button-in 0.5s var(--ease-spring) forwards;
}

.js-filter .projects-filter-btn.is-active.is-animating {
  animation-name: filter-button-active-in;
}

@keyframes filter-button-in {
  0% { opacity: 0; transform: translateY(10px) scale(0.96); }
  70% { opacity: 1; transform: translateY(-2px) scale(1.02); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes filter-button-active-in {
  0% { opacity: 0; transform: translateY(10px) scale(0.96); }
  70% { opacity: 1; transform: translateY(-3px) scale(1.02); }
  100% { opacity: 1; transform: translateY(-1px) scale(1); }
}

@media (max-width: 900px) {
  .js-filter .projects-filter-btn {
    min-height: 0;
    padding: 7px 24px 7px 12px;
  }
}

@media (max-width: 640px) {
  .js-filter .projects-filter-btn {
    min-height: 0;
    padding: 7px 22px 7px 11px;
    font-size: 0.82rem;
  }
}

/* Final filter control design: minimal tabs instead of raised cards or pills. */
.js-filter .projects-filter-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: auto;
  height: auto;
  min-height: 0;
  margin: 0;
  padding: 9px 14px 8px;
  overflow: visible;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  cursor: pointer;
  outline: none;
  box-shadow: none;
  appearance: none;
  transition:
    color 0.2s var(--ease),
    background-color 0.2s var(--ease),
    border-color 0.2s var(--ease);
}

.js-filter .projects-filter-btn::before {
  display: none;
  content: none;
}

.js-filter .projects-filter-btn::after {
  content: "";
  position: absolute;
  inset-inline: 14px;
  inset-block-end: -2px;
  display: block;
  width: auto;
  height: 2px;
  border: 0;
  border-radius: 0;
  background: var(--accent);
  opacity: 0;
  pointer-events: none;
  transform: scaleX(0);
  transform-origin: right center;
  transition: opacity 0.2s var(--ease), transform 0.28s var(--ease-out);
}

.js-filter .projects-filter-btn:hover {
  transform: none;
  border-color: transparent;
  background: var(--accent-tint);
  color: var(--accent-strong);
  box-shadow: none;
}

.js-filter .projects-filter-btn:hover::after {
  opacity: 0.45;
  transform: scaleX(0.45);
}

.js-filter .projects-filter-btn:focus-visible {
  transform: none;
  border-color: transparent;
  background: var(--accent-tint);
  color: var(--accent-strong);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: none;
}

.js-filter .projects-filter-btn.is-active {
  transform: none;
  border-color: transparent;
  background: transparent;
  color: var(--accent-strong);
  box-shadow: none;
}

.js-filter .projects-filter-btn.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.js-filter .projects-filter-btn.is-active:hover {
  transform: none;
  border-color: transparent;
  background: var(--accent-tint);
  color: var(--accent-strong);
  box-shadow: none;
}

.js-filter .projects-filter-btn.is-animating {
  opacity: 0;
  transform: translateY(6px);
  animation: filter-tab-in 0.34s var(--ease-out) forwards;
}

.js-filter .projects-filter-btn.is-active.is-animating {
  animation-name: filter-tab-active-in;
}

@keyframes filter-tab-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes filter-tab-active-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .js-filter .projects-filter-btn {
    padding: 8px 12px 7px;
    font-size: 0.84rem;
  }
}

@media (max-width: 640px) {
  .js-filter .projects-filter-btn {
    padding: 7px 10px 6px;
    font-size: 0.8rem;
  }
}

/* Projects motion stays active even when the device has animations turned off
   (prefers-reduced-motion) — see base.css note. */
