/* ============================================
   Modules
   Reusable layout modules — can be included
   on any page that needs them.
   ============================================ */


/* ============================================
   Mosaic
   One wide image on top, two equal images
   below with optional captions.
   ============================================ */

.mosaic {
  padding: 30px var(--page-margin);
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* Big image — 7:3 wide panoramic */
.mosaic__big {
  width: 100%;
  aspect-ratio: 7 / 3;
  overflow: hidden;
  background-color: var(--color-manila);
}

.mosaic__big-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Pair — stacks on mobile, side by side on tablet+ */
.mosaic__pair {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
}

@media (min-width: 768px) {
  .mosaic__pair {
    grid-template-columns: 1fr 1fr;
  }
}

/* Individual item: image + optional caption */
.mosaic__item {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Small images — 16:9 */
.mosaic__img-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background-color: var(--color-manila);
}

.mosaic__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Caption — omit the element entirely if not needed */
.mosaic__caption {
  font-family: var(--font-body);
  font-size: var(--text-small);
  color: var(--color-charcoal);
  line-height: var(--leading-body);
}


/* ============================================
   Case Study Hero
   Title, body copy, and services list.
   Used at the top of every case study page.
   ============================================ */

.cs-hero {
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding: 30px var(--page-margin);
  background-color: var(--color-paper);
}

.cs-hero__title {
  font-family: var(--font-display);
  font-size: var(--text-h1);
  line-height: var(--leading-heading);
  color: var(--color-charcoal);
}

/* Content row: stacks on mobile, side-by-side on tablet+ */
.cs-hero__content {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

@media (min-width: 768px) {
  .cs-hero__content {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0;
  }
}

.cs-hero__body {
  font-family: var(--font-body);
  font-size: var(--text-small);
  line-height: var(--leading-body);
  color: var(--color-charcoal);
}

@media (min-width: 768px) {
  .cs-hero__body {
    font-size: var(--text-body-lg);
    max-width: 770px;
  }
}

.cs-hero__body a {
  text-decoration: underline;
  text-underline-offset: 2px;
  color: inherit;
}

.cs-hero__body p + p {
  margin-top: 1em;
}

.cs-hero__services {
  list-style: disc;
  padding-left: 27px;
  font-family: var(--font-display-italic);
  font-size: 18px;
  line-height: var(--leading-heading);
  color: var(--color-charcoal);
}

@media (min-width: 768px) {
  .cs-hero__services {
    padding-left: 36px;
    font-size: 24px;
    line-height: var(--leading-body);
    max-width: 470px;
    flex-shrink: 0;
  }
}


/* ============================================
   Website Mockup
   Full-width screenshot image with a caption
   paragraph below.
   ============================================ */

.website-mockup {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 30px var(--page-margin);
  background-color: var(--color-paper);
}

.website-mockup__img-wrap {
  width: 100%;
  aspect-ratio: 1370 / 827;
  overflow: hidden;
  background-color: var(--color-manila);
}

.website-mockup__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.website-mockup__caption {
  font-family: var(--font-body);
  font-size: var(--text-small);
  line-height: var(--leading-body);
  color: var(--color-charcoal);
}

@media (min-width: 768px) {
  .website-mockup__caption {
    font-size: var(--text-body-lg);
    max-width: 1170px;
  }
}


/* ============================================
   Big Image
   Two-column layout: text on one side, image
   on the other. Use modifier classes to flip.

   .big-image--img-right  (default): text left, image right
   .big-image--img-left:              image left, text right
   ============================================ */

.big-image {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 15px var(--page-margin);
  background-color: var(--color-paper);
}

/* Mobile: image always stacks on top, text below */
.big-image__img-wrap {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background-color: var(--color-manila);
}

.big-image__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.big-image__text {
  font-family: var(--font-body);
  font-size: var(--text-small);
  line-height: var(--leading-body);
  color: var(--color-charcoal);
}

.big-image__text p + p {
  margin-top: 1em;
}

/* Mobile: image first, text second — reorder for img-right */
.big-image--img-right .big-image__img-wrap { order: -1; }
.big-image--img-left  .big-image__img-wrap { order: -1; }

@media (min-width: 768px) {
  .big-image {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0;
    padding: 30px var(--page-margin);
  }

  .big-image__img-wrap {
    width: 55%;
    aspect-ratio: 770 / 578;
    flex-shrink: 0;
  }

  .big-image__text {
    width: 40%;
    font-size: var(--text-body-lg);
  }

  /* Reset mobile order on desktop */
  .big-image--img-right .big-image__img-wrap { order: 0; }
  .big-image--img-left  .big-image__img-wrap { order: 0; }

  /* img-right: DOM order is text then image — no change needed */
  /* img-left: flip so image appears on the left */
  .big-image--img-left {
    flex-direction: row-reverse;
  }
}


/* ============================================
   Interrupter
   Full-bleed charcoal section with a single
   wide decorative image. Negative margins
   break out of <main>'s max-width constraint
   (same technique as .gallery).
   ============================================ */

.interrupter {
  background-color: var(--color-charcoal);
  overflow: hidden;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

.interrupter__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 15px;
}

@media (min-width: 768px) {
  .interrupter__inner {
    padding: 30px 35px;
  }
}

/* Mobile: natural image height — avoids letterboxing.
   Desktop: lock to Figma spec (1370×514). */
.interrupter__img-wrap {
  width: 100%;
}

.interrupter__img-wrap img {
  width: 100%;
  height: auto;
  display: block;
}

@media (min-width: 768px) {
  .interrupter__img-wrap {
    aspect-ratio: 1370 / 514;
    overflow: hidden;
  }

  .interrupter__img-wrap img {
    height: 100%;
    object-fit: contain; /* logo grid — must not be cropped */
  }
}


/* ============================================
   Image Grid
   Intro text above a responsive grid of
   square images (12 total: 3-col mobile,
   4-col tablet+).
   ============================================ */

.image-grid {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 30px var(--page-margin);
  background-color: var(--color-paper);
}

@media (min-width: 768px) {
  .image-grid {
    gap: 30px;
  }
}

.image-grid__text {
  font-family: var(--font-body);
  font-size: var(--text-small);
  line-height: var(--leading-body);
  color: var(--color-charcoal);
}

@media (min-width: 768px) {
  .image-grid__text {
    font-size: var(--text-body-lg);
    max-width: 870px;
  }
}

.image-grid__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
}

@media (min-width: 768px) {
  .image-grid__grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
  }
}

