/* ===================================================================
 * CASE POST — Página individual de Case Study
 * Estrutura: Hero → Intro → BAB → Stack → Results → Testimonial → FAQ → CTA
 * Motion premium. Usa tokens de tokens.css + motion.css system.
 * Segue os mesmos padrões do insight-post.css para consistência.
 * =================================================================== */

/* ===== HERO — Dark cinematic ===== */
.cpost-hero {
  position: relative;
  background: var(--black-rock);
  color: #fff;
  padding: 140px var(--gutter) 0;
  overflow: hidden;
  isolation: isolate;
  z-index: 1;
}
.cpost-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 70% at 20% 0%, color-mix(in srgb, var(--primary-hi) 22%, transparent), transparent 60%),
    radial-gradient(ellipse 60% 60% at 85% 100%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 55%);
  pointer-events: none;
  z-index: 0;
}
/* Film grain */
.cpost-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.5 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 200px;
}
.cpost-hero-inner {
  position: relative;
  z-index: 2;
  max-width: var(--container);
  margin: 0 auto;
  padding-bottom: var(--s-8);
}

/* Back link — same pattern as insight-post */
.cpost-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  padding: 8px 16px;
  margin-left: -16px;
  border-radius: var(--r-pill);
  transition: all var(--t-fast);
  margin-bottom: var(--s-7);
  opacity: 0;
  transform: translateX(-20px);
  animation: cpostSlideRight 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.1s forwards;
}
.cpost-back:hover { background: rgba(255,255,255,0.08); color: #fff; }
.cpost-back svg { width: 16px; height: 16px; flex-shrink: 0; }

@keyframes cpostSlideRight { to { opacity: 1; transform: translateX(0); } }
@keyframes cpostFadeUp { to { opacity: 1; transform: translateY(0); filter: blur(0); } }

/* Client logo */
.cpost-client-logo {
  height: 28px;
  width: auto;
  margin-bottom: 16px;
  display: block;
  opacity: 0;
  animation: cpostLogoIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.15s forwards;
}
@keyframes cpostLogoIn { to { opacity: 0.6; } }

/* Hero logo — large centered below impact */
.cpost-hero-logo {
  display: block;
  height: 48px;
  width: auto;
  max-width: 200px;
  margin: 32px 0 0;
  opacity: 0;
  filter: brightness(0) invert(1);
  animation: cpostHeroLogoIn 1s cubic-bezier(0.16, 1, 0.3, 1) 0.7s forwards;
}
@keyframes cpostHeroLogoIn { to { opacity: 0.45; } }

/* Meta badges — same as insight-post meta-line */
.cpost-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  font-weight: 500;
  margin-bottom: var(--s-5);
  opacity: 0;
  transform: translateY(15px);
  animation: cpostFadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}
.cpost-meta-tag {
  color: rgba(255,255,255,0.6);
}
.cpost-meta-tag:first-child {
  color: var(--accent);
}
.cpost-meta-sep {
  opacity: 0.4;
}
.cpost-meta-sep::after {
  content: "·";
}

/* H1 */
.cpost-hero h1 {
  font-size: clamp(28px, 4.5vw, 52px);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 var(--s-5);
  text-wrap: balance;
  max-width: 920px;
  opacity: 0;
  transform: translateY(40px);
  filter: blur(3px);
  animation: cpostFadeUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
}

/* Impact badge */
.cpost-impact {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  background: rgba(186, 239, 38, 0.08);
  border: 1px solid rgba(186, 239, 38, 0.2);
  border-radius: var(--r-pill);
  padding: 10px 24px;
  margin-bottom: var(--s-6);
  opacity: 0;
  transform: translateY(15px);
  animation: cpostFadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.5s forwards;
}
.cpost-impact-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.03em;
  white-space: nowrap;
}
.cpost-impact-label {
  font-size: 14px;
  color: rgba(255,255,255,0.6);
  font-weight: 400;
}


