/* Cart page: isolated styles */

.cartPage {
  --shadow-soft: 0 14px 32px rgba(13, 21, 28, 0.08);
}

body.cartPage {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--color-background-main);
  color: var(--color-text-primary);
  font-family: var(--font-family-base);
}

.cartPage *,
.cartPage *::before,
.cartPage *::after {
  box-sizing: border-box;
}

body.cartPage.modal-open {
  overflow: hidden;
}

/* Shared header/footer markup comes from style.css (layoutLoader partials). */
.cartPage .site-header,
.cartPage .site-footer-container {
  width: 100%;
}

.cartPage .button-primary.hero-button {
  background-color: var(--color-primary);
  color: var(--color-text-light);
}

.cartPage .button.button-primary.hero-button {
  padding: 0 1rem;
  min-height: 2.5rem;
  border-radius: 9999px;
  text-decoration: none;
}

.cartPage .page-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 12px 0 48px;
}

.cartPage .page-wrapper {
  min-height: 100vh;
  padding-top: 96px;
}

.cartPage .layout-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.cartPage .section-title,
.cartPage .cart-item-title,
.cartPage .summary-total strong,
.cartPage .button,
.cartPage .button-secondary,
.cartPage .item-price strong,
.cartPage .zoom-close {
  font-family: var(--font-family-button);
}

.cartPage .cart-kicker,
.cartPage .summary-line span,
.cartPage .summary-total span,
.cartPage .zoom-hint {
  color: var(--color-text-placeholder);
  font-size: 0.92rem;
}

.cartPage .hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 16px 18px;
}

.cartPage .hero-copy {
  display: grid;
  gap: 6px;
}

.cartPage .hero-copy p {
  margin: 0;
  color: var(--color-text-placeholder);
  font-size: 0.95rem;
}

.cartPage .section-title {
  color: var(--color-text-primary);
  font-family: var(--font-family-heading);
  letter-spacing: -0.025em;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 900;
  line-height: 1.1;
  margin: 0;
  text-align: left;
}

.cartPage .cart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.9fr);
  gap: 24px;
  align-items: start;
}

.cartPage.cart-is-empty .cart-layout {
  grid-template-columns: 1fr;
}

.cartPage.cart-is-empty .summary-panel,
.cartPage.cart-is-empty .cart-footer,
.cartPage.cart-is-empty .cart-top-action {
  display: none;
}

.cartPage .cart-empty-state {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  min-height: 120px;
  padding: 8px 0 4px;
}

.cartPage .cart-empty-cta {
  text-decoration: none;
}

.cartPage .cart-empty-continue {
  color: var(--color-text-secondary);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cartPage .cart-empty-continue:hover {
  color: var(--color-primary-hover);
}

.cartPage .panel {
  background: var(--color-background-card);
  border: 1px solid var(--color-border-divider);
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
}

.cartPage .cart-panel,
.cartPage .summary-panel {
  padding: 24px;
}

.cartPage .summary-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.cartPage .summary-panel-header h2 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.cartPage .cart-items {
  display: grid;
  gap: 18px;
}

.cartPage .cart-top-action {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 18px;
}

.cartPage .cart-item {
  border: 1px solid var(--color-border-divider);
  border-radius: 20px;
  padding: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfd 100%);
}

.cartPage .cart-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.cartPage .cart-item-title {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.015em;
}

.cartPage .item-price {
  text-align: right;
  white-space: nowrap;
}

.cartPage .item-price strong {
  display: block;
  font-size: 1.06rem;
  margin-bottom: 0;
}

.cartPage .postcard-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
  align-items: start;
}

.cartPage .postcard-face-button {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: zoom-in;
  text-align: left;
}

.cartPage .postcard-face-button:focus-visible,
.cartPage .button:focus-visible,
.cartPage .button-secondary:focus-visible,
.cartPage .zoom-close:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.cartPage .postcard-face-wrap {
  display: grid;
  gap: 8px;
  width: 100%;
}

.cartPage .face-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-placeholder);
}

.cartPage .zoom-hint {
  font-size: 0.82rem;
  font-weight: 500;
}

.cartPage .postcard-side {
  position: relative;
  width: 100%;
  border: 1px solid var(--color-border-postcard);
  background: var(--color-background-card);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: var(--shadow-postcard-glow);
}

