/* =============================================
   PROJECTS SECTION
   ============================================= */

/* Zero-padded Devanagari numerals for the card index: ०१, ०२ … */
@counter-style deva-pad {
  system: extends devanagari;
  pad: 2 '०';
}

/* Bento grid: the featured project runs full width on top and the
   GitHub strip closes the grid, so no row is ever left half-empty */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
  counter-reset: project;
}

.project-card {
  --px: 0;              /* pointer across the card, -0.5 … 0.5 (set in motion.js) */
  --py: 0;
  --lift: 1;
  --tilt-x: -9deg;
  --tilt-y: 11deg;
  position: relative;
  counter-increment: project;
  /* Frosted glass: the 3D body glows softly through */
  background: rgba(23, 25, 30, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--ash-15);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: perspective(1000px) rotateX(calc(var(--py) * var(--tilt-x))) rotateY(calc(var(--px) * var(--tilt-y))) scale(var(--lift));
  transition: transform 0.6s var(--ease-out), border-color 0.25s ease, box-shadow 0.25s ease,
    opacity 0.25s ease, filter 0.25s ease;
  will-change: transform;
}

/* Follow the pointer closely while it is on the card */
.project-card.is-tilting {
  --lift: 1.02;
  transition: transform 0.12s linear, border-color 0.25s ease, box-shadow 0.25s ease,
    opacity 0.25s ease, filter 0.25s ease;
}

.project-card:hover {
  border-color: rgba(192, 138, 46, 0.45);
  box-shadow: 0 26px 50px -20px rgba(0, 0, 0, 0.75), 0 12px 36px -12px rgba(179, 58, 58, 0.3);
}

/* ── Flashlight border: the cursor lights the edges of every nearby card
   (positions set per card by cards.js while the pointer is over the grid) ── */
.project-card::before,
.project-more::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 5;
  padding: 1.5px;
  border-radius: inherit;
  background: radial-gradient(
    360px circle at var(--fx, -999px) var(--fy, -999px),
    rgba(244, 211, 140, 0.9),
    rgba(179, 58, 58, 0.45) 35%,
    transparent 65%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.projects-grid.is-lit .project-card::before,
.projects-grid.is-lit .project-more::before {
  opacity: 1;
}

/* ── Holographic foil: a gold sheen that slides against the tilt ── */
.project-card::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 4;
  border-radius: inherit;
  background:
    radial-gradient(
      380px circle at calc(50% + var(--px) * 100%) calc(50% + var(--py) * 100%),
      rgba(255, 233, 190, 0.14),
      transparent 50%
    ),
    linear-gradient(
      115deg,
      transparent 30%,
      rgba(244, 211, 140, 0.12) 42%,
      rgba(179, 58, 58, 0.12) 50%,
      rgba(192, 138, 46, 0.14) 58%,
      transparent 70%
    );
  background-size: 100% 100%, 300% 300%;
  background-position: 0 0, calc(50% - var(--px) * 140%) calc(50% - var(--py) * 140%);
  mix-blend-mode: screen;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.project-card:hover::after {
  opacity: 1;
}

/* Kept for the hero badge's border beam (hero.css) */
@keyframes border-beam-sweep {
  0% {
    background-position: 0% 0%;
  }
  50% {
    background-position: 100% 100%;
  }
  100% {
    background-position: 0% 0%;
  }
}

/* Dimmed state when a ticker filter doesn't match this card */
.project-card.filtered-out {
  opacity: 0.28;
  filter: grayscale(0.6);
  transform: scale(0.98) !important;
}

/* js/deal.js: cards stay off the table until their row is dealt */
.project-card.is-undealt,
.project-more.is-undealt {
  opacity: 0;
}

/* ── Thumbnail: a window the image drifts behind as the card tilts ── */
.project-img-wrap {
  position: relative;
  width: 100%;
  height: 160px;
  overflow: hidden;
  flex-shrink: 0;
}

.project-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: scale(1.06);
  transition: transform 0.6s var(--ease-out);
  display: block;
}

.project-card:hover .project-img-wrap img {
  transform: scale(1.14) translate(calc(var(--px) * -16px), calc(var(--py) * -12px));
}

/* Dark gradient overlay */
.project-img-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom,
      rgba(14, 15, 17, 0.25) 0%,
      rgba(14, 15, 17, 0.55) 100%);
  transition: background 0.3s ease;
}

