/*
 * assets/ui/horn-press.css - THE HORN PRESS (js/horn-press-room.js): the press played as a painted animation, and the
 * Horn Wall. Goliath 2026-11-09 16:24Z: "awesome little art ... and cool animations".
 *
 * The press's pictures are cut by tools/horn-press-art.py: the frame and its head share one 640 x 640 square, so the
 * head's place is the frame's own (the head box in assets/horns/manifest.json, as percentages here). Words follow the
 * room's floor (var(--rui-min), lesson UI-5), buttons 44 px or more; every motion stops under prefers-reduced-motion.
 */
.hp-sheet { --hp-glow: #c77dff; }
.hp-sheet .rui-dlg__body, .hp-sheet { text-align: center; }
.hp-sheet--mythic::backdrop, .hp-sheet--mythic { box-shadow: 0 0 0 100vmax rgb(4 0 10 / 55%); }

/* ---- the stage: the fire, the press, the horn in its cradle, the Horn Cracker ---------------------------------- */
.hp-stage { position: relative; width: min(520px, 86vw); aspect-ratio: 4 / 3; margin: 0 auto; overflow: hidden; border-radius: 14px;
  background: radial-gradient(ellipse at 52% 92%, rgb(110 255 90 / 28%), transparent 55%), linear-gradient(#1a1024, #0d0814); }
.hp-press { position: absolute; left: 22%; top: -4%; width: 72%; aspect-ratio: 1; }
.hp-press__frame { position: absolute; inset: 0; width: 100%; height: 100%; }
/* the head box (tools/horn-press-art.py HEAD_BOX at 640: 265,289 to 378,370) */
.hp-press__head { position: absolute; left: 41.4%; top: 45.1%; width: 17.7%; height: 12.7%; transition: transform 0.5s cubic-bezier(.5,0,.75,0); }
.hp-horn { position: absolute; left: 28%; top: 50%; width: 42%; aspect-ratio: 1; transform: translateX(-60%) rotate(52deg); opacity: 0; }
.hp-horn__pic { width: 100%; height: 100%; filter: drop-shadow(0 0 10px var(--hp-glow)); }
.hp-horn__band { position: absolute; left: 30%; top: 63%; width: 13%; height: 4%; border-radius: 3px; background: var(--hp-band); transform: rotate(-52deg); box-shadow: 0 0 6px var(--hp-band); opacity: 0.9; }
.hp-cracker { position: absolute; left: 1%; bottom: 2%; width: 33%; aspect-ratio: 1; transform-origin: 50% 100%; }
.hp-fire { position: absolute; left: 42%; bottom: 8%; width: 30%; height: 12%; border-radius: 50%; background: radial-gradient(rgb(160 255 110 / 70%), transparent 70%); animation: hp-flicker 0.9s ease-in-out infinite alternate; }
.hp-dust, .hp-shards, .hp-wisps { position: absolute; left: 58%; top: 56%; width: 0; height: 0; }
.hp-shards i { position: absolute; width: 10px; height: 16px; clip-path: polygon(50% 0, 100% 40%, 70% 100%, 0 70%); box-shadow: 0 0 8px currentColor; }
.hp-wisps i { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(#b6ff8a, rgb(80 220 70 / 0%) 70%); }
.hp-orb { position: absolute; left: 50%; top: 52%; width: 18%; opacity: 0; transform: translate(-50%, 0) scale(0.4); filter: drop-shadow(0 0 18px #ffd76a); }

/* the beats (js/horn-press-room.js reveal): loading, pressing, cracking, burst, done */
.hp-stage.is-loading .hp-horn { animation: hp-load 0.6s ease-out forwards; }
.hp-stage.is-loading .hp-cracker { animation: hp-step 0.6s ease-out; }
.hp-stage.is-pressing .hp-horn, .hp-stage.is-cracking .hp-horn { opacity: 1; transform: translateX(0) rotate(52deg); }
.hp-stage.is-pressing .hp-press__head { transform: translateY(32%); }
.hp-stage.is-cracking .hp-press__head { transform: translateY(48%); }
.hp-stage.is-pressing .hp-press { animation: hp-shake 0.12s linear 4 0.35s; }
.hp-stage.is-cracking .hp-press { animation: hp-shake 0.08s linear 6; }
.hp-stage.is-cracking .hp-horn__pic { animation: hp-strain 0.6s ease-in forwards; }
.hp-stage.is-burst .hp-horn { opacity: 1; transform: translateX(0) rotate(52deg); animation: hp-pop 0.45s ease-out forwards; }
.hp-stage.is-burst .hp-press__head { transform: translateY(10%); transition-duration: 0.9s; }
.hp-stage.is-burst::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 58% 58%, var(--hp-glow), transparent 55%); animation: hp-flash 0.7s ease-out forwards; pointer-events: none; }
.hp-stage.is-burst .hp-orb, .hp-stage.is-done .hp-orb { animation: hp-rise 1.6s ease-out forwards; }
.hp-stage.is-done .hp-horn { opacity: 0; }
.hp-stage.is-done .hp-orb { opacity: 1; transform: translate(-50%, -150%) scale(1); }
.hp-stage.is-mythic, .hp-sheet--mythic .hp-stage { box-shadow: inset 0 0 60px rgb(255 215 106 / 35%); }

.hp-title { display: block; margin: 10px 0 4px; font-size: calc(18px * var(--rui-s, 1)); color: var(--fr-gold, #c77dff); }
.hp-won { list-style: none; margin: 6px auto; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 520px; }
.hp-won__row { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 4px 10px 4px 4px; border-radius: 999px; background: rgb(20 13 30 / 80%); border: 1.5px solid rgb(201 168 245 / 35%); color: #fbf3e7; font-size: var(--rui-min, 16px); }
.hp-won__row.is-wish { border-color: #ffd76a; box-shadow: 0 0 14px rgb(255 215 106 / 60%); }
.hp-won__pic { width: 36px; height: 36px; object-fit: contain; }
.hp-essence { margin: 6px 0; font-size: calc(18px * var(--rui-s, 1)); color: #b6ff8a; opacity: 0; transition: opacity 0.4s; }
.hp-essence.is-shown { opacity: 1; }
.hp-skip.rui-btn { min-height: 44px; margin-top: 6px; }

@keyframes hp-load { from { opacity: 0; transform: translateX(-60%) rotate(52deg); } to { opacity: 1; transform: translateX(0) rotate(52deg); } }
@keyframes hp-step { 50% { transform: translateX(6%) rotate(-3deg); } }
@keyframes hp-shake { 25% { transform: translate(-1.5px, 1px); } 75% { transform: translate(1.5px, -1px); } }
@keyframes hp-strain { to { filter: drop-shadow(0 0 16px var(--hp-glow)) brightness(1.35); } }
@keyframes hp-pop { to { opacity: 0; transform: translateX(0) rotate(52deg) scale(1.25); filter: brightness(2.5); } }
@keyframes hp-flash { from { opacity: 0.95; } to { opacity: 0; } }
@keyframes hp-rise { 0% { opacity: 0; transform: translate(-50%, 0) scale(0.4); } 40% { opacity: 1; } 100% { opacity: 1; transform: translate(-50%, -150%) scale(1); } }
@keyframes hp-flicker { from { opacity: 0.6; transform: scaleX(0.92); } to { opacity: 1; transform: scaleX(1.06); } }

/* ---- the Horn Wall -------------------------------------------------------------------------------------------- */
.hp-wall__count { margin: 0 0 8px; color: #d2c5e4; font-size: var(--rui-min, 16px); text-align: start; }
.hp-wall { display: grid; gap: 6px; padding: 12px 10px; border-radius: 14px; background-size: cover; background-position: center; overflow-x: auto; }
.hp-wall__row { display: grid; grid-template-columns: 64px repeat(9, minmax(52px, 1fr)); gap: 6px; align-items: center; padding: 4px; border-radius: 10px; }
.hp-wall__row.has-aura { box-shadow: 0 0 18px var(--hp-glow), inset 0 0 12px var(--hp-glow); }
.hp-wall__label { color: var(--hp-glow); font-size: var(--rui-min, 16px); font-weight: 700; text-align: start; text-shadow: 0 1px 2px #000; }
.hp-mount { position: relative; aspect-ratio: 1; }
.hp-mount__plaque { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0.85; }
.hp-mount.is-held .hp-mount__plaque { opacity: 1; }
/* the painting lies corner to corner already, so it hangs as painted, inside its own mount (no clipping, no reach into the next) */
.hp-mount__horn { position: absolute; left: 12%; top: 6%; width: 76%; height: 76%; object-fit: contain; filter: drop-shadow(0 2px 2px #000); }
.hp-mount.is-pristine .hp-mount__horn { filter: drop-shadow(0 0 7px #ffd76a) drop-shadow(0 0 2px #ffd76a); }
.hp-mount.is-new { animation: hp-new 1.2s ease-out 2; }
.hp-mount__class { position: absolute; left: 0; right: 0; bottom: -2px; font-size: 13px; line-height: 1; color: #fbf3e7; text-shadow: 0 1px 2px #000, 0 0 4px var(--hp-band); }
.hp-ranks { margin: 10px 0 0; padding-inline-start: 22px; text-align: start; color: #d2c5e4; font-size: var(--rui-min, 16px); }
.hp-ranks li { margin: 4px 0; }
.hp-ranks li.is-won { color: #b6ff8a; }
.hp-ranks li.is-won::marker { content: "\2714  "; }
@keyframes hp-new { 0% { filter: brightness(2.2); transform: scale(1.12); } 100% { filter: none; transform: none; } }

/* a phone held sideways: the press on the left, what it gave on the right, so the result is seen without a scroll */
@media (max-height: 520px) and (orientation: landscape) {
  .hp-sheet:not(.hp-sheet--wall) .rui-dlg__body { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-auto-rows: min-content; column-gap: 16px; align-items: start; }
  .hp-sheet:not(.hp-sheet--wall) .hp-stage { grid-row: 1 / span 4; width: min(50vw, calc((100dvh - 120px) * 4 / 3)); }
  .hp-sheet:not(.hp-sheet--wall) .hp-skip { justify-self: center; }
}

@media (prefers-reduced-motion: reduce) {
  .hp-sheet *, .hp-sheet *::after { animation: none !important; transition: none !important; }
}
