/* ==========================================================
   case-study.css — shared styles for all case study pages
   ========================================================== */

:root {
  --bg-deep:       #f5f5f5;
  --bg-dark:       #efefef;
  --bg-card:       #ffffff;
  --bg-elevated:   #e8e8e8;
  --accent:        hsl(33, 90%, 46%);
  --accent-warm:   hsl(38, 85%, 40%);
  --accent-bright: hsl(43, 80%, 54%);
  --gradient:      linear-gradient(135deg, hsl(28, 90%, 46%) 0%, hsl(43, 86%, 58%) 100%);
  --text-primary:  hsl(0, 0%, 10%);
  --text-sub:      hsl(0, 0%, 38%);
  --text-muted:    hsl(0, 0%, 58%);
  --border:        rgba(0, 0, 0, 0.07);
  --border-lit:    rgba(180, 110, 20, 0.28);
  --border-solid:  #e0e0e0;
  --surface-shadow: 0 1px 0 rgba(255,255,255,0.9) inset,
                    0 2px 8px rgba(0,0,0,0.04),
                    0 10px 30px rgba(0,0,0,0.07);
  --tr:            0.3s ease;
  --font-display:  'Space Grotesk', sans-serif;
  --font-head:     'Space Grotesk', sans-serif;
  --font-body:     'Inter', sans-serif;
  --radius:        12px;
  --max-w:         1040px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.7;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

.container { max-width: var(--max-w); width: 92%; margin: 0 auto; }

/* ── Stacked asset cards ── */
.stack-section {
  margin: 0 0 80px;
}
.stack-cards {
  position: relative;
}

/* ── Horizontal scroll gallery ── */
.scroll-gallery {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 5vw 20px;
  margin: 0 0 80px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(200,146,42,0.35) transparent;
}
.scroll-gallery::-webkit-scrollbar { height: 4px; }
.scroll-gallery::-webkit-scrollbar-track { background: transparent; }
.scroll-gallery::-webkit-scrollbar-thumb { background: rgba(200,146,42,0.35); border-radius: 2px; }

.scroll-gallery img,
.scroll-gallery video {
  height: 58vh;
  width: auto;
  flex-shrink: 0;
  display: block;
  border-radius: 8px;
  object-fit: cover;
}
@media (max-width: 768px) {
  .scroll-gallery img,
  .scroll-gallery video { height: 38vh; }
  .scroll-gallery { gap: 8px; padding: 0 4vw 16px; }
}

.stack-card {
  position: sticky;
  top: 80px;
  width: 80%;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 16px;
  border-radius: 12px;
  overflow: hidden;
  background: #111;
  aspect-ratio: 3/2;
  box-shadow:
    0 1px 2px rgba(0,0,0,0.04),
    0 4px 12px rgba(0,0,0,0.06),
    0 16px 40px rgba(0,0,0,0.08);
  will-change: transform;
}
.stack-card:last-child { margin-bottom: 0; }
.stack-card:nth-child(1)  { z-index: 1; }
.stack-card:nth-child(2)  { z-index: 2; }
.stack-card:nth-child(3)  { z-index: 3; }
.stack-card:nth-child(4)  { z-index: 4; }
.stack-card:nth-child(5)  { z-index: 5; }
.stack-card:nth-child(6)  { z-index: 6; }
.stack-card:nth-child(7)  { z-index: 7; }
.stack-card:nth-child(8)  { z-index: 8; }
.stack-card:nth-child(9)  { z-index: 9; }
.stack-card:nth-child(10) { z-index: 10; }
.stack-card:nth-child(11) { z-index: 11; }
.stack-card:nth-child(12) { z-index: 12; }
.stack-card:nth-child(13) { z-index: 13; }
.stack-card:nth-child(14) { z-index: 14; }
.stack-card:nth-child(15) { z-index: 15; }
.stack-card:nth-child(16) { z-index: 16; }
.stack-card:nth-child(17) { z-index: 17; }
.stack-card:nth-child(18) { z-index: 18; }
.stack-card:nth-child(19) { z-index: 19; }
.stack-card:nth-child(20) { z-index: 20; }
.stack-card:nth-child(21) { z-index: 21; }
.stack-card:nth-child(22) { z-index: 22; }
.stack-card:nth-child(23) { z-index: 23; }
.stack-card:nth-child(24) { z-index: 24; }
.stack-card:nth-child(25) { z-index: 25; }
.stack-card:nth-child(26) { z-index: 26; }
.stack-card:nth-child(27) { z-index: 27; }
.stack-card:nth-child(28) { z-index: 28; }
.stack-card:nth-child(29) { z-index: 29; }
.stack-card:nth-child(30) { z-index: 30; }
.stack-card img,
.stack-card video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.stack-card iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}
.stack-card .card-caption {
  padding: 10px 18px;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: #fff;
}
@media (max-width: 768px) {
  .stack-card { width: 94%; top: 56px; }
  .stack-card iframe { height: 360px; }
}

