/* ==========================================================================
   3PEDIA DIGITAL — CASE STUDIES PAGE STYLES (case-studies.css v4.0)
   ========================================================================== */

/* --- HERO --- */
.cs-hero {
  min-height: 92vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  padding: 150px 0 60px;
  overflow: hidden;
  perspective: 1600px;
}

.cs-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 30px 30px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 75%);
  pointer-events: none;
}

.cs-hero-in {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 40px;
  align-items: center;
}

.cs-hero h1 {
  font-family: 'Archivo', sans-serif;
  font-stretch: 110%;
  font-weight: 800;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1.06;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.cs-hero h1 .soft {
  color: var(--ink-faint);
}

.cs-hero .sub {
  margin-top: 22px;
  font-size: 16.5px;
  color: var(--ink-soft);
  max-width: 520px;
  line-height: 1.68;
}

.cs-hero .btn-row {
  display: flex;
  gap: 14px;
  margin-top: 34px;
  flex-wrap: wrap;
}

/* --- FOUNDER SHOWCASE CARD --- */
.founder-showcase {
  position: relative;
  max-width: 300px;
  margin-left: auto;
  perspective: 1400px;
}

.founder-showcase .fd-frame {
  aspect-ratio: 4/5;
  transition: transform 0.12s ease-out;
  transform-style: preserve-3d;
  cursor: pointer;
}

.founder-showcase .fd-badge {
  max-width: 185px;
  text-align: right;
  line-height: 1.4;
  font-size: 10px;
}

.founder-cap {
  margin-top: 18px;
  text-align: right;
}

.founder-cap b {
  display: block;
  font-family: 'Archivo', sans-serif;
  font-stretch: 110%;
  font-weight: 800;
  font-size: 18px;
  text-transform: uppercase;
}

.founder-cap span {
  font-size: 12px;
  color: var(--ink-faint);
}

.fs-mini {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 14px 18px;
  z-index: 5;
}

.fs-mini b {
  display: block;
  font-family: 'Archivo', sans-serif;
  font-stretch: 110%;
  font-size: 20px;
  font-weight: 800;
}

.fs-mini span {
  font-size: 10px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fs-mini.a {
  top: -22px;
  left: -34px;
}

.fs-mini.b {
  bottom: 60px;
  right: -30px;
  background: var(--ink);
  color: var(--bg);
}

.fs-mini.b span {
  color: rgba(244, 244, 244, 0.5);
}

/* --- FILTER TABS & 3D FLIP CARDS --- */
.cs-work-sec {
  border-top: 1px solid var(--line);
}

.cs-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 56px;
}

.cs-tab {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 11px 22px;
  cursor: pointer;
  transition: all 0.3s var(--ease);
}

.cs-tab.active,
.cs-tab:hover {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.cs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
}

.flip-card {
  perspective: 1600px;
  height: 440px;
  cursor: pointer;
  transition: transform 0.25s ease-out;
  will-change: transform;
  opacity: 0;
  transform: translateY(28px);
}

html.has-js .cs-grid.in .flip-card {
  animation: cardIn 0.75s var(--ease) forwards;
}

.cs-grid.in .flip-card:nth-child(1) { animation-delay: 0.05s; }
.cs-grid.in .flip-card:nth-child(2) { animation-delay: 0.14s; }
.cs-grid.in .flip-card:nth-child(3) { animation-delay: 0.23s; }
.cs-grid.in .flip-card:nth-child(4) { animation-delay: 0.32s; }
.cs-grid.in .flip-card:nth-child(5) { animation-delay: 0.41s; }
.cs-grid.in .flip-card:nth-child(6) { animation-delay: 0.50s; }

html:not(.has-js) .flip-card {
  opacity: 1;
  transform: none;
}

.flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.9s var(--ease);
  transform-style: preserve-3d;
}

.flip-card.flipped .flip-inner {
  transform: rotateY(180deg);
}

.flip-front,
.flip-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 30px 28px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.flip-back {
  transform: rotateY(180deg);
  background: var(--ink);
  color: var(--bg);
}

.flip-tag {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 12px;
}

.spark-wrap {
  width: 100%;
  height: 64px;
  margin-bottom: 14px;
}

.spark-wrap svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.spark-line {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 300;
  stroke-dashoffset: 300;
  transition: stroke-dashoffset 1.6s var(--ease);
}

.flip-card.in .spark-line {
  stroke-dashoffset: 0;
}

.spark-dot {
  opacity: 0;
  transition: opacity 0.4s var(--ease) 0.9s;
}

.flip-card.in .spark-dot {
  opacity: 1;
}

.flip-metric {
  font-family: 'Archivo', sans-serif;
  font-stretch: 110%;
  font-weight: 800;
  font-size: clamp(40px, 5vw, 58px);
  line-height: 1;
  letter-spacing: -0.02em;
}

.flip-metric-label {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 8px;
}

.flip-brand {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 600;
  margin-top: 20px;
}

.flip-hint {
  margin-top: auto;
  font-size: 11.5px;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  gap: 6px;
}

.flip-hint::after {
  content: '↻';
  font-size: 14px;
}

.flip-back .flip-tag {
  color: rgba(244, 244, 244, 0.45);
}

.fb-step {
  margin-bottom: 14px;
}

.fb-step b {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(244, 244, 244, 0.5);
  margin-bottom: 5px;
}

.fb-step p {
  font-size: 13.5px;
  line-height: 1.5;
  color: rgba(244, 244, 244, 0.85);
}

.flip-back .flip-hint {
  color: rgba(244, 244, 244, 0.4);
}

.note-tag {
  text-align: center;
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 34px;
  font-family: 'Space Grotesk', sans-serif;
}

/* --- RESULTS STRIP & CTA --- */
.results-strip {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 60px 0;
}

.rs-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  text-align: center;
}

.rs-grid b {
  display: block;
  font-family: 'Archivo', sans-serif;
  font-stretch: 110%;
  font-size: clamp(28px, 3.4vw, 42px);
  font-weight: 800;
}

.rs-grid span {
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}

.cs-cta {
  padding: 110px 0;
  text-align: center;
}

.cs-cta h2 {
  font-family: 'Archivo', sans-serif;
  font-stretch: 110%;
  font-weight: 800;
  font-size: clamp(28px, 4vw, 46px);
  letter-spacing: -0.02em;
  text-transform: uppercase;
  max-width: 700px;
  margin: 0 auto;
}

.cs-cta p {
  margin-top: 16px;
  color: var(--ink-soft);
  font-size: 16px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.cs-cta .btn-row {
  display: flex;
  justify-content: center;
  margin-top: 32px;
}

/* --- RESPONSIVE --- */
@media (max-width: 960px) {
  .cs-hero-in {
    grid-template-columns: 1fr;
  }
  .founder-showcase {
    margin: 20px auto 0;
    max-width: 240px;
  }
  .fs-mini {
    display: none;
  }
  .cs-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 700px) {
  .rs-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
  }
}

@media (max-width: 640px) {
  .cs-grid {
    grid-template-columns: 1fr;
  }
  .flip-card {
    height: auto;
    perspective: none;
  }
  .flip-inner {
    transition: none;
    transform-style: flat;
    position: relative;
    height: auto;
  }
  .flip-card.flipped .flip-inner {
    transform: none;
  }
  .flip-front {
    position: relative;
  }
  .flip-back {
    display: none;
  }
  .flip-card.flipped .flip-front {
    display: none;
  }
  .flip-card.flipped .flip-back {
    display: flex;
    position: relative;
    transform: none;
  }
}