/* Safe printable area: 7" x 5" inside 7.25" x 5.25" bleed (0.125" trim per edge). */
.cartPage .postcard-side--safe-zone {
  aspect-ratio: 7 / 5;
}

.cartPage .postcard-bleed-frame {
  position: absolute;
  width: calc(100% * 7.25 / 7);
  height: calc(100% * 5.25 / 5);
  left: calc(-100% * 0.125 / 7);
  top: calc(-100% * 0.125 / 5);
}

.cartPage .postcard-bleed-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cartPage .item-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cartPage .item-action-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.cartPage .item-action-buttons .button-secondary {
  width: auto;
  flex: 0 0 auto;
}

.cartPage .button:not(.header-create-btn),
.cartPage .button-secondary,
.cartPage .zoom-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0 1rem;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.25rem;
  letter-spacing: 0.015em;
  text-decoration: none;
  transition: background-color 0.2s ease-in-out, opacity 0.2s ease-in-out;
}

.cartPage .button {
  background-color: var(--color-primary);
  color: var(--color-text-light);
}

.cartPage .button:hover,
.cartPage .zoom-close:hover {
  background-color: var(--color-primary-hover);
}

.cartPage .button-secondary {
  background-color: var(--color-secondary);
  color: #ffffff;
}

.cartPage .button-secondary:hover {
  background-color: var(--color-secondary-hover);
}

.cartPage .cart-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border-divider);
}

.cartPage .cart-subtotal strong,
.cartPage .summary-line strong,
.cartPage .summary-total strong {
  font-size: 1.05rem;
}

.cartPage .summary-panel {
  position: sticky;
  top: 20px;
}

.cartPage .site-footer-spacer {
  flex: 1 0 auto;
}

.cartPage .summary-breakdown {
  display: grid;
  gap: 14px;
  margin: 18px 0;
  padding: 18px 0;
  border-top: 1px solid var(--color-border-divider);
  border-bottom: 1px solid var(--color-border-divider);
}

.cartPage .summary-line,
.cartPage .summary-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cartPage .summary-line-items {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--color-border-divider);
}

.cartPage .summary-line-items[hidden] {
  display: none !important;
}

.cartPage .summary-line[hidden] {
  display: none !important;
}

.cartPage .summary-line-discount strong {
  color: var(--color-success-strong);
}

.cartPage .payment-summary-actions {
  max-width: none;
  margin-top: 0.75rem;
  margin-bottom: 0;
}

.cartPage .summary-total {
  margin-bottom: 18px;
}

.cartPage .summary-total strong:last-child {
  font-size: 1.45rem;
}

.cartPage .checkout-button {
  width: 100%;
}

.cartPage .zoom-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--color-overlay-dark);
}

.cartPage .zoom-modal[hidden] {
  display: none;
}

.cartPage .zoom-dialog {
  width: min(980px, 100%);
  max-height: 100%;
  overflow: auto;
  background: var(--color-background-card);
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
  position: relative;
}

/* Image-only zoom: viewport-sized on all breakpoints (not shrink-to-fit thumbnail) */
.cartPage .zoom-dialog.zoom-dialog--image-only {
  width: min(92vw, 980px, calc((100dvh - 140px) * 7.25 / 5.25));
  max-width: calc(100vw - 40px);
  padding: 12px 12px 14px;
  /* ~image radius (3px) + padding (12px); softer than 24px base .zoom-dialog */
  border-radius: 8px;
}

.cartPage .zoom-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.cartPage .zoom-dialog.zoom-dialog--image-only .zoom-header {
  width: 100%;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  min-height: 32px;
}

/* Keep close button in the header row (global .modal-close-x is position:absolute) */
.cartPage .zoom-dialog.zoom-dialog--image-only .zoom-header .modal-close-x {
  position: static;
  top: auto;
  right: auto;
  flex-shrink: 0;
}

.cartPage .zoom-dialog.zoom-dialog--image-only .zoom-header .zoom-side-label {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  text-align: left;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}

.cartPage .zoom-dialog.zoom-dialog--image-only .zoom-header .zoom-close {
  flex-shrink: 0;
  align-self: center;
}

