/*
 * Copperwell shop design system: the content pages (FAQ, copper care, corporate sales, the
 * affiliate programme, press, podcasts, media mentions, the founder's story, the policies).
 * Builds on base.css (tokens, type, buttons, fields, the accordion, numbered steps); see the
 * note on isolation there. The pages are put together from parts in the admin panel
 * (src/collections/Pages/parts.ts); each block below draws one kind of part.
 */

#cw .cw-page {
  padding-block: calc(var(--cw-header) + 16px) clamp(56px, 7vw, 96px);
  background: var(--cw-paper);
}

/* Every part sits the same distance below the one before, as on the home page. */
#cw .cw-part {
  margin-top: clamp(48px, 6vw, 88px);
}

#cw .cw-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

/* ---- Page heading: the words on the left, a photo, photos or a film on the right, in one card -- */
#cw .cw-pagehead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  overflow: hidden;
  border-radius: var(--cw-radius);
  background: var(--cw-cream);
}

#cw .cw-pagehead--none {
  grid-template-columns: minmax(0, 1fr);
}

#cw .cw-pagehead__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 18px;
  padding: clamp(28px, 4vw, 64px);
}

#cw .cw-pagehead--none .cw-pagehead__text {
  padding-block: clamp(36px, 5vw, 72px);
}

#cw .cw-pagehead__text .cw-actions {
  margin-top: 10px;
}

#cw .cw-pagehead__media {
  position: relative;
  min-height: clamp(280px, 30vw, 460px);
}

/* One photo fills its half of the card, which takes the photo's shape (set on the element). */
#cw .cw-pagehead--photo .cw-pagehead__media {
  min-height: 0;
}

#cw .cw-pagehead--photo .cw-pagehead__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

/* Two or three photos stand side by side inside it. */
#cw .cw-pagehead--photos .cw-pagehead__media {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 12px;
  padding: 20px;
}

#cw .cw-pagehead--photos .cw-pagehead__media img {
  width: 100%;
  height: 100%;
  max-width: none;
  border-radius: var(--cw-radius-sm);
  object-fit: cover;
}

/* Cut-outs stand on a tinted panel. */
#cw .cw-pagehead--cutouts .cw-pagehead__media {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 3vw, 48px);
  padding: clamp(20px, 3vw, 40px);
  background: var(--cw-sand);
}

#cw .cw-pagehead--cutouts .cw-pagehead__media img {
  width: auto;
  max-width: 44%;
  height: clamp(220px, 26vw, 380px);
  object-fit: contain;
}

/* A wide film fills its half; an upright or square one stands on a tinted panel. */
#cw .cw-pagehead--film .cw-pagehead__media {
  display: grid;
  place-items: center;
  min-height: 0;
}

#cw .cw-pagehead__media--wide .cw-film {
  width: 100%;
  height: 100%;
  border-radius: 0;
}

#cw .cw-pagehead__media--upright,
#cw .cw-pagehead__media--square {
  padding: 24px;
  background: var(--cw-sand);
}

#cw .cw-pagehead__media--upright .cw-film,
#cw .cw-pagehead__media--square .cw-film {
  height: clamp(320px, 36vw, 520px);
}

/* The categories offered on the "page not found" page. */
#cw .cw-notfound__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

/* ---- Films ------------------------------------------------------------------------------------- */
#cw .cw-film {
  position: relative;
  overflow: hidden;
  border-radius: var(--cw-radius);
  background: #1a120a;
}

#cw .cw-film--wide {
  aspect-ratio: 16 / 9;
}

#cw .cw-film--upright {
  aspect-ratio: 9 / 16;
}

#cw .cw-film--square {
  aspect-ratio: 1;
}

#cw .cw-film__player {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
}

/* In a list of films an upright one is shown whole inside the wide frame. */
#cw .cw-film--whole .cw-film__player {
  object-fit: contain;
}

#cw .cw-film__poster {
  position: absolute;
  inset: 0;
  display: block;
}

