/**
 * TSW Single Case Study — Detail Page Styles
 *
 * Mobile-first. Breakpoint format used globally across the page:
 *   Mobile        ->  max-width: 480px
 *   Mobile Small  ->  max-width: 375px
 *   Large Mobile  ->  max-width: 767px
 *   Tablet        ->  min-width: 768px and max-width: 1023px
 *   Desktop       ->  min-width: 1024px
 *
 * Used on: single-tsw_case_study.php
 * Prefix:  .csp-  (Case Study Page)
 *
 * @package TSW
 * @since   1.0.0
 */

/* ══════════════════════════════════════════════════════════
 *  BASE (mobile-first)
 * ══════════════════════════════════════════════════════════ */
.csp-single {
  background: var(--tsw-white);
  overflow-x: clip;
}

.csp-section-eyebrow {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--tsw-green);
  margin-bottom: 14px;
}

/* ──────────────── HERO ──────────────── */
.csp-hero {
  position: relative;
  padding: 96px 0 44px;
  background: linear-gradient(135deg, #122618 0%, #1a3c2a 45%, #224633 100%);
  overflow: hidden;
  isolation: isolate;
}

.csp-hero-shapes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: -2;
}

.csp-hero-shapes .tsw-shape { opacity: .07; }

.csp-hero-grid-overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
}

/* Breadcrumbs inside hero (Yoast + custom) */
.csp-hero .tsw-breadcrumbs {
  margin-bottom: 22px;
  font-size: .78rem;
}

.csp-hero .tsw-breadcrumbs a,
.csp-hero .tsw-breadcrumbs .breadcrumb-item a {
  color: rgba(255,255,255,.6);
  text-decoration: none;
  transition: color .2s ease;
}

.csp-hero .tsw-breadcrumbs a:hover { color: var(--tsw-white); }

.csp-hero .tsw-breadcrumbs .breadcrumb-item.active,
.csp-hero .tsw-breadcrumbs .breadcrumb_last,
.csp-hero .tsw-breadcrumbs > span:last-child {
  color: var(--tsw-green-bright);
  font-weight: 600;
}

.csp-hero-inner {
  position: relative;
  max-width: 820px;
}

.csp-hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.csp-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: .76rem;
  font-weight: 600;
  color: rgba(255,255,255,.85);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(4px);
}

.csp-hero-badge i { font-size: .85rem; }

.csp-hero-badge--accent {
  color: #122618;
  background: var(--tsw-green-bright);
  border-color: var(--tsw-green-bright);
}

.csp-hero-title {
  color: var(--tsw-white);
  font-size: clamp(1.7rem, 6vw, 3rem);
  line-height: 1.15;
  margin: 0 0 16px;
}

.csp-hero-tagline {
  color: rgba(255,255,255,.78);
  font-size: 1.05rem;
  line-height: 1.7;
  margin: 0 0 22px;
  max-width: 640px;
}

.csp-hero-client {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.csp-hero-client-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  background: var(--tsw-white);
  border-radius: 10px;
  padding: 6px;
}

.csp-hero-client-name {
  color: rgba(255,255,255,.7);
  font-size: .92rem;
}

.csp-hero-client-name strong { color: var(--tsw-white); }

/* Quick facts strip */
.csp-hero-facts {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.csp-hero-fact {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 18px 12px 44px;
  border-radius: 12px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  min-width: 130px;
  flex: 1 1 auto;
}

.csp-hero-fact > i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  color: var(--tsw-green-bright);
}

.csp-hero-fact-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.55);
}

.csp-hero-fact-value {
  font-size: .9rem;
  font-weight: 600;
  color: var(--tsw-white);
}

.csp-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ──────────────── BODY / LAYOUT ──────────────── */
.csp-body {
  padding: 44px 0 20px;
}

