/* ==========================================================================
   Pre-order products
   ========================================================================== */

.products-section {
  background:
    radial-gradient(ellipse 800px 400px at 50% 0%, color-mix(in srgb, var(--flare) 6%, transparent), transparent);
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  background: transparent;
  border: none;
  justify-content: center;
}

/* On desktop with 5 products (3 in row 1, 2 in row 2): center the last 2 items neatly */
@media (min-width: 1001px) {
  .products-grid:has(.product-card:nth-child(5):last-child) {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .products-grid:has(.product-card:nth-child(5):last-child) .product-card:nth-child(1),
  .products-grid:has(.product-card:nth-child(5):last-child) .product-card:nth-child(2),
  .products-grid:has(.product-card:nth-child(5):last-child) .product-card:nth-child(3) {
    grid-column: span 2;
  }
  .products-grid:has(.product-card:nth-child(5):last-child) .product-card:nth-child(4) {
    grid-column: 2 / span 2;
  }
  .products-grid:has(.product-card:nth-child(5):last-child) .product-card:nth-child(5) {
    grid-column: 4 / span 2;
  }
}

.product-card {
  background: var(--ink);
  border: 1px solid var(--line);
  padding: 32px 24px 28px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease);
}

.product-card:hover {
  background: var(--surface);
}

.product-card__image {
  aspect-ratio: 4 / 3;
  margin: -32px -24px 20px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

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

.product-card__badge-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.product-card__type {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bone-dim);
}

.product-card__badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

.product-card__premium {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bone);
  border: 1px solid var(--line);
  background: var(--surface-2);
  padding: 3px 8px;
  border-radius: 999px;
}

.product-card__limited {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--flare);
  border: 1px solid color-mix(in srgb, var(--flare) 45%, transparent);
  padding: 3px 8px;
  border-radius: 999px;
}

.product-card__name {
  font-size: 26px;
  color: var(--bone);
  margin-bottom: 6px;
  min-height: 62px;
  display: flex;
  align-items: flex-end;
}

.product-card__bundle-line {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  color: var(--bone-dim);
  margin-bottom: 14px;
}

.product-card__price {
  font-family: var(--font-mono);
  font-size: 20px;
  color: var(--bone);
  margin-bottom: 18px;
  font-variant-numeric: tabular-nums;
}

.product-card__price small {
  font-size: 12px;
  color: var(--bone-dim);
  font-weight: 400;
  margin-left: 4px;
}

.product-card__size-guide {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  background: none;
  border: none;
  padding: 0;
  margin-bottom: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--bone-dim);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s var(--ease);
}

.product-card__size-guide:hover,
.product-card__size-guide:focus-visible {
  color: var(--flare);
}

.product-card__features {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex-grow: 1;
}

.product-card__features li {
  font-size: 13px;
  color: var(--bone-dim);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}

.product-card__features li::before {
  content: '';
  width: 4px;
  height: 4px;
  margin-top: 7px;
  background: var(--bone-dim);
  flex-shrink: 0;
}

.product-card__cta {
  width: 100%;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--bone);
}

.product-card__cta:hover,
.product-card__cta:focus-visible {
  background: var(--flare);
  border-color: var(--flare);
  color: var(--ink);
  transform: none;
  box-shadow: none;
}

/* -------------------------------------------------------------------------
   Order modal / dialog — shared across all four products
   ------------------------------------------------------------------------- */

.order-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10, 10, 12, 0.82);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.order-modal-backdrop.is-open {
  display: flex;
}

.order-modal {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 32px;
  position: relative;
  animation: modal-in 0.25s var(--ease);
  direction: rtl;
  text-align: right;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.order-modal__close {
  position: absolute;
  top: 20px;
  left: 20px;
  right: auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--bone-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.order-modal__close:hover,
.order-modal__close:focus-visible {
  color: var(--bone);
  border-color: var(--bone-dim);
}

.order-modal__eyebrow {
  margin-bottom: 8px;
  text-align: right;
}

.order-modal__product-name {
  font-size: 30px;
  color: var(--bone);
  margin-bottom: 4px;
  padding-left: 40px;
  padding-right: 0;
  text-align: right;
}

.order-modal__product-price {
  font-family: var(--font-mono);
  color: var(--bone-dim);
  font-size: 15px;
  margin-bottom: 24px;
  text-align: right;
}

.order-form__field {
  margin-bottom: 18px;
  text-align: right;
  direction: rtl;
}

.order-form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  direction: rtl;
}

.order-form__label {
  display: block;
  font-family: var(--font-body), sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--bone-dim);
  margin-bottom: 8px;
  text-align: right;
  direction: rtl;
}

.order-form__label .required {
  color: var(--flare);
  margin-right: 4px;
  margin-left: 0;
}