/* ===== INTRO ===== */
.cpost-intro {
  position: relative;
  z-index: 2;
  padding: clamp(64px, 8vh, 100px) 0;
  background: var(--bg);
  overflow: hidden;
}
.cpost-intro-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding-inline: var(--gutter);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(32px, 4vw, 64px);
  align-items: center;
}
.cpost-intro-text { max-width: 540px; }
.cpost-intro-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary-hi);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.cpost-intro-eyebrow::before {
  content: "";
  width: 20px; height: 1px;
  background: currentColor;
  opacity: 0.6;
}
.cpost-intro h2 {
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 400;
  line-height: var(--lh-heading);
  letter-spacing: -0.012em;
  margin: 0 0 20px;
  text-wrap: balance;
}
.cpost-intro h2 em {
  font-style: normal;
  font-weight: 500;
  color: var(--primary-hi);
}
.cpost-intro-desc {
  font-size: 16px;
  line-height: 1.75;
  color: var(--fg-muted);
  font-weight: 300;
}
.cpost-intro-media {
  position: relative;
  border-radius: var(--r-3);
  overflow: hidden;
  aspect-ratio: 4/3;
}
.cpost-intro-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
@media (max-width: 860px) {
  .cpost-intro-inner { grid-template-columns: 1fr; }
  .cpost-intro-media { aspect-ratio: 16/9; max-height: 320px; }
}

/* ===== BAB SECTION ===== */
.cpost-bab {
  padding: clamp(64px, 8vh, 100px) 0;
  background: var(--bg-alt);
  border-top: 1px solid var(--rule);
}
.cpost-bab-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding-inline: var(--gutter);
}
.cpost-bab-title { text-align: center; margin-bottom: 40px; }
.cpost-bab-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
@media (max-width: 860px) {
  .cpost-bab-grid { grid-template-columns: 1fr; gap: 16px; }
}

/* BAB Card */
.cpost-bab-card {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--r-3);
  padding: 32px 24px;
  position: relative;
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.35s ease;
}
.cpost-bab-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0,0,0,0.06);
}
.cpost-bab-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.cpost-bab-card.before::before { background: #ef4444; }
.cpost-bab-card.after::before  { background: var(--accent); }
.cpost-bab-card.bridge::before { background: var(--primary-hi); }
.cpost-bab-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 16px;
  font-weight: 600;
}
.cpost-bab-card.before .cpost-bab-icon { background: rgba(239,68,68,0.08); color: #ef4444; }
.cpost-bab-card.after  .cpost-bab-icon { background: rgba(186,239,38,0.08); color: var(--accent); }
.cpost-bab-card.bridge .cpost-bab-icon { background: rgba(105,17,223,0.08); color: var(--primary-hi); }
.cpost-bab-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin-bottom: 12px;
}
.cpost-bab-text {
  font-size: 15px;
  line-height: 1.7;
  color: var(--fg);
  font-weight: 300;
}

/* ===== TECH STACK — Interactive Gravity (DOM-based, Google Labs pattern) ===== */
.cpost-stack {
  padding: clamp(48px, 5vh, 72px) 0;
  background: var(--bg);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.cpost-stack-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding-inline: var(--gutter);
  text-align: center;
}
.cpost-stack-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin-bottom: 24px;
}
.cpost-stack-gravity {
  position: relative;
  width: 100%;
  height: 280px;
  border-radius: var(--r-3, 16px);
  overflow: hidden;
  background: color-mix(in srgb, var(--bg-alt) 60%, transparent);
  border: 1px solid var(--rule);
  touch-action: none;
}

/* Badge — DOM element positioned via transform by physics engine */
.grav-badge {
  position: absolute;
  top: 0; left: 0;
  padding: 10px 24px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  user-select: none;
  pointer-events: none; /* container handles events */
  will-change: transform;
  letter-spacing: 0.01em;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  transition: box-shadow 0.2s;
}

