/* HDL Portfolio Case Study V2.2
 * Dedicated image-led case-study styling for the Bricks Portfolio template.
 * Bricks owns the logical content structure; this scoped stylesheet supplies
 * the HDL surface rhythm and responsive presentation without ACF.
 */

.hdl-pf-section,
.hdl-pf-section *,
.hdl-pf-section *::before,
.hdl-pf-section *::after {
  box-sizing: border-box;
}

.hdl-pf-section {
  width: 100%;
  padding-block: var(--section-space-m, clamp(72px, 8vw, 112px));
  padding-inline: var(--section-padding-x, clamp(20px, 4vw, 40px));
}

.hdl-pf-container,
.hdl-pf-brief__grid,
.hdl-pf-split,
.hdl-pf-details__grid,
.hdl-pf-cta__inner,
.hdl-pf-copy-stack,
.hdl-pf-split__copy,
.hdl-pf-build__copy,
.hdl-pf-details__column,
.hdl-pf-gallery__intro,
.hdl-pf-before-after__item,
.hdl-pf-split__media-group,
.hdl-pf-cta__copy,
.hdl-pf-cta__actions {
  min-width: 0;
  max-width: 100%;
}

.hdl-pf-heading,
.hdl-pf-subheading,
.hdl-pf-body,
.hdl-pf-body p,
.hdl-pf-fact-value,
.hdl-pf-details-list dd,
.hdl-pf-feature-list li,
.hdl-pf-pullquote {
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: normal;
  white-space: normal;
}

.hdl-pf-body,
.hdl-pf-body p {
  width: 100%;
}

.hdl-pf-surface--default {
  background: var(--primary-ultra-light, #f5f3f0);
}

.hdl-pf-surface--alternate {
  background: var(--primary-trans-10, rgba(75, 66, 52, .10));
}

.hdl-pf-surface--standout {
  background: var(--primary-light, #c0b5a5);
}

.hdl-pf-container {
  width: 100%;
  max-width: var(--content-width, 1200px);
  margin-inline: auto;
}

.hdl-pf-eyebrow {
  margin: 0;
  color: #000;
  font-size: 13px;
  font-weight: inherit;
  line-height: 1.35;
  letter-spacing: .22em;
  text-transform: uppercase;
}

.hdl-pf-heading,
.hdl-pf-subheading,
.hdl-pf-body,
.hdl-pf-fact-label,
.hdl-pf-fact-value,
.hdl-pf-pullquote {
  margin: 0;
}

.hdl-pf-body > :first-child {
  margin-top: 0;
}

.hdl-pf-body > :last-child {
  margin-bottom: 0;
}

.hdl-pf-body > * + * {
  margin-top: 1.2em;
}

/* Hero -------------------------------------------------------------------- */
.hdl-pf-hero {
  position: relative;
  min-height: clamp(560px, 74svh, 820px);
  padding: 0;
  overflow: hidden;
  isolation: isolate;
  color: var(--white, #fff);
  background: var(--primary-ultra-dark, #1e1a15);
}

/* The V2.1 template places the project image directly under the Hero section.
 * This keeps the media layer independent from the content container. */
.hdl-pf-hero__media {
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  position: absolute !important;
  inset: 0 !important;
  z-index: 0;
  margin: 0 !important;
  overflow: hidden;
  background: transparent;
}

.hdl-pf-hero__media picture,
.hdl-pf-hero__media img {
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
}

.hdl-pf-hero__media img {
  display: block;
  object-fit: cover;
  object-position: 50% 50%;
}

/* Localised readability veil: image -> gradient -> text. */
.hdl-pf-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, .24) 0%,
    rgba(0, 0, 0, .16) 22%,
    rgba(0, 0, 0, .05) 38%,
    rgba(0, 0, 0, 0) 48%
  );
}

.hdl-pf-hero > .hdl-pf-container {
  width: 100%;
  max-width: none;
  min-height: inherit;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
}

.hdl-pf-hero__intro {
  width: 100%;
  max-width: calc(var(--content-width, 1200px) + 80px);
  display: flex;
  flex-direction: column;
  gap: var(--space-s, 1rem);
  margin: 0 auto;
  padding: clamp(48px, 7vw, 86px) var(--section-padding-x, clamp(20px, 4vw, 40px)) clamp(18px, 3vw, 38px);
  transform: translateY(clamp(28px, 3vw, 46px));
}

.hdl-pf-hero .hdl-pf-eyebrow,
.hdl-pf-hero__h1 {
  position: relative;
  z-index: 3;
  color: var(--white, #fff) !important;
}

.hdl-pf-hero__h1 {
  max-width: 16ch;
  margin: 0;
  text-wrap: balance;
}

/* Client brief ------------------------------------------------------------ */
.hdl-pf-brief__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, .65fr);
  gap: clamp(52px, 8vw, 112px);
  align-items: start;
}