.order-form__input {
  width: 100%;
  background: var(--ink);
  border: 1px solid var(--line);
  color: var(--bone);
  padding: 13px 14px;
  font-family: var(--font-body), sans-serif;
  font-size: 15px;
  border-radius: var(--radius);
  transition: border-color 0.2s var(--ease);
  direction: rtl;
  text-align: right;
  unicode-bidi: plaintext;
  box-sizing: border-box;
}

.order-form__input:focus {
  border-color: var(--flare);
  outline: none;
}

.order-form__input::placeholder {
  color: var(--bone-dim);
  opacity: 0.6;
  text-align: right;
  direction: rtl;
}

.order-form__input[aria-invalid="true"] {
  border-color: var(--flare);
}

.order-form__textarea {
  resize: vertical;
  min-height: 72px;
  font-family: var(--font-body), sans-serif;
  direction: rtl;
  text-align: right;
  unicode-bidi: plaintext;
  box-sizing: border-box;
}

/* Conditional shipping fields (Address / Postal Code / Contact Number) —
   shown only for products with requires_shipping=true. Hidden by default;
   JS toggles the .is-visible class and the `required` attribute together. */
.js-shipping-fields {
  display: none;
}

.js-shipping-fields.is-visible {
  display: block;
  animation: shipping-fields-in 0.2s var(--ease);
}

@keyframes shipping-fields-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.order-form__error {
  font-family: var(--font-body), sans-serif;
  font-size: 12px;
  color: var(--flare);
  margin-top: 6px;
  display: none;
  text-align: right;
  direction: rtl;
}

.order-form__error.is-visible {
  display: block;
}

/* Variant selectors — Products 3 & 4 only (button-group style) */
.variant-group {
  margin-bottom: 18px;
  text-align: right;
  direction: rtl;
}

.variant-group__label {
  display: block;
  font-family: var(--font-body), sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--bone-dim);
  margin-bottom: 10px;
  text-align: right;
  direction: rtl;
}

.variant-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  direction: rtl;
  justify-content: flex-start;
}

.variant-option {
  position: relative;
}

.variant-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.variant-option label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  background: var(--ink);
  color: var(--bone-dim);
  font-family: var(--font-mono);
  font-size: 13px;
  border-radius: var(--radius);
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), background 0.2s var(--ease);
}

.variant-option input[type="radio"]:checked + label {
  border-color: var(--flare);
  color: var(--bone);
  background: color-mix(in srgb, var(--flare) 12%, var(--ink));
}

.variant-option input[type="radio"]:focus-visible + label {
  outline: 2px solid var(--flare);
  outline-offset: 2px;
}

.order-form__summary {
  background: var(--ink);
  border: 1px solid var(--line);
  padding: 14px 16px;
  margin-bottom: 22px;
  font-family: var(--font-body), sans-serif;
  font-size: 13px;
  color: var(--bone-dim);
  line-height: 1.7;
  direction: rtl;
  text-align: right;
}

.order-form__summary strong {
  color: var(--bone);
  font-weight: 500;
}

.order-form__submit {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}

.order-form__submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.order-form__note {
  margin-top: 14px;
  font-size: 12px;
  color: var(--bone-dim);
  text-align: center;
}

/* -------------------------------------------------------------------------
   Accessories Selection UI & Product Details
   ------------------------------------------------------------------------- */

.product-card__details {
  margin-bottom: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.product-card__details-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--bone-dim);
  cursor: pointer;
  list-style: none;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}

.product-card__details-toggle::-webkit-details-marker {
  display: none;
}

.product-card__details-toggle:hover {
  color: var(--bone);
  background: var(--surface);
}

.product-card__details-toggle svg {
  transition: transform 0.2s var(--ease);
}

.product-card__details[open] .product-card__details-toggle svg {
  transform: rotate(180deg);
}

.product-card__details-content {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.6;
  color: var(--bone-dim);
  direction: rtl;
  text-align: right;
}

.variant-group__header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.variant-group__header-row .variant-group__label {
  margin-bottom: 0;
}

.accessories-fit-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--bone);
  letter-spacing: 0.04em;
}

.variant-options--accessories-type .variant-option label {
  min-width: 80px;
  font-weight: 500;
}

@media (max-width: 1000px) {
  .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .products-grid {
    grid-template-columns: 1fr;
  }

  .product-card__name {
    min-height: auto;
  }

  .order-form__row {
    grid-template-columns: 1fr;
  }

  .order-modal {
    padding: 26px 20px;
  }

  .order-modal__close {
    top: 14px;
    left: 14px;
    right: auto;
    width: 44px;
    height: 44px;
  }

  .order-modal__product-name {
    padding-left: 56px;
    padding-right: 0;
    text-align: right;
  }
}
