/* ============================================================
   Dreams shop pages (Shop page buttons, Cart, and later Checkout and Order).
   Only the site's tokens: the six colours plus --sun-rule, --sun-rule-soft, --cream-soft,
   --cream-faint and the error tint #FFD9C9 the sign-up form already uses.
   ============================================================ */

/* The hidden attribute always wins. Several shop rules below set a display value (grid, flex) on the same
   element, which would otherwise quietly override it and show a form or a choice that is meant to be hidden. */
[hidden] { display: none !important; }

/* "Added. View cart" under a buy button */
.product__added { min-height: 1.4em; margin-top: 0.7rem; font-size: 0.9375rem; color: var(--cream); }
.product__added a { color: var(--sun); margin-left: 0.2rem; }
.cd-tie + .product__added { text-align: center; }

/* A plain message strip */
.shop-notice {
  margin: 0 0 var(--space-3); padding: 0.8rem 1rem; border: 1px solid var(--sun-rule-soft);
  color: var(--cream); font-size: 0.9375rem; border-radius: 2px;
}
.shop-notice[hidden] { display: none; }
.is-error { color: #FFD9C9; }

/* ---- the Cart page ---- */
.cart { min-height: 55vh; }
.cart h1 { color: var(--cream); margin-bottom: var(--space-3); }
.cart-loading { color: var(--cream-soft); }
.cart-empty { text-align: center; padding: var(--space-4) 0; }
.cart-empty__text { color: var(--cream-soft); font-size: 1.125rem; margin-bottom: var(--space-3); }

.cart-lines { list-style: none; border-top: 1px solid var(--sun-rule-soft); }
.cart-line {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 0.5rem var(--space-3);
  align-items: center; padding: var(--space-2) 0; border-bottom: 1px solid var(--sun-rule-soft);
}
.cart-line__name { font-family: var(--serif); font-size: 1.375rem; color: var(--cream); line-height: 1.25; }
.cart-line__format { color: var(--cream-soft); font-size: 0.9375rem; }
.cart-line__unit { color: var(--cream-faint); font-size: 0.875rem; margin-top: 0.15rem; }
.cart-line__total { color: var(--sun); font-weight: 500; letter-spacing: 0.04em; min-width: 5.5rem; text-align: right; }
.cart-line__qty { display: inline-flex; align-items: center; gap: 0.35rem; }
.cart-line__qty--one { color: var(--cream-soft); font-size: 0.9375rem; }
.cart-qty__btn {
  width: 2.75rem; height: 2.75rem; border: 1px solid var(--sun-rule-soft); border-radius: 2px;
  color: var(--cream); font-size: 1.25rem; line-height: 1;
}
.cart-qty__btn:hover:not(:disabled) { border-color: var(--sun); color: var(--sun); }
.cart-qty__btn:disabled { opacity: 0.4; cursor: not-allowed; }
.cart-qty__input {
  width: 3.25rem; height: 2.75rem; text-align: center; background: rgba(251,234,205,0.06);
  border: 1px solid var(--sun-rule-soft); border-radius: 2px; color: var(--cream);
  font-family: var(--sans); font-size: 1rem;
}
.cart-line__remove {
  grid-column: 1 / -1; justify-self: start; min-height: 2.75rem; padding: 0 0.1rem;
  color: var(--cream-soft); font-size: 0.875rem; text-decoration: underline; text-underline-offset: 3px;
}
.cart-line__remove:hover { color: var(--sun); }

.cart-summary { margin-top: var(--space-3); display: flex; flex-direction: column; align-items: flex-end; gap: 0.6rem; }
.cart-summary__row { display: flex; gap: var(--space-3); align-items: baseline; font-size: 1.125rem; color: var(--cream); }
.cart-summary__label { font-family: var(--sans); font-weight: 500; font-size: 0.8125rem; letter-spacing: 0.18em; text-transform: uppercase; }
.cart-summary__amount { color: var(--sun); font-weight: 500; font-size: 1.375rem; }
.cart-summary__note { color: var(--cream-faint); font-size: 0.875rem; margin-bottom: 0.6rem; }

@media (max-width: 640px) {
  .cart-line { grid-template-columns: minmax(0, 1fr) auto; }
  .cart-line__qty { grid-column: 1; }
  .cart-line__total { grid-column: 2; grid-row: 2; }
  .cart-summary { align-items: stretch; }
  .cart-summary .btn { text-align: center; }
}

/* ---- the Checkout page ---- */
.checkout { min-height: 60vh; }
.checkout h1 { color: var(--cream); margin-bottom: var(--space-3); }
.checkout__loading { color: var(--cream-soft); }
.checkout__grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.checkout__main { min-width: 0; }
.checkout__summary { border: 1px solid var(--sun-rule-soft); border-radius: 2px; padding: var(--space-3); position: sticky; top: 5.5rem; }

.co-block { border: 0; margin: 0 0 var(--space-4); padding: 0; min-width: 0; }
.co-legend {
  font-family: var(--serif); font-weight: 500; font-size: var(--fs-subhead); color: var(--cream);
  margin-bottom: var(--space-2); padding: 0;
}
.co-field { margin-bottom: var(--space-2); }
.co-field label { display: block; font-size: 0.875rem; color: var(--cream-soft); margin-bottom: 0.35rem; }
.co-field input[type="text"], .co-field input[type="email"], .co-field select {
  width: 100%; min-height: 2.75rem; background: rgba(251,234,205,0.06); border: 1px solid var(--sun-rule-soft);
  border-radius: 2px; color: var(--cream); font-family: var(--sans); font-size: 1rem; padding: 0.7em 0.9em;
}
.co-field select option { color: var(--ink); background: var(--cream); }
.co-field input[aria-invalid="true"], .co-field select[aria-invalid="true"] { border-color: #FFD9C9; }
.co-field input::placeholder { color: var(--cream-faint); }
.co-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--space-2); }
.co-hint { color: var(--cream-faint); font-size: 0.8125rem; margin-top: 0.3rem; }
.co-error { color: #FFD9C9; font-size: 0.875rem; min-height: 1.2em; margin-top: 0.25rem; }
.co-radio { display: flex; align-items: center; gap: 0.6rem; min-height: 2.75rem; }
.co-radio input { width: 1.1rem; height: 1.1rem; accent-color: var(--sun); }
.co-radio label { color: var(--cream); cursor: pointer; }
.co-pickup { border-left: 2px solid var(--sun-rule); padding: 0.2rem 0 0.2rem var(--space-2); margin-bottom: var(--space-2); }
.co-pickup__label { color: var(--cream); font-weight: 500; }
.co-check { display: flex; align-items: center; gap: 0.6rem; min-height: 2.75rem; margin-bottom: var(--space-2); color: var(--cream-soft); }
.co-check input { width: 1.1rem; height: 1.1rem; accent-color: var(--sun); }
.co-payment { margin-top: var(--space-3); }
#payment-element { margin-bottom: var(--space-2); min-height: 4rem; }
.checkout .btn:disabled { opacity: 0.6; cursor: progress; }

.co-items { list-style: none; border-bottom: 1px solid var(--sun-rule-soft); margin-bottom: var(--space-2); padding-bottom: var(--space-1); }
.co-item { display: flex; justify-content: space-between; gap: var(--space-2); padding: 0.4rem 0; color: var(--cream); }
.co-item__price { color: var(--cream-soft); white-space: nowrap; }
.co-total { display: flex; justify-content: space-between; gap: var(--space-2); color: var(--cream-soft); padding: 0.25rem 0; }
.co-total--grand { color: var(--cream); font-size: 1.25rem; font-weight: 500; border-top: 1px solid var(--sun-rule-soft); margin-top: 0.4rem; padding-top: 0.7rem; }
.co-total--grand span:last-child { color: var(--sun); }
.co-back { color: var(--cream-soft); font-size: 0.875rem; }

@media (max-width: 860px) {
  .checkout__grid { grid-template-columns: minmax(0, 1fr); }
  .checkout__summary { position: static; order: -1; }
}
@media (max-width: 480px) {
  .co-row { grid-template-columns: minmax(0, 1fr); }
  .checkout .btn { width: 100%; text-align: center; }
}

/* ---- the Order page ---- */
.order { min-height: 60vh; }
.order h1 { color: var(--cream); margin-bottom: var(--space-2); }
.order-loading { color: var(--cream-soft); }
.order-lost { margin-bottom: var(--space-4); }
.order-lost__text { color: var(--cream); font-size: 1.125rem; margin-bottom: var(--space-2); }
.order-status { font-size: 1.25rem; color: var(--cream); margin-bottom: 0.4rem; }
.order-status a { color: var(--sun); margin-left: 0.2rem; }
.order-email { color: var(--cream-faint); font-size: 0.9375rem; margin-bottom: var(--space-3); }
.order-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
.order-box { border: 1px solid var(--sun-rule-soft); border-radius: 2px; padding: var(--space-3); min-width: 0; }
.order-downloads { margin-top: var(--space-4); }
.order-downloads h2 { color: var(--cream); margin-bottom: 0.4rem; }
.order-note { color: var(--cream-soft); margin-bottom: var(--space-2); min-height: 1.4em; }

.order-zip { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem var(--space-2); margin-bottom: var(--space-3); }
.order-zip .btn { min-height: 2.75rem; }
.order-zip .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.songs { list-style: none; border-top: 1px solid var(--sun-rule-soft); }
.song {
  display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto auto; gap: 0.25rem var(--space-2);
  align-items: center; padding: 0.7rem 0; border-bottom: 1px solid var(--sun-rule-soft);
}
.song__num { color: var(--cream-faint); font-size: 0.9375rem; text-align: right; }
.song__body { display: flex; flex-direction: column; min-width: 0; }
.song__title { font-family: var(--serif); font-size: 1.25rem; color: var(--cream); line-height: 1.25; }
.song__size { color: var(--cream-faint); font-size: 0.8125rem; }
.song__left { color: var(--cream-soft); font-size: 0.875rem; white-space: nowrap; }
.song__btn { padding: 0.55em 1.2em; min-height: 2.75rem; }
.song__btn:disabled { opacity: 0.45; cursor: not-allowed; }

.order-resend { max-width: 28rem; margin-top: var(--space-4); }
.order-resend h2 { color: var(--cream); margin-bottom: 0.4rem; }
.order-resend .btn { margin-top: 0.4rem; }
#resend-msg { color: var(--cream); min-height: 1.4em; }
#resend-msg.is-error { color: #FFD9C9; }
#download-status.is-error { color: #FFD9C9; }

@media (max-width: 560px) {
  .song { grid-template-columns: 1.5rem minmax(0, 1fr) auto; }
  .song__left { grid-column: 2; grid-row: 2; }
  .song__btn { grid-column: 3; grid-row: 1 / span 2; }
}

/* ---- the photo gallery on the Shop page ---- */
.gallery { width: 100%; max-width: 440px; }
/* The photos are cropped to the CD itself (no white backdrop). The frame stays a square so nothing below it moves when the
   photo changes; each photo fills the frame's width at its own shape and sits in the middle of it, with its own shadow. */
.gallery__stage {
  aspect-ratio: 1 / 1; display: flex; flex-direction: column; justify-content: center;
}
.gallery .gallery__stage picture { display: block; }
.gallery .gallery__stage img { width: 100%; height: auto; max-width: none; aspect-ratio: auto; box-shadow: 0 18px 48px rgba(26, 18, 8, 0.45); border-radius: 2px; display: block; }
.gallery__thumbs { display: none; list-style: none; gap: 0.6rem; margin-top: 0.9rem; }
.js .gallery__thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gallery__thumb {
  display: block; width: 100%; aspect-ratio: 1 / 1; min-height: 44px; padding: 0; overflow: hidden;
  background: rgba(26, 18, 8, 0.35); border: 2px solid transparent; border-radius: 2px;
}
.gallery__thumb:hover { border-color: var(--sun-rule); }
.gallery__thumb[aria-pressed="true"] { border-color: var(--sun); }
.gallery .gallery__thumb img { width: 100%; height: 100%; max-width: none; aspect-ratio: auto; object-fit: contain; box-shadow: none; border-radius: 0; display: block; }
.gallery__caption { margin-top: 0.7rem; min-height: 1.4em; text-align: center; color: var(--cream-soft); font-size: 0.875rem; }
.gallery__links { list-style: none; margin-top: 0.8rem; }
.gallery__links a { color: var(--sun); font-size: 0.9375rem; }

/* ---- shipping summary under the CD's buy button ---- */
.product__ship { margin-top: 1rem; max-width: 46ch; color: var(--cream-soft); font-size: 0.9375rem; }
.product__ship[hidden] { display: none; }
.product__ship-title { font-family: var(--sans); font-weight: 500; font-size: 0.75rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--sun); margin-bottom: 0.4rem; }
.product__ship-list { list-style: none; display: grid; gap: 0.25rem; }
.product__ship-extra { margin-top: 0.4rem; }
.product__ship-extra:empty { display: none; }

/* A small line of links and a contact address, under the places where a buyer decides. */
.policy-line { color: var(--cream-faint); font-size: 0.875rem; margin-top: var(--space-3); line-height: 1.6; overflow-wrap: anywhere; }
.policy-line a { color: var(--cream-soft); text-decoration: underline; text-underline-offset: 0.18em; }
.policy-line a:hover, .policy-line a:focus-visible { color: var(--sun); }
.policy-line--shop { margin-top: var(--space-2); }
