/*
  Form primitives shared by every page that shows a form — the checkout page and
  the legal pages with a contact or return form — plus the checkout order summary.
  Keeping them on one set of field styles is deliberate: two copies drift apart.

  The last section dresses the CheckoutChamp runtime on the CRM-hosted checkout:
  the redirect overlay, the injected
  insurance widget and the runtime's error text. Those selectors match nothing on
  the storefront, so the rules simply never apply there.
*/

.checkout {
  padding-block: 3rem;
  border-top: 1px solid var(--line-soft);
  background: var(--white);
  scroll-margin-top: 7rem;
}

.checkout__intro {
  max-width: 42rem;
  margin-bottom: 2rem;
}

.checkout__title {
  margin-top: 0.25rem;
  font-size: clamp(1.5rem, 3vw, 1.875rem);
}

.checkout__lead {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.checkout__disclaimer {
  margin-top: 0.75rem;
}

.checkout__grid {
  display: grid;
  gap: 2rem;
  align-items: start;
}

@media (min-width: 1024px) {
  .checkout {
    padding-block: 3.5rem;
  }

  .checkout__grid {
    grid-template-columns: minmax(0, 1fr) 340px;
  }
}

.checkout__form {
  display: grid;
  gap: 1.25rem;
}

/* Fields ------------------------------------------------------------------ */

.field-group {
  margin: 0;
  padding: 0.75rem 1.25rem 1.25rem;
  border: 0;
  border-radius: 1rem;
  background: rgba(251, 250, 247, 0.6);
  box-shadow: var(--shadow-card);
  outline: 1px solid var(--line-soft);
}

.field-group__title {
  /* The legend renders on the fieldset's block-start edge, above its padding,
     so the room above the title has to come from the legend's own padding. */
  padding: 0.75rem 0 0;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
}

.field-grid {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .field-group {
    padding: 0.75rem 1.5rem 1.5rem;
  }

  .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field--wide {
    grid-column: span 2;
  }
}

.field {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
}

.field__label {
  display: block;
}

.field__input {
  width: 100%;
  margin-top: 0.375rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid rgba(11, 40, 88, 0.1);
  border-radius: 0.75rem;
  background: var(--white);
  font-size: 0.875rem;
  font-weight: 400;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field__input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(37, 143, 140, 0.2);
}

.field__input[aria-invalid="true"] {
  border-color: var(--coral);
}

/* Payment options --------------------------------------------------------- */

.pay-options {
  display: grid;
  gap: 0.5rem;
  margin-top: 1rem;
}

.pay-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid rgba(11, 40, 88, 0.1);
  border-radius: 0.75rem;
  background: var(--white);
  font-size: 0.875rem;
  cursor: pointer;
}

.pay-option:has(input:checked) {
  border-color: var(--teal);
  background: rgba(238, 245, 244, 0.5);
  box-shadow: 0 0 0 2px rgba(37, 143, 140, 0.2);
}

.pay-option input {
  accent-color: var(--teal);
}

.pay-option__label {
  font-weight: 600;
}

.pay-option__marks {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: flex-end;
  gap: 0.375rem;
  /* One shared box for every row, so the marks sit on a common centre line
     regardless of how tall the individual artwork is. */
  height: 39px;
  margin-left: auto;
}

.pay-mark {
  display: block;
  width: auto;
  height: 26px;
}

/* Official files carry different amounts of built-in clear space, so an equal
   CSS height would not read as equal. These per-brand heights mirror the
   heightRatio values in payment-banner/catalog.json, which is what makes the
   rendered strip look evenly weighted. */
.pay-mark--mastercard {
  height: 34px;
}

.pay-mark--visa,
.pay-mark--bancontact {
  height: 39px;
}

/* The label and the amount are two separate flex children of .btn, so on a
   narrow viewport the wrapping label left the amount stranded in a column of
   its own. Stack them deliberately instead, and drop the pill radius: 999px
   reads as a blob once the button is two lines tall. The label must stay an
   unambiguous "this is a payment" wording, which a translation cannot shorten,
   so the button has to survive wrapping. */
.checkout__submit {
  flex-direction: column;
  gap: 0.125rem;
  margin-top: 1rem;
  padding-block: 0.875rem;
  border-radius: 1rem;
  line-height: 1.3;
}

/* The wording carries the button; the amount only confirms it, so it stays the
   quieter of the two lines. */
.checkout__submit-label {
  font-size: 1rem;
  font-weight: 700;
}

.checkout__submit [data-summary="total"] {
  font-size: 0.875rem;
  font-weight: 600;
  opacity: 0.9;
}

/* Full width reads as a slab next to a two-line label on desktop; narrow it to
   two thirds and centre it. `display: flex` because an inline-flex box ignores
   auto margins. */
@media (min-width: 1024px) {
  .checkout__submit {
    display: flex;
    width: 66.667%;
    margin-inline: auto;
  }
}

.checkout__note {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: var(--mint);
  outline: 1px solid rgba(37, 143, 140, 0.25);
  font-size: 0.875rem;
}

.checkout__note--error {
  background: rgba(184, 60, 60, 0.08);
  outline-color: rgba(184, 60, 60, 0.3);
  color: var(--coral);
}

/* The unpaid-return message: an icon beside two lines, a step larger than the
   routine notes because the buyer has to notice it before paying again. */
.checkout__note--alert {
  display: flex;
  gap: 0.625rem;
  align-items: flex-start;
  padding: 0.875rem 1rem;
  font-size: 0.9375rem;
  line-height: 1.45;
}

.checkout__note-icon {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.0625rem;
}

.checkout__note-line {
  display: block;
}

.checkout__note-line + .checkout__note-line {
  margin-top: 0.25rem;
}

