/* ==========================================================================
   Subscriptions Shop & Checkout
   ========================================================================== */

/* ---------------------------------------------------------------------------
   CSS custom properties
   Absolute px values — WP theme sets html { font-size: 62.5% }, so rem values
   from front-page/css/global.css misfire here. Only button.css is enqueued on
   these pages; all required design tokens are defined below.
   --------------------------------------------------------------------------- */

:root {
  /* Brand */
  --brand-yellow: #efcb54;
  --brand-orange: #f4ad3d;
  --brand-light-blue: #d8efef;
  --brand-blue: #68b2e2;

  /* Neutrals */
  --neutral-900: #212b36;
  --neutral-600: #637381;
  --neutral-300: #dde1e6;
  --neutral-100: #f5f6f8;
  --neutral-0: #ffffff;

  /* Alert Colors */

  --alert-warning-background: #fff5cc;
  --alert-warning-border: #fff5cc;
  --alert-warning-foreground: #7a4100;
  --alert-warning-icon: #ffab00;
  --alert-info-background: #d2f7ff;
  --alert-info-border: #d2f7ff;
  --alert-info-foreground: #004957;
  --alert-info-icon: #61b5c7;
  --alert-success-background: #d8fbde;
  --alert-success-border: #36b37e;
  --alert-success-foreground: #0a5554;
  --alert-success-icon: #36b37e;

  /* Semantic aliases */
  --text-primary: var(--neutral-900);
  --text-secondary: var(--neutral-600);
  --divider-color: var(--neutral-300);
  --action-hover: rgba(99, 115, 129, 0.08);

  /* Typography — px because WP base is 62.5% */
  --font-family-heading: "Brandon Grotesque", sans-serif;
  --font-family-paragraph: "Libre Franklin", sans-serif;
  --font-size-h2: 24px;
  --font-size-h3: 20px;
  --font-size-h4: 18px;
  --font-size-p-md: 16px;
  --font-size-p-sm: 13px;
  --font-size-p-xs: 12px;
  --font-weight-heading-bold: 600;
  --font-weight-paragraph-bold: 600;
  --font-weight-paragraph-regular: 400;
  --font-weight-paragraph-light: 300;
  /* Shape */
  --border-radius-xs: 6px;
  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 16px;
  --border-radius-full: 9999px;

  /* Shadows */
  --shadow-card:
    0 0 2px 0 rgba(145, 158, 171, 0.2),
    0 12px 24px -4px rgba(145, 158, 171, 0.12);
}

/* Genesis layout overrides — subscriptions.css is only loaded on subscriptions templates */
.site-inner {
  padding: 0;
}

/* Override Genesis body font for subscriptions pages */
.checkout-header,
.subscriptions-shop,
.cart,
.checkout-result,
.embedded-checkout {
  font-family: var(--font-family-paragraph);
}

/* ---------------------------------------------------------------------------
   Checkout header
   --------------------------------------------------------------------------- */

.checkout-header {
  background: var(--neutral-0);
  border-bottom: 1px solid var(--divider-color);
  margin-bottom: 40px;
}

.checkout-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.checkout-header__logo {
  display: block;
  height: 40px;
  width: 142px;
}

.checkout-header__nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.checkout-header__nav-link {
  font-family: var(--font-family-paragraph);
  font-size: 14px;
  font-weight: var(--font-weight-paragraph-bold);
  color: var(--text-primary);
  text-decoration: none;
  padding: 6px 8px;
  border-radius: var(--border-radius-xs);
  text-transform: none;
  letter-spacing: 0;
  text-align: center;
}

.checkout-header__nav-link:hover {
  background: var(--action-hover);
  color: var(--text-primary);
}

@media (max-width: 600px) {
  .checkout-header__nav {
    gap: 4px;
  }

  .checkout-header__nav-link {
    font-size: 12px;
    padding: 4px 6px;
  }
}

/* ---------------------------------------------------------------------------
   Shop page wrapper
   --------------------------------------------------------------------------- */

.subscriptions-shop {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px 40px;
}

.subscriptions-shop__products {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 40px;
}

/* ---------------------------------------------------------------------------
   Product card
   --------------------------------------------------------------------------- */

.product-card {
  flex: 0 0 100%;
  box-shadow: var(--shadow-card);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--neutral-0);
  min-height: 260px;
  gap: 24px;
}

.product-card__header {
  flex: 0 0 auto;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
}

.subscriptions-shop .product-card__name {
  font-family: var(--font-family-heading);
  font-size: var(--font-size-h2);
  font-weight: var(--font-weight-heading-bold);
  line-height: 1;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-primary);
  margin: 0;
  padding: 4px 0;
}

@media (max-width: 600px) {
  .subscriptions-shop .product-card__name {
    font-size: var(--font-size-h3);
  }
}

/* Product card responsive widths — match MUI lg/md/sm/xs breakpoints */
@media (min-width: 600px) {
  .product-card {
    flex-basis: calc(50% - 8px);
  }
}
@media (min-width: 900px) {
  .product-card {
    flex-basis: calc(33.333% - 11px);
  }
}
@media (min-width: 1200px) {
  .product-card {
    flex-basis: calc(25% - 12px);
  }
}

