:root {
  --marfil: #FAF7F2;
  --crepusculo: #1A2238;
  --carmesi: #C81E2B;
  --coral: #E88D67;
  --header-offset: 74px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: #111625;
  font-family: 'Plus Jakarta Sans', 'DM Sans', system-ui, -apple-system, sans-serif;
  color: var(--crepusculo);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.font-serif {
  font-family: 'Fraunces', 'Lora', Georgia, serif;
}

/* Barra superior fija */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(21, 27, 46, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Contenedor principal de las 14 páginas (vista vertical continua fluida) */
#pages-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.catalog-page {
  width: 100%;
  background-color: var(--marfil);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border-radius: 22px;
  padding: 1.5rem;
  box-shadow: 0 22px 55px -16px rgba(0, 0, 0, 0.55);
  scroll-margin-top: calc(var(--header-offset) + 12px);
}

@media (min-width: 640px) {
  #pages-container {
    gap: 2rem;
  }
  .catalog-page {
    padding: 2rem;
    border-radius: 24px;
  }
}

/* Portada y cierre con identidad Azul Crepúsculo */
.cover-gradient {
  background: linear-gradient(160deg, #1A2238 0%, #242E4C 45%, #7B3E48 78%, #E88D67 100%);
}

.closing-surface {
  background: linear-gradient(175deg, #1A2238 0%, #141B2D 100%);
}

/* Espacios de fotografía */
.photo-slot {
  position: relative;
  background-color: #EFEAE1;
  border: 1px solid rgba(26, 34, 56, 0.08);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 112px;
}

.photo-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  display: none;
  user-select: none;
  -webkit-user-drag: none;
  transition: transform 0.08s ease-out;
}

.photo-slot.is-dragging-pan img {
  transition: none;
}

.photo-slot.has-image img {
  display: block;
}

.photo-slot.has-image .photo-placeholder {
  display: none;
}

.photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px;
  text-align: center;
  color: rgba(26, 34, 56, 0.45);
}

/* Controles de edición de imagen (solo visibles en Modo Edición) */
.photo-upload-overlay {
  position: absolute;
  inset: 0;
  background: rgba(26, 34, 56, 0.72);
  color: #FAF7F2;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  padding: 8px;
  backdrop-filter: blur(2px);
}

body.edit-mode .photo-slot:not(.has-image) .photo-upload-overlay {
  display: flex;
}

body.edit-mode .photo-slot.has-image:not(.is-panning) {
  cursor: grab;
}

body.edit-mode .photo-slot.is-drag-over {
  outline: 2.5px dashed #C81E2B;
  outline-offset: -3px;
  background-color: rgba(232, 141, 103, 0.25);
}

.photo-edit-bar {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  z-index: 4;
  display: none;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 10px;
  background: rgba(26, 34, 56, 0.82);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

body.edit-mode .photo-slot.has-image:not(.is-panning) .photo-edit-bar {
  display: flex;
}

.photo-edit-btn {
  border: 1px solid rgba(250, 247, 242, 0.22);
  background: rgba(255, 255, 255, 0.1);
  color: #FAF7F2;
  border-radius: 7px;
  padding: 3px 7px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.photo-edit-btn:hover {
  background: #E88D67;
  color: #1A2238;
}

.photo-pan-controls {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  z-index: 6;
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 7px 9px;
  border-radius: 12px;
  background: rgba(26, 34, 56, 0.92);
  color: #FAF7F2;
  border: 1px solid rgba(232, 141, 103, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

body.edit-mode .photo-slot.is-panning {
  cursor: grab;
  touch-action: none;
  outline: 2px solid #E88D67;
  outline-offset: -2px;
}

body.edit-mode .photo-slot.is-panning.is-dragging-pan {
  cursor: grabbing;
}

body.edit-mode .photo-slot.is-panning .photo-pan-controls {
  display: flex;
}

body.edit-mode .photo-slot.is-panning .photo-clear-btn {
  display: none;
}

.photo-pan-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.photo-pan-range {
  flex: 1;
  min-width: 0;
  accent-color: #E88D67;
  cursor: pointer;
}

.photo-clear-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 4;
  display: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(200, 30, 43, 0.92);
  color: #FAF7F2;
  border: 1px solid rgba(250, 247, 242, 0.5);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

body.edit-mode .photo-slot.has-image .photo-clear-btn {
  display: inline-flex;
}

/* Campos editables en Modo Edición */
body.edit-mode [data-editable="true"] {
  outline: 1.5px dashed #E88D67;
  outline-offset: 2px;
  border-radius: 6px;
  background-color: rgba(232, 141, 103, 0.12);
  cursor: text;
  transition: background-color 0.2s ease;
}

body.edit-mode [data-editable="true"]:focus {
  outline: 2px solid #C81E2B;
  background-color: #FFFFFF;
  color: #1A2238;
}

/* Ocultar medidas vacías en modo cliente */
body:not(.edit-mode) [data-size-field].is-empty {
  display: none;
}

/* Botones e ícono/logo en tarjetas de pago */
.payment-icon-box {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background-color: var(--marfil);
  border: 1px solid rgba(232, 141, 103, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.payment-icon-box.has-logo {
  background-color: #FFFFFF;
}

.payment-icon-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

body.edit-mode .payment-icon-box {
  cursor: pointer;
}

body.edit-mode .payment-icon-box:hover {
  border-color: #C81E2B;
}

.payment-card-remove,
.payment-logo-btn,
.payment-logo-clear {
  display: none;
}

body.edit-mode .payment-card-remove,
body.edit-mode .payment-logo-btn,
body.edit-mode .payment-logo-clear {
  display: inline-flex;
}

/* Modal Política de Cancelaciones y Reembolsos */
.policy-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(17, 22, 37, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.policy-modal-backdrop.hidden {
  display: none;
}

.policy-modal-dialog {
  width: 100%;
  max-width: 620px;
  max-height: 88vh;
  background: var(--marfil);
  color: var(--crepusculo);
  border-radius: 22px;
  border: 1px solid rgba(232, 141, 103, 0.35);
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Toast de notificación */
#toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1A2238;
  color: #FAF7F2;
  border: 1px solid #E88D67;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  z-index: 95;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
  max-width: calc(100vw - 2rem);
  text-align: center;
}

#toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Scrollbar discreta */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #111625;
}

::-webkit-scrollbar-thumb {
  background: #2C3654;
  border-radius: 99px;
}