.hdl-pf-copy-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-m, 1.5rem);
}

.hdl-pf-brief__copy {
  max-width: 760px;
}

.hdl-pf-facts {
  margin: calc(var(--space-m, 1.5rem) + 1.15rem) 0 0;
  border-top: 1px solid var(--primary-trans-20, rgba(75, 66, 52, .2));
}

.hdl-pf-fact {
  display: grid;
  gap: .35rem;
  padding: var(--space-s, 1rem) 0;
  border-bottom: 1px solid var(--primary-trans-20, rgba(75, 66, 52, .2));
}

.hdl-pf-fact-label {
  color: var(--primary, #4b4234);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.hdl-pf-fact-value {
  text-wrap: pretty;
}

/* Reusable editorial split ------------------------------------------------ */
.hdl-pf-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(44px, 7vw, 96px);
  align-items: center;
}

.hdl-pf-split__copy {
  width: min(100%, 650px);
  display: flex;
  flex-direction: column;
  gap: var(--space-m, 1.5rem);
  justify-self: start;
}

.hdl-pf-split__media {
  width: 100%;
  aspect-ratio: 4 / 3;
  margin: 0;
  overflow: hidden;
  background: rgba(0, 0, 0, .035);
}

.hdl-pf-split__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
}

.hdl-pf-split__media-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: .8rem;
}

.hdl-pf-media-label,
.hdl-pf-before-after__label {
  margin: 0;
  color: #000;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: .16em;
  text-transform: uppercase;
}

/* Behind the finish: copy remains first in the DOM for a sensible mobile
 * reading order, while desktop places the smaller construction image left. */
.hdl-pf-build__media {
  grid-column: 1;
  grid-row: 1;
}

.hdl-pf-build__copy {
  grid-column: 2;
  grid-row: 1;
}

.hdl-pf-build:not(:has(.hdl-pf-build__media)) .hdl-pf-build__copy {
  grid-column: 1 / -1;
  width: min(100%, 820px);
}

/* Finished result: editorial copy first, followed by a wide project image. */
.hdl-pf-result__copy {
  width: min(100%, 820px);
  display: flex;
  flex-direction: column;
  gap: var(--space-m, 1.5rem);
}

.hdl-pf-result__media {
  width: 100%;
  aspect-ratio: 16 / 7;
  margin: clamp(30px, 4vw, 48px) 0 0;
  overflow: hidden;
  background: rgba(0, 0, 0, .035);
}

.hdl-pf-result__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
}

/* Finished result --------------------------------------------------------- */
.hdl-pf-pullquote {
  margin-top: var(--space-xs, .75rem);
  padding-left: clamp(18px, 2vw, 28px);
  border-left: 2px solid var(--primary, #4b4234);
  font-size: 1.15em;
  line-height: 1.5;
  text-wrap: pretty;
}

/* Project details --------------------------------------------------------- */
.hdl-pf-details__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(52px, 8vw, 112px);
  align-items: start;
}

.hdl-pf-details__column {
  display: flex;
  flex-direction: column;
  gap: var(--space-m, 1.5rem);
}

.hdl-pf-details__column > .hdl-pf-body {
  width: 100%;
  margin-inline-start: 0 !important;
  padding-inline-start: 0 !important;
}

.hdl-pf-details-list,
.hdl-pf-feature-list {
  margin: 0;
  padding: 0;
}

.hdl-pf-details-list {
  border-top: 1px solid var(--primary-trans-20, rgba(75, 66, 52, .2));
}

.hdl-pf-details-list__row {
  display: grid;
  grid-template-columns: minmax(9rem, .7fr) minmax(0, 1.3fr);
  gap: var(--space-m, 1.5rem);
  padding: var(--space-s, 1rem) 0;
  border-bottom: 1px solid var(--primary-trans-20, rgba(75, 66, 52, .2));
}