.product-card__description {
  font-size: 16px;
  font-weight: var(--font-weight-paragraph-light);
  line-height: 1.4;
  color: var(--text-secondary);
  margin: 0;
  letter-spacing: 0.01em;
}

.product-card__image {
  display: block;
  max-width: 100%;
  max-height: 128px;
  height: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.product-card__pricing {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
}

.product-card__price {
  font-size: var(--font-size-p-md);
  font-weight: var(--font-weight-paragraph-bold);
  color: var(--text-primary);
  margin: 0;
}

.product-card__unit,
.product-card__renewal {
  font-size: 16px;
  font-weight: var(--font-weight-paragraph-light);
  line-height: 1.5;
  color: var(--text-primary);
  margin: 0;
}

.product-card__actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.product-card__actions .btn {
  width: 100%;
  box-sizing: border-box;
}

/* Theme resets — Genesis overrides text-transform and letter-spacing on buttons/anchors */
.subscriptions-shop .btn,
.modal .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-block: 8px;
  padding-inline: 16px;
  font-family: var(--font-family-paragraph);
  font-size: 14px;
  text-transform: none;
  letter-spacing: 0;
}

/* Button variant local to subscriptions — light border, matches platform "Learn More" */
.btn--outline.btn--light {
  background-color: transparent;
  color: var(--text-primary);
  border: 1px solid var(--neutral-300);
}

.btn--outline.btn--light:hover:not(:disabled) {
  border-color: var(--neutral-900);
  background-color: var(--neutral-100);
}

.btn--outline.btn--light:disabled,
.btn--outline.btn--light[disabled] {
  opacity: 0.5;
}

/* ---------------------------------------------------------------------------
   Cart
   --------------------------------------------------------------------------- */

.cart {
  max-width: 1200px;
  margin: 0 auto;
}

.cart__grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 16px;
  align-items: start;
}

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

/* ---------------------------------------------------------------------------
   Card (generic container block)
   --------------------------------------------------------------------------- */

.card {
  box-shadow: var(--shadow-card);
  border-radius: var(--border-radius-lg);
  background: var(--neutral-0);
  margin-bottom: 16px;
  overflow: hidden;
}

.card__header {
  padding: 16px;
}

.cart .card__title {
  font-family: var(--font-family-heading);
  font-size: var(--font-size-h4);
  font-weight: var(--font-weight-heading-bold);
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-primary);
  margin: 0;
}

.card__count {
  font-size: var(--font-size-p-md);
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* ---------------------------------------------------------------------------
   Cart table
   --------------------------------------------------------------------------- */

.cart__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.5;
  margin: 0;
}

.cart__table tbody {
  border-bottom: none;
}

.cart__table th,
.cart__table td {
  padding: 16px;
  text-align: left;
  vertical-align: middle;
  border-top: none;
}

@media (max-width: 600px) {
  .cart__table th,
  .cart__table td {
    padding: 10px 12px;
  }
}

.cart__table thead th {
  background: var(--neutral-100);
  font-weight: 500;
  font-size: 14px;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: 0;
}

.cart__table thead th:nth-child(2) {
  text-align: right;
}

.cart__item-label {
  font-weight: 600;
}

.cart__table tbody tr + tr td {
  border-top: 1px solid var(--neutral-100);
}

.cart__price {
  font-weight: var(--font-weight-paragraph-light);
  width: 1%;
  text-align: right;
  white-space: nowrap;
}

.cart__table th:last-child,
.cart__table td:last-child {
  width: 1%;
}

.cart__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 8px;
  border-radius: var(--border-radius-full);
  width: 40px;
  height: 40px;
}

.cart__remove:hover {
  color: #c00;
  background: #fee;
}

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

.order-summary__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  margin: 0;
}

.order-summary__table tbody {
  border-bottom: none;
}

.order-summary__table td {
  font-weight: var(--font-weight-paragraph-light);
  padding: 8px 16px;
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
  border-top: none;
}

.order-summary__table td:last-child {
  padding-right: 32px;
}

.order-summary__row--total {
  background-image: linear-gradient(var(--divider-color), var(--divider-color));
  background-size: calc(100% - 48px) 1px;
  background-repeat: no-repeat;
  background-position: 24px 0;
}

.order-summary__row--total td {
  padding-top: 6px;
  padding-bottom: 24px;
}

/* ---------------------------------------------------------------------------
   Checkout form
   --------------------------------------------------------------------------- */

.checkout-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.checkout-form__fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.checkout-form__submit {
  width: 100%;
}

.cart .checkout-form__submit {
  padding-block: 12px;
  padding-inline: 22px;
  font-size: 15px;
}