/* Order summary ----------------------------------------------------------- */

.summary__card {
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--white);
  box-shadow: var(--shadow-featured);
}

@media (min-width: 1024px) {
  .summary {
    position: sticky;
    top: 6rem;
  }

  .summary__card {
    padding: 1.5rem;
  }
}

.summary__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.summary__image {
  width: 4rem;
  height: 5rem;
  object-fit: contain;
}

.summary__title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}

.summary__pack {
  color: var(--muted);
  font-size: 0.75rem;
}

.summary__lines {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line-soft);
}

.summary__line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.375rem;
  font-size: 0.875rem;
}

.summary__line dt {
  color: var(--muted);
}

.summary__line dd {
  margin: 0;
  font-weight: 600;
}

.summary__line--total {
  margin-top: 0.375rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line-soft);
  font-size: 1rem;
}

.summary__line--total dd {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
}

.summary__benefits {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.summary__benefits li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid rgba(37, 143, 140, 0.25);
  border-radius: 0.75rem;
  background: rgba(238, 245, 244, 0.8);
  font-size: 0.875rem;
  font-weight: 500;
}

.summary__tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 0.6875rem;
  text-align: center;
}

.summary__tile {
  padding: 0.625rem 0.5rem;
  border-radius: 0.5rem;
  background: var(--cream);
}

.summary__tile-title {
  color: var(--navy);
  font-weight: 600;
}


/* CheckoutChamp runtime --------------------------------------------------- */

/*
  The runtime appends its own stylesheet to <head> while the page runs, which
  puts it after this file. At equal specificity it wins, so every rule that
  overrides injected markup carries a `body` prefix to outweigh it. That is why
  there is no !important below.
*/

/* Redirect overlay */

/*
  Card and Klarna both leave for a Mollie-hosted page, and the trip takes
  seconds. Without this the page just sits there looking broken. The runtime's
  own dialogs sit at 10000.
*/
.cc-pay-overlay {
  position: fixed;
  inset: 0;
  z-index: 10100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gutter);
  background: rgba(251, 250, 247, 0.92);
}

.cc-pay-overlay__box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: 20rem;
  padding: 1.75rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--white);
  box-shadow: var(--shadow-card);
  text-align: center;
}

.cc-pay-overlay__spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid var(--line);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: cc-pay-spin 0.9s linear infinite;
}

.cc-pay-overlay__text {
  margin: 0;
  color: var(--navy);
  font-family: var(--font-display);
  font-size: 1.125rem;
  line-height: 1.4;
}

/* On submit the CRM runtime inserts its own FontAwesome spinner right after
   the button (and re-shows it with an inline display:block). The overlay above
   already covers the wait, so suppress the duplicate. */
#fk-submit-spinner {
  display: none !important;
}

@keyframes cc-pay-spin {
  to {
    transform: rotate(360deg);
  }
}

/* The spinner is the only sign that the redirect is still under way, and a
   static ring reads as a frozen page. Under reduced motion it keeps turning,
   only slower; the `!important` beats the global animation reset in base.css. */
@media (prefers-reduced-motion: reduce) {
  .cc-pay-overlay__spinner {
    animation-duration: 1.8s !important;
    animation-iteration-count: infinite !important;
  }
}

/* Shipping insurance */

/*
  Generated by the runtime, including the decline popup, so none of this markup
  exists in the page. It lands inside .cc-insureship once insureShipPlacement is
  3; these rules pull it onto the same card as the rest of the form.
*/
body .cc-insure-ship-widget-container {
  margin: 0 0 1rem;
}

body .cc-insure-ship-widget {
  display: block;
  /* The runtime caps its own widget at 550px and centres it in a flex row, which
     leaves the insurance line visibly narrower than every other row in the form. */
  max-width: none;
  padding: 0.75rem 0.875rem;
  border: 1px solid rgba(11, 40, 88, 0.1);
  border-radius: 0.75rem;
  background: var(--white);
  color: var(--navy);
  font-family: var(--font-sans);
  font-size: 0.875rem;
}

body .cc-insure-ship-widget-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

body .cc-insure-ship-widget-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--navy);
  /* Matches .pay-option__label: this row sits among the payment rows and should
     read as one of them, not as a heading. */
  font-size: 0.875rem;
  font-weight: 600;
}

body .cc-insure-ship-widget-label svg {
  flex: none;
  width: auto;
  height: 1.125rem;
  /* The runtime paints the shield with `fill`, not currentColor, so setting a
     colour here would change nothing. */
  fill: var(--teal);
  top: 0;
}

/* The runtime wraps the shield and the wording in one inline span. As a plain
   inline box the icon starts its own line, so the label reads as two rows; an
   inline flex row keeps icon and text on the same baseline. */
body .cc-insure-ship-widget-label .cc-insure-ship-widget-text-nowrap {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

body .cc-insure-ship-widget-price-value {
  font-size: 0.875rem;
  font-weight: 700;
}

body .cc-insure-ship-widget-description {
  margin-top: 0.375rem;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

/* The runtime ships a blue iOS-style switch; this is the same switch in the
   page's teal. */
body .cc-insure-ship-widget-switch {
  flex: none;
}

body .cc-insure-ship-widget-slider {
  background-color: rgba(11, 40, 88, 0.2);
}

body .cc-insure-ship-widget-switch input:checked + .cc-insure-ship-widget-slider {
  background-color: var(--teal);
}

body .cc-insure-ship-widget-switch input:focus-visible + .cc-insure-ship-widget-slider {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* Runtime error messages */

/*
  ccError is injected next to the field it belongs to and next to the order
  button. Untouched it renders as raw red text in the browser's default face.
*/
body .ccError {
  margin: 0.375rem 0 0;
  color: var(--coral);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.4;
}
