:root {
  --bg: #ffffff;
  --text: #1a1a1a;
  --gray: #f5f5f5;
  --gray-dark: #666;
  --border: #eaeaea;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

nav {
  display: flex;
  justify-content: space-between;
  padding: 1rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}

.site-title {
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
}

.nav-link {
  text-decoration: none;
  color: var(--gray-dark);
}

/* Project Grid */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.project-card {
  text-decoration: none;
  color: inherit;
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s;
}

.project-card .card-thumbnail {
  position: relative;
  width: 100%;
  aspect-ratio: 1/1;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  background-color: #0a0a0a; /* Fallback */
  display: flex;
  align-items: center;  /* Vertical centering */
  justify-content: center; /* Horizontal centering */
}

.project-card .card-thumbnail::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: inherit; /* Inherits from parent div */
  background-size: cover;
  background-position: center;
  filter: blur(24px) brightness(0.6) saturate(1.5);
  transform: scale(1.2); /* Hides blur edges */
  transition: filter 0.3s ease;
}

/* Slight intensify on hover */
.project-card:hover .card-thumbnail::before {
  filter: blur(20px) brightness(0.5) saturate(1.8);
}

.project-card:hover {
  transform: translateY(-4px);
}

/* Actual thumbnail image */
.card-thumbnail img {
  position: relative;
  z-index: 3;
  display: block;
  margin-left: auto;  /* Explicit */
  margin-right: auto; /* Explicit */
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Landscape - full width */
.project-card.landscape .card-thumbnail img {
  width: 100%;
  height: auto;
  max-height: none; /* Override the max-height */
}

/* Portrait & Vertical - full height */
.project-card.portrait .card-thumbnail img,
.project-card.vertical .card-thumbnail img {
  width: auto;
  height: 100%;
  max-width: none; /* Override the max-width */
}

.project-card .card-thumbnail::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0) 70%,
    rgba(0,0,0,0.1) 100%
  );
  z-index: 2;
  pointer-events: none;
}

.card-content {
  padding: 1rem 0;
}

.card-content h3 {
  font-size: 1.2rem;
  margin-bottom: 0.25rem;
}

.client {
  color: var(--gray-dark);
  font-size: 0.9rem;
}

.card-meta {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--gray-dark);
}

.type-tag {
  background: var(--gray);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

/* Filter Nav */
.filter-nav {
  display: flex;
  gap: 0.5rem;
  margin: 2rem 0 1rem;
}

.filter-btn {
  padding: 0.5rem 1rem;
  background: var(--gray);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}

.filter-btn.active {
  background: var(--text);
  color: white;
}

/* Case Study Layout */
.case-study {
  max-width: 1000px;
  margin: 0 auto;
}

.back-link {
  display: inline-block;
  margin-bottom: 2rem;
  color: var(--gray-dark);
  text-decoration: none;
}

.project-header {
  margin: 2rem 0;
}

.project-meta {
  display: flex;
  gap: 2rem;
  margin: 1rem 0;
  color: var(--gray-dark);
}

.project-tags {
  display: flex;
  gap: 0.5rem;
}

.tag {
  background: var(--gray);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
}

.project-description {
  font-size: 1.1rem;
  line-height: 1.8;
}

/* Video Container - SINGLE SOURCE OF TRUTH */
.video-container {
  margin: 2rem auto;
  border-radius: 8px;
  background: none;
  width: 100%;
  display: flex;
  justify-content: center;
}

/* Orientation labels */
.video-container::after {
  content: "";
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0,0,0,0.6);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.2s;
}

.video-container:hover::after {
  opacity: 1;
}

.video-container.landscape::after {
  content: "16:9";
}

.video-container.portrait::after {
  content: "4:5";
}

.video-container.vertical::after {
  content: "9:16";
}

.video-container iframe {
  width: 100%;
  height: auto;
  border: 0;
  border-radius: 8px;
}

.video-container.landscape iframe {
  aspect-ratio: 16/9;
  max-width: 1000px;
  width: 100%;
}

.video-container.portrait iframe {
  aspect-ratio: 4/5;
  max-width: 500px;
  width: 100%;
}

.video-container.vertical iframe {
  aspect-ratio: 9/16;
  max-width: 360px;
  width: 100%;
}

/* Mobile */
@media (max-width: 600px) {
  body { padding: 1rem; }
  .project-grid { grid-template-columns: 1fr; }
  .project-meta { flex-direction: column; gap: 0.5rem; }
  
  .video-container.landscape,
  .video-container.portrait,
  .video-container.vertical {
    max-width: 100%;
  }
  .project-card .card-thumbnail::before {
    filter: blur(16px) brightness(0.6);
  }
}