.hdl-pf-details-list dt {
  color: var(--primary, #4b4234);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.hdl-pf-details-list dd {
  margin: 0;
}

.hdl-pf-feature-list {
  list-style: none;
  width: 100%;
  margin-inline-start: 0 !important;
  padding-inline-start: 0 !important;
  counter-reset: hdl-pf-feature;
  border-top: 1px solid var(--primary-trans-20, rgba(75, 66, 52, .2));
}

.hdl-pf-feature-list li {
  position: relative;
  padding: var(--space-s, 1rem) 0 var(--space-s, 1rem) 3.2rem;
  border-bottom: 1px solid var(--primary-trans-20, rgba(75, 66, 52, .2));
  counter-increment: hdl-pf-feature;
}

.hdl-pf-feature-list li::before {
  position: absolute;
  left: 0;
  top: var(--space-s, 1rem);
  color: var(--primary, #4b4234);
  content: counter(hdl-pf-feature, decimal-leading-zero);
  font-weight: 700;
  letter-spacing: .06em;
}

/* Gallery ----------------------------------------------------------------- */
.hdl-pf-gallery__intro {
  width: min(100%, 760px);
  display: flex;
  flex-direction: column;
  gap: var(--space-s, 1rem);
  margin-bottom: clamp(28px, 4vw, 44px);
}

.hdl-pf-before-after {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--grid-gap, var(--space-m, 1.5rem));
  margin-bottom: clamp(34px, 4vw, 50px);
}

.hdl-pf-before-after__item {
  display: flex;
  flex-direction: column;
  gap: .65rem;
}

.hdl-pf-before-after__media {
  width: 100%;
  aspect-ratio: 4 / 3;
  margin: 0;
  overflow: hidden;
  background: rgba(0, 0, 0, .035);
}

.hdl-pf-before-after__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
}

.hdl-pf-gallery-grid {
  --columns: 3;
  --gutter: var(--grid-gap, 1rem);
}

.hdl-pf-gallery-grid .image {
  overflow: hidden;
}

.hdl-pf-gallery-grid img {
  object-fit: cover;
}