.csp-layout {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.csp-content { min-width: 0; }

/* Featured image */
.csp-feature-img {
  margin: 0 0 32px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.csp-feature-img img {
  display: block;
  width: 100%;
  height: auto;
}

/* Overview */
.csp-overview { margin-bottom: 36px; }

.csp-overview-text {
  font-size: 1.12rem;
  line-height: 1.75;
  color: var(--tsw-ink);
  font-weight: 500;
  margin: 0;
}

/* Metrics */
.csp-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 40px;
}

.csp-metric {
  text-align: center;
  padding: 24px 14px;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(68,185,104,.08), rgba(68,185,104,.02));
  border: 1px solid rgba(68,185,104,.16);
}

.csp-metric-value {
  display: block;
  font-size: clamp(1.6rem, 6vw, 2.3rem);
  font-weight: 800;
  line-height: 1;
  color: var(--tsw-green-dark);
  margin-bottom: 6px;
}

.csp-metric-label {
  display: block;
  font-size: .78rem;
  color: var(--tsw-graphite);
  line-height: 1.4;
}

/* Story blocks */
.csp-story {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-bottom: 40px;
}

.csp-story-block {
  position: relative;
  padding: 26px 24px 26px 26px;
  border-radius: 16px;
  background: var(--tsw-white);
  border: 1px solid var(--tsw-stone);
  border-left: 4px solid var(--tsw-green);
  box-shadow: var(--shadow-sm);
}

.csp-story-block--challenge { border-left-color: #e8954a; }
.csp-story-block--solution  { border-left-color: var(--tsw-green); }
.csp-story-block--approach  { border-left-color: #4a90e8; }
.csp-story-block--outcome   { border-left-color: var(--tsw-green-bright); }

.csp-story-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.csp-story-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  font-size: 1.15rem;
  flex-shrink: 0;
  color: var(--tsw-white);
  background: var(--tsw-green);
}

.csp-story-block--challenge .csp-story-icon { background: #e8954a; }
.csp-story-block--approach  .csp-story-icon { background: #4a90e8; }
.csp-story-block--outcome   .csp-story-icon { background: var(--tsw-green-bright); color: #122618; }

.csp-story-title {
  font-size: 1.25rem;
  margin: 0;
  color: var(--tsw-ink);
}

.csp-story-text {
  font-size: .98rem;
  line-height: 1.78;
  color: var(--tsw-slate);
}

.csp-story-text p { margin: 0 0 14px; }
.csp-story-text p:last-child { margin-bottom: 0; }

/* Editor prose */
.csp-editor { margin-bottom: 40px; }

/* Gallery */
.csp-gallery { margin-bottom: 40px; }

.csp-gallery-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.csp-gallery-item {
  display: block;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--tsw-stone);
  box-shadow: var(--shadow-sm);
  transition: transform .3s ease, box-shadow .3s ease;
}

.csp-gallery-item img {
  display: block;
  width: 100%;
  height: auto;
}

.csp-gallery-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

/* Testimonial */
.csp-testimonial {
  position: relative;
  margin: 0 0 20px;
  padding: 34px 26px 26px;
  border-radius: 18px;
  background: linear-gradient(150deg, #1a3c2a 0%, #224633 100%);
  color: var(--tsw-white);
  overflow: hidden;
}

.csp-testimonial-mark {
  position: absolute;
  top: 10px;
  right: 18px;
  font-size: 4rem;
  line-height: 1;
  color: rgba(255,255,255,.1);
}

.csp-testimonial-quote {
  position: relative;
  font-size: 1.1rem;
  line-height: 1.7;
  font-style: italic;
  margin: 0 0 22px;
}

.csp-testimonial-author {
  display: flex;
  align-items: center;
  gap: 12px;
}

.csp-testimonial-photo,
.csp-testimonial-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.csp-testimonial-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--tsw-green-bright);
  color: #122618;
  font-weight: 700;
  font-size: 1.1rem;
}

.csp-testimonial-meta { display: flex; flex-direction: column; }
.csp-testimonial-name { font-weight: 700; }
.csp-testimonial-role { font-size: .82rem; color: rgba(255,255,255,.7); }

/* ──────────────── SIDEBAR ──────────────── */
.csp-sidebar { min-width: 0; }

.csp-sidebar-sticky {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.csp-widget {
  border-radius: 16px;
  padding: 22px 20px;
  background: var(--tsw-white);
  border: 1px solid var(--tsw-stone);
  box-shadow: var(--shadow-sm);
}

.csp-widget-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 1rem;
  margin: 0 0 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--tsw-stone);
  color: var(--tsw-ink);
}

.csp-widget-title i { color: var(--tsw-green); }

.csp-facts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.csp-fact {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: .88rem;
}

.csp-fact-k {
  color: var(--tsw-graphite);
  flex-shrink: 0;
}

.csp-fact-v {
  color: var(--tsw-ink);
  font-weight: 600;
  text-align: right;
}

.csp-widget-block {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--tsw-stone);
}