/* ── Nav ── */
.cs-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(247, 246, 243, 0.97);
  border-bottom: 1px solid var(--border-solid);
  padding: 0.9rem 0;
  box-shadow: 0 1px 20px rgba(0,0,0,0.06);
}
.cs-nav-inner {
  max-width: var(--max-w);
  width: 92%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cs-back {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-sub);
  transition: color var(--tr);
}
.cs-back:hover { color: var(--accent); }
.cs-back i { font-size: 0.75rem; }
.cs-nav-logo {
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.cs-nav-logo span {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.cs-nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Per-brand atmospheric backdrop ── */
.cs-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  /* gradient set inline per page */
}

/* ── Hero ── */
.cs-hero {
  padding: 140px 0 80px;
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
}
.cs-hero-bg {
  position: absolute;
  inset: 0;
  opacity: 0.5;
  z-index: 0;
}
.cs-hero-inner { position: relative; z-index: 1; }
.cs-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}
.cs-breadcrumb a { transition: color var(--tr); }
.cs-breadcrumb a:hover { color: var(--accent); }
.cs-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.cs-tag {
  padding: 4px 12px;
  background: rgba(0,0,0,0.04);
  border: 1px solid var(--border-solid);
  border-radius: 100px;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-sub);
}
.cs-title {
  font-family: var(--font-head);
  font-size: clamp(3.2rem, 8vw, 7rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.0;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
  text-wrap: balance;
  animation: csTitleRise 1.1s cubic-bezier(0.16, 1, 0.3, 1) 0.25s both;
}
@keyframes csTitleRise {
  from { opacity: 0; transform: translateY(32px); }
  to   { opacity: 1; transform: translateY(0); }
}
.g-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.cs-summary {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  color: var(--text-sub);
  max-width: 640px;
  line-height: 1.75;
}

/* ── Meta band ── */
.cs-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border-solid);
  border-top: 1px solid var(--border-solid);
  border-bottom: 1px solid var(--border-solid);
  margin-bottom: 80px;
}
.cs-meta-cell {
  padding: 1.5rem 1.25rem;
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.cs-meta-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.cs-meta-value {
  font-family: var(--font-head);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Heading line-mask reveal (scroll-triggered) ── */
.heading-reveal .h-line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.06em;
}
.heading-reveal .h-line-inner {
  display: block;
  transform: translateY(106%);
  transition: transform 1.1s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}
.heading-reveal.in-view .h-line-inner {
  transform: translateY(0);
}

/* ── Image slide-up + scale entrance ── */
.img-rise {
  opacity: 0;
  transform: translateY(40px) scale(0.96);
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
              transform 1s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity;
}
.img-rise.in-view {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ── Parallax ── */
.parallax-frame { overflow: hidden; position: relative; }
.parallax-img {
  will-change: transform;
  transform: scale(1.14) translateY(0px);
}

/* ── Content body ── */
.cs-body {
  padding-bottom: 100px;
  position: relative;
  background: transparent;
}
.cs-body > * { position: relative; z-index: 1; }
.cs-section { margin-bottom: 80px; }

.cs-section-label {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-sub);
  margin-bottom: 0.75rem;
}
.cs-section-title {
  font-family: var(--font-head);
  font-size: clamp(2.2rem, 4.5vw, 3.6rem);
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  line-height: 1.1;
  text-wrap: balance;
}
.cs-section-text {
  font-size: 1rem;
  color: var(--text-sub);
  line-height: 1.8;
  max-width: 760px;
}
.cs-section-text p { margin-bottom: 1rem; }
.cs-section-text p:last-child { margin-bottom: 0; }

/* ── Image slots ── */
.img-slot {
  width: 100%;
  background: var(--bg-elevated);
  border: 2px dashed var(--border-solid);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  gap: 10px;
  transition: border-color var(--tr);
  text-align: center;
  padding: 1rem;
}
.img-slot:hover { border-color: var(--border-lit); }
.img-slot i { font-size: 2rem; opacity: 0.4; }
.img-slot-label { font-weight: 500; color: var(--text-sub); }
.img-slot-hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

.img-full .img-slot  { aspect-ratio: 16/9; }
.img-wide .img-slot  { aspect-ratio: 21/9; }
.img-square .img-slot{ aspect-ratio: 1/1; }

.img-full img, .img-wide img, .img-square img {
  width: 100%;
  border-radius: var(--radius);
  display: block;
}

.img-grid {
  display: grid;
  gap: 1rem;
}
.img-grid-2 { grid-template-columns: 1fr 1fr; }
.img-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.img-grid-2 .img-slot, .img-grid-3 .img-slot { aspect-ratio: 4/3; }

/* ── Results band ── */
.cs-results {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 80px;
}
.cs-result-card {
  padding: 1.75rem;
  background: rgba(255, 255, 255, 0.70);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.80);
  box-shadow: 0 1px 0 rgba(255,255,255,0.95) inset, 0 4px 24px rgba(0,0,0,0.07), 0 12px 40px rgba(0,0,0,0.06);
  border-radius: var(--radius);
  text-align: center;
}
.cs-result-num {
  font-family: var(--font-head);
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 0.4rem;
}
.cs-result-label {
  font-size: 0.85rem;
  color: var(--text-sub);
}

