/* ─── Project page wrapper ────────────────────────────────── */
.page-project .wrapper {
  max-width: calc(1600px + (var(--pad) * 2));
}

/* ─── Case study inner wrapper ───────────────────────────── */
.case-study-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* ─── Project header ─────────────────────────────────────── */
.cs-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: var(--pad) 0 calc(var(--pad) * 1.5);
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.cs-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--gap);
}

.cs-header-top .btn-outline {
  flex-shrink: 0;
  margin-top: 12px;
}

.cs-header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cs-meta-pill {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 4px 10px;
  border: 1px solid var(--border);
  letter-spacing: 0.02em;
}

/* ─── Bento grid ──────────────────────────────────────────── */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 280px;
  gap: 12px;
}

.bento-item {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
}

.bento-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bento-tag {
  position: absolute;
  bottom: 12px;
  left: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(12, 13, 12, 0.48);
  padding: 4px 9px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.bento-stat {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.bento-stat-number {
  font-size: 52px;
  font-weight: 900;
  line-height: 1;
  color: var(--text-primary);
}

.bento-stat-label {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
  margin-top: 8px;
}

.bento-col2 { grid-column: span 2; }
.bento-col3 { grid-column: span 3; }
.bento-row2 { grid-row: span 2; }

/* ─── Back link ──────────────────────────────────────────── */
.back-row {
  padding: var(--pad) 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--size-body);
  font-weight: 400;
  line-height: var(--lh-body);
  color: var(--text-primary);
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

/* ─── Title block ────────────────────────────────────────── */
.cs-title-block {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--gap);
  padding: var(--pad) 0;
  color: var(--text-primary);
}

.cs-title-block .btn-outline {
  margin-top: 12px;
}

.cs-title-text {
  display: flex;
  flex-direction: column;
}

.cs-title {
  font-size: var(--size-xxl);
  font-weight: 900;
  line-height: var(--lh-xxl);
  text-transform: uppercase;
  color: var(--text-primary);
}

.cs-subtitle {
  font-size: 20px;
  font-weight: 400;
  line-height: 26px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ─── Panel sections (inside the panel body) ─────────────── */
.panel-section + .panel-section {
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.panel-section-heading {
  font-size: var(--size-medium);
  font-weight: 700;
  line-height: var(--lh-medium);
  color: var(--text-primary);
  margin-bottom: 16px;
}

/* ─── Metadata strip ─────────────────────────────────────── */
.cs-meta-strip {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  padding: var(--pad) 0;
}

.cs-meta-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 24px;
  min-height: 120px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.cs-meta-label {
  font-size: 11px;
  font-weight: 700;
  line-height: 14px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cs-meta-value {
  font-size: var(--size-body);
  font-weight: 700;
  line-height: var(--lh-body);
  color: var(--text-primary);
}

/* ─── Hero image ─────────────────────────────────────────── */
.cs-hero {
  width: 100%;
  aspect-ratio: 16 / 7;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: var(--pad);
}

.cs-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ─── Inline stats band ──────────────────────────────────── */
.cs-stats-band {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: var(--pad);
}

.cs-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 28px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.cs-stat-number {
  font-size: 48px;
  font-weight: 900;
  line-height: 1;
  color: var(--text-primary);
}

.cs-stat-label {
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: var(--text-secondary);
}

.cs-stat .cs-stat-number { color: var(--text-primary); }

/* ─── Sections ───────────────────────────────────────────── */
.cs-section {
  width: 100%;
  padding-bottom: calc(var(--pad) * 3);
}

.cs-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: var(--pad) 0;
}

.cs-section-heading {
  font-size: var(--size-large);
  font-weight: 700;
  line-height: var(--lh-large);
  color: var(--text-primary);
}


/* ─── Image placeholders ─────────────────────────────────── */
.cs-image-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  overflow: hidden;
}

.cs-image-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cs-image-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
}

.cs-image-2col .cs-image-placeholder {
  aspect-ratio: unset;
  height: auto;
}

.cs-image-2col .cs-image-placeholder img {
  height: auto;
  object-fit: initial;
}

/* ─── Side panel ─────────────────────────────────────────── */
.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 45%;
  max-width: 960px;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 200;
  overflow: hidden;
}