.project-card:hover .project-img-wrap::after {
  background: linear-gradient(to bottom,
      rgba(14, 15, 17, 0.1) 0%,
      rgba(179, 58, 58, 0.2) 50%,
      rgba(14, 15, 17, 0.55) 100%);
}

/* Devanagari index numeral, etched in gold. It drifts opposite to the
   image on tilt, so it seems to float above the thumbnail. */
.project-img-wrap::before {
  content: counter(project, deva-pad);
  content: counter(project, deva-pad) / '';
  position: absolute;
  top: 8px;
  right: 14px;
  z-index: 2;
  font-family: 'Tiro Devanagari Hindi', var(--font-display);
  font-size: 2.6rem;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(244, 211, 140, 0.65);
  pointer-events: none;
  transition: color 0.35s ease, transform 0.6s var(--ease-out);
}

.project-card:hover .project-img-wrap::before {
  color: rgba(244, 211, 140, 0.92);
  transform: translate(calc(var(--px) * 10px), calc(var(--py) * 8px));
}

/* Live badge, top-left of thumbnail */
.project-img-wrap .project-badge {
  position: absolute;
  top: var(--sp-3);
  left: var(--sp-3);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(14, 15, 17, 0.75);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(192, 138, 46, 0.3);
  border-radius: var(--r-md);
  padding: 4px 9px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.project-card:hover .project-badge {
  opacity: 1;
  transform: translateY(0);
}

.project-badge .icon {
  width: 10px;
  height: 10px;
  animation: badge-spin 3s linear infinite;
}

@keyframes badge-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.project-card-body {
  position: relative;
  z-index: 2;
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  flex: 1;
}

.project-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: 2px;
}

.project-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--chalk);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.project-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.project-link-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  border: 1px solid var(--ash-15);
  color: var(--ash);
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s var(--ease-out), background 0.2s ease;
}

.project-link-icon:hover {
  color: var(--gold);
  border-color: var(--gold);
  background: var(--gold-10);
  transform: rotate(8deg) scale(1.08);
}

.project-link-icon.project-link-live {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.08);
}

.project-link-icon.project-link-live:hover {
  color: #10b981;
  border-color: #34d399;
  background: rgba(52, 211, 153, 0.2);
  transform: rotate(8deg) scale(1.08);
}

.project-link-icon svg {
  width: 14px;
  height: 14px;
}

.project-live-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: var(--sp-2);
  padding: 6px 12px;
  border-radius: var(--r-md);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #34d399;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.25);
  transition: all 0.2s ease;
  width: fit-content;
  text-decoration: none;
}

.project-live-action:hover {
  background: rgba(52, 211, 153, 0.16);
  border-color: rgba(52, 211, 153, 0.5);
  color: #6ee7b7;
  transform: translateY(-1px);
}

.project-live-action svg {
  width: 13px;
  height: 13px;
}

.live-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px #34d399;
  animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-ring {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.85); }
}

.project-desc {
  font-size: var(--text-sm);
  color: var(--ash);
  line-height: 1.6;
  flex: 1;
  margin: 0;
}

.project-stack {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-1);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--ash-10);
}

.stack-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--ash);
  background: var(--ink);
  border: 1px solid var(--ash-15);
  border-radius: var(--r-md);
  padding: 3px 8px;
  letter-spacing: 0.01em;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.stack-tag .icon {
  width: 11px;
  height: 11px;
  color: var(--gold);
  flex-shrink: 0;
}

.project-card:hover .stack-tag {
  border-color: rgba(192, 138, 46, 0.3);
  color: var(--chalk);
}

/* =============================================
   FEATURED PROJECT (full-width banner card)
   ============================================= */

.project-card.is-featured {
  grid-column: 1 / -1;
  /* a wide card needs a gentler tilt to stay readable */
  --tilt-x: -3deg;
  --tilt-y: 3.5deg;
}

/* The Galla banner is 2.5:1 with its content in the middle band, so a
   shorter window crops only empty margin */
.is-featured .project-img-wrap {
  height: clamp(220px, 24vw, 300px);
}

.is-featured .project-img-wrap::after {
  background: linear-gradient(to bottom, transparent 55%, rgba(14, 15, 17, 0.55) 100%);
}

