/* ==========================================================================
   Case Study — DETAIL page (V2)
   Loads after css/home_v2.css + css_v2/base/variable.css (main/v2/base.html).
   Only what those / Bootstrap do NOT already provide.
   ========================================================================== */
:root { --font-heading: "Montserrat", sans-serif; }

/* home_v2.css gives .btn-flat svg a green disc; the arrows here use
   stroke="currentColor", so force the stroke white like the homepage markup */
.btn-flat svg { color: #fff; }

/* ---------------------------------------------------------------- hero */
.csd-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(900px 460px at 84% -10%, var(--brand-green-light) 0%, rgba(242, 248, 244, 0) 64%),
    linear-gradient(180deg, #fbfdfb, #fff);
}
.csd-hero__orb,
.csd-hero__dots { position: absolute; pointer-events: none; }
.csd-hero__orb {
  top: -150px;
  right: -120px;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  filter: blur(6px);
  background: radial-gradient(circle at 34% 30%, rgba(39, 93, 43, .22), rgba(39, 93, 43, .04) 62%, transparent 72%);
  animation: csdDrift 24s ease-in-out infinite;
}
.csd-hero__dots {
  inset: 0;
  background-image: radial-gradient(rgba(39, 93, 43, .14) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(680px 380px at 86% 4%, #000 0%, transparent 70%);
  mask-image: radial-gradient(680px 380px at 86% 4%, #000 0%, transparent 70%);
}
.csd-hero__inner { position: relative; }

.csd-crumbs { font-size: .84rem; color: var(--text-muted); }
.csd-crumbs a { color: var(--text-muted); }
.csd-crumbs a:hover { color: var(--brand-green); }
.csd-crumbs .sep { color: #a9b6ae; }
.csd-crumbs .here { color: #0f3d22; }

.csd-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(1.9rem, 3.8vw, 3.25rem);
  line-height: 1.06;
  letter-spacing: -.02em;
  max-width: 22ch;
}
.csd-lead {
  max-width: 56ch;
  color: var(--text-muted);
  font-size: clamp(.95rem, 1.15vw, 1.075rem);
  line-height: 1.65;
}
.csd-meta-pill {
  padding: .4rem .8rem;
  border: 1px solid #e7f3ec;
  border-radius: 40px;
  background: var(--brand-green-light);
  color: #3c4f45;
  font-size: .75rem;
  font-weight: 600;
}
.csd-meta-pill:first-child { color: #0f3d22; }

.csd-kicker {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--brand-green);
}

/* hero media — real image */
.csd-shot {
  position: relative;
  overflow: hidden;
  border: 1px solid #e7f3ec;
  border-radius: 14px;
  background: var(--brand-green-light);
  box-shadow: 0 22px 50px rgba(31, 111, 67, .14);
}
.csd-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Screenshots and dashboards must never be cropped — letterbox them instead. */
.csd-shot--stage { background: #fbfdfb; }
.csd-shot--stage img { object-fit: contain; }

/* Hero: keep the image's own proportions rather than forcing 4:3 on a screenshot */
.csd-shot--hero img { height: auto; max-height: 520px; object-fit: contain; }

/* placeholder for an un-filled CMS image slot */
.csd-ph {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 1.25rem;
  text-align: center;
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 600;
}
.csd-ph::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .6;
  background-image: linear-gradient(135deg, var(--brand-green-light) 25%, transparent 25%, transparent 50%, var(--brand-green-light) 50%, var(--brand-green-light) 75%, transparent 75%);
  background-size: 16px 16px;
}
.csd-ph svg, .csd-ph span { position: relative; }

/* ---------------------------------- hero media — animated (no image) --- */
.csd-anim {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 22px 50px rgba(15, 61, 34, .22);
  background: linear-gradient(115deg, #082a17, #0f3d22 28%, #1f6f43 62%, #7edfa6 100%);
  background-size: 220% 220%;
  animation: csdShift 16s ease-in-out infinite;
}
.csd-anim__dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .3) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: .45;
}
.csd-anim__scan {
  position: absolute;
  left: 0;
  right: 0;
  height: 34%;
  animation: csdScan 9s linear infinite;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .12), rgba(255, 255, 255, 0));
}
.csd-anim__stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.csd-anim__orbits {
  position: relative;
  width: 62%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.csd-anim__ring { position: absolute; border-radius: 50%; }
.csd-anim__ring--1 { inset: 0; border: 1.5px dashed rgba(255, 255, 255, .28); animation: csdSpin 26s linear infinite; }
.csd-anim__ring--2 { inset: 14%; border: 1.5px solid rgba(255, 255, 255, .22); animation: csdSpin 18s linear infinite reverse; }
.csd-anim__ring--3 { inset: 30%; border: 1.5px solid rgba(255, 255, 255, .16); animation: csdSpin 34s linear infinite; }
.csd-anim__ring i { position: absolute; border-radius: 50%; background: #fff; }
.csd-anim__ring--1 i { top: -5px; left: 50%; width: 10px; height: 10px; margin-left: -5px; box-shadow: 0 0 12px rgba(255, 255, 255, .8); }
.csd-anim__ring--2 i { bottom: -4px; left: 50%; width: 8px; height: 8px; margin-left: -4px; background: #d9f2e2; }
.csd-anim__ring--3 i { top: 50%; right: -4px; width: 7px; height: 7px; margin-top: -3.5px; background: rgba(255, 255, 255, .85); }
.csd-anim__pulse {
  position: absolute;
  inset: 34%;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  animation: csdPulse 3.2s ease-out infinite;
}
.csd-anim__pulse--b { animation-delay: 1.6s; }
.csd-anim__mono {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34%;
  aspect-ratio: 1 / 1;
  border-radius: 26%;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 14px 34px rgba(4, 26, 13, .35);
  animation: csdBeat 3.6s ease-in-out infinite;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(1.15rem, 2.4vw, 2rem);
  letter-spacing: -.03em;
  color: #0f3d22;
}
.csd-anim__bars {
  position: absolute;
  left: 1.25rem;
  bottom: 1.25rem;
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 58px;
}
.csd-anim__bars i { display: block; width: 7px; border-radius: 3px; background: rgba(255, 255, 255, .6); }
.csd-anim__bars i:nth-child(1) { animation: csdBarA 2.8s ease-in-out infinite; }
.csd-anim__bars i:nth-child(2) { animation: csdBarB 3.4s ease-in-out infinite; }
.csd-anim__bars i:nth-child(3) { animation: csdBarC 3.1s ease-in-out infinite; }
.csd-anim__bars i:nth-child(4) { animation: csdBarA 3.8s ease-in-out .4s infinite; }
.csd-anim__star { position: absolute; border-radius: 50%; background: #fff; animation: csdTwinkle 4s ease-in-out infinite; }
.csd-anim__star--1 { top: 14%; left: 10%; width: 6px; height: 6px; }
.csd-anim__star--2 { top: 70%; right: 14%; width: 5px; height: 5px; animation-duration: 5.2s; animation-delay: .8s; }
.csd-anim__star--3 { top: 26%; right: 8%; width: 4px; height: 4px; animation-duration: 6s; animation-delay: 1.4s; }
.csd-anim__badge {
  position: absolute;
  top: 1rem;
  right: 1.1rem;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .8rem;
  border-radius: 40px;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.csd-anim__badge i { width: 7px; height: 7px; border-radius: 50%; background: #7edfa6; animation: csdBeat 1.8s ease-in-out infinite; }

/* ------------------------------------------------------- outcome strip */
.csd-strip {
  background: #fbfdfb;
  border-top: 1px solid #e7f3ec;
  border-bottom: 1px solid #e7f3ec;
}
.csd-outcome b {
  display: block;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(1.5rem, 2.6vw, 2.2rem);
  letter-spacing: -.02em;
  color: #0f3d22;
}

/* -------------------------------------------------------------- rail */
.csd-rail { position: sticky; top: calc(var(--cs-header-h, 0px) + 1.5rem); }
.csd-panel-title {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #0f3d22;
}
.csd-facts div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem 0;
  border-bottom: 1px solid #f0f5f1;
}
.csd-facts span:first-child { font-size: .82rem; color: var(--text-muted); white-space: nowrap; }
.csd-facts span:last-child { font-size: .82rem; font-weight: 600; color: #0f3d22; text-align: right; }
.csd-pill {
  padding: .3rem .65rem;
  border: 1px solid #e7f3ec;
  border-radius: 40px;
  background: var(--brand-green-light);
  color: #3c4f45;
  font-size: .72rem;
  font-weight: 500;
}
.csd-pill--solid { background: #e3f0e7; color: #0f3d22; }

.csd-live {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .9rem;
  padding: 1.1rem 1.25rem;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(120deg, #0f3d22, #1f6f43);
  transition: background .25s ease, transform .25s ease;
}
.csd-live:hover { color: #fff; background: linear-gradient(120deg, #14532d, #2e8b57); transform: translateY(-2px); }
.csd-live__host { font-size: .92rem; font-weight: 600; word-break: break-word; }
.csd-live svg { flex: 0 0 auto; }

/* ---------------------------------------------------------- rich text */
.csd-prose { color: #3e4f46; font-size: 1.02rem; line-height: 1.75; }
.csd-prose > *:first-child { margin-top: 0; }
.csd-prose p { margin: 0 0 1.35rem; }
.csd-prose > p:first-of-type { font-size: 1.15rem; line-height: 1.65; color: #2b3a32; }
.csd-prose h2 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(1.4rem, 2.2vw, 1.85rem);
  line-height: 1.2;
  color: var(--black);
  margin: 2.75rem 0 .85rem;
}
.csd-prose h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.22rem;
  line-height: 1.3;
  color: var(--black);
  margin: 2rem 0 .6rem;
}
.csd-prose h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.05rem;
  color: #0f3d22;
  margin: 1.6rem 0 .5rem;
}
.csd-prose ul, .csd-prose ol { margin: 0 0 1.35rem; padding-left: 1.35rem; }
.csd-prose li { margin: 0 0 .55rem; }
.csd-prose li::marker { color: var(--brand-green); }
.csd-prose strong { color: #0f3d22; font-weight: 600; }
.csd-prose a {
  color: var(--brand-green);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.csd-prose a:hover { color: #1e4a22; }
.csd-prose blockquote {
  margin: 1.75rem 0;
  padding: 1.35rem 1.6rem;
  background: var(--brand-green-light);
  border-left: 3px solid var(--brand-green);
  border-radius: 0 12px 12px 0;
}
.csd-prose blockquote p {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 1.15rem;
  line-height: 1.5;
  color: #0f3d22;
}
.csd-prose blockquote cite {
  display: block;
  margin-top: .6rem;
  font-style: normal;
  font-size: .86rem;
  color: var(--text-muted);
}
.csd-prose figure { margin: 1.75rem 0; }
.csd-prose img { width: 100%; height: auto; border-radius: 12px; border: 1px solid #e7f3ec; display: block; }
.csd-prose figcaption { margin-top: .6rem; font-size: .84rem; color: var(--text-muted); }
.csd-prose hr { height: 1px; border: 0; background: #e7f3ec; margin: 2.25rem 0; }
.csd-prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .86rem;
  background: var(--brand-green-light);
  border: 1px solid #e7f3ec;
  border-radius: 6px;
  padding: .1rem .35rem;
  color: #0f3d22;
}
.csd-prose pre {
  background: #0f3d22;
  color: #d9f2e2;
  padding: 1.25rem;
  border-radius: 12px;
  overflow: auto;
  margin: 0 0 1.5rem;
}
.csd-prose pre code { background: none; border: 0; color: inherit; padding: 0; }
.csd-prose table { width: 100%; border-collapse: collapse; margin: 0 0 1.5rem; font-size: .92rem; }
.csd-prose th {
  text-align: left;
  font-family: var(--font-heading);
  font-weight: 600;
  color: #0f3d22;
  padding: .7rem .85rem;
  border-bottom: 2px solid #e7f3ec;
}
.csd-prose td { padding: .7rem .85rem; border-bottom: 1px solid #f0f5f1; }
.csd-prose table { display: block; overflow-x: auto; white-space: nowrap; }

/* ------------------------------------- "Inside the product" — viewer */
.csd-vindex { border-top: 1px solid #f0f5f1; }
.csd-vindex button {
  display: flex;
  align-items: flex-start;
  gap: .9rem;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 0;
  border-bottom: 1px solid #f0f5f1;
  border-left: 3px solid transparent;
  padding: 1rem 1rem 1rem .85rem;
  transition: background .25s ease, border-color .25s ease;
}
.csd-vindex button:hover { background: #fbfdfb; border-left-color: #cfe0d4; }
.csd-vindex button[aria-selected="true"] { background: var(--brand-green-light); border-left-color: var(--brand-green); }
.csd-vindex .n {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .08em;
  color: var(--text-muted);
  padding-top: 2px;
}
.csd-vindex button[aria-selected="true"] .n { color: var(--brand-green); }
.csd-vindex .t {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: .95rem;
  line-height: 1.3;
  color: var(--black);
}
.csd-vindex button[aria-selected="true"] .t { color: #0f3d22; }
.csd-vindex .c { font-size: .78rem; line-height: 1.5; color: var(--text-muted); }
.csd-shot--stage { aspect-ratio: 16 / 10; }
.csd-shot--stage .csd-stage-item { display: block; }
.csd-shot--stage img { animation: csdFadeIn .45s ease both; }
.csd-stage-title { font-family: var(--font-heading); font-weight: 600; font-size: 1.02rem; color: var(--black); }

/* -------------------------------------- client quote (no-visuals case) */
.csd-quote {
  background: #fbfdfb;
  border: 1px solid #e7f3ec;
  border-radius: 18px;
}
.csd-quote p {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: clamp(1.15rem, 2vw, 1.6rem);
  line-height: 1.4;
  color: #0f3d22;
}
.csd-quote-orb {
  position: relative;
  aspect-ratio: 1 / 1;
  max-width: 200px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0f3d22, #1f6f43 55%, #7edfa6);
  animation: csdFloat 8s ease-in-out infinite;
}
.csd-quote-orb::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background-image: radial-gradient(rgba(255, 255, 255, .3) 1px, transparent 1px);
  background-size: 16px 16px;
  opacity: .5;
}
.csd-quote-orb::after {
  content: "";
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  border: 1.5px dashed rgba(39, 93, 43, .22);
  animation: csdSpin 30s linear infinite;
}

/* -------------------------------------------------------- related cards */
.csd-rel { overflow: hidden; display: flex; flex-direction: column; }
.csd-rel > span:last-child { display: flex !important; flex-direction: column; flex: 1 1 auto; }
.csd-rel__foot { margin-top: auto; }
.csd-rel .csd-metric + .text-muted-custom { min-width: 0; }
.csd-rel:hover { transform: translateY(-6px); box-shadow: 0 20px 44px rgba(31, 111, 67, .16); }
.csd-rel__art { position: relative; height: 150px; overflow: hidden; }
.csd-rel__art .dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .32) 1px, transparent 1px);
  background-size: 16px 16px;
  opacity: .5;
}
.csd-rel__art .ring {
  position: absolute;
  top: -40px;
  right: -30px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .3);
}
.csd-rel__art .mono {
  position: absolute;
  left: 1.1rem;
  bottom: .7rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 2.6rem;
  line-height: 1;
  letter-spacing: -.04em;
  color: rgba(255, 255, 255, .2);
}
.csd-rel__art .badge-ind {
  position: absolute;
  top: .75rem;
  left: .9rem;
  padding: .3rem .7rem;
  border-radius: 40px;
  background: rgba(255, 255, 255, .93);
  color: #0f3d22;
  font-size: .7rem;
  font-weight: 600;
}
.csd-rel__title { font-family: var(--font-heading); font-weight: 600; font-size: 1.05rem; line-height: 1.25; color: var(--black); }
.csd-metric { font-family: var(--font-heading); font-weight: 700; font-size: 1rem; color: #0f3d22; }

/* ------------------------------------------------------------ keyframes */
@keyframes csdDrift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  33% { transform: translate3d(4%, -3%, 0) scale(1.07); }
  66% { transform: translate3d(-3%, 4%, 0) scale(.96); }
}
@keyframes csdSpin { to { transform: rotate(360deg); } }
@keyframes csdPulse { 0% { transform: scale(.72); opacity: .5; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes csdShift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes csdScan { 0% { transform: translateY(-120%); } 100% { transform: translateY(420%); } }
@keyframes csdBeat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes csdBarA { 0%, 100% { height: 28%; } 50% { height: 76%; } }
@keyframes csdBarB { 0%, 100% { height: 62%; } 50% { height: 34%; } }
@keyframes csdBarC { 0%, 100% { height: 44%; } 50% { height: 88%; } }
@keyframes csdTwinkle { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }
@keyframes csdFloat { 0%, 100% { transform: translate3d(0, 0, 0); } 50% { transform: translate3d(0, -12px, 0); } }
@keyframes csdFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ------------------------------------------------------------ responsive */
@media (max-width: 991.98px) {
  .csd-rail { position: static; }
  .csd-title { max-width: none; }
}
@media (max-width: 767.98px) {
  .csd-prose { font-size: .98rem; }
  .csd-prose > p:first-of-type { font-size: 1.05rem; }
  .csd-anim__bars { left: 1rem; bottom: 1rem; height: 44px; }
  .csd-rel:hover { transform: none; box-shadow: 0 10px 35px rgba(31, 111, 67, .08); }
  /* main.css makes .btn-brand full-width below 576px — the hero pair stacks fine,
     but keep the rail CTA inline */
  .csd-inline-btn { width: auto !important; }
}
@media (max-width: 575.98px) {
  .csd-quote-orb { max-width: 150px; }
}

@media (prefers-reduced-motion: reduce) {
  .csd-hero__orb, .csd-anim, .csd-anim *, .csd-quote-orb, .csd-quote-orb::after { animation: none !important; }
  .csd-rel, .csd-live { transition: none !important; }
}

/* ------------------------------------------- server-rendered gallery stage */
.csd-stage-item { position: absolute; inset: 0; display: block; }
.csd-rel__art--img {
  background-size: cover;
  background-position: center;
}