#cw .cw-film__poster img {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

#cw .cw-film__play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  border-radius: 50%;
  background: var(--cw-amber);
  color: var(--cw-brown);
  transition:
    background-color 0.2s ease,
    transform 0.3s var(--cw-ease);
}

#cw .cw-film__play .cw-icon {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

#cw .cw-film__poster:hover .cw-film__play {
  background: var(--cw-amber-deep);
  transform: scale(1.06);
}

#cw .cw-films {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 32px 20px;
}

#cw .cw-films[data-count='1'] {
  max-width: 860px;
}

#cw .cw-films > li {
  display: grid;
  align-content: start;
  gap: 16px;
}

#cw .cw-films__text {
  max-width: 60ch;
  font-size: 16px;
  line-height: 1.6;
  color: var(--cw-brown-soft);
}

/* ---- The heading of a part -------------------------------------------------------------------- */
#cw .cw-parthead {
  display: grid;
  justify-items: start;
  gap: 12px;
}

#cw .cw-parthead__text {
  max-width: 60ch;
  font-size: 16px;
  line-height: 1.6;
  color: var(--cw-brown-soft);
}

#cw .cw-parthead .cw-actions {
  margin-top: 12px;
}

/* The heading with the part's button at its right. */
#cw .cw-parthead--row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

#cw .cw-parthead--row .cw-actions {
  flex: none;
}

/* ---- A heading on the left, what belongs to it on the right ------------------------------------ */
#cw .cw-split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: start;
  gap: clamp(24px, 4vw, 64px);
}

/* Beside a long list the heading stays in view. */
#cw .cw-split--sticky > .cw-parthead {
  position: sticky;
  top: calc(var(--cw-header) + 24px);
}

/* The editable lifestyle introduction precedes the approved beach composite. */
#cw .cw-product-benefits .cw-benefits-copy {
  min-width: 0;
  width: 100%;
}

/* The product benefits keep their introduction and photo together on wide screens. */
#cw .cw-benefits-photo {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  margin-top: 16px;
  border-radius: var(--cw-radius);
  background: var(--cw-cream);
  object-fit: contain;
}

#cw .cw-split__body {
  display: grid;
  justify-items: start;
  gap: 24px;
}

/* With a film: the words and steps on the left, the film on the right. */
#cw .cw-split--film {
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  align-items: center;
}

#cw .cw-split__lead {
  display: grid;
  gap: 28px;
}

#cw .cw-split--film > .cw-film {
  justify-self: center;
  width: 100%;
}

#cw .cw-split--film > .cw-film--upright {
  width: min(100%, 340px);
}

/* ---- Running text ------------------------------------------------------------------------------ */
#cw .cw-article {
  max-width: 760px;
  margin-inline: auto;
}

#cw .cw-article .cw-actions {
  margin-top: 28px;
}

#cw .cw-prose--page {
  font-size: 16px;
  line-height: 1.7;
}

#cw .cw-prose--page > * + * {
  margin-top: 1.1em;
}

#cw .cw-prose--page :where(h2, h3, h4) {
  font-weight: 400;
  letter-spacing: -0.01em;
}

#cw .cw-prose--page :where(h2) {
  font-size: 24px;
  line-height: 1.25;
}

#cw .cw-prose--page :where(h3) {
  font-size: 20px;
  line-height: 1.3;
}

#cw .cw-prose--page :where(h4) {
  font-size: 18px;
  line-height: 1.35;
}

#cw .cw-prose--page > :where(h2, h3) {
  margin-top: 2em;
}

#cw .cw-prose--page > :where(h4) {
  margin-top: 1.6em;
}

#cw .cw-prose--page > :first-child {
  margin-top: 0;
}

/* ---- Questions and answers: the accordion of base.css, at reading size ------------------------- */
#cw .cw-accs--lg {
  margin-top: 0;
}

#cw .cw-accs--lg .cw-acc summary {
  min-height: 72px;
  padding: 16px 0;
}

