/**
 * Media + Copy block (atsko/media-copy).
 *
 * Full-bleed two-column section: a photo on one side, copy on the other. Grew
 * out of the About "Our Story" and "What We Make" rows (Figma Company •
 * Desktop, 32:762), which were the same layout mirrored.
 *
 * The media bleeds to the viewport edge, so the copy column carries the
 * container gutter itself and then adds the same 3rem / 9rem inset the home
 * spotlight uses, keeping the text block in the same rhythm across templates.
 *
 * @package Atsko
 */

.media-copy {
  position: relative;
  overflow: hidden;
  background: var(--atsko-white);
  box-sizing: border-box;
}

.media-copy.alignfull {
  width: 100%;
  max-width: none;
}

/*
 * Break out of a constrained wrapper. Skipped inside .page-main__content, which
 * is already full width — 100vw counts the scrollbar and would overflow there.
 */
.container .media-copy.alignfull,
.entry-content:not(.page-main__content) .media-copy.alignfull {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

/* —— Angled wash —— */

/*
 * The wedge sits behind the copy, so which edge it hugs follows the media
 * position rather than being its own option.
 */
.media-copy--angle::before {
  content: "";
  position: absolute;
  z-index: 0;
  pointer-events: none;
  background-image: url("../images/about/angle-story.svg");
  background-repeat: no-repeat;
}

.media-copy--angle-blue::before {
  background-image: url("../images/about/angle-story-blue.svg");
}

.media-copy--angle.media-copy--media-right::before {
  left: -20%;
  bottom: 0;
  width: 70%;
  height: 100%;
  background-position: left center;
  background-size: 100% 100%;
}

.media-copy--angle.media-copy--media-left::before {
  right: 0;
  top: 0;
  width: 50%;
  height: 100%;
  background-position: bottom right;
  background-size: 100% 80%;
}

/* —— Columns —— */

.media-copy__inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 0;
  width: 100%;
}

.media-copy__media,
.media-copy__copy {
  flex: 1 1 50%;
  flex-basis: 50%;
  width: 50%;
  min-width: 0;
  box-sizing: border-box;
}

.media-copy__copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
  padding-top: 7rem;
  padding-bottom: 7rem;
}

.media-copy--media-right .media-copy__copy {
  padding-left: calc(3rem + max(2rem, (100vw - var(--atsko-container)) / 2));
  padding-right: 9rem;
}

.media-copy--media-left .media-copy__copy {
  padding-left: 9rem;
  padding-right: calc(3rem + max(2rem, (100vw - var(--atsko-container)) / 2));
}

/* No media to sit beside, so the copy takes the row with even gutters. */
.media-copy--no-media .media-copy__copy {
  flex-basis: 100%;
  width: 100%;
  padding-left: calc(3rem + max(2rem, (100vw - var(--atsko-container)) / 2));
  padding-right: calc(3rem + max(2rem, (100vw - var(--atsko-container)) / 2));
}

/* —— Copy —— */

.media-copy__eyebrow {
  margin: 0 !important;
  font-size: 0.875rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  line-height: 1.5 !important;
  color: var(--atsko-blue) !important;
}

.media-copy__eyebrow.media-copy__eyebrow--blue {
  color: var(--atsko-blue) !important;
}

.media-copy__eyebrow.media-copy__eyebrow--orange {
  color: var(--atsko-orange) !important;
}

.media-copy__eyebrow.media-copy__eyebrow--green {
  color: var(--atsko-green) !important;
}

.media-copy__title {
  margin: 0 !important;
  font-size: clamp(1.75rem, 3vw, 2rem) !important;
  font-weight: 700 !important;
  line-height: 0.9 !important;
  color: var(--atsko-charcoal) !important;
}

.media-copy__body {
  margin: 0 !important;
  font-size: 1rem !important;
  line-height: 1.3 !important;
  color: var(--atsko-charcoal) !important;
}

.media-copy__actions {
  margin: 0.5rem 0 0 !important;
}

.media-copy__actions .atsko-btn {
  margin: 0;
}

/* —— Media —— */

.media-copy__media {
  display: flex;
  align-items: stretch;
}

.media-copy__figure {
  position: relative;
  margin: 0 !important;
  width: 100%;
  min-height: 31rem;
  overflow: hidden;
  box-shadow: 0 4px 4px rgba(0, 0, 0, 0.25);
  background: var(--atsko-gray-400);
}

.media-copy__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* —— Logo grid over the photo —— */

.media-copy__figure--logos {
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-copy__figure--logos .media-copy__image {
  position: absolute;
  inset: 0;
}

.media-copy__logos {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(var(--media-copy-logo-cols, 2), minmax(0, 12rem));
  gap: 1.25rem 2rem;
  margin: 0;
  padding: 2rem;
  list-style: none;
  place-items: center;
}

.media-copy__logos li {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3.5rem;
}

/* A lone item on the final row centres across the grid instead of hanging left. */
.media-copy__logos li:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.media-copy__logos img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 3.25rem;
  object-fit: contain;
}

.media-copy__logo--invert {
  filter: brightness(0) invert(1);
}

.media-copy__logo-text {
  font-family: "PT Sans", system-ui, sans-serif;
  font-size: clamp(1.25rem, 2.5vw, 1.85rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-align: center;
  color: var(--atsko-white);
}

/* —— Responsive —— */

@media (max-width: 900px) {
  /* Copy stays on top either way: the reversed order matches media-first DOM. */
  .media-copy__inner {
    flex-direction: column;
  }

  .media-copy--media-left .media-copy__inner {
    flex-direction: column-reverse;
  }

  .media-copy__media,
  .media-copy__copy {
    flex-basis: 100%;
    width: 100%;
  }

  .media-copy--media-right .media-copy__copy,
  .media-copy--media-left .media-copy__copy {
    padding: 3rem 1.5rem;
  }

  .media-copy__figure {
    min-height: 20rem;
  }

  .media-copy--angle.media-copy--media-right::before {
    width: 120%;
  }

  .media-copy--angle.media-copy--media-left::before {
    width: 100%;
    background-position: top right;
  }

  .media-copy__logos {
    grid-template-columns: repeat(
      var(--media-copy-logo-cols, 2),
      minmax(0, 9rem)
    );
  }
}