.checkout-form__submit.loading {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn__spinner {
  width: 18px;
  height: 18px;
  margin-left: 4px;
  flex-shrink: 0;
  animation: btn-spin 0.8s linear infinite;
}

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

.checkout-form__tax-note {
  font-size: var(--font-size-p-xs);
  font-weight: 400;
  color: var(--text-secondary);
  margin: 0;
  margin-top: 8px;
}

/* ---------------------------------------------------------------------------
   Radio group
   --------------------------------------------------------------------------- */

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.radio__label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  cursor: pointer;
  font-size: 15px;
  font-weight: var(--font-weight-paragraph-light);
}

.radio__label input[type="radio"] {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--neutral-600);
  background: var(--neutral-0);
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
  transition:
    border-color 0.15s,
    background 0.15s,
    box-shadow 0.15s;
}

.radio__label:hover input[type="radio"] {
  box-shadow: 0 0 0 8px rgba(239, 203, 84, 0.08);
}

.radio__label input[type="radio"]:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
}

.radio__label input[type="radio"]:checked {
  border-color: var(--brand-yellow);
  background: radial-gradient(
    circle,
    var(--brand-yellow) 45%,
    var(--neutral-0) 45%
  );
}

/* ---------------------------------------------------------------------------
   Field
   --------------------------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field__label {
  font-size: 14px;
  font-weight: 600;
}

.field__required {
  color: #c00;
}

.field__input {
  width: 100%;
  padding: 16.5px 14px;
  border: 1px solid var(--neutral-300);
  border-radius: var(--border-radius-sm);
  font-size: 15px;
  box-sizing: border-box;
}

select.field__input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23637381' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
}

.field__input:focus {
  outline: none;
  border-color: var(--neutral-600);
}

.field__input:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
  border-color: var(--neutral-600);
}

select.field__input:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
  border-color: var(--neutral-600);
}

.field__helper {
  font-size: var(--font-size-p-sm);
  font-weight: var(--font-weight-paragraph-light);
  color: var(--text-secondary);
  margin: 0;
}

/* ---------------------------------------------------------------------------
   Alerts
   --------------------------------------------------------------------------- */

.alert-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 24px;
}

.alert {
  border-radius: var(--border-radius-xs);
  padding: 14px 16px;
  font-size: 14px;
  font-weight: var(--font-weight-paragraph-light);
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.alert__icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  fill: currentColor;
  margin-top: 1px;
}

.alert--info .alert__icon {
  fill: var(--alert-info-icon);
}

.alert p:last-child {
  margin-bottom: 0;
}

.alert p:first-child {
  margin-top: 0;
}

.alert--warning {
  background: var(--alert-warning-background);
  color: var(--alert-warning-foreground);
}

.alert--warning .alert__icon {
  fill: var(--alert-warning-icon);
}

.alert--info {
  background: var(--alert-info-background);
  color: var(--alert-info-foreground);
}

.alert--success {
  background: var(--alert-success-background);
  color: var(--alert-success-foreground);
}

/* ---------------------------------------------------------------------------
   Modal
   --------------------------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(33, 43, 54, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.modal[hidden] {
  display: none;
}

.modal__dialog {
  background: var(--neutral-0);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  width: 100%;
  min-width: 600px;
  max-width: 600px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

@media (max-width: 660px) {
  .modal {
    padding: 12px;
    align-items: center;
  }

  .modal__dialog {
    min-width: auto;
    max-width: 100%;
    width: 100%;
    border-radius: var(--border-radius-md);
  }
}

.modal .modal__title {
  font-family: var(--font-family-heading);
  font-size: var(--font-size-h4);
  font-weight: var(--font-weight-heading-bold);
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-primary);
  margin: 0 0 16px;
}

.modal__dialog .field {
  margin-bottom: 16px;
}

.modal__support-note {
  font-size: var(--font-size-p-md);
  color: var(--text-secondary);
  margin: 12px 0 0;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ---------------------------------------------------------------------------
   Embedded checkout & result states
   --------------------------------------------------------------------------- */

.embedded-checkout {
  width: 100%;
  min-height: 400px;
}

.checkout-result {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px 40px;
}

.checkout-result--expired {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 64px);
  padding-bottom: 0;
}

.checkout-result__link {
  margin-top: 20px;
  font-size: 15px;
}

.checkout-result .checkout-result__title {
  font-family: var(--font-family-heading);
  font-size: 32px;
  font-weight: 700;
  line-height: 48px;
  color: var(--text-primary);
  text-align: center;
  margin: 0 0 16px;
  text-transform: none;
  letter-spacing: 0;
}

.checkout-result__body {
  font-family: var(--font-family-paragraph);
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  color: var(--text-secondary);
  text-align: center;
  margin: 0;
}

.checkout-result__illustration {
  display: block;
  width: 400px;
  height: 260px;
  max-width: 100%;
  margin: 0 auto;
  text-align: center;
}

@media (max-width: 600px) {
  .checkout-result__illustration {
    width: 280px;
    height: 182px;
  }
}

.checkout-result__cta {
  display: block;
  width: fit-content;
  margin: 0 auto;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--font-family-paragraph);
  font-size: 15px;
}

.alert--success .alert__icon {
  fill: var(--alert-success-icon);
}