/* Purple variant */
.grav-purple {
  background: #1a0e2e;
  color: #ffffff;
  border: 1px solid rgba(105, 17, 223, 0.25);
}
/* Lime variant */
.grav-lime {
  background: #baef26;
  color: #0e0b1a;
  border: 1px solid rgba(186, 239, 38, 0.4);
}

/* Dark mode */
[data-theme="dark"] .grav-purple {
  background: #2d1b4e;
  border-color: rgba(105, 17, 223, 0.35);
}
[data-theme="dark"] .grav-lime {
  background: #baef26;
  color: #0e0b1a;
}
[data-theme="dark"] .cpost-stack-gravity {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.08);
}

@media (max-width: 640px) {
  .cpost-stack-gravity { height: 220px; }
  .grav-badge { font-size: 12px; padding: 8px 18px; }
}

/* ===== RESULTS ===== */
.cpost-results {
  padding: clamp(64px, 8vh, 100px) 0;
  background: var(--black-rock);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.cpost-results::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 70% 80%, rgba(105,17,223,0.12), transparent);
  pointer-events: none;
}
.cpost-results-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding-inline: var(--gutter);
  position: relative;
  z-index: 1;
}
.cpost-results-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  margin-bottom: 36px;
  text-align: center;
}
.cpost-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  max-width: 900px;
  margin: 0 auto;
}
.cpost-result-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--r-3);
  padding: 32px 20px;
  text-align: center;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.35s;
}
.cpost-result-card:hover {
  transform: translateY(-4px);
  border-color: rgba(186,239,38,0.2);
}
.cpost-result-value {
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 8px;
  word-break: break-word;
}
.cpost-result-desc {
  font-size: 14px;
  color: rgba(255,255,255,0.5);
  font-weight: 400;
  line-height: 1.5;
}

/* ===== TESTIMONIAL ===== */
.cpost-testimonial {
  padding: clamp(64px, 8vh, 100px) 0;
  background: var(--bg);
}
.cpost-testimonial-inner {
  max-width: 760px;
  margin: 0 auto;
  padding-inline: var(--gutter);
  text-align: center;
}
.cpost-quote-mark {
  font-size: 64px;
  line-height: 1;
  color: var(--primary-hi);
  font-family: Georgia, serif;
  margin-bottom: 12px;
  opacity: 0.5;
}
.cpost-quote-text {
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 300;
  line-height: 1.65;
  font-style: italic;
  color: var(--fg);
  margin: 0 0 28px;
  text-wrap: pretty;
}
.cpost-quote-author {
  font-size: 14px;
  color: var(--fg-faint);
}
.cpost-quote-author strong {
  color: var(--fg);
  font-weight: 500;
}

/* ===== FAQ — Editorial Accordion (Ali Imam style, same as University) ===== */
.cpost-faq {
  padding: var(--s-9, clamp(64px, 8vh, 100px)) 0;
  background: var(--bg);
}
.cpost-faq-inner {
  max-width: 900px;
  margin: 0 auto;
  padding-inline: var(--gutter);
}
.cpost-faq-head {
  text-align: center;
  margin-bottom: var(--s-8, 48px);
}
.cpost-faq-head h2 {
  margin: 12px 0 0;
  text-wrap: balance;
}

/* Accordion container */
.cpost-faq .faq-accordion {
  border-top: 1px solid var(--rule);
}

/* Item */
.cpost-faq .faq-item {
  border-bottom: 1px solid var(--rule);
}

/* Trigger */
.cpost-faq .faq-trigger {
  width: 100%;
  background: transparent;
  border: 0;
  padding: 20px 0;
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: opacity 300ms ease;
  opacity: 0.2;
  color: var(--fg);
}
.cpost-faq .faq-trigger:hover { opacity: 0.45; }
.cpost-faq .faq-item.is-open .faq-trigger {
  opacity: 1;
  color: var(--primary-hi);
}

/* Number */
.cpost-faq .faq-num {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: inherit;
  flex-shrink: 0;
  min-width: 28px;
  opacity: 0.6;
  transition: opacity 300ms ease;
}
.cpost-faq .faq-item.is-open .faq-num { opacity: 1; }