.image-grid__item {
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.image-grid__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Variant: show 6 items on mobile (2×3), all 8 at tablet+ (2×4).
   Only applies when the modifier class is present — does not
   affect other image-grid instances (e.g. Rahua with 12 items). */
.image-grid--6-mobile .image-grid__grid .image-grid__item:nth-child(n+7) {
  display: none;
}

@media (min-width: 768px) {
  .image-grid--6-mobile .image-grid__grid .image-grid__item:nth-child(n+7) {
    display: block;
  }
}


/* ============================================
   Pre-Footer
   Centered CTA section before the footer.
   Narrow column with title, body, and a
   primary button.
   ============================================ */

.pre-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px var(--page-margin);
  background-color: var(--color-paper);
  text-align: center;
}

.pre-footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  max-width: 570px;
  width: 100%;
}

.pre-footer__title {
  font-family: var(--font-display);
  font-size: 48px;
  line-height: var(--leading-heading);
  color: var(--color-charcoal);
}

.pre-footer__body {
  font-family: var(--font-body);
  font-size: var(--text-body-lg);
  line-height: var(--leading-body);
  color: var(--color-charcoal);
}


/* ============================================
   Gallery
   Mobile: horizontal scroll carousel.
   Tablet+: absolute-positioned gallery wall.

   Background is full-bleed charcoal. Content
   is centered inside .gallery__inner (mirrors
   the footer pattern). The inner wrapper uses
   hardcoded 35px side padding at tablet+ so
   the 1370px wall canvas fits exactly within
   the 1440px max-width.
   ============================================ */

.gallery {
  background-color: var(--color-charcoal);
  overflow: hidden;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

/* Inner wrapper — centers content, matches page grid */
.gallery__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 15px;
}

@media (min-width: 768px) {
  .gallery__inner {
    padding: 30px 35px;
  }
}

/* ── Mobile carousel ─────────────────────── */

.gallery__carousel {
  display: flex;
  gap: 15px;
  height: 340px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
}

.gallery__carousel::-webkit-scrollbar {
  display: none; /* Chrome / Safari */
}

.gallery__carousel-item {
  flex-shrink: 0;
  height: 100%;
  scroll-snap-align: start;
  overflow: hidden;
  position: relative;
}

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

/* Cropped variant — image is wider than container, panned left */
.gallery__carousel-item--crop img {
  position: absolute;
  height: 100%;
  width: 150%;
  left: -22.71%;
  top: 0;
}

/* ── Desktop gallery wall ────────────────── */

.gallery__wall {
  display: none;
}

@media (min-width: 768px) {
  .gallery__carousel {
    display: none;
  }

  .gallery__wall {
    display: block;
    position: relative;
    width: 1370px;
    height: 1184px;
  }

  .gallery__wall-item {
    position: absolute;
    overflow: hidden;
  }

  .gallery__wall-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  /* Cropped variant — image panned horizontally within container */
  .gallery__wall-item--crop img {
    position: absolute;
    height: 100%;
    width: 150%;
    left: -22.71%;
    top: 0;
  }
}


/* ============================================
   Double Image
   Two images side by side (stacked on mobile).
   Simple equal-width layout with 4:3 images.
   ============================================ */

.double-image {
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding: 15px var(--page-margin);
  background-color: var(--color-paper);
}

.double-image__item {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.double-image__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (min-width: 768px) {
  .double-image {
    flex-direction: row;
    padding: 30px var(--page-margin);
  }

  .double-image__item {
    width: 50%;
  }
}

/* ============================================
   Text Module
   Heading + body copy + optional CTA button.
   Reusable intro block for any page.
   ============================================ */

.text-module {
  display: flex;
  flex-direction: column;
  gap: 40px;
  align-items: flex-start;
  padding: 60px var(--page-margin);
}

.text-module__heading {
  font-family: var(--font-display);
  font-size: var(--text-h1);
  line-height: var(--leading-heading);
  color: var(--color-charcoal);
}

.text-module__body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  color: var(--color-charcoal);
}

@media (min-width: 768px) {
  .text-module__body {
    font-size: var(--text-body-lg);
  }
}