#cw .cw-accs--lg .cw-acc summary h3 {
  font-size: 18px;
  line-height: 1.4;
}

#cw .cw-accs--lg .cw-acc__body {
  padding: 0 44px 24px 0;
}

/* ---- Points ------------------------------------------------------------------------------------ */
#cw .cw-point__title {
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

#cw .cw-point__text {
  font-size: 15px;
  line-height: 1.6;
  color: var(--cw-brown-soft);
}

#cw .cw-point__label {
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* As cards. */
#cw .cw-pointcards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 20px;
}

#cw .cw-pointcards > li {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: clamp(24px, 2.6vw, 36px);
  border-radius: var(--cw-radius);
  background: var(--cw-cream);
}

#cw .cw-pointcards .cw-point__icon {
  width: auto;
  height: 64px;
  margin-bottom: 10px;
  object-fit: contain;
}

#cw .cw-pointcards + .cw-film {
  margin-top: 28px;
}

/* As icons in a row, on a tinted band. */
#cw .cw-pointband {
  padding: clamp(32px, 4vw, 56px);
  border-radius: var(--cw-radius);
  background: var(--cw-sand);
  text-align: center;
}

#cw .cw-pointband .cw-parthead {
  justify-items: center;
}

#cw .cw-pointband__list {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 28px 20px;
  margin-top: 40px;
}

#cw .cw-pointband__list[data-count='2'] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#cw .cw-pointband__list[data-count='3'] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#cw .cw-pointband__list[data-count='4'] {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#cw .cw-pointband__list[data-count='5'] {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

#cw .cw-pointband__list > li {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 14px;
}

#cw .cw-pointband .cw-point__icon {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

#cw .cw-pointband .cw-actions {
  justify-content: center;
  margin-top: 32px;
}

#cw .cw-pointband > .cw-film {
  margin-top: 36px;
}

/* As numbered steps (the list itself is in base.css). */
#cw .cw-steps__words {
  display: grid;
  flex: 1;
  gap: 4px;
  min-width: 0;
}

#cw .cw-steps__title {
  font-size: 18px;
  line-height: 1.45;
}

#cw .cw-steps .cw-point__icon {
  flex: none;
  align-self: center;
  width: 56px;
  height: 56px;
  object-fit: contain;
}

/* ---- Links to other sites: what was written about the brand ------------------------------------ */
#cw .cw-mentions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 20px;
}

#cw .cw-mention {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
  padding: clamp(24px, 2.6vw, 36px);
  border-radius: var(--cw-radius);
  background: var(--cw-cream);
  transition: background-color 0.2s ease;
}

#cw .cw-mention:hover {
  background: var(--cw-sand);
}

#cw .cw-mention__logo {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  overflow: hidden;
  border-radius: var(--cw-radius-sm);
  background: var(--cw-paper);
}

#cw .cw-mention__logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#cw .cw-mention__text {
  font-size: 18px;
  line-height: 1.55;
}

#cw .cw-mention__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  font-size: 14px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

/* The link covers the whole card. */
#cw .cw-mention__link::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--cw-radius);
}

#cw .cw-mention__link:focus-visible {
  outline: none;
}

#cw .cw-mention__link:focus-visible::after {
  outline: 2px solid var(--cw-navy);
  outline-offset: 2px;
}

/* ---- Call-outs --------------------------------------------------------------------------------- */
/* One: a band, its buttons beside the words. */
#cw .cw-callband {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px clamp(24px, 4vw, 64px);
  padding: clamp(28px, 4vw, 56px);
  border-radius: var(--cw-radius);
  background: var(--cw-sand);
}

#cw .cw-callband__words {
  display: grid;
  gap: 14px;
  max-width: 72ch;
}

#cw .cw-callband .cw-prose--page {
  font-size: 18px;
  line-height: 1.55;
  color: var(--cw-brown);
}

