/* Art · /gallery (the shelf) and /gallery/collection/<n> (one pack) */

/* ---------- the shelf ---------- */
.ph-cleo { margin: 0 auto; }
.cleo-painter { width: min(250px, 62vw); height: auto; }

.gal-sec { padding: 28px clamp(14px, 3.5vw, 40px) 38px; }
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 26px 22px; padding: 26px clamp(12px, 2.5vw, 26px); background-color: var(--lapis); background-image: radial-gradient(color-mix(in srgb, var(--gold) 38%, transparent) 1px, transparent 1.6px); background-size: 10px 10px; border: 3px solid var(--ink); border-radius: 12px; box-shadow: 6px 6px 0 var(--ink); }
.shelf-item { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 18px; min-width: 0; }
.shelf-pack { flex: 0 0 auto; margin: 0 auto; }
.pack.pack-lg { width: 160px; height: 230px; }
.pack-lg .pack-seal { width: 74px; height: 74px; font-size: 44px; }
.pack-lg .pack-name { font-size: 16px; }
.shelf-card { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; }
.shelf-card .term-dl { flex: 1 1 auto; }
.shelf-open { align-self: flex-start; margin: 0 12px 12px; }
.sealed-cat { font-size: 20px; line-height: 1.35; }
.is-sealed .shelf-card { box-shadow: 4px 4px 0 var(--pack-sealed); }

.rules { position: relative; max-width: 440px; margin: 34px auto 0; padding: 18px 22px 16px; background: var(--a4-soft); border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); transform: rotate(-1deg); }
.rules::before { content: ""; position: absolute; top: -10px; left: 50%; width: 80px; height: 20px; margin-left: -40px; background: color-mix(in srgb, var(--a1) 70%, transparent); transform: rotate(3deg); }
.rules-h { margin-bottom: 8px; font-family: var(--f-display); font-size: 18px; }
.rules ol { display: flex; flex-direction: column; gap: 6px; font-family: var(--f-cute); font-size: 16px; line-height: 1.5; }
.rules b { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-right: 8px; border-radius: 50%; background: var(--ink); color: var(--a4-text); font-family: var(--f-term); font-size: 18px; font-weight: 400; }

/* ---------- one pack: the stage ---------- */
.stage { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 32px 52px; padding: 40px clamp(16px, 4vw, 48px) 38px; border-bottom: 3px solid var(--ink); }
.stage-left { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: 6px; }
.pack-wrap { position: relative; border-radius: 6px; }
.pack-wrap:has(.pack-btn:focus-visible) { outline: 3px dashed var(--focus); outline-offset: 6px; }
.pack-btn { display: block; padding: 0; background: none; border: none; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.pack-btn:focus-visible { outline: none; }
.pack.pack-xl { width: min(236px, 52vw); height: auto; aspect-ratio: 236 / 340; padding: 4px; transition: transform 0.3s ease, filter 0.3s ease, opacity 0.3s ease; }
.pack-xl .pack-face { position: relative; padding: 26px 14px 22px; }
.pack-xl .pack-no { padding: 2px 10px; font-size: 15px; }
.pack-xl .pack-seal { width: min(112px, 26vw); height: min(112px, 26vw); font-size: min(66px, 15vw); }
.pack-xl .pack-name { font-size: clamp(19px, 5.4vw, 24px); -webkit-text-stroke-width: 5px; }
.pack-xl .pack-count { padding: 2px 10px; font-size: 15px; }
.opened-stamp { position: absolute; top: 44%; left: 50%; display: none; padding: 6px 14px; background: var(--ink); color: var(--a4-text); border: 3px solid var(--a4-text); font-family: var(--f-display); font-size: 20px; white-space: nowrap; transform: translate(-50%, -50%) rotate(-12deg); }
.tap-tag { position: absolute; z-index: 2; top: -8px; right: -16px; padding: 1px 8px; pointer-events: none; background: var(--paper-hi); border: 2px solid var(--ink); color: var(--ink); font-family: var(--f-term); font-size: 18px; transform: rotate(8deg); animation: tear 1.6s ease-in-out infinite; }
@keyframes tear { 50% { transform: rotate(8deg) translateY(-3px); } }
@keyframes wiggle { 0%, 78%, 100% { transform: rotate(0deg); } 82% { transform: rotate(-3deg); } 86% { transform: rotate(3deg); } 90% { transform: rotate(-2deg); } 94% { transform: rotate(1deg); } }
.is-open .tap-tag { display: none; }
.js body:not(.is-open) .pack-xl { animation: wiggle 2.8s ease-in-out infinite; transform-origin: 50% 90%; }
@media (hover: hover) { .js body:not(.is-open) .pack-btn:hover .pack-xl { animation-duration: 0.9s; } }
.is-open .pack-xl { transform: rotate(-4deg); filter: saturate(0.55); opacity: 0.85; }
.is-open .opened-stamp { display: block; }

.stage-cleo svg { width: min(150px, 30vw); height: auto; }
.cleo-wake { display: none; }
.is-open .cleo-wake { display: inline; }
.is-open .cleo-lazy { display: none; }

.stage-info { flex: 1 1 340px; max-width: 520px; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.stage-info .ph-title { font-size: clamp(34px, 4.6vw, 56px); -webkit-text-stroke-width: 6px; text-shadow: 5px 5px 0 var(--title-shadow); }
.manifest-win { align-self: stretch; box-shadow: 5px 5px 0 var(--a3); }
.manifest { padding: 12px 14px; font-size: 21px; line-height: 1.35; }
.manifest div div { white-space: pre-wrap; overflow-wrap: anywhere; }
.stage-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.hint { font-size: 16px; color: var(--muted-ink); }
.hint-link { display: inline-flex; align-items: center; min-height: 44px; font-family: var(--f-term); font-size: 21px; }

/* sealed or open: the page holds both, <body class="is-open"> picks one (no JavaScript shows the works) */
.js body:not(.is-open) [data-when="open"], .js body.is-open [data-when="sealed"] { display: none !important; }
html:not(.js) [data-when="sealed"] { display: none !important; }

/* ---------- the works ---------- */
.works-sec { padding: 32px clamp(16px, 4vw, 40px) 40px; }
.sealed-note { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 260px; padding: 24px; background: var(--paper-hi); border: 3px dashed var(--a3); border-radius: 14px; text-align: center; }
.sealed-note .hiero { font-size: 54px; line-height: 1; color: var(--a3); }
.sealed-note .cute { font-size: 19px; }
.sealed-note .term { font-size: 20px; color: var(--muted-ink); }
.works-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(160px, 38vw), 1fr)); gap: 24px 18px; }
.work { animation: deal 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.25) both; animation-delay: calc(var(--i, 0) * 0.06s); }
@keyframes deal { from { opacity: 0; transform: translateY(-70px) rotate(-8deg) scale(0.7); } to { opacity: 1; transform: none; } }
.art-card { height: 100%; padding: 8px 8px 10px; background: var(--paper-hi); border: 2px solid var(--ink); border-radius: 6px; transition: transform 0.2s ease; }
.art-card:hover { transform: translateY(-6px) rotate(-1deg); }
.ws-1 { box-shadow: 4px 4px 0 var(--a1); } .ws-2 { box-shadow: 4px 4px 0 var(--a2); } .ws-3 { box-shadow: 4px 4px 0 var(--a3); } .ws-4 { box-shadow: 4px 4px 0 var(--a4); }
.art-img { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 5; overflow: hidden; border: 1.5px solid var(--ink); }
.art-img span { padding: 1px 6px; background: var(--paper-hi); font-size: 14px; }
.art-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.aw-1 { background: radial-gradient(circle at 50% 40%, var(--paper-hi), var(--a1-soft) 70%); }
.aw-2 { background: repeating-linear-gradient(45deg, var(--a2-soft) 0 8px, var(--a2) 8px 16px); }
.aw-3 { background: radial-gradient(var(--a3) 1.6px, transparent 2.2px) 0 0 / 10px 10px, var(--a3-soft); }
.aw-4 { background: linear-gradient(160deg, var(--a4-soft), var(--gold)); }
.aw-5 { background: repeating-linear-gradient(0deg, var(--paper) 0 10px, color-mix(in srgb, var(--a1-soft) 55%, var(--paper)) 10px 20px); }
.aw-6 { background: radial-gradient(var(--gold) 1.4px, transparent 2px) 0 0 / 9px 9px, var(--ink); }
.art-card figcaption { display: flex; flex-direction: column; gap: 2px; padding-top: 8px; }
.w-title { font-size: 16px; line-height: 1.35; }
.w-title b { font-weight: 500; color: var(--link); }
.w-meta { font-family: var(--f-term); font-size: 19px; color: var(--muted-ink); }

