/* Hula sa Quiapo (templates/games/hula.html). Classes start with hl-. Phone first: the bar, the canvas,
   then the reading panel. From 820px the panel sits right of the canvas. The canvas, the panel and the
   album are dusk at Plaza Miranda in both themes: dark aubergine with gold hairlines. The bar uses the
   site tokens. Bump ?v= in hula.html. */
.hl, .hl-album {
  --hl-gold: #d9b45a; --hl-gold-hi: #f3dfae; --hl-hair: rgba(217, 180, 90, .36); --hl-hair-lo: rgba(217, 180, 90, .16);
  --hl-txt: #f1e8da; --hl-txt-2: #cdbdc8; --hl-txt-3: #a898a8; --hl-well: rgba(8, 3, 12, .34);
  --hl-glass: radial-gradient(120% 60% at 50% 0%, rgba(217, 160, 90, .16), transparent 60%), linear-gradient(165deg, #3a2042 0%, #24132c 46%, #180c1f 100%);
}
.hl { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "bar" "view" "panel"; }
.hl-bar { grid-area: bar; display: flex; align-items: center; gap: 10px; min-width: 0; }
.hl-bar h1 { flex: 1; min-width: 0; font-size: clamp(20px, 3vw, 28px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hl-back { flex: none; display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--txt-hi); font-weight: 600; font-size: 13.5px; }
.hl-back:hover { text-decoration: none; background: var(--sunk); }
.hl-mute { flex: none; display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--txt-hi); cursor: pointer; }
.hl-mute:hover { background: var(--sunk); }
.hl-mute .hl-mute-off, .hl-mute[aria-pressed="true"] .hl-mute-on { display: none; }
.hl-mute[aria-pressed="true"] .hl-mute-off { display: inline; }
.hl-mute[aria-pressed="true"]:not(#fsBtn) { color: var(--txt-3); }
.hl-mute[hidden] { display: none; }
.hl-coins { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px 0 8px; border-radius: 999px; background: color-mix(in srgb, var(--sun) 28%, var(--card)); color: var(--sun-on); font: 700 16px var(--display); font-variant-numeric: tabular-nums; }
:root[data-theme="dark"] .hl-coins { color: var(--sun-ink); }

.hl-view { grid-area: view; position: relative; height: clamp(340px, 56svh, 580px); overflow: hidden; border-radius: var(--r2); background: #0d0812; box-shadow: 0 18px 44px -22px rgba(24, 8, 30, .7); }
.hl-view canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; outline: none; }
.hl-loading { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; color: var(--hl-gold-hi); font: 600 16px var(--display); background: radial-gradient(60% 50% at 50% 55%, #3a1d2c, #0d0812 75%); transition: opacity .6s ease; }
.hl-loading.out { opacity: 0; pointer-events: none; }

.hl-panel { grid-area: panel; position: relative; display: grid; gap: 11px; align-content: start; padding: 22px 20px 20px; border-radius: var(--r2); background: var(--hl-glass); border: 1px solid var(--hl-hair); box-shadow: inset 0 1px 0 rgba(255, 236, 196, .16), inset 0 0 0 5px rgba(12, 5, 16, .35), inset 0 0 0 6px var(--hl-hair-lo), 0 18px 44px -22px rgba(24, 8, 30, .7); color: var(--hl-txt); outline: none; }
.hl-count { margin: 0; font: 600 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--hl-gold); }
.hl-panel h2 { font: 800 34px/1.05 var(--display); letter-spacing: -.01em; color: var(--hl-gold-hi); text-shadow: 0 0 22px rgba(240, 190, 100, .38), 0 1px 0 rgba(0, 0, 0, .5); padding-bottom: 12px; background: linear-gradient(90deg, var(--hl-gold), transparent 78%) left bottom / 100% 1px no-repeat; }
.hl-help { margin: 0; color: var(--hl-txt-2); font-size: 14.5px; }
.hl-cost { margin: 0 0 8px; font-weight: 700; color: var(--hl-gold-hi); }
.hl-topics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.hl-topic { display: grid; gap: 2px; justify-items: start; min-height: 58px; padding: 10px 13px; border-radius: 12px; border: 1px solid var(--hl-hair); background: linear-gradient(180deg, rgba(255, 240, 210, .09), rgba(255, 240, 210, .025)); box-shadow: inset 0 1px 0 rgba(255, 236, 196, .12); color: var(--hl-txt); font: 700 15px var(--ui); text-align: left; cursor: pointer; transition: border-color .2s, box-shadow .2s, background-color .2s; }
.hl-topic small { font: 500 12.5px var(--ui); color: var(--hl-txt-2); }
.hl-topic:hover:not(:disabled) { border-color: var(--hl-gold); box-shadow: inset 0 1px 0 rgba(255, 236, 196, .2), 0 0 18px -4px rgba(240, 190, 100, .55); }
.hl-topic:disabled { opacity: .5; cursor: wait; }
.hl-msg { margin: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255, 140, 150, .4); background: rgba(190, 40, 60, .22); color: #ffc9cd; font-weight: 600; font-size: 14px; }

.hl-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hl-cards:empty { display: none; }
.hl-cards li { display: grid; gap: 3px; padding: 12px 12px 12px 14px; border-radius: 12px; background: var(--hl-well); box-shadow: inset 2px 0 0 var(--hl-gold), inset 0 0 0 1px var(--hl-hair-lo); animation: hl-in .45s ease both; }
.hl-pos { font: 600 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--hl-gold); }
.hl-cards li { cursor: pointer; transition: box-shadow .2s; }
.hl-cards li:hover { box-shadow: inset 2px 0 0 var(--hl-gold), inset 0 0 0 1px var(--hl-hair), 0 0 18px -6px rgba(240, 190, 100, .55); }
.hl-name { font: 700 17px var(--display); color: var(--hl-gold-hi); }
button.hl-name { justify-self: start; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; text-decoration: underline; text-decoration-color: var(--hl-hair); text-underline-offset: 4px; }
button.hl-name:focus-visible { outline: 3px solid var(--hl-gold-hi); outline-offset: 2px; border-radius: 4px; }
.hl-name span { font-weight: 500; color: var(--hl-txt-2); }
.hl-rev { justify-self: start; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--hl-hair); color: var(--hl-gold-hi); font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.hl-lead { margin: 2px 0 0; font-size: 13px; color: var(--hl-txt-3); }
.hl-line { margin: 0; font-size: 14.5px; color: var(--hl-txt); }
/* the advice: the one line the reading ends on, so it is the loudest text in the panel */
.hl-payo { margin: 0; padding: 18px 18px 18px 20px; border-radius: 14px; border: 1px solid var(--hl-gold); background: linear-gradient(160deg, rgba(240, 190, 100, .24), rgba(240, 190, 100, .06) 70%); box-shadow: inset 0 1px 0 rgba(255, 236, 196, .25), 0 0 30px -8px rgba(240, 190, 100, .6); color: var(--hl-gold-hi); font: 700 19px/1.4 var(--display); text-wrap: balance; }

.hl-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.hl-acts:not(:has(:not([hidden]))) { display: none; }
.hl-btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--hl-hair); background: rgba(255, 240, 210, .05); color: var(--hl-gold-hi); font: 700 15px var(--ui); cursor: pointer; transition: box-shadow .2s, border-color .2s, filter .2s; }
.hl-btn[hidden] { display: none; }
.hl-btn.primary { flex: 1; border-color: #f3dfae; background: linear-gradient(180deg, #f1d894 0%, #d2a548 52%, #b08128 100%); color: #2a1506; text-shadow: 0 1px 0 rgba(255, 240, 200, .5); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), inset 0 -2px 0 rgba(90, 50, 10, .35), 0 8px 22px -8px rgba(240, 180, 80, .7); }
/* a slow shine across the gold button */
.hl-btn.primary::after { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, .55) 50%, transparent 62%); transform: translateX(-120%); }
.hl-btn.primary:hover:not(:disabled)::after, .hl-btn.primary:focus-visible::after { transform: translateX(120%); transition: transform .7s ease; }
.hl-btn:hover:not(:disabled) { border-color: var(--hl-gold); box-shadow: 0 0 18px -4px rgba(240, 190, 100, .55); }
.hl-btn.primary:hover:not(:disabled) { filter: brightness(1.06); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), inset 0 -2px 0 rgba(90, 50, 10, .35), 0 8px 26px -6px rgba(240, 180, 80, .9); }
.hl-btn:disabled { opacity: .5; cursor: wait; filter: saturate(.6); }
.hl-btn:focus-visible, .hl-topic:focus-visible { outline: 3px solid var(--hl-gold-hi); outline-offset: 2px; }
.hl-back:focus-visible, .hl-mute:focus-visible { outline: 3px solid var(--grape); outline-offset: 2px; }
.hl-note { margin: 0; font-size: 12.5px; color: var(--hl-txt-3); }

