/* ==========================================================================
   Single Case Study Template
   BEM block: sd-case-study
   ========================================================================== */

/* --- Variables (mapped to site tokens; accent = brand CTA green, not tan) --- */
.sd-case-study-page {
  --cs-primary: var(--sd-color-primary, #36452f);
  --cs-primary-dark: var(--sd-color-primary-dark, #2a3624);
  --cs-accent: var(--sd-color-cta, #5f7d3a);
  --cs-accent-hover: var(--sd-color-cta-hover, #8db35a);
  --cs-text: var(--sd-color-text, #171717);
  --cs-text-light: var(--sd-color-text-light, #525252);
  --cs-bg: var(--sd-color-background, #ffffff);
  --cs-bg-alt: var(--sd-color-cream, #f8f6ee);
  --cs-border: var(--sd-color-border, #d4d4d4);
  --cs-radius: 8px; /* matches the card radius used site-wide */
  --cs-header-h: var(--sd-header-height-desktop, 88px);
}

/* Headings: Outfit, consistent with the rest of the site */
.sd-case-study-page h1,
.sd-case-study-page h2,
.sd-case-study-page h3,
.sd-case-study-page h4 {
  font-family: var(--sd-font-family-primary, 'Outfit', sans-serif);
}

.admin-bar .sd-case-study-page {
  --cs-admin-bar: 32px;
}

@media (max-width: 782px) {
  .admin-bar .sd-case-study-page {
    --cs-admin-bar: 46px;
  }
}

@media (max-width: 767px) {
  .sd-case-study-page {
    --cs-header-h: var(--sd-header-height-mobile, 72px);
  }
}

/* ==========================================================================
   Hero
   ========================================================================== */

.sd-case-study__hero {
  position: relative;
  min-height: 75vh;
  display: flex;
  align-items: stretch;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: var(--cs-primary-dark);
}

/* Neutral dark gradient — same hue family as the service-page heroes.
   NOTE: the overlay is a normal flow child (NOT absolute) so the hero grows
   with tall content instead of letting the title slide under the fixed nav. */
.sd-case-study__hero-overlay {
  position: relative;
  background: linear-gradient(
    180deg,
    rgba(20, 28, 16, 0.55) 0%,
    rgba(20, 28, 16, 0.68) 45%,
    rgba(20, 28, 16, 0.94) 100%
  );
  display: flex;
  align-items: flex-end;
  width: 100%;
}

.sd-case-study__hero-content {
  padding-top: calc(var(--cs-header-h) + var(--cs-admin-bar, 0px) + 4rem);
  padding-bottom: 3.5rem;
  color: #ffffff;
}

/* Back to the case studies index (photo hero, so light-on-dark).
   display:flex (not inline) so the badge below starts on its own line. */
.sd-case-study__back {
  display: flex;
  width: max-content;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 1.1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  transition: color 0.2s ease, gap 0.2s ease;
}

.sd-case-study__back:hover,
.sd-case-study__back:focus-visible {
  color: #ffffff;
  gap: 0.65rem;
}

.sd-case-study__badge {
  display: inline-block;
  background: var(--cs-accent);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  margin-bottom: 1.25rem;
}

.sd-case-study__title {
  font-size: clamp(2.25rem, 5vw, 4rem); /* unified hero title scale */
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem;
  color: #ffffff;
}

.sd-case-study__intro {
  font-size: 1.0625rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 2rem;
  max-width: 580px;
}

.sd-case-study__intro p {
  margin: 0;
}

/* Stats Row */
.sd-case-study__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-bottom: 2.5rem;
}

.sd-case-study__stats-divider {
  width: 1px;
  background: rgba(255, 255, 255, 0.25);
  align-self: stretch;
}

.sd-case-study__stat {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.sd-case-study__stat-label {
  display: block;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.6;
}

.sd-case-study__stat-value {
  display: block;
  font-size: 1.125rem;
  font-weight: 700;
}

/* Hero CTA */
.sd-case-study__hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--cs-accent);
  color: #ffffff;
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 0.875rem 2rem;
  border-radius: 999px;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  letter-spacing: 0.01em;
}

.sd-case-study__hero-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  background: var(--sd-color-cta-strong, #4f6b30);
  color: #ffffff;
}

/* ==========================================================================
   Image Gallery — Airbnb-style preview grid
   Max 5 visible: 1 hero (left) + up to 4 small (right 2×2)
   Full gallery accessible via lightbox
   ========================================================================== */

.sd-case-study__gallery {
  padding: 3rem 0 0;
}

/* --- Grid layouts by visible count --- */

.sd-case-study__gallery-grid {
  display: grid;
  gap: 8px;
  border-radius: var(--cs-radius);
  overflow: hidden;
  height: 480px;
}

/* 1 image — single full-width */
.sd-case-study__gallery-grid[data-count="1"] {
  grid-template-columns: 1fr;
}

/* 2 images — hero left 60%, one right */
.sd-case-study__gallery-grid[data-count="2"] {
  grid-template-columns: 1.5fr 1fr;
}

/* 3 images — hero left, 2 stacked right */
.sd-case-study__gallery-grid[data-count="3"] {
  grid-template-columns: 1.5fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.sd-case-study__gallery-grid[data-count="3"] .sd-case-study__gallery-item--hero {
  grid-row: 1 / 3;
}

/* 4 images — hero left (2 rows), two stacked middle, one tall right.
   Every cell filled: no white holes. */
.sd-case-study__gallery-grid[data-count="4"] {
  grid-template-columns: 1.5fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.sd-case-study__gallery-grid[data-count="4"] .sd-case-study__gallery-item--hero {
  grid-row: 1 / 3;
}

.sd-case-study__gallery-grid[data-count="4"] .sd-case-study__gallery-item:last-child {
  grid-column: 3;
  grid-row: 1 / 3;
}

/* 5 images — hero left 50%, 4 in 2×2 grid right */
.sd-case-study__gallery-grid[data-count="5"] {
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.sd-case-study__gallery-grid[data-count="5"] .sd-case-study__gallery-item--hero {
  grid-row: 1 / 3;
}

/* --- Gallery item base --- */

.sd-case-study__gallery-item {
  margin: 0;
  overflow: hidden;
  position: relative;
  cursor: zoom-in;
}

.sd-case-study__gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
  margin: 0 !important;
}

.sd-case-study__gallery-item:hover img {
  transform: scale(1.05);
}

/* --- "View all X photos" overlay on last preview image --- */

.sd-case-study__gallery-more {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 600;
  pointer-events: none;
  transition: background 0.3s ease;
}

.sd-case-study__gallery-item:hover .sd-case-study__gallery-more {
  background: rgba(0, 0, 0, 0.35);
}

/* --- "View all photos" button (mobile + below grid) --- */

.sd-case-study__gallery-view-all {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: var(--cs-bg);
  border: 1px solid var(--cs-border);
  border-radius: var(--cs-radius);
  color: var(--cs-text);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.sd-case-study__gallery-view-all:hover {
  background: var(--cs-bg-alt);
  border-color: var(--cs-primary);
}

/* ==========================================================================
   Lightbox
   ========================================================================== */

.sd-case-study__lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sd-case-study__lightbox--open {
  opacity: 1;
  visibility: visible;
}

.sd-case-study__lightbox img {
  max-width: 85vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
  user-select: none;
}

/* Lightbox close button */
.sd-case-study__lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  z-index: 2;
}

.sd-case-study__lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Lightbox prev/next arrows */
.sd-case-study__lightbox-prev,
.sd-case-study__lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, opacity 0.2s ease;
  z-index: 2;
}

.sd-case-study__lightbox-prev {
  left: 1.25rem;
}

.sd-case-study__lightbox-next {
  right: 1.25rem;
}

.sd-case-study__lightbox-prev:hover,
.sd-case-study__lightbox-next:hover {
  background: rgba(255, 255, 255, 0.3);
}

.sd-case-study__lightbox-prev[hidden],
.sd-case-study__lightbox-next[hidden] {
  display: none;
}

/* Lightbox counter */
.sd-case-study__lightbox-counter {
  position: absolute;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 2;
}

/* Lightbox caption */
.sd-case-study__lightbox-caption {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9375rem;
  text-align: center;
  max-width: 80%;
}

/* ==========================================================================
   Video Section
   ========================================================================== */

.sd-case-study__video {
  padding: 3rem 0;
  background: var(--cs-bg-alt);
}

.sd-case-study__video-wrap {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--cs-radius);
  box-shadow: var(--sd-shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1));
}

.sd-case-study__video-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ==========================================================================
   360° Walkthrough (shares the video's 16:9 frame)
   ========================================================================== */

.sd-case-study__tour {
  padding: 3rem 0;
}

.sd-case-study__tour-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.sd-case-study__tour-title {
  margin: 0;
  font-size: clamp(1.375rem, 2.4vw, 1.75rem);
}

.sd-case-study__tour-open {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--cs-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sd-case-study__tour-open:hover {
  text-decoration-thickness: 2px;
}

/* ==========================================================================
   Content + Sidebar Body
   ========================================================================== */

.sd-case-study__body {
  display: flex;
  gap: 3rem;
  align-items: flex-start;
  padding: 3.5rem 0;
}

.sd-case-study__content {
  flex: 1;
  min-width: 0;
}

/* Reuse sd-content typography from sd-post */
.sd-case-study__content.sd-content {
  color: var(--cs-text);
  line-height: 1.75;
  font-size: 1.0625rem;
}

.sd-case-study__content.sd-content > * + * {
  margin-top: 1.1em;
}

.sd-case-study__content.sd-content h2,
.sd-case-study__content.sd-content h3,
.sd-case-study__content.sd-content h4 {
  line-height: 1.3;
  margin-top: 1.5em;
  margin-bottom: 0.6em;
  font-weight: 600;
}

.sd-case-study__content.sd-content h2 {
  font-size: clamp(1.5rem, 1.2vw + 1rem, 2rem);
}

.sd-case-study__content.sd-content h3 {
  font-size: clamp(1.25rem, 0.9vw + 0.9rem, 1.5rem);
}

.sd-case-study__content.sd-content p {
  margin: 0;
}

.sd-case-study__content.sd-content p strong {
  font-size: clamp(1.25rem, 0.9vw + 0.9rem, 1.5rem);
  display: block;
  margin-top: 1.5em;
  margin-bottom: 0.4em;
  line-height: 1.3;
}

.sd-case-study__content.sd-content a {
  color: var(--cs-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sd-case-study__content.sd-content a:hover {
  text-decoration-thickness: 2px;
}

.sd-case-study__content.sd-content img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 1.5rem 0;
}

.sd-case-study__content.sd-content ul,
.sd-case-study__content.sd-content ol {
  padding-left: 1.2rem;
}

.sd-case-study__content.sd-content li + li {
  margin-top: 0.35rem;
}

/* Content often uses <br> + bullet chars instead of ul/li — improve spacing */
.sd-case-study__content.sd-content br {
  content: '';
  display: block;
  margin-top: 0.25em;
}

/* Mid-content CTA — soft cream card, consistent with site cards */
.sd-case-study__mid-cta {
  margin-top: 3rem;
  padding: 2.5rem;
  background: var(--cs-bg-alt);
  border: 1px solid rgba(54, 69, 47, 0.08);
  border-radius: 6px;
}

.sd-case-study__mid-cta h3 {
  font-size: 1.375rem !important;
  font-weight: 600 !important;
  margin: 0 0 0.5rem !important;
  color: var(--cs-text) !important;
}

.sd-case-study__mid-cta p {
  color: var(--cs-text-light);
  margin: 0 0 1.5rem;
  font-size: 1rem;
  line-height: 1.5;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */

.sd-case-study__sidebar {
  width: 320px;
  flex-shrink: 0;
}

.sd-case-study__sidebar-sticky {
  position: sticky;
  top: calc(var(--cs-header-h) + 24px);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.admin-bar .sd-case-study__sidebar-sticky {
  top: calc(var(--cs-header-h) + 32px + 24px);
}

/* Details Card — slightly tighter radius than full-size cards; 16px reads
   too round at sidebar scale */
.sd-case-study__details-card {
  background: var(--cs-primary);
  color: #ffffff;
  padding: 2rem;
  border-radius: 6px;
}

/* typography.css forces a dark colour on headings — must be explicit on dark cards */
.sd-case-study__details-heading {
  font-size: 1.125rem;
  font-weight: 600;
  color: #ffffff;
  margin: 0 0 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.sd-case-study__details-list {
  margin: 0;
  padding: 0;
}

.sd-case-study__detail {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.625rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sd-case-study__detail:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.sd-case-study__detail dt {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.7;
}

.sd-case-study__detail dd {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  text-align: right;
}

/* Building uses: one per line, each opens the explorer filtered to that use. */
.sd-case-study__detail dd .sd-case-study__use {
  display: flex;
  width: fit-content;
  margin-left: auto;
  align-items: center;
  justify-content: flex-end;
  gap: 0.375rem;
  color: #ffffff !important;
  text-decoration: none;
  line-height: 1.35;
}

.sd-case-study__detail dd .sd-case-study__use + .sd-case-study__use {
  margin-top: 0.375rem;
}

.sd-case-study__use svg {
  flex: none;
  opacity: 0.6;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.sd-case-study__detail dd .sd-case-study__use:hover,
.sd-case-study__detail dd .sd-case-study__use:focus-visible {
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.55);
  text-underline-offset: 3px;
}

.sd-case-study__use:hover svg,
.sd-case-study__use:focus-visible svg {
  opacity: 1;
  transform: translateX(2px);
}

/* CTA Card */
.sd-case-study__cta-card {
  background: var(--cs-primary-dark);
  color: #ffffff;
  padding: 2rem;
  border-radius: 6px;
  text-align: center;
}

.sd-case-study__cta-card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #ffffff;
  margin: 0 0 0.5rem;
}

.sd-case-study__cta-card p {
  font-size: 0.9375rem;
  opacity: 0.8;
  margin: 0 0 1.25rem;
  line-height: 1.5;
}

.sd-case-study__phone {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 0.9375rem;
  margin-top: 0.75rem;
  transition: color 0.2s ease;
}

.sd-case-study__phone:hover {
  color: #ffffff;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.sd-case-study__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.8125rem 1.75rem;
  border-radius: 999px; /* pill, matching site buttons */
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  cursor: pointer;
  border: 2px solid transparent;
}

.sd-case-study__btn:hover {
  transform: translateY(-1px);
}

/* High specificity: the content area's link colour/underline otherwise
   overrides the button styles (green-on-green text). */
.sd-case-study-page a.sd-case-study__btn--primary {
  background: var(--cs-accent);
  color: #ffffff;
  border-color: var(--cs-accent);
  text-decoration: none;
  box-shadow: none;
}

.sd-case-study-page a.sd-case-study__btn--primary:hover {
  background: var(--sd-color-cta-strong, #4f6b30);
  border-color: var(--sd-color-cta-strong, #4f6b30);
  color: #ffffff;
}

.sd-case-study__btn--primary:hover {
  background: var(--cs-primary-dark);
  border-color: var(--cs-primary-dark);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(26, 77, 46, 0.3);
}

.sd-case-study__btn--white {
  background: #ffffff;
  color: var(--cs-primary);
  border-color: #ffffff;
}

.sd-case-study__btn--white:hover {
  background: #f0f0f0;
  color: var(--cs-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sd-case-study__btn--outline {
  background: transparent;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.4);
}

.sd-case-study__btn--outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #ffffff;
  color: #ffffff;
}

/* ==========================================================================
   Testimonial
   ========================================================================== */

.sd-case-study__testimonial {
  background: var(--cs-bg-alt);
  padding: 5rem 0;
}

.sd-case-study__testimonial-inner {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.sd-case-study__quote-icon {
  color: var(--cs-primary);
  opacity: 0.2;
  margin-bottom: 1.5rem;
}

.sd-case-study__quote {
  font-size: clamp(1.125rem, 1vw + 0.8rem, 1.375rem);
  line-height: 1.7;
  color: var(--cs-text);
  font-style: italic;
  margin: 0 0 2rem;
  padding: 0;
  border: 0;
}

.sd-case-study__attribution {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.sd-case-study__stars {
  display: flex;
  gap: 0.125rem;
}

.sd-case-study__star {
  color: var(--cs-border);
  fill: none;
}

.sd-case-study__star--filled {
  color: #f59e0b;
  fill: #f59e0b;
}

.sd-case-study__cite {
  font-style: normal;
}

.sd-case-study__cite strong {
  display: block;
  font-size: 1.0625rem;
  color: var(--cs-text);
}

.sd-case-study__cite span {
  display: block;
  font-size: 0.875rem;
  color: var(--cs-text-light);
  margin-top: 0.125rem;
}

/* ==========================================================================
   Related Case Studies
   ========================================================================== */

.sd-case-study__related {
  padding: 5rem 0;
}

.sd-case-study__section-heading {
  font-size: clamp(1.5rem, 2vw + 1rem, 2rem);
  font-weight: 600;
  color: var(--cs-text);
  margin: 0 0 2rem;
}

.sd-case-study__related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

/* ==========================================================================
   Final CTA
   ========================================================================== */

.sd-case-study__final-cta {
  background: var(--cs-primary);
  color: #ffffff;
  padding: 5rem 0;
}

.sd-case-study__final-cta-inner {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

.sd-case-study__final-cta h2 {
  font-size: clamp(1.75rem, 2vw + 1rem, 2.5rem);
  font-weight: 700;
  margin: 0 0 1rem;
  color: #ffffff;
}

.sd-case-study__final-cta p {
  font-size: 1.125rem;
  opacity: 0.85;
  margin: 0 0 2rem;
  line-height: 1.6;
}

.sd-case-study__final-cta-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1024px) {
  .sd-case-study__body {
    flex-direction: column;
  }

  .sd-case-study__sidebar {
    width: 100%;
    order: -1;
  }

  .sd-case-study__sidebar-sticky {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sd-case-study__details-card,
  .sd-case-study__cta-card {
    flex: 1;
    min-width: 280px;
  }

  .sd-case-study__related-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Gallery: reduce height at tablet */
  .sd-case-study__gallery-grid {
    height: 380px;
  }
}

@media (max-width: 767px) {
  .sd-case-study__hero {
    min-height: 65vh;
  }

  .sd-case-study__hero-content {
    padding-top: calc(var(--cs-header-h) + var(--cs-admin-bar, 0px) + 3rem);
    padding-bottom: 2.5rem;
  }

  .sd-case-study__title {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
  }

  .sd-case-study__intro {
    font-size: 1rem;
  }

  .sd-case-study__stats {
    gap: 1.25rem;
  }

  .sd-case-study__stats-divider {
    display: none;
  }

  .sd-case-study__body {
    padding: 2.5rem 0;
  }

  .sd-case-study__sidebar-sticky {
    flex-direction: column;
  }

  .sd-case-study__details-card,
  .sd-case-study__cta-card {
    min-width: 0;
  }

  .sd-case-study__mid-cta {
    padding: 1.75rem;
  }

  /* Gallery: show only hero image, hide rest, show "View all" button */
  .sd-case-study__gallery-grid {
    height: 280px;
    grid-template-columns: 1fr !important;
    grid-template-rows: 1fr !important;
  }

  .sd-case-study__gallery-item:not(.sd-case-study__gallery-item--hero) {
    display: none;
  }

  .sd-case-study__gallery-item--hero {
    grid-column: auto !important;
    grid-row: auto !important;
  }

  .sd-case-study__gallery-view-all {
    display: flex;
  }

  /* Lightbox arrows smaller on mobile */
  .sd-case-study__lightbox-prev,
  .sd-case-study__lightbox-next {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .sd-case-study__lightbox-prev {
    left: 0.75rem;
  }

  .sd-case-study__lightbox-next {
    right: 0.75rem;
  }

  .sd-case-study__testimonial {
    padding: 3.5rem 0;
  }

  .sd-case-study__related {
    padding: 3.5rem 0;
  }

  .sd-case-study__related-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .sd-case-study__final-cta {
    padding: 3.5rem 0;
  }

  .sd-case-study__final-cta-buttons {
    flex-direction: column;
    align-items: center;
  }

  .sd-case-study__final-cta-buttons .sd-case-study__btn {
    width: 100%;
    max-width: 320px;
  }
}

/* ==========================================================================
   Divi Overrides — ensure our template looks right within Divi wrapper
   ========================================================================== */

.sd-case-study-page #main-content {
  padding-top: 0 !important;
}

.sd-case-study-page #content-area {
  padding-top: 0 !important;
}

.sd-case-study-page #page-container {
  padding-top: 0 !important;
}

.sd-case-study-page .container {
  max-width: var(--sd-container-max, 1440px);
  margin: 0 auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* Inside the flex hero overlay the .container is a flex item, so without an
   explicit width it shrinks to its content instead of spanning the hero —
   which collapses the max-width + auto-margin centring. Force it full width. */
.sd-case-study__hero .container {
  width: 100%;
}

/* Override Divi heading resets */
.sd-case-study-page h1,
.sd-case-study-page h2,
.sd-case-study-page h3,
.sd-case-study-page h4 {
  padding-bottom: 0;
  line-height: 1.2;
  color: var(--cs-text) !important;
}

/* Hero headings stay white */
.sd-case-study__hero h1,
.sd-case-study__hero-content h1 {
  color: #ffffff !important;
}

/* White headings in dark cards and sections */
.sd-case-study__details-card h3,
.sd-case-study__cta-card h3,
.sd-case-study__final-cta h2 {
  color: #ffffff !important;
}

/* Ensure hero breaks out of any container */
.sd-case-study__hero {
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  width: 100vw;
}

/* Full-width sections */
.sd-case-study__testimonial,
.sd-case-study__final-cta,
.sd-case-study__video {
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  width: 100vw;
}

/* ==========================================================================
   Inflation-adjusted price
   ========================================================================== */

.sd-case-study__stat--adjusted .sd-case-study__stat-label {
  font-size: 0.5625rem;
  opacity: 0.45;
}

.sd-case-study__stat--adjusted .sd-case-study__stat-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--sd-color-cta, #5f7d3a);
  opacity: 1;
}

.sd-case-study__detail--adjusted {
  border-top: 1px dashed rgba(255, 255, 255, 0.15);
  margin-top: 0.25rem;
  padding-top: 0.75rem;
}

.sd-case-study__detail--adjusted dt {
  font-size: 0.6875rem;
}

.sd-case-study__detail--adjusted dd {
  font-weight: 700;
  color: var(--sd-color-cta, #5f7d3a);
}

/* ── One page grid (2026-09-27): every template starts its content at the
   same edge as the logo: max var(--sd-container-max) with var(--sd-gutter)
   (20px phones → 56px desktop). ── */
.sd-case-study-page .container { padding-inline: var(--sd-gutter); }
.sd-case-study__hero .container { padding-inline: 20px; } /* hero keeps its own edge */

/* ── Case study: hero links + in-content prompt (2026-09-27) ────────────── */

/* Links inside the hero intro read white on the photo overlay (the global
   `p a` link colour is !important, so this has to be too). */
.sd-case-study__hero .sd-case-study__intro a,
.sd-case-study__hero .sd-case-study__intro p a {
  color: #fff !important;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.55);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.sd-case-study__hero .sd-case-study__intro a:hover,
.sd-case-study__hero .sd-case-study__intro p a:hover { text-decoration-color: #fff; }

/* "Like what you see?": a ruled prompt, not a card. Copy left, action right;
   stacks with real spacing on narrow columns. */
.sd-case-study__content.sd-content > .sd-case-study__prompt {
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
  padding: 1.75rem 0;
  border-top: 1px solid rgba(54, 69, 47, 0.18);
  border-bottom: 1px solid rgba(54, 69, 47, 0.18);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem 2.5rem;
}
.sd-case-study__prompt-copy { flex: 1 1 22rem; }
.sd-case-study__content.sd-content .sd-case-study__prompt-title {
  margin: 0;
  font-family: var(--sd-font-family-primary);
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--cs-text);
}
.sd-case-study__content.sd-content .sd-case-study__prompt-text {
  margin: 0.4rem 0 0;
  max-width: 48ch;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--cs-text-light);
}
.sd-case-study__content.sd-content a.sd-case-study__prompt-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.95rem 1.35rem;
  background: var(--sd-color-cta, #5f7d3a);
  color: #fff;
  font-family: var(--sd-font-family-primary);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  border-radius: 4px;
  text-decoration: none;
  transition: background-color 0.2s ease;
}
.sd-case-study__content.sd-content a.sd-case-study__prompt-btn:hover {
  background: var(--sd-color-cta-strong, #4f6b30);
  color: #fff;
}
.sd-case-study__prompt-btn svg { flex: none; transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1); }
.sd-case-study__prompt-btn:hover svg,
.sd-case-study__prompt-btn:focus-visible svg { transform: translateX(3px); }
@media (max-width: 480px) {
  .sd-case-study__content.sd-content a.sd-case-study__prompt-btn { width: 100%; justify-content: space-between; box-sizing: border-box; }
}
@media (prefers-reduced-motion: reduce) {
  .sd-case-study__prompt-btn, .sd-case-study__prompt-btn svg { transition: none; }
}

/* End-of-page band: the page's h2 colour rule (!important, above) would turn
   its heading dark on the green. */
.sd-case-study-page .sd-endcta__heading {
  color: #ffffff !important;
}

/* ── Announcement intro (post_announcement_text, kept verbatim from the Divi
      site: the "21 years, 21 stories" blocks and event notes) ── */
.sd-announcement {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin: 0 0 2rem;
  padding: 1.5rem 1.75rem;
  background: var(--sd-color-background-alt, #f3f4f6);
  border-left: 4px solid var(--sd-color-primary, #36452f);
  border-radius: 0 var(--sd-radius-xl, 0.375rem) var(--sd-radius-xl, 0.375rem) 0;
}
.sd-announcement .sd-announcement__text { flex: 1; min-width: 0; }
.sd-announcement .sd-announcement__text > :first-child { margin-top: 0; }
.sd-announcement .sd-announcement__text > :last-child { margin-bottom: 0; }
.sd-announcement .sd-announcement__text h2 {
  font-size: clamp(1.25rem, 0.8vw + 1rem, 1.5rem);
  margin: 0 0 0.5rem;
  color: var(--sd-color-primary, #36452f);
}
.sd-announcement .sd-announcement__image { flex: 0 0 auto; width: 112px; height: auto; margin: 0; }
@media (max-width: 640px) {
  .sd-announcement { flex-direction: column-reverse; align-items: flex-start; gap: 1rem; padding: 1.25rem; }
  .sd-announcement .sd-announcement__image { width: 88px; }
}