/* ── Next project ── */
.cs-next {
  padding: 80px 0;
  border-top: 1px solid var(--border-solid);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}
.cs-next-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.cs-next-title {
  font-family: var(--font-head);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 600;
  color: var(--text-primary);
  transition: color var(--tr);
}
.cs-next a:hover .cs-next-title { color: var(--accent); }
.cs-next-arrow {
  width: 52px; height: 52px;
  border: 1px solid var(--border-solid);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-sub);
  transition: all var(--tr);
  flex-shrink: 0;
}
.cs-next a:hover .cs-next-arrow {
  background: var(--gradient);
  border-color: transparent;
  color: #fff;
}

/* ── Behance project embed ── */
.behance-section { margin-bottom: 80px; }
.behance-embed-wrap {
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-solid);
  background: var(--bg-elevated);
  margin-top: 1.25rem;
}
.behance-embed-wrap iframe {
  display: block;
  width: 100%;
  height: 680px;
  border: none;
}
.behance-embed-wrap + .behance-embed-wrap { margin-top: 1rem; }
.behance-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 1rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-sub);
  transition: color 0.2s ease;
}
.behance-link:hover { color: var(--accent); }
.behance-link i { font-size: 1rem; }
@media (max-width: 768px) {
  .behance-embed-wrap iframe { height: 420px; }
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .cs-meta { grid-template-columns: repeat(2, 1fr); }
  .cs-results { grid-template-columns: 1fr 1fr; }
  .img-grid-2, .img-grid-3 { grid-template-columns: 1fr; }
  .cs-next { flex-direction: column; align-items: flex-start; }
  .cs-title { font-size: clamp(2.8rem, 10vw, 5rem); }
}
@media (max-width: 480px) {
  .cs-results { grid-template-columns: 1fr; }
  .cs-meta { grid-template-columns: 1fr 1fr; }
  .cs-nav-right { display: none; }
  .scroll-gallery img, .scroll-gallery video { height: 32vh; }
}

/* ── Animated gradient background ── */
.cs-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.cs-blob {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
}
.cs-blob:nth-child(1) { animation: blobDrift1 24s ease-in-out infinite; }
.cs-blob:nth-child(2) { animation: blobDrift2 31s ease-in-out infinite; }
.cs-blob:nth-child(3) { animation: blobDrift3 38s ease-in-out infinite; }

@keyframes blobDrift1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%       { transform: translate(7%, 5%) scale(1.06); }
}
@keyframes blobDrift2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%       { transform: translate(-6%, -8%) scale(0.94); }
}
@keyframes blobDrift3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%       { transform: translate(4%, -6%) scale(1.10); }
}

/* ── Light background mode ── */
body.light-bg {
  background: #f5f5f5;
  color: #1a1a1a;
}
body.light-bg .cs-nav {
  background: rgba(245, 245, 245, 0.88);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
body.light-bg .cs-nav-logo { color: #1a1a1a; }
body.light-bg .cs-back { color: rgba(0, 0, 0, 0.45); }
body.light-bg .cs-nav-right { color: rgba(0, 0, 0, 0.35); }
body.light-bg .cs-breadcrumb { color: rgba(0, 0, 0, 0.38); }
body.light-bg .cs-breadcrumb a { color: rgba(0, 0, 0, 0.50); }
body.light-bg .cs-hero {
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
}
body.light-bg .cs-meta {
  background: transparent;
  border-color: rgba(0, 0, 0, 0.07);
}
body.light-bg .cs-meta-cell {
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
body.light-bg .cs-meta-label { color: rgba(0, 0, 0, 0.42); }
body.light-bg .cs-meta-value { color: rgba(0, 0, 0, 0.85); }
body.light-bg .cs-section-label { color: rgba(0, 0, 0, 0.42); }
body.light-bg .cs-tag {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.14);
  color: rgba(0, 0, 0, 0.58);
}
body.light-bg .cs-title { color: #1a1a1a; }
body.light-bg .cs-summary { color: rgba(0, 0, 0, 0.60); }
body.light-bg .cs-section-title { color: #1a1a1a; }
body.light-bg .cs-section-text { color: rgba(0, 0, 0, 0.62); }
body.light-bg .cs-body { background: transparent; }
body.light-bg .cs-result-card {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.90);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07), 0 1px 0 rgba(255,255,255,0.9) inset;
}
body.light-bg .cs-result-num { color: #1a1a1a; }
body.light-bg .cs-result-label { color: rgba(0, 0, 0, 0.55); }
body.light-bg .cs-next { border-top-color: rgba(0, 0, 0, 0.08); }
body.light-bg .cs-next-label { color: rgba(0, 0, 0, 0.38); }
body.light-bg .cs-next-title { color: #1a1a1a; }
body.light-bg .cs-next a:hover .cs-next-title { color: inherit; opacity: 0.6; }
body.light-bg .cs-next-arrow {
  border-color: rgba(0, 0, 0, 0.14);
  color: rgba(0, 0, 0, 0.42);
}
body.light-bg .img-slot {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.12);
  color: rgba(0, 0, 0, 0.35);
}