.project-card.is-featured:hover .project-img-wrap::after {
  background: linear-gradient(to bottom, rgba(179, 58, 58, 0.06) 0%, transparent 50%, rgba(14, 15, 17, 0.55) 100%);
}

/* The Galla banner carries its own "live" pill and fills every corner, so
   the featured card skips the badge and the numeral (grid cards count ०१ …) */
.project-card.is-featured {
  counter-increment: none;
}

.is-featured .project-img-wrap::before,
.is-featured .project-badge {
  display: none;
}

.project-card.is-featured:hover .project-img-wrap img {
  transform: scale(1.08) translate(calc(var(--px) * -12px), calc(var(--py) * -8px));
}

/* Copy on the left, stack and actions on the right */
.is-featured .project-card-body {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  grid-template-areas:
    'eyebrow eyebrow'
    'top     top'
    'desc    stack'
    'desc    live';
  column-gap: var(--sp-10);
  row-gap: var(--sp-3);
  padding: var(--sp-6) var(--sp-8) var(--sp-8);
}

.is-featured .project-eyebrow { grid-area: eyebrow; }
.is-featured .project-card-top { grid-area: top; align-items: center; }
.is-featured .project-desc { grid-area: desc; font-size: var(--text-base); max-width: 58ch; }
.is-featured .project-live-action { grid-area: live; align-self: start; margin-top: 0; }

.is-featured .project-stack {
  grid-area: stack;
  align-self: start;
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.is-featured .project-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 2.6vw, 2.25rem);
  font-weight: 500;
  line-height: 1.1;
}

.project-eyebrow {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

.project-eyebrow::before {
  content: '';
  width: 20px;
  height: 1px;
  background: linear-gradient(90deg, var(--signal), var(--gold));
}

/* =============================================
   "MORE ON GITHUB" STRIP
   ============================================= */

.project-more {
  position: relative;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: var(--sp-8);
  padding: var(--sp-6) var(--sp-8);
  border: 1px dashed rgba(192, 138, 46, 0.35);
  border-radius: var(--r-lg);
  background:
    radial-gradient(420px circle at 12% 50%, rgba(179, 58, 58, 0.16), transparent 70%),
    rgba(14, 15, 17, 0.45);
  color: var(--chalk);
  transition: border-color 0.3s ease, transform 0.4s var(--ease-out), box-shadow 0.3s ease;
}

.project-more:hover {
  border-style: solid;
  border-color: rgba(192, 138, 46, 0.6);
  transform: translateY(-3px);
  box-shadow: 0 18px 40px -18px rgba(179, 58, 58, 0.45);
}

/* Miniature temple arch with a bead on a tilted orbit, echoing the hero */
.more-arch {
  position: relative;
  flex-shrink: 0;
  width: 58px;
  height: 74px;
  display: grid;
  place-items: center;
  margin: 0 var(--sp-3);
  border: 1px solid var(--gold-30);
  border-radius: 50% 50% 8px 8px / 39% 39% 8px 8px;
  color: var(--gold);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.more-arch svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.more-orbit {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 104px;
  height: 104px;
  margin: -52px 0 0 -52px;
  border-radius: 50%;
  border: 1px solid rgba(192, 138, 46, 0.18);
  animation: more-orbit 7s linear infinite;
  pointer-events: none;
}

.more-orbit::before {
  content: '';
  position: absolute;
  top: -3px;
  left: 50%;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  border-radius: 50%;
  background: var(--gold-hover);
  box-shadow: 0 0 10px var(--gold);
}

@keyframes more-orbit {
  from { transform: rotateX(68deg) rotateZ(0deg); }
  to { transform: rotateX(68deg) rotateZ(360deg); }
}

.project-more:hover .more-arch {
  border-color: var(--gold);
  box-shadow: 0 0 26px -4px rgba(192, 138, 46, 0.5), inset 0 0 18px -6px rgba(192, 138, 46, 0.45);
}

.project-more:hover .more-orbit {
  animation-duration: 2.5s;
}

.more-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.more-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 500;
  line-height: 1.2;
}

.more-sub {
  font-size: var(--text-sm);
  color: var(--ash);
}

.more-cta {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gold);
}

.more-cta svg {
  width: 14px;
  height: 14px;
  transition: transform 0.3s var(--ease-out);
}

.project-more:hover .more-cta svg {
  transform: translateX(4px);
}