/* CTA --------------------------------------------------------------------- */
.hdl-pf-cta {
  padding-block: clamp(56px, 6vw, 82px);
  color: var(--primary-ultra-dark, #4b4234);
  background: var(--primary-light, #e0dad2);
}

.hdl-pf-cta .hdl-pf-eyebrow,
.hdl-pf-cta .hdl-pf-heading,
.hdl-pf-cta .hdl-pf-body {
  color: var(--primary-ultra-dark, #4b4234) !important;
}

.hdl-pf-cta__inner {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  gap: clamp(40px, 7vw, 96px);
  align-items: center;
}

.hdl-pf-cta__copy {
  width: min(100%, 760px);
  display: flex;
  flex-direction: column;
  gap: var(--space-m, 1.5rem);
}

.hdl-pf-cta__actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-s, 1rem);
  justify-self: end;
  align-items: flex-end;
}

.hdl-pf-cta__actions > * {
  width: 100% !important;
  max-width: 390px;
  justify-content: center;
  text-align: center;
}

.hdl-pf-cta .btn--primary {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
}

.hdl-pf-cta .btn--primary::after {
  content: "\2192";
  flex: 0 0 auto;
  font-size: 1.15em;
  font-weight: 400;
  line-height: 1;
}

/* Tablet ------------------------------------------------------------------ */
@media (max-width: 991px) {
  .hdl-pf-brief__grid,
  .hdl-pf-split,
  .hdl-pf-details__grid,
  .hdl-pf-cta__inner {
    grid-template-columns: minmax(0, 1fr);
  }

  .hdl-pf-brief__grid,
  .hdl-pf-split,
  .hdl-pf-details__grid {
    gap: var(--space-xl, 2.5rem);
  }

  /* V2.2 keeps logical copy-first DOM order. Reset the desktop-only build
   * placement when the layout becomes a single column. */
  .hdl-pf-build__media,
  .hdl-pf-build__copy {
    grid-column: auto;
    grid-row: auto;
  }

  .hdl-pf-split__copy {
    width: 100%;
    justify-self: stretch;
  }

  .hdl-pf-facts {
    margin-top: 0;
  }

  .hdl-pf-cta__actions {
    width: 100%;
    justify-self: stretch;
    align-items: stretch;
  }
}

/* Mobile ------------------------------------------------------------------ */
@media (max-width: 767px) {
  .hdl-pf-section {
    width: 100%;
    padding-block: clamp(52px, 12vw, 68px);
    padding-inline: 20px;
  }

  .hdl-pf-container {
    width: 100%;
    max-width: 100%;
  }

  .hdl-pf-eyebrow {
    font-size: 11px;
    line-height: 1.3;
    letter-spacing: .18em;
  }

  /* Keep case-study typography on the same responsive scale as the service
   * pages. These elements are semantic H2/H3/body content, so Bricks Theme
   * Style (HDL Typography) owns their font size and line height. */
  .hdl-pf-heading,
  .hdl-pf-subheading {
    width: 100%;
    text-wrap: pretty;
  }

  .hdl-pf-copy-stack,
  .hdl-pf-split__copy,
  .hdl-pf-build__copy,
  .hdl-pf-details__column,
  .hdl-pf-cta__copy {
    gap: 1rem;
  }

  .hdl-pf-hero {
    min-height: clamp(500px, 68svh, 620px);
    padding: 0;
  }

  .hdl-pf-hero > .hdl-pf-container {
    min-height: inherit;
  }

  .hdl-pf-hero__intro {
    width: 100%;
    max-width: 100%;
    gap: .8rem;
    margin: 0;
    padding: 36px 20px 42px;
    transform: none;
  }

  .hdl-pf-hero__h1 {
    width: 100%;
    max-width: 12ch;
    text-wrap: balance;
  }

  .hdl-pf-hero::after {
    background: linear-gradient(
      90deg,
      rgba(0, 0, 0, .26) 0%,
      rgba(0, 0, 0, .16) 38%,
      rgba(0, 0, 0, .04) 68%,
      rgba(0, 0, 0, 0) 88%
    );
  }

  .hdl-pf-brief__grid,
  .hdl-pf-split,
  .hdl-pf-details__grid {
    gap: 2rem;
  }

  .hdl-pf-facts {
    width: 100%;
    margin-top: .25rem;
  }

  .hdl-pf-fact {
    width: 100%;
    padding: .9rem 0;
  }

  .hdl-pf-split__media,
  .hdl-pf-before-after__media {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 4 / 3;
  }

  .hdl-pf-split__media img,
  .hdl-pf-before-after__media img,
  .hdl-pf-build__media img {
    display: block;
    width: 100%;
    max-width: 100%;
  }

  .hdl-pf-build__media,
  .hdl-pf-result__media {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 4 / 3;
  }

  .hdl-pf-result__media {
    margin-top: 1.5rem;
  }

  .hdl-pf-pullquote {
    width: 100%;
    margin-top: .5rem;
    padding-left: 1rem;
  }

  .hdl-pf-details__grid {
    gap: 3rem;
  }

  .hdl-pf-details-list__row {
    grid-template-columns: minmax(0, 1fr);
    gap: .35rem;
    padding: .9rem 0;
  }

  .hdl-pf-details-list dt,
  .hdl-pf-fact-label,
  .hdl-pf-before-after__label,
  .hdl-pf-media-label {
    font-size: 12px;
  }

  .hdl-pf-feature-list li {
    width: 100%;
    min-width: 0;
    padding: .9rem 0 .9rem 2.55rem;
  }

  .hdl-pf-feature-list li::before {
    top: .9rem;
  }

  .hdl-pf-gallery__intro {
    width: 100%;
    margin-bottom: 1.75rem;
  }

  .hdl-pf-before-after {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.75rem;
    margin-bottom: 2rem;
  }

  .hdl-pf-gallery-grid {
    --columns: 1;
    --gutter: .75rem;
    width: 100%;
    max-width: 100%;
  }

  .hdl-pf-gallery-grid img {
    display: block;
    width: 100%;
    max-width: 100%;
  }

  .hdl-pf-cta {
    padding-block: 52px;
  }

  .hdl-pf-cta__inner {
    gap: 2rem;
  }

  .hdl-pf-cta__actions {
    width: 100%;
    max-width: none;
    gap: .75rem;
  }

  .hdl-pf-cta__actions > * {
    width: 100% !important;
    max-width: none;
    min-width: 0;
    white-space: normal;
  }
}

@media (max-width: 479px) {
  .hdl-pf-section {
    padding-block: 48px;
    padding-inline: 18px;
  }

  .hdl-pf-hero__intro {
    padding-inline: 18px;
    padding-bottom: 36px;
  }

  .hdl-pf-hero__h1 {
    max-width: 11.5ch;
  }
}