/* the holo rare: one pack in six, Cleo falls out */
.rare-card { box-shadow: 0 0 0 3px var(--gold), 0 0 26px color-mix(in srgb, var(--a3) 75%, transparent); }
.rare-art { aspect-ratio: 4 / 5; display: flex; align-items: center; justify-content: center; padding: 6px; overflow: hidden; border: 1.5px solid var(--ink); background: linear-gradient(135deg, var(--a1-soft), var(--a3-soft) 50%, var(--a2-soft)); }
.holo-cleo { width: 100%; height: 100%; }
.rare-card .w-title b { color: var(--a1-deep); }

/* ---------- the exhibit plaque ---------- */
.plaque-sec { padding: 8px clamp(16px, 4vw, 48px) 40px; }
.plaque-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: 22px 30px; max-width: 1020px; margin: 0 auto; }
.plaque-row .plaque { flex: 1 1 460px; min-width: 0; margin: 0; }
.statue { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 0 auto; }
.statue-cleo { width: 140px; height: auto; }
.statue figcaption { max-width: 170px; font-family: var(--f-serif); font-size: 13px; line-height: 1.4; text-align: center; color: #4A4350; }
.plaque { position: relative; max-width: 780px; margin: 0 auto; padding: 30px clamp(22px, 4vw, 38px) 24px; background: #FBF7EF; border: 1.5px solid var(--ink); box-shadow: 4px 4px 0 rgba(20, 16, 24, 0.22); color: #1F1A24; font-family: var(--f-serif); }
.screw { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #E8D9A6, #C9B37A 60%); border: 1px solid #8A7442; }
.screw:nth-of-type(1) { top: 10px; left: 10px; } .screw:nth-of-type(2) { top: 10px; right: 10px; }
.screw:nth-of-type(3) { bottom: 10px; left: 10px; } .screw:nth-of-type(4) { bottom: 10px; right: 10px; }
.plq-top, .plq-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; font-size: 13px; letter-spacing: 0.16em; color: #4A4350; }
.plaque h2 { margin: 12px 0 4px; font-weight: 700; font-size: 28px; line-height: 1.25; }
.plq-meta { font-size: 15px; font-style: italic; color: #4A4350; }
.plq-text { margin-top: 14px; font-size: 17px; line-height: 1.8; }
.plq-foot { margin-top: 18px; padding-top: 10px; border-top: 1px solid var(--ink); letter-spacing: 0.04em; }

@media (prefers-reduced-motion: reduce) { .work { opacity: 1; } }
