/* ════════════════════════════════════════════════
   PROJECT CARD — EXPANDED PANEL
   Append this to the bottom of styles.css
   ════════════════════════════════════════════════ */

/* When a card is in expanded state, lock its scale + style */
/* Expand the wrap horizontally using margins — unlike scale(), this affects
   layout flow so adjacent cards maintain consistent spacing */
.project-card-wrap:has(.project-card.is-expanded) {
  margin-left: -3%;
  margin-right: -3%;
  transition: margin 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-card-wrap {
  transition: margin 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-card.is-expanded {
  transform: none !important;
  opacity: 1 !important;
  border-color: rgba(255,255,255,0.28) !important;
  background: rgba(255,255,255,0.07) !important;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent !important;
  cursor: pointer;          /* was: default */
}

/* Hold the card's connected-border look while the panel is animating closed */
.project-card.is-collapsing {
  border-bottom-left-radius: 0;        /* no !important */
  border-bottom-right-radius: 0;
  border-bottom-color: transparent !important;
}


/* Subtle background shift on hover to reinforce clickability */
.project-card.is-expanded:hover {
  background: rgba(255,255,255,0.10) !important;
}

/* Keep preview image bright when expanded (same as .active) */
.project-card.is-expanded .project-preview img {
  filter: blur(0px) brightness(1);
}

/* Hide the "Read More" hint when expanded */
.project-card.is-expanded ~ .project-read-more {
  opacity: 0 !important;
  pointer-events: none;
}

/* ── Expanded panel container (grid trick for smooth height) ── */
.project-expanded {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.6s ease,
              background-color 0.6s ease;
  border: 1px solid transparent;
  border-top: none;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  overflow: hidden;
}

.project-expanded.open {
  grid-template-rows: 1fr;
  border-color: rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.035);
}

/* Inner wrapper — min-height:0 is required for the grid trick */
.expand-inner {
  min-height: 0;
  overflow: hidden;
}

/* ── Toolbar (GitHub link + Minimize button) ── */
.expand-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 35px 0;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 18px;
  margin-bottom: 0;
}

.expand-github-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg);
  text-decoration: none;
  border: 1px solid var(--card-border);
  border-radius: 5px;
  padding: 8px 18px;
  background: rgba(255,255,255,0.04);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.expand-github-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.28);
}

.expand-github-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.75;
}

.expand-minimize-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 0;
  opacity: 0.55;
  transition: opacity 0.2s, color 0.2s;
  font-family: 'Work Sans', sans-serif;
}

.expand-minimize-btn:hover {
  opacity: 1;
  color: var(--fg);
}

.expand-minimize-btn svg {
  width: 14px;
  height: 14px;
}

/* ── Body content ── */
.expand-body {
  padding: 36px 35px 40px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

/* ── Individual content sections ── */
.expand-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.expand-section h4 {
  font-size: 13px;
  font-weight: 300;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
}

.expand-section p {
  font-size: 16px;
  line-height: 1.85;
  color: var(--muted);
  font-weight: 200;
}

.expand-section p + p {
  margin-top: 25px;
}

/* ── Two-column image + text layout ── */
.expand-media-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  align-items: start;
}

.expand-media-row.media-wide {
  grid-template-columns: 3fr 2fr;
}

@media (max-width: 640px) {
  .expand-media-row { grid-template-columns: 1fr; }
}

/* ── Figure / image with caption ── */
.expand-figure {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.expand-figure img {
  width: 100%;
  border-radius: 7px;
  border: 1px solid var(--card-border);
  object-fit: cover;
  display: block;
  filter: grayscale(10%);
  transition: filter 0.3s ease;
}

.expand-figure img:hover {
  filter: grayscale(0%);
}

.expand-figure figcaption {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.3);
  font-weight: 300;
  line-height: 1.5;
  text-align: center;  /* ← add this */
}

/* ── Full-width image ── */
.expand-figure.full-width img {
  max-height: 340px;
  object-fit: cover;
}

/* ── Inline tag row within expand content ── */
.expand-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

/* ── Divider ── */
.expand-divider {
  height: 1px;
  background: var(--card-border);
  border: none;
  margin: 0;
}

/* ── Fade-in animation when panel opens ── */
.project-expanded.open .expand-inner {
  animation: expand-fade-in 0.45s ease 0.15s both;
}

@keyframes expand-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Fade-out animation when panel closes ── */
.project-expanded.is-closing .expand-inner {
  animation: expand-fade-out 0.4s ease both;
}

@keyframes expand-fade-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(8px); }
}