.csp-widget-sub {
  display: block;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--tsw-graphite);
  margin-bottom: 10px;
}

.csp-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.csp-chip {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 50px;
  font-size: .76rem;
  font-weight: 500;
  color: var(--tsw-green-dark);
  background: rgba(68,185,104,.1);
  border: 1px solid rgba(68,185,104,.18);
}

.csp-chip--tech {
  color: var(--tsw-slate);
  background: var(--tsw-cloud);
  border-color: var(--tsw-stone);
}

.csp-widget-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: .88rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--tsw-green-dark);
  background: rgba(68,185,104,.08);
  border: 1px solid rgba(68,185,104,.2);
  transition: background .2s ease, color .2s ease;
}

.csp-widget-link:hover {
  background: var(--tsw-green);
  color: var(--tsw-white);
}

/* CTA widget */
.csp-cta-widget {
  text-align: center;
  background: linear-gradient(160deg, #1a3c2a 0%, #122618 100%);
  border: none;
  color: var(--tsw-white);
}

.csp-cta-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  font-size: 1.5rem;
  margin-bottom: 14px;
  color: #122618;
  background: var(--tsw-green-bright);
}

.csp-cta-title {
  font-size: 1.2rem;
  margin: 0 0 8px;
  color: var(--tsw-white);
}

.csp-cta-text {
  font-size: .88rem;
  line-height: 1.6;
  color: rgba(255,255,255,.72);
  margin: 0 0 18px;
}

.csp-cta-btn {
  width: 100%;
  justify-content: center;
  margin-bottom: 10px;
}

.csp-cta-whatsapp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--tsw-white);
  background: rgba(37,211,102,.16);
  border: 1px solid rgba(37,211,102,.4);
  transition: background .2s ease;
}

.csp-cta-whatsapp:hover { background: #25D366; color: var(--tsw-white); }
.csp-cta-whatsapp i { font-size: 1.05rem; }

/* ──────────────── RELATED ──────────────── */
.csp-related {
  padding: 56px 0;
  background: var(--tsw-cloud);
}

.csp-related-head {
  text-align: center;
  margin-bottom: 34px;
}

.csp-related-title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin: 0;
  color: var(--tsw-ink);
}

.csp-related-foot {
  text-align: center;
  margin-top: 36px;
}

/* ──────────────── BOTTOM CTA ──────────────── */
.csp-bottom-cta {
  padding: 64px 0;
  text-align: center;
}

.csp-bottom-cta-title {
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  color: var(--tsw-white);
  margin: 0 0 14px;
}

.csp-bottom-cta-desc {
  color: rgba(255,255,255,.72);
  font-size: 1rem;
  line-height: 1.7;
  max-width: 560px;
  margin: 0 auto 28px;
}


/* ══════════════════════════════════════════════════════════
 *  Desktop
 * ══════════════════════════════════════════════════════════ */
