/* ==========================================================================
   Guardians of Blockchain · payment and shop additions (GoB, not in the static funnel)
   Payment method choice (Bitcoin or another method), currency switch, checkout errors,
   the pickup point and the order page forms. Built from the tokens and patterns of
   base.css and shop.css (.shipping-option, .summary-list, .notice); pages layer only.
   ========================================================================== */

@layer pages {
  /* Currency switch in the order summary head ---------------------------- */

  .currency-switch {
    display: inline-flex;
    align-items: center;
    gap: var(--space-8);
  }

  .currency-switch__select {
    min-height: 2rem;
    padding: 0 var(--space-32) 0 var(--space-12);
    border: 1px solid var(--color-control);
    border-radius: var(--radius-pill);
    background: var(--color-night)
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2390a1b9' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E")
      no-repeat right var(--space-12) center;
    color: var(--color-white);
    font: 500 0.75rem/1 var(--font-text);
    letter-spacing: 0.04em;
    appearance: none;
    cursor: pointer;
  }

  .currency-switch__select:focus-visible {
    outline: 2px solid var(--color-teal);
    outline-offset: 2px;
  }

  .currency-switch__apply {
    color: var(--color-teal);
    font-size: 0.75rem;
  }

  /* Checkout: error list, honeypot, pickup point --------------------------- */

  .checkout-errors {
    display: grid;
    gap: var(--space-8);
    margin-bottom: var(--space-24);
    padding: var(--space-16) var(--space-24);
    border-color: var(--color-error);
  }

  .checkout-errors:focus {
    outline: 2px solid var(--color-error);
    outline-offset: 2px;
  }

  .checkout-errors__title {
    color: var(--color-error);
    font: 600 1rem/1.5rem var(--font-display);
  }

  .checkout-errors__list {
    display: grid;
    gap: var(--space-4);
    padding-left: var(--space-16);
    list-style: disc;
    font-size: 0.875rem;
  }

  .checkout__trap {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
  }

  .pickup-point {
    display: grid;
    gap: var(--space-12);
  }

  .pickup-point:focus {
    outline: none;
  }

  .pickup-point__chosen {
    display: flex;
    align-items: flex-start;
    gap: var(--space-8);
    padding: var(--space-12) var(--space-16);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-button);
    background-color: var(--color-night);
    font-size: 0.875rem;
    line-height: 1.25rem;
  }

  .pickup-point__chosen .icon {
    flex: none;
    color: var(--color-teal);
  }

  .checkout:has([data-delivery="home"]:checked) .pickup-point {
    display: none;
  }

  /* Payment method choice: the look of .shipping-option ------------------- */

  .payment-options {
    display: grid;
    gap: var(--space-12);
  }

  .payment-option {
    --option-outline: var(--color-control);
    --option-ring: transparent;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: var(--space-4) var(--space-12);
    padding: var(--space-12) var(--space-16);
    border: 1px solid var(--option-outline);
    border-radius: var(--radius-button);
    background-color: var(--color-night);
    box-shadow: inset 0 0 0 1px var(--option-ring);
    cursor: pointer;
    transition:
      border-color var(--duration-fast) ease,
      box-shadow var(--duration-fast) ease;
  }

  .payment-option:has(:checked) {
    --option-outline: var(--color-teal);
    --option-ring: var(--color-teal);
  }

  .payment-option:has(:focus-visible) {
    outline: 2px solid var(--color-teal);
    outline-offset: 2px;
  }

  .payment-option__icon {
    width: 1.75rem;
    height: 1.75rem;
    color: var(--color-teal);
  }

  .payment-option__title {
    font-weight: 500;
  }

  .payment-option__description {
    grid-column: 1 / -1;
    color: var(--color-mist);
    font-size: 0.875rem;
    line-height: 1.25rem;
  }

  @media (min-width: 48rem) {
    .payment-option {
      gap: var(--space-4) var(--space-16);
      padding: var(--space-16) var(--space-24);
    }

    .payment-option__icon {
      grid-row: 1 / 3;
      width: 2rem;
      height: 2rem;
    }

    .payment-option__description {
      grid-column: 2;
    }
  }

  /* Order page: the POST button of "Pay again" / "Open Payment Page" fills the notice like a link */

  .notice__form {
    display: grid;
    width: 100%;
  }

  /* "Could not open the payment page" above the notice card, as wide as the card. */
  .shop-main > .checkout-errors {
    max-width: 21.25rem;
    margin-inline: auto;
  }

  /* Cart: render as the thumbnail, the discounted second unit has no stepper */

  .cart-item__thumb img {
    object-fit: contain;
  }

  .cart-item__quantity--fixed {
    align-self: center;
  }

  /* Guide dialog states (homepage) */

  .guide-dialog__done {
    display: grid;
    gap: var(--space-16);
  }

  .guide-dialog__done[hidden],
  [data-guide-intro][hidden] {
    display: none;
  }

  .guide-dialog__turnstile:empty {
    display: none;
  }
}

/* Cookie banner (templates/partials/_consent_head.html.twig): on phones keep it above the sticky cart/checkout bar. */
@media (width < 64rem) {
  :root:has(.order-bar) .gob-consent {
    bottom: 5.5rem;
  }
}
