/* Best-seller flip cards, the create-your-own-box builder and ready-box contents. */

/* ----- flip cards, like the gift shop ----- */
.flip-card { perspective: 1000px; height: 400px; cursor: pointer; }
.flip-inner { position: relative; width: 100%; height: 100%; transition: transform .7s; transform-style: preserve-3d; border-radius: 12px; box-shadow: 0 4px 14px -6px rgba(45, 38, 32, .3); }
@media (hover: hover) { .flip-card:hover .flip-inner { transform: rotateY(180deg); } }
.flip-card.is-flipped .flip-inner { transform: rotateY(180deg); }
.flip-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 12px; overflow: hidden; }
.flip-front { background: var(--surface); display: flex; flex-direction: column; }
.flip-front img { width: 100%; height: 80%; object-fit: cover; background: var(--soft); }
.flip-front .ff-name { flex: 1; display: grid; place-items: center; padding: 8px 14px; text-align: center; font: 500 16px/1.3 var(--serif); }
.flip-back { transform: rotateY(180deg); background: #2d2620; color: #fff; padding: 24px; display: flex; flex-direction: column; justify-content: space-between; align-items: center; text-align: center; gap: 12px; }
.flip-back h3 { font-size: 20px; color: #fff; }
.flip-back p { margin: 8px 0 0; font-size: 13.5px; color: #e9dfcf; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.flip-back .fb-price { font-size: 22px; font-weight: 700; color: #c5a880; margin-top: 12px; }
.flip-back .fb-note { font-size: 12px; color: #cfc4b4; margin-top: 4px; }
.flip-back .btn { width: 100%; background: #c5a880; color: #2d2620; }
.flip-back .btn:hover { background: #d4bb98; }
.flip-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 30px; }

/* ----- create-your-box promo on the home page ----- */
.box-promo { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; padding: 56px 0; }
.box-promo h2 { font-size: clamp(28px, 3.6vw, 40px); }
.box-promo p { color: var(--muted); max-width: 46ch; margin: 12px 0 22px; }
.box-promo .sizes { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.box-promo .sizes span { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 14px; font-weight: 600; font-size: 14px; }
.box-promo .art { display: grid; place-items: center; }
.box-promo .art svg { width: min(300px, 80%); height: auto; }

/* ----- box builder ----- */
.size-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 28px 0 8px; }
.size-card { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 14px; text-align: center; cursor: pointer; display: grid; gap: 4px; justify-items: center; transition: border-color .2s, box-shadow .2s; }
.size-card:hover { border-color: var(--accent-2); }
.size-card.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--soft-2); }
.size-card:disabled { opacity: .45; cursor: not-allowed; }
.size-card .sz-ico { width: 54px; height: 54px; }
.size-card img.sz-ico { object-fit: cover; border-radius: 8px; }
.size-card b { font: 600 15px/1.3 var(--serif); }
.size-card small { color: var(--muted); font-size: 12.5px; }
.size-card .price { font-size: 14px; color: var(--ink); }
.builder { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; align-items: start; padding: 20px 0 70px; }
.builder > * { min-width: 0; }
.builder .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px 18px; }
.bcard { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.bcard .bc-name { font: 500 15px/1.35 var(--serif); }
.bcard .bc-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bcard select, .bcard input { min-height: 36px; padding: 4px 8px; font-size: 13px; border-radius: 8px; }
.bcard .add-btn { min-height: 38px; padding: .3em .9em; font-size: 14px; }
.bcard .in-box { position: absolute; top: 10px; inset-inline-start: 10px; background: var(--ink); color: #fff; border-radius: 999px; min-width: 26px; height: 26px; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; padding: 0 7px; }
.box-panel { position: sticky; top: 96px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; display: grid; gap: 14px; box-shadow: 0 1px 3px rgba(45, 38, 32, .05); }
.box-panel h2 { font-size: 22px; }
.box-stage { position: relative; display: grid; place-items: center; padding: 6px 0; }
.box-art { width: 200px; height: 190px; transform-origin: center; }
.box-art .lid { transform: translateY(-90px); opacity: 0; transition: transform .6s cubic-bezier(.34, 1.56, .64, 1), opacity .3s ease-in; }
.box-art.is-full .lid { transform: translateY(0); opacity: 1; }
.box-art.is-full { animation: spinCelebrate 1.2s cubic-bezier(.45, 0, .55, 1) .6s both; }
.box-art.jump { animation: jump .4s cubic-bezier(.25, .46, .45, .94); }
@keyframes spinCelebrate { 0% { transform: perspective(800px) rotateY(0) scale(1); } 50% { transform: perspective(800px) rotateY(180deg) scale(1.1); } 100% { transform: perspective(800px) rotateY(360deg) scale(1); } }
@keyframes jump { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-16px) scale(1.04); } }
.full-badge { position: absolute; top: 0; inset-inline-end: 18%; width: 50px; height: 50px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; opacity: 0; transition: opacity .5s; }
.full-badge.show { opacity: 1; transition-delay: 1.8s; }
.meter { height: 8px; border-radius: 6px; background: var(--soft); overflow: hidden; }
.meter div { height: 100%; background: var(--accent-2); border-radius: 6px; transition: width .4s; }
.count-line { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; }
.box-list { display: grid; gap: 8px; max-height: 260px; overflow-y: auto; }
.box-list .bl { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 13.5px; }
.box-list img { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; }
.box-list .stepper { height: 30px; }
.box-list .stepper button { width: 26px; font-size: 15px; }
.particle { position: fixed; width: 44px; height: 44px; border-radius: 8px; pointer-events: none; z-index: 1000; background-size: cover; background-position: center; box-shadow: 0 6px 16px rgba(0, 0, 0, .25); animation: tossIn .9s cubic-bezier(.25, .46, .45, .94) forwards; }
@keyframes tossIn {
  0% { transform: translate(0, 0) scale(1) rotate(0); opacity: 1; }
  50% { transform: translate(calc(var(--dx) * .5), calc(var(--dy) * .5 - 160px)) scale(1.8) rotate(180deg); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(.2) rotate(360deg); opacity: 0; }
}
.box-line-items { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ----- ready-made box contents on the product page ----- */
.contents { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.contents h3 { font-size: 18px; margin-bottom: 10px; }
.contents .ci { display: flex; gap: 10px; align-items: center; padding: 6px 0; text-decoration: none; }
.contents img { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; }
.chips + .chips { margin-top: 8px; }
.chip-label { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-ink); align-self: center; margin-inline-end: 4px; }
.filters-col { display: grid; gap: 10px; }

@media (prefers-reduced-motion: reduce) { .flip-inner, .box-art, .box-art .lid { transition: none; animation: none !important; } .particle { display: none; } }
@media (max-width: 1000px) {
  .flip-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
  .builder { grid-template-columns: 1fr; }
  .box-panel { position: static; order: -1; }
  .builder .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .flip-card { height: 320px; }
  .flip-back { padding: 14px; }
  .flip-back p { -webkit-line-clamp: 3; }
  .box-promo { grid-template-columns: 1fr; padding: 40px 0; }
  .box-promo .art { order: -1; }
  .size-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .box-art { width: 160px; height: 152px; }
}