.side-panel.is-open {
  transform: translateX(0);
}

.side-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  z-index: 199;
}

.side-panel-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.side-panel-title {
  font-size: var(--size-large);
  font-weight: 700;
  line-height: var(--lh-large);
  color: var(--text-primary);
}

.side-panel-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  flex-shrink: 0;
  transition: opacity 0.15s;
}

.side-panel-close:hover {
  opacity: 0.6;
}

.side-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ─── Panel body content ─────────────────────────────────── */
.panel-body-text {
  font-size: 16px;
  font-weight: 400;
  line-height: 26px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.panel-body-text:last-child {
  margin-bottom: 0;
}

.panel-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.panel-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  background: var(--surface-subtle);
}

.panel-stat:nth-child(1) { background: #fafaea; }
.panel-stat:nth-child(2) { background: #edf7ee; }
.panel-stat:nth-child(3) { background: #eaecf8; }
.panel-stat:nth-child(4) { background: #edf6f7; }
.panel-stat:nth-child(5) { background: #faf3ea; }
.panel-stat:nth-child(6) { background: #ededf7; }

.panel-stat-number {
  font-size: var(--size-large);
  font-weight: 900;
  line-height: 1.1;
  color: var(--text-primary);
}

.panel-stat:nth-child(1) .panel-stat-number { color: #a8a300; }
.panel-stat:nth-child(2) .panel-stat-number { color: #2e8f3a; }
.panel-stat:nth-child(3) .panel-stat-number { color: #3045b8; }
.panel-stat:nth-child(4) .panel-stat-number { color: #2e8a90; }
.panel-stat:nth-child(5) .panel-stat-number { color: #a86520; }
.panel-stat:nth-child(6) .panel-stat-number { color: #7a2e8f; }

.panel-stat-label {
  font-size: 13px;
  font-weight: 400;
  line-height: 18px;
  color: var(--text-secondary);
}

.panel-awards-list {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-awards-list li {
  font-size: 16px;
  font-weight: 400;
  line-height: 26px;
  color: var(--text-secondary);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.panel-awards-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.panel-award-year {
  font-weight: 700;
  color: var(--text-primary);
  margin-right: 8px;
}

@media (max-width: 768px) {
  .panel-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ─── Next / Previous bar ────────────────────────────────── */
.next-prev-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--pad) 0;
}

.prev-link,
.next-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 16px;
  font-weight: 700;
  line-height: 20px;
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prev-link:hover,
.next-link:hover {
  color: var(--states-primary-hover);
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .cs-header-top {
    flex-direction: column;
  }

  .cs-header-top .btn-outline {
    margin-top: 0;
  }

  .bento-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 200px;
  }

  .bento-col3 {
    grid-column: span 2;
  }

  .cs-title-block {
    flex-direction: column;
  }

  .cs-title-block .btn-outline {
    margin-top: 16px;
  }

  .side-panel {
    width: 90%;
  }

  .side-panel-header {
    padding: 20px 24px;
  }

  .side-panel-body {
    padding: 24px;
  }

  .cs-meta-strip {
    flex-wrap: wrap;
    gap: 8px;
  }

  .cs-meta-item {
    flex: 0 0 calc(50% - 4px);
    padding: 16px;
    gap: 8px;
  }

  .cs-hero {
    aspect-ratio: 4 / 3;
  }

  .cs-stats-band {
    grid-template-columns: repeat(2, 1fr);
  }

  .cs-stat {
    padding: 24px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }

  .cs-stat-number {
    font-size: 36px;
  }

  .panel-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1024px) {
  .cs-image-2col {
    grid-template-columns: 1fr;
  }
}