#cw .cw-callband .cw-actions {
  flex: none;
}

/* Two or three: cards side by side. */
#cw .cw-callcards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 20px;
}

#cw .cw-callcard {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding: clamp(24px, 2.6vw, 36px);
  border-radius: var(--cw-radius);
  background: var(--cw-cream);
}

#cw .cw-callcard__title {
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

#cw .cw-callcard .cw-prose--page {
  font-size: 15px;
  line-height: 1.6;
}

#cw .cw-callcard .cw-actions {
  margin-top: auto;
  padding-top: 6px;
}

/* ---- A form over the page ---------------------------------------------------------------------- */
#cw .cw-modal {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 0;
  border-radius: var(--cw-radius);
  background: var(--cw-paper);
  box-shadow: var(--cw-shadow);
  color: var(--cw-brown);
}

#cw .cw-modal::backdrop {
  background: rgba(46, 26, 8, 0.45);
}

#cw .cw-modal[open] {
  animation: cw-modal-in 0.3s var(--cw-ease);
}

#cw .cw-modal[open]::backdrop {
  animation: cw-fade-in 0.3s ease;
}

@keyframes cw-modal-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

@keyframes cw-fade-in {
  from {
    opacity: 0;
  }
}

#cw .cw-modal__panel {
  display: grid;
  gap: 16px;
  padding: 28px clamp(20px, 4vw, 36px) clamp(24px, 4vw, 36px);
}

#cw .cw-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

#cw .cw-modal__head .cw-iconbtn {
  flex: none;
  margin: -8px -10px 0 0;
}

#cw .cw-modal__title {
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

#cw .cw-modal__intro {
  font-size: 15px;
  line-height: 1.55;
  color: var(--cw-brown-soft);
}

#cw .cw-request {
  display: grid;
  gap: 16px;
}

#cw .cw-request__fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

#cw .cw-request__wide {
  grid-column: 1 / -1;
}

#cw .cw-request--sent {
  justify-items: start;
}

#cw .cw-request--sent:focus {
  outline: none;
}

/* ---- Smaller windows --------------------------------------------------------------------------- */
@media (max-width: 900px) {
  #cw .cw-pagehead,
  #cw .cw-split,
  #cw .cw-split--film {
    grid-template-columns: minmax(0, 1fr);
  }

  #cw .cw-pagehead--photos .cw-pagehead__media {
    min-height: 0;
    aspect-ratio: 3 / 2;
    padding: 0 16px 16px;
  }

  #cw .cw-pagehead--cutouts .cw-pagehead__media {
    min-height: 0;
  }

  #cw .cw-pagehead--cutouts .cw-pagehead__media img {
    height: clamp(180px, 46vw, 300px);
  }

  #cw .cw-pagehead__media--upright .cw-film,
  #cw .cw-pagehead__media--square .cw-film {
    height: clamp(280px, 80vw, 460px);
  }

  #cw .cw-split--sticky > .cw-parthead {
    position: static;
  }

  #cw .cw-split--film > .cw-film {
    justify-self: start;
    max-width: 520px;
  }

  #cw .cw-pointband__list,
  #cw .cw-pointband__list[data-count='4'],
  #cw .cw-pointband__list[data-count='5'] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #cw .cw-callband {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  #cw .cw-parthead--row {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  #cw .cw-pointband__list,
  #cw .cw-pointband__list[data-count='3'],
  #cw .cw-pointband__list[data-count='4'],
  #cw .cw-pointband__list[data-count='5'] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #cw .cw-accs--lg .cw-acc__body {
    padding-right: 0;
  }

  #cw .cw-mention__text {
    font-size: 16px;
  }

  #cw .cw-request__fields {
    grid-template-columns: minmax(0, 1fr);
  }

  #cw .cw-film__play {
    width: 60px;
    height: 60px;
    margin: -30px 0 0 -30px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #cw .cw-modal[open],
  #cw .cw-modal[open]::backdrop {
    animation: none;
  }
}
