/* =============================================
   CASE STUDY PAGE STYLES
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=Lora:ital,wght@0,400;0,600;1,400&family=Inter:wght@300;400;500&display=swap');

[data-fade] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
[data-fade].visible { opacity: 1; transform: none; }

/* Figma prototype embed */
.cs-figma-embed {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 8px;
}

.cs-figma-embed-frame {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
}

.cs-figma-embed-frame iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 1440px;
  height: 900px;
  border: 0;
  display: block;
  transform-origin: top left;
}

.cs-figma-embed-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.cs-figma-embed-footer p {
  font-size: 0.85rem;
  color: var(--ink-light);
  margin: 0;
}

/* Hero */
.cs-hero {
  padding-top: 120px;
  padding-bottom: 0;
  position: relative;
  overflow: hidden;
}

.cs-hero-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
  padding-bottom: 64px;
}

.cs-hero-text .eyebrow { margin-bottom: 12px; }
.cs-hero-text .back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--ff-ui);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-light);
  margin-bottom: 24px;
  transition: color 0.2s;
}
.cs-hero-text .back-link:hover { color: var(--accent); }

.cs-hero-text h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.15;
  margin-bottom: 16px;
}

.cs-hero-text .cs-intro {
  font-size: 1.05rem;
  color: var(--ink-mid);
  line-height: 1.75;
  margin-bottom: 28px;
}

.cs-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 28px;
}

.cs-meta-item {
  background: var(--bg);
  padding: 14px 16px;
}

.cs-meta-item .meta-label {
  font-family: var(--ff-ui);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-light);
  display: block;
  margin-bottom: 3px;
}

.cs-meta-item .meta-value {
  font-family: var(--ff-ui);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink);
}

.cs-hero-img {
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 4/3;
  background: var(--bg-alt);
}

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

/* Modifier for hero images that are portrait phone mockups rather than landscape screenshots */
.cs-hero-img--tall {
  aspect-ratio: 3/4;
}

@media (max-width: 900px) {
  .cs-hero-img--tall { aspect-ratio: 4/3; }
}

/* Case study body */
.cs-body {
  padding: 72px 0;
}

.cs-layout {
  display: grid;
  grid-template-columns: 680px 1fr;
  gap: 80px;
  align-items: start;
}

.cs-sidebar {
  position: sticky;
  top: 88px;
}

.cs-toc {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.cs-toc h4 {
  font-family: var(--ff-ui);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-light);
  margin-bottom: 14px;
}

.cs-toc ul { display: flex; flex-direction: column; gap: 2px; }

.cs-toc ul a {
  display: block;
  font-family: var(--ff-ui);
  font-size: 0.85rem;
  color: var(--ink-mid);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}

.cs-toc ul a:hover,
.cs-toc ul a.active {
  background: var(--white);
  color: var(--accent);
}

.cs-sidebar-cta {
  background: var(--accent);
  border-radius: var(--radius-lg);
  padding: 24px;
  color: var(--white);
}

.cs-sidebar-cta h4 {
  font-family: var(--ff-display);
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.cs-sidebar-cta p {
  font-size: 0.85rem;
  opacity: 0.85;
  line-height: 1.55;
  margin-bottom: 16px;
}

.cs-sidebar-cta .btn {
  background: var(--white);
  color: var(--accent-dark);
  font-size: 0.82rem;
  padding: 10px 20px;
}

.cs-sidebar-cta .btn:hover {
  background: var(--ink);
  color: var(--white);
}

/* Content sections */
.cs-section {
  margin-bottom: 56px;
  scroll-margin-top: 100px;
}

.cs-section:last-child { margin-bottom: 0; }

.section-label {
  font-family: var(--ff-ui);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  display: block;
  margin-bottom: 8px;
}

.cs-section h2 {
  font-size: clamp(1.4rem, 2.5vw, 1.9rem);
  margin-bottom: 16px;
}

.cs-section p {
  font-size: 0.95rem;
  color: var(--ink-mid);
  line-height: 1.8;
  margin-bottom: 14px;
}

.cs-section p:last-child { margin-bottom: 0; }

/* Deliverables list */
.deliverables-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.deliverable-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-alt);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.deliverable-item .d-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 5px;
}

.deliverable-item span {
  font-family: var(--ff-ui);
  font-size: 0.85rem;
  color: var(--ink-mid);
}

/* Outcomes / Key results */
.outcomes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.outcome-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  background: var(--accent-pale);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent);
}

.outcome-item svg { flex-shrink: 0; color: var(--accent); margin-top: 2px; }

.outcome-item p {
  font-size: 0.9rem;
  color: var(--ink);
  margin: 0;
  line-height: 1.6;
}