/* Title — large uppercase */
.cpost-faq .faq-title {
  flex: 1;
  font-size: clamp(20px, 2.8vw, 36px);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.cpost-faq .faq-title strong {
  font-weight: 700;
}

/* Plus icon → rotates 45° to become × */
.cpost-faq .faq-plus {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--rule-strong, var(--rule));
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: transform 400ms cubic-bezier(0.16, 1, 0.3, 1),
              background 300ms ease,
              border-color 300ms ease,
              color 300ms ease;
  color: var(--fg);
}
.cpost-faq .faq-item.is-open .faq-plus {
  transform: rotate(45deg);
  background: var(--accent);
  border-color: var(--accent);
  color: var(--black-rock);
}

/* Body — grid height transition */
.cpost-faq .faq-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 500ms cubic-bezier(0.16, 1, 0.3, 1);
}
.cpost-faq .faq-item.is-open .faq-body {
  grid-template-rows: 1fr;
}
.cpost-faq .faq-body-wrap {
  overflow: hidden;
  min-height: 0;
}

/* Content — fade + slide in */
.cpost-faq .faq-body-content {
  padding: 0 0 24px 44px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--fg-muted);
  max-width: 600px;
  font-weight: 300;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 400ms ease-out 120ms,
              transform 400ms ease-out 120ms;
}
.cpost-faq .faq-item.is-open .faq-body-content {
  opacity: 1;
  transform: none;
}
.cpost-faq .faq-body-content p { margin: 0; }

/* Responsive */
@media (max-width: 600px) {
  .cpost-faq .faq-trigger { padding: 16px 0; gap: 12px; }
  .cpost-faq .faq-title { font-size: 18px; }
  .cpost-faq .faq-plus { width: 28px; height: 28px; }
  .cpost-faq .faq-body-content { padding-left: 0; }
}
@media (hover: none) {
  .cpost-faq .faq-trigger { opacity: 0.5; }
}

/* ===== CTA ===== */
.cpost-cta {
  padding: clamp(64px, 8vh, 100px) 0;
  background: var(--black-rock);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.cpost-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 60% at 30% 80%, rgba(105,17,223,0.15), transparent),
    radial-gradient(ellipse 40% 40% at 80% 30%, rgba(186,239,38,0.06), transparent);
  pointer-events: none;
}
.cpost-cta-inner {
  max-width: 640px;
  margin: 0 auto;
  padding-inline: var(--gutter);
  text-align: center;
  position: relative;
  z-index: 1;
}
.cpost-cta-title {
  font-size: clamp(24px, 3.5vw, 40px);
  font-weight: 400;
  line-height: var(--lh-heading);
  margin-bottom: 16px;
  color: #fff;
}
.cpost-cta-text {
  font-size: 16px;
  color: rgba(255,255,255,0.6);
  font-weight: 300;
  line-height: 1.65;
  margin-bottom: 32px;
}

/* ===== PROGRESS BAR ===== */
.cpost-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-hi), var(--accent));
  z-index: 10000;
  transition: width 60ms linear;
  pointer-events: none;
}

/* ===== DARK MODE ===== */
[data-theme="dark"] .cpost-intro { background: var(--bg); }
[data-theme="dark"] .cpost-bab { background: var(--bg-alt); }
[data-theme="dark"] .cpost-bab-card { background: var(--bg); border-color: var(--rule); }
[data-theme="dark"] .cpost-stack { background: var(--bg); }
[data-theme="dark"] .cpost-stack-badge { background: var(--bg-alt); }
[data-theme="dark"] .cpost-testimonial { background: var(--bg); }
[data-theme="dark"] .cpost-faq { background: var(--bg-alt); }

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .cpost-hero { padding-top: 100px; }
  .cpost-impact { padding: 8px 18px; gap: 10px; }
  .cpost-impact-value { font-size: 18px; }
  .cpost-impact-label { font-size: 13px; }
  .cpost-results-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .cpost-hero { padding-top: 80px; }
}