@media (min-width: 1024px) {
  .csp-hero { padding: 130px 0 64px; }

  .csp-hero-title { font-size: 3rem; }

  .csp-body { padding: 64px 0 40px; }

  .csp-layout {
    flex-direction: row;
    align-items: flex-start;
    gap: 48px;
  }

  .csp-content { flex: 1; }

  .csp-sidebar {
    flex: 0 0 340px;
    width: 340px;
    position: sticky;
    top: 90px;
    align-self: flex-start;
  }

  .csp-metrics {
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
  }

  .csp-gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }

  .csp-story-block { padding: 30px 28px; }

  .csp-related { padding: 80px 0; }

  .csp-bottom-cta { padding: 84px 0; }
}


/* ══════════════════════════════════════════════════════════
 *  Tablet
 * ══════════════════════════════════════════════════════════ */
@media (min-width: 768px) and (max-width: 1023px) {
  .csp-hero { padding: 110px 0 52px; }

  .csp-layout {
    flex-direction: column;
    gap: 44px;
  }

  /* Sidebar becomes a horizontal 2-up under the content */
  .csp-sidebar-sticky {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 20px;
  }

  .csp-widget { flex: 1 1 calc(50% - 10px); }

  .csp-metrics { grid-template-columns: repeat(4, 1fr); }

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

  .csp-related { padding: 64px 0; }
}


/* ══════════════════════════════════════════════════════════
 *  Large Mobile
 * ══════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  .csp-hero { padding: 88px 0 40px; }

  .csp-hero-tagline { font-size: 1rem; }

  .csp-hero-actions { gap: 10px; }
  .csp-hero-actions .tsw-btn-lg { flex: 1 1 100%; justify-content: center; }

  .csp-feature-img { border-radius: 14px; margin-bottom: 26px; }

  .csp-overview-text { font-size: 1.02rem; }

  .csp-story-title { font-size: 1.15rem; }

  .csp-testimonial-quote { font-size: 1.02rem; }
}


/* ══════════════════════════════════════════════════════════
 *  Mobile
 * ══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .csp-hero { padding: 82px 0 34px; }

  .csp-hero-badges { gap: 6px; }
  .csp-hero-badge { font-size: .72rem; padding: 5px 11px; }

  .csp-hero-title { font-size: 1.65rem; }

  .csp-hero-facts { gap: 8px; }
  .csp-hero-fact {
    flex: 1 1 100%;
    min-width: 0;
    padding: 10px 14px 10px 42px;
  }

  .csp-body { padding: 34px 0 16px; }

  .csp-metrics {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 32px;
  }

  .csp-metric { padding: 18px 10px; }

  .csp-story-block {
    padding: 22px 18px;
    border-radius: 14px;
  }

  .csp-story-head { gap: 10px; margin-bottom: 12px; }
  .csp-story-icon { width: 36px; height: 36px; font-size: 1rem; }
  .csp-story-title { font-size: 1.08rem; }
  .csp-story-text { font-size: .94rem; }

  .csp-testimonial { padding: 28px 20px 22px; border-radius: 14px; }

  .csp-widget { padding: 20px 18px; }

  .csp-related { padding: 48px 0; }
  .csp-bottom-cta { padding: 52px 0; }
}


/* ══════════════════════════════════════════════════════════
 *  Mobile Small
 * ══════════════════════════════════════════════════════════ */
@media (max-width: 375px) {
  .csp-hero { padding: 78px 0 30px; }
  .csp-hero-title { font-size: 1.5rem; }
  .csp-hero-tagline { font-size: .94rem; }

  .csp-hero-fact { padding: 9px 12px 9px 38px; }
  .csp-hero-fact > i { left: 13px; font-size: 1rem; }
  .csp-hero-fact-value { font-size: .84rem; }

  .csp-metric-value { font-size: 1.5rem; }
  .csp-metric-label { font-size: .72rem; }

  .csp-story-block { padding: 20px 16px; }
  .csp-story-title { font-size: 1.02rem; }

  .csp-fact { font-size: .82rem; }

  .csp-cta-title { font-size: 1.1rem; }
}