/* Lessons learned */
.lessons-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.lesson-item {
  padding: 18px 20px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.lesson-item h4 {
  font-family: var(--ff-ui);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

.lesson-item p {
  font-size: 0.875rem;
  color: var(--ink-mid);
  margin: 0;
  line-height: 1.65;
}

/* Flow walkthrough (in-context animated demo) */
.cs-flow-demo {
  display: flex;
  gap: 28px;
  align-items: center;
  margin-top: 20px;
  padding: 28px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.cs-flow-demo-media {
  flex-shrink: 0;
  width: 220px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 12px 28px -10px rgba(28, 28, 30, 0.25);
  border: 1px solid var(--border);
}

.cs-flow-demo-media img {
  display: block;
  width: 100%;
  height: auto;
}

.cs-flow-demo-caption .flow-tag {
  font-family: var(--ff-ui);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  display: block;
  margin-bottom: 6px;
}

.cs-flow-demo-caption h4 {
  font-family: var(--ff-ui);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}

.cs-flow-demo-caption p {
  font-size: 0.875rem;
  color: var(--ink-mid);
  line-height: 1.65;
  margin: 0;
}

@media (max-width: 640px) {
  .cs-flow-demo {
    flex-direction: column;
    align-items: stretch;
  }
  .cs-flow-demo-media {
    width: 160px;
    margin: 0 auto;
  }
  .cs-flow-demo-caption { text-align: center; }
}

/* Confidentiality notice */
.confidentiality-notice {
  display: flex;
  gap: 12px;
  padding: 16px 18px;
  background: #fff8e6;
  border: 1px solid #f0d070;
  border-radius: var(--radius-md);
  margin-top: 16px;
}

.confidentiality-notice svg { flex-shrink: 0; color: #b07c00; margin-top: 2px; }

.confidentiality-notice p {
  font-size: 0.82rem;
  color: #7a5500;
  margin: 0;
  line-height: 1.6;
}

/* Image gallery */
.cs-gallery-section {
  padding: 56px 0;
  background: var(--bg-alt);
}

.cs-gallery-section h2 {
  font-family: var(--ff-display);
  font-size: clamp(1.4rem, 2.5vw, 1.9rem);
  margin-bottom: 8px;
}

.cs-gallery-section .gallery-sub {
  font-size: 0.9rem;
  color: var(--ink-mid);
  margin-bottom: 32px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

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

/* Modifier for galleries of portrait phone-mockup screenshots (e.g. social media posts) */
.gallery-grid.gallery-phones { grid-template-columns: repeat(4, 1fr); }

/* Modifier for galleries of portrait product/packaging renders */
.gallery-grid.gallery-products { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
  .gallery-grid.gallery-phones { grid-template-columns: repeat(3, 1fr); }
  .gallery-grid.gallery-products { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 600px) {
  .gallery-grid.gallery-phones { grid-template-columns: repeat(2, 1fr); }
  .gallery-grid.gallery-products { grid-template-columns: repeat(2, 1fr); }
}

.gallery-item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 4/3;
  cursor: pointer;
  background: var(--bg);
}

.gallery-grid.gallery-phones .gallery-item { aspect-ratio: 9/16; }
.gallery-grid.gallery-products .gallery-item { aspect-ratio: 3/4; background: #f4f3f1; }
.gallery-grid.gallery-products .gallery-item img { object-fit: contain; }

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.gallery-item:hover img { transform: scale(1.04); }

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: rgba(28,28,30,0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
}

.gallery-item:hover .gallery-overlay { background: rgba(28,28,30,0.3); }

.gallery-overlay svg {
  color: white;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.25s;
}

.gallery-item:hover .gallery-overlay svg {
  opacity: 1;
  transform: scale(1);
}

.gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.5));
  font-family: var(--ff-ui);
  font-size: 0.72rem;
  color: rgba(255,255,255,0.9);
  opacity: 0;
  transition: opacity 0.25s;
}

.gallery-item:hover .gallery-caption { opacity: 1; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.lightbox.open {
  opacity: 1;
  pointer-events: all;
}

.lightbox-img-wrap {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-img-wrap img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  display: block;
}

.lightbox-caption {
  position: absolute;
  bottom: -36px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--ff-ui);
  font-size: 0.82rem;
  color: rgba(255,255,255,0.6);
}

.lightbox-close {
  position: fixed;
  top: 20px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: background 0.2s;
  z-index: 1001;
}

.lightbox-close:hover { background: rgba(255,255,255,0.2); }

.lightbox-prev,
.lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: background 0.2s;
  z-index: 1001;
}

.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
.lightbox-prev:hover,
.lightbox-next:hover { background: rgba(255,255,255,0.2); }

.lightbox-counter {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--ff-ui);
  font-size: 0.82rem;
  color: rgba(255,255,255,0.5);
  z-index: 1001;
}

/* Next/prev project nav */
.project-nav {
  border-top: 1px solid var(--border);
  padding: 40px 0;
}

.project-nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.project-nav-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 280px;
}

.project-nav-link.next { text-align: right; }

.nav-direction {
  font-family: var(--ff-ui);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-light);
}

.project-nav-link h4 {
  font-family: var(--ff-display);
  font-size: 1.1rem;
  color: var(--ink);
  transition: color 0.2s;
}

.project-nav-link:hover h4 { color: var(--accent); }

/* Responsive */
@media (max-width: 1100px) {
  .cs-layout { grid-template-columns: 1fr; }
  .cs-sidebar { position: static; }
  .cs-toc { display: none; }
}

@media (max-width: 900px) {
  .cs-hero-inner { grid-template-columns: 1fr; }
  .cs-hero-img { aspect-ratio: 16/9; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .gallery-grid.gallery-2col { grid-template-columns: 1fr; }
  .deliverables-grid { grid-template-columns: 1fr; }
  .project-nav-inner { flex-direction: column; align-items: stretch; }
  .project-nav-link.next { text-align: left; }
}

@media (max-width: 600px) {
  .gallery-grid { grid-template-columns: 1fr; }
  .cs-meta-grid { grid-template-columns: 1fr; }
  .cs-hero { padding-top: 88px; }
  .cs-body { padding: 48px 0; }
  .cs-section { margin-bottom: 40px; }
  .cs-section h2 { font-size: 1.4rem; }
  .cs-hero-text h1 { font-size: 1.7rem; }
  .cs-hero-text .cs-intro { font-size: 0.95rem; }
  .lesson-item, .deliverable-item { padding: 12px; }
  .project-nav { padding: 28px 0; }
}