.cartPage .zoom-header h2 {
  margin: 0 0 4px;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.cartPage .zoom-header p {
  margin: 0;
  color: var(--color-text-placeholder);
  font-size: 0.92rem;
}

.cartPage .zoom-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.cartPage .zoom-gallery.zoom-gallery--single {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 100%;
  margin-inline: auto;
  box-sizing: border-box;
}

/* Modal clone only: hide FRONT/BACK caption (still shown on cart thumbnails) */
.cartPage .zoom-gallery .face-label {
  display: none;
}

.cartPage .zoom-gallery .postcard-face-wrap {
  gap: 10px;
  width: 100%;
  max-width: 100%;
  margin-inline: 0;
  justify-items: stretch;
}

.cartPage .zoom-gallery .postcard-face-button {
  cursor: default;
  pointer-events: none;
  width: 100%;
  max-width: 100%;
  display: block;
}

.cartPage .zoom-gallery .postcard-bleed-frame img {
  display: block;
  width: 100%;
  height: 100%;
}

.cartPage .zoom-gallery .postcard-side {
  box-shadow: var(--shadow-postcard-glow);
  margin-inline: auto;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

@media (max-width: 960px) {
  .cartPage .cart-layout {
    grid-template-columns: 1fr;
  }

  .cartPage .summary-panel {
    position: static;
  }
}

@media (min-width: 721px) {
  .cartPage .page-shell {
    padding-left: 24px;
    padding-right: 24px;
  }

  .cartPage .zoom-dialog.zoom-dialog--image-only {
    width: min(85vw, 980px, calc((100dvh - 140px) * 7.25 / 5.25));
    max-width: calc(100vw - 40px);
  }
}

@media (max-width: 900px) {
  .cartPage .zoom-gallery {
    grid-template-columns: 1fr;
  }

  .cartPage .item-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .cartPage .item-action-buttons {
    justify-content: center;
    flex-wrap: nowrap;
  }

  .cartPage .zoom-hint {
    text-align: center;
  }
}

@media (max-width: 720px) {
  .cartPage .page-shell {
    padding: 8px 0 28px;
  }

  .cartPage .hero {
    padding: 12px 16px 18px;
  }

  .cartPage .cart-panel,
  .cartPage .summary-panel {
    padding: 16px;
  }

  .cartPage .cart-item {
    padding: 14px;
  }

  .cartPage .cart-top-action {
    justify-content: stretch;
  }

  .cartPage .hero,
  .cartPage .summary-panel-header,
  .cartPage .cart-item-top,
  .cartPage .cart-footer,
  .cartPage .item-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .cartPage .zoom-dialog .zoom-header {
    flex-direction: row;
    align-items: center;
  }

  .cartPage .postcard-pair {
    gap: 10px;
  }

  .cartPage .face-label {
    font-size: 0.72rem;
  }

  .cartPage .item-price {
    text-align: left;
  }

  .cartPage .section-title {
    font-size: 1.75rem;
  }

  .cartPage .button-secondary,
  .cartPage .button:not(.header-create-btn),
  .cartPage .zoom-close {
    width: 100%;
  }

  .cartPage .zoom-modal {
    padding: 12px;
  }
}

@media (max-width: 768px) {
  /* Don't let cart button resets re-show the trailing header CTA on small screens. */
  .cartPage .site-header a.button.header-create-trailing {
    display: none;
  }

  /* Keep drawer CTA flex-centered (cart.css excludes .header-create-btn from button flex rules). */
  .cartPage .site-header a.button.header-create-in-drawer {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: none;
    line-height: 1.25rem;
    padding-top: 0;
    padding-bottom: 0;
  }
}

.cart-page-loading {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.97);
  pointer-events: auto;
}

.cart-page-loading.hidden {
  display: none !important;
}

.cart-page-loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
}

.cart-page-loading-logo {
  width: 120px;
  height: auto;
  object-fit: contain;
}

.cart-page-loading-text {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.cart-checkout-loading {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.96);
  pointer-events: auto;
}

.cart-checkout-loading.hidden {
  display: none;
}

.cart-checkout-loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
}

.cart-checkout-loading-logo {
  width: 120px;
  height: auto;
  object-fit: contain;
}

.cart-checkout-loading-text {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

