.preview-stage {
  aspect-ratio: 5 / 7;
  max-width: 420px;
  margin: 0 auto;
  perspective: 1200px;
}

.notebook-cover {
  container-type: inline-size;
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-lg);
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow-pop), inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  display: grid;
  grid-template-rows: 1fr 1fr 1fr;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-areas:
    "top-left    top-center    top-right"
    "left        center        right"
    "bottom-left bottom-center bottom-right";
  padding: clamp(6px, 8cqw, 32px);
}

.engrave-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 0;
}

.zone-top-left { grid-area: top-left; align-items: flex-start; justify-content: flex-start; }
.zone-top-center { grid-area: top-center; justify-content: flex-start; }
.zone-center { grid-area: center; }
.zone-bottom-center { grid-area: bottom-center; justify-content: flex-end; }
.zone-bottom-right { grid-area: bottom-right; align-items: flex-end; justify-content: flex-end; }

/* ---- Engraved text ---- */
.engrave-text {
  font-size: clamp(8px, 13cqw, 28px);
  letter-spacing: 0.03em;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.engrave-text.foil-gold,
.engrave-text.foil-silver,
.engrave-text.foil-rose-gold {
  background-image: var(--foil-fill);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.35));
}

.engrave-text.foil-black {
  color: var(--foil-black);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.1);
}

.engrave-text.foil-blind {
  color: var(--cover-color);
  text-shadow:
    1px 1px 1px rgba(255, 255, 255, 0.35),
    -1px -1px 1px rgba(0, 0, 0, 0.35);
}

/* ---- Engraved icon ---- */
.engrave-icon {
  width: clamp(12px, 18cqw, 44px);
  height: clamp(12px, 18cqw, 44px);
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.engrave-icon.foil-gold,
.engrave-icon.foil-silver,
.engrave-icon.foil-rose-gold {
  background-image: var(--foil-fill);
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.35));
}

.engrave-icon.foil-black {
  background-color: var(--foil-black);
}

.engrave-icon.foil-blind {
  background-color: var(--cover-color);
  filter: drop-shadow(1px 1px 1px rgba(255, 255, 255, 0.35)) drop-shadow(-1px -1px 1px rgba(0, 0, 0, 0.35));
}

/* ---- Accessory previews: each shows the notebook from the angle where
   that feature actually reads (open spread / spine top / hanging ribbon /
   wrapped band), not just a flat color swatch. ---- */
.accessory-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.accessory-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.accessory-title {
  font-size: 11px;
  color: var(--color-ink-muted);
  text-align: center;
}

.accessory-title b {
  color: var(--color-ink);
  font-weight: 600;
}

/* Ruling patterns — shared by the open-book page faces */
.paper-lined {
  background-repeat: repeat;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(120, 132, 150, 0.5) 0,
    rgba(120, 132, 150, 0.5) 1px,
    transparent 1px,
    transparent 9px
  );
}

.paper-dot {
  background-repeat: repeat;
  background-image: radial-gradient(rgba(120, 132, 150, 0.55) 1.2px, transparent 1.2px);
  background-size: 10px 10px;
}

.paper-blank {
  background-image: none;
}

/* ---- 1. Inner pages: notebook opened flat, two page faces + gutter ---- */
.open-book {
  display: flex;
  width: 100%;
  height: 110px;
  max-width: 230px;
  margin: 0 auto;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.page-leaf {
  flex: 1;
  position: relative;
}

.page-leaf.left {
  box-shadow: inset -8px 0 10px -8px rgba(0, 0, 0, 0.3);
}

.page-leaf.right {
  box-shadow: inset 8px 0 10px -8px rgba(0, 0, 0, 0.3);
}

.book-gutter {
  width: 5px;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.05));
}

/* ---- 2. Headband: woven cap wrapping the top edge of the closed notebook ---- */
.headband-strip {
  position: absolute;
  left: -4px;
  right: -4px;
  top: -4px;
  height: 13px;
  border-radius: 6px 6px 0 0;
  background-repeat: repeat;
  background-size: 10px 10px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

/* ---- 3. Ribbon: hanging out of the closed notebook ---- */
.closed-book-mini {
  position: relative;
  width: 100%;
  max-width: 130px;
  aspect-ratio: 5 / 7;
  margin: 0 auto;
  border-radius: var(--radius-md);
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow-card);
  overflow: visible;
}

.ribbon-hang {
  position: absolute;
  top: 0;
  width: 8px;
  height: 122%;
}

.ribbon-hang::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 6px solid currentColor;
}

/* ---- 4. Book band: wrapped around the closed notebook ---- */
.bookband-wrap {
  position: absolute;
  left: -6px;
  right: -6px;
  top: 50%;
  height: 16px;
  transform: translateY(-50%);
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.accessory-card.is-disabled .closed-book-mini {
  opacity: 0.55;
}

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