/* Projects page — project cards and media galleries */
body {
  min-height: 100vh;
  padding: 3rem 1.5rem;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
}

header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 3.5rem;
}

.back {
  color: #A855F7;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  border: 1px solid #7C3AED;
  padding: 0.4rem 1rem;
  border-radius: 2rem;
  transition: background 0.2s, box-shadow 0.2s;
}
.back:hover {
  background: rgba(124, 58, 237, 0.15);
  box-shadow: 0 0 18px rgba(124, 58, 237, 0.4);
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, #F0ABFC, #A855F7, #818CF8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.projects {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.project-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  align-items: center;
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: 1.2rem;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(4px);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.project-card:hover {
  border-color: rgba(168, 85, 247, 0.6);
  box-shadow: 0 0 40px rgba(168, 85, 247, 0.15);
}

.project-card:nth-child(even) { direction: rtl; }
.project-card:nth-child(even) > * { direction: ltr; }

.project-info {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.project-info h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #E9D5FF;
}

.project-info p {
  font-size: 0.97rem;
  line-height: 1.7;
  color: #fff;
}

.project-info p a {
  color: #C084FC;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.project-info p a:hover {
  color: #E9D5FF;
}

.project-info p.project-subtitle {
  font-size: 1.05rem;
  font-style: italic;
  color: #E9D5FF;
}

.venue {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0.04em;
}

.wip-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.25rem 0.75rem;
  border-radius: 2rem;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #FCD34D;
  text-transform: uppercase;
}

.materials {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.tag {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.8rem;
  border-radius: 2rem;
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.35);
  color: #C084FC;
}

/* ── Media switcher ── */
.project-media {
  display: flex;
  flex-direction: column;
  align-self: stretch;   /* fill full card height, flush to all edges */
  background: linear-gradient(135deg,
    rgba(59, 7, 100, 0.5),
    rgba(76, 29, 149, 0.5),
    rgba(45, 11, 107, 0.5));
}
.media-display {
  position: relative;
  flex: 1;               /* grow to fill card height above the thumb strip */
  min-height: 0;
  width: 100%;
  overflow: hidden;
  background: transparent; /* gradient shows through letterbox areas */
}
.media-item {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;   /* never crop — photos and videos shown in full */
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.media-item.active {
  opacity: 1;
  pointer-events: auto;
}

/* ── Loading spinner ── */
.media-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.media-display.loading .media-spinner { opacity: 1; }
.media-spinner img {
  width: 52px;
  height: 52px;
  animation: media-spin 1.1s linear infinite;
  filter: drop-shadow(0 0 12px rgba(168, 85, 247, 0.75));
}
@keyframes media-spin { to { transform: rotate(360deg); } }
.media-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.45);
  justify-content: center;
}
.media-thumb {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 8px;
  border: 2px solid rgba(124, 58, 237, 0.3);
  overflow: hidden;
  cursor: pointer;
  background: rgba(59, 7, 100, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}
.media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* Video thumbnail: captured frame sits behind the play icon */
.thumb-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.thumb-preview.loaded { opacity: 1; }
.media-thumb svg {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 18px;
  color: rgba(255, 255, 255, 0.9);
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.85));
}
.media-thumb.active {
  border-color: #A855F7;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.6);
}
.media-thumb:hover:not(.active) {
  border-color: rgba(168, 85, 247, 0.55);
  transform: scale(1.07);
}

/* On desktop, project-body is transparent to the flex layout —
   its children (p, .venue, .materials) appear as direct flex
   children of project-info, preserving the existing gap/padding */
.project-body {
  display: contents;
}

@media (max-width: 620px) {
  .project-card,
  .project-card:nth-child(even) {
    grid-template-columns: 1fr;
    direction: ltr;
  }

  /* Fixed ratio for media display in single-column layout */
  .media-display {
    flex: none;
    aspect-ratio: 4 / 3;
  }
}