/* a soft change between steps (hula.js sets the class again at each step) */
@keyframes hl-in { from { opacity: 0; transform: translateY(8px); } }
.hl-step > :not(.hl-cards):not(.hl-acts) { animation: hl-in .4s ease both; }
.hl-step > h2 { animation-delay: .04s; }
.hl-step > .hl-help { animation-delay: .08s; }
.hl-step > #stepBody { animation-delay: .12s; }

/* the album */
.hl-album { width: min(920px, calc(100vw - 24px)); max-height: calc(100svh - 24px); padding: 20px; border: 1px solid var(--hl-hair); border-radius: var(--r2); background: var(--hl-glass); box-shadow: inset 0 1px 0 rgba(255, 236, 196, .16), 0 30px 80px -20px rgba(10, 2, 14, .8); color: var(--hl-txt); }
.hl-album::backdrop { background: rgba(8, 4, 14, .72); backdrop-filter: blur(6px); }
.hl-album-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.hl-album-head h2 { font-size: 24px; color: var(--hl-gold-hi); }
.hl-album-head p { flex: 1; margin: 0; color: var(--hl-txt-2); font-size: 13.5px; }
.hl-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.hl-grid li { aspect-ratio: 70 / 120; position: relative; display: grid; place-items: center; overflow: hidden; border-radius: 8px; border: 1px solid #b89a5a; background: #ecdfbd; color: #4e111b; text-align: center; font: 600 11px/1.2 Georgia, serif; padding: 6px; box-shadow: 0 6px 14px -8px rgba(0, 0, 0, .8); }
.hl-grid li img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hl-grid li b { display: block; font-size: 13px; margin-bottom: 4px; }
.hl-grid li button { position: absolute; inset: 0; width: 100%; padding: 6px; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; display: grid; place-items: center; }
.hl-grid li button:focus-visible { outline: 3px solid var(--hl-gold-hi); outline-offset: -3px; border-radius: 8px; }
.hl-grid li.off { background: var(--hl-well); border-color: var(--hl-hair-lo); color: var(--hl-txt-3); box-shadow: none; }

/* full screen (F): the whole game fills the screen, and the table takes all the height the panel leaves */
.hl:fullscreen { padding: 12px; background: var(--bg, Canvas); overflow-y: auto; }
.hl:fullscreen .hl-view { height: 62svh; }
@media (min-width: 820px) {
  .hl:fullscreen { grid-template-rows: auto minmax(0, 1fr); }
  .hl:fullscreen .hl-view, .hl:fullscreen .hl-panel { height: 100%; max-height: none; }
}

/* the card view: the picture beside its text, or above it on a phone */
.hl-card { width: min(680px, calc(100vw - 24px)); }
.hl-card[open] { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.hl-card img { width: 100%; max-width: 300px; max-height: 56svh; justify-self: center; aspect-ratio: 70 / 120; object-fit: cover; border-radius: 12px; border: 1px solid #b89a5a; box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .9); }
.hl-card-text { display: grid; gap: 6px; align-content: center; }
.hl-card-text .hl-name { font-size: 24px; }
.hl-card-text .hl-line { font-size: 17px; }
.hl-card-text .hl-btn { justify-self: start; margin-top: 10px; }
@media (min-width: 600px) { .hl-card[open] { grid-template-columns: 260px minmax(0, 1fr); gap: 22px; } }

@media (min-width: 820px) {
  .hl { grid-template-columns: minmax(0, 1fr) 340px; grid-template-areas: "bar bar" "view panel"; align-items: start; }
  .hl-view { height: clamp(520px, calc(100svh - 170px), 780px); }
  .hl-panel { max-height: clamp(520px, calc(100svh - 170px), 780px); overflow-y: auto; scrollbar-color: var(--hl-hair) transparent; }
  /* the panel scrolls on its own here, so its buttons stay in sight at the foot */
  .hl-acts { position: sticky; bottom: -20px; margin: 0 -20px -20px; padding: 14px 20px 20px; background: linear-gradient(180deg, rgba(24, 12, 31, 0), #1b0e22 34%); border-radius: 0 0 var(--r2) var(--r2); }
}
@media (prefers-reduced-motion: reduce) {
  @keyframes hl-in { from { opacity: 0; } }
  .hl-step > *, .hl-cards li { animation-duration: .25s !important; animation-delay: 0s !important; }
  .hl-btn.primary::after { display: none; }
}
