/* Момент награды карты дня (modules/home3-reward.mjs). Файл подгружается вместе с модулем,
   в первой отрисовке главной не участвует. Все классы с приставкой hr-, общие стили не меняются. */

/* ---------- сцена: свет, кольцо, частицы ---------- */
:is(#home3,#daily-card-master) #hm-day-scene[data-hr-tier] { overflow-x: clip; overflow-y: visible; --hr-wait: 1.3s; --hr-light: #efcf9a; --hr-deep: #d8b783; }
:is(#home3,#daily-card-master) #hm-day-scene[data-hr-tier="1"] { --hr-wait: 1.5s; }
:is(#home3,#daily-card-master) #hm-day-scene[data-hr-tier="2"] { --hr-wait: 1.7s; --hr-light: #e6edff; --hr-deep: #b9c7ec; }
:is(#home3,#daily-card-master) #hm-day-scene[data-hr-tier="3"] { --hr-wait: 1.9s; --hr-light: #ffe6b0; }
html:is([data-cards-landing], [data-ritual-entry]) :is(#home3,#daily-card-master) #hm-day-scene[data-hr-tier] { --hr-wait: 1.15s; }
/* На светлой теме свет темнее, иначе он теряется на бумажном фоне. */
:root[data-theme="light"] :is(#home3,#daily-card-master) #hm-day-scene[data-hr-tier] { --hr-light: #c99232; --hr-deep: #a8741f; }
:root[data-theme="light"] :is(#home3,#daily-card-master) #hm-day-scene[data-hr-tier="2"] { --hr-light: #7f93c9; --hr-deep: #5c6ea8; }
#hm-day-scene[data-hr-tier] [data-cards] { isolation: isolate; }
.hr-glow, .hr-flash, .hr-ring { position: absolute; left: 50%; top: 50%; translate: -50% -50%; pointer-events: none; }
.hr-glow {
  z-index: -2; width: min(430px, 100vw - 2 * var(--gutter, 20px)); height: 470px; border-radius: 50%; opacity: 0;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--hr-light) 72%, transparent), color-mix(in srgb, var(--hr-light) 44%, transparent) 46%, color-mix(in srgb, var(--hr-deep) 15%, transparent) 72%, transparent);
}
.hr-flash {
  z-index: 3; width: min(400px, 100vw - 2 * var(--gutter, 20px)); height: 420px; border-radius: 50%; opacity: 0;
  background: radial-gradient(closest-side, #fff8e4e6, color-mix(in srgb, var(--hr-light) 62%, transparent) 34%, color-mix(in srgb, var(--hr-light) 20%, transparent) 62%, transparent);
}
#home3 .hr-ring { z-index: 2; width: 196px; max-width: none; height: 312px; overflow: visible; opacity: 0; transition: translate .7s cubic-bezier(.2, .8, .2, 1), scale .7s cubic-bezier(.2, .8, .2, 1); }
:is(#home3,#daily-card-master) #hm-day-scene[data-hr="wait"] .hr-ring, :is(#home3,#daily-card-master) #hm-day-scene[data-hr="burst"] .hr-ring { translate: -50% calc(-50% - 10px); scale: 1.05; }
.hr-ring rect { fill: none; stroke: var(--hr-light); stroke-width: 1.2; stroke-dasharray: 100; stroke-dashoffset: 100; stroke-linecap: round; }
.hr-ring .hr-ring-2 { stroke-width: .7; opacity: 0; }
.hr-sparks { position: absolute; z-index: 3; left: 0; top: -70px; width: 100%; height: calc(100% + 190px); pointer-events: none; }

/* Предвкушение: карта приподнимается, свет собирается, кольцо замыкается. */
:is(#home3,#daily-card-master) #hm-day-scene[data-hr] .cm-card { animation: none; }
:is(#home3,#daily-card-master) #hm-day-scene[data-hr="wait"] .cm-card { animation: hr-lift var(--hr-wait) cubic-bezier(.2, .7, .2, 1) forwards; cursor: default; }
:is(#home3,#daily-card-master) #hm-day-scene[data-hr="burst"] .cm-card { translate: 0 -10px; scale: 1.05; animation: golden-poise .18s both; }
:is(#home3,#daily-card-master) #hm-day-scene[data-hr="done"] .cm-card { transition: translate .7s cubic-bezier(.2, .8, .2, 1), scale .7s cubic-bezier(.2, .8, .2, 1); }
#hm-day-scene[data-hr="wait"] .hr-glow { animation: hr-gather var(--hr-wait) ease-in forwards; }
:is(#home3,#daily-card-master) #hm-day-scene[data-hr="wait"] .hr-ring { opacity: 1; }
#hm-day-scene[data-hr="wait"] .hr-ring rect { animation: hr-draw var(--hr-wait) cubic-bezier(.5, 0, .3, 1) forwards; }
/* Редкий день даёт о себе знать ещё до переворота: появляется второе кольцо. */
#hm-day-scene[data-hr="wait"][data-hr-tier="2"] .hr-ring-2, #hm-day-scene[data-hr="wait"][data-hr-tier="3"] .hr-ring-2 { opacity: .8; animation-delay: .5s; animation-duration: calc(var(--hr-wait) - .5s); }
#hm-day-scene[data-hr="burst"] .hr-glow { animation: hr-bloom .95s ease-out forwards; }
#hm-day-scene[data-hr="burst"] .hr-flash { animation: hr-flash .6s ease-out both; }
:is(#home3,#daily-card-master) #hm-day-scene[data-hr="burst"] .hr-ring { opacity: 1; animation: hr-release .7s ease-out .26s forwards; }
#hm-day-scene[data-hr="burst"] .hr-ring rect { stroke-dashoffset: 0; }
#hm-day-scene[data-hr="done"] .hr-glow { opacity: .4; transition: opacity .8s ease; }
#hm-day-scene[data-hr="done"][data-hr-tier="1"] .hr-glow { opacity: .52; }
#hm-day-scene[data-hr="done"][data-hr-tier="2"] .hr-glow, #hm-day-scene[data-hr="done"][data-hr-tier="3"] .hr-glow { opacity: .68; }
/* Печать особого дня остаётся вокруг открытой карты до конца дня. */
:is(#home3,#daily-card-master) #hm-day-scene[data-hr="done"]:not([data-hr-tier="0"]) .hr-ring { opacity: .7; }
#hm-day-scene[data-hr="done"]:not([data-hr-tier="0"]) .hr-ring rect { stroke-dashoffset: 0; }
#hm-day-scene[data-hr="done"][data-hr-tier="3"] .hr-ring-2 { opacity: .7; }
/* Личный день: лучи за картой один раз медленно поворачиваются и замирают. */
#hm-day-scene[data-hr-tier="3"] .hr-glow::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--hr-light) 34%, transparent) 0 3deg, transparent 3deg 18deg);
  -webkit-mask: radial-gradient(closest-side, transparent 40%, #000 56%, transparent 100%); mask: radial-gradient(closest-side, transparent 40%, #000 56%, transparent 100%);
}
#hm-day-scene[data-hr="done"][data-hr-tier="3"] .hr-glow::before { animation: hr-rays 14s cubic-bezier(.2, .6, .2, 1) forwards; }
@keyframes golden-poise { from,to { translate: 0 -10px; scale: 1.05; } }
@keyframes hr-lift { 55% { translate: 0 -8px; scale: 1.035; } 78% { translate: 0 -11px; scale: 1.062; } 100% { translate: 0 -10px; scale: 1.05; } }
@keyframes hr-gather { from { opacity: 0; scale: .55; } to { opacity: .85; scale: 1; } }
@keyframes hr-draw { to { stroke-dashoffset: 0; } }
@keyframes hr-bloom { 0% { opacity: .85; scale: 1; } 38% { opacity: 1; scale: 1.22; } 100% { opacity: .4; scale: 1; } }
@keyframes hr-flash { 0% { opacity: 0; scale: .45; } 30% { opacity: .9; } 100% { opacity: 0; scale: 1.7; } }
@keyframes hr-release { to { opacity: 0; scale: 1.12; } }
@keyframes hr-rays { to { rotate: 80deg; } }

/* Строка предвкушения встаёт на место кнопки. Отступ под кнопкой с момента касания держит место
   под толкование: когда оно появится, страница уже не прыгнет. */
#hm-day-scene[data-hr] + #hm-day-open { visibility: hidden; }
#home3 .hr-whisper {
  position: absolute; left: 0; right: 0; top: calc(100% + 16px); margin: 0 auto; max-width: 20em;
  font-size: 15.5px; line-height: 1.45; color: var(--muted); text-wrap: balance; animation: hr-rise .5s ease both;
}

/* Звук: выключен, пока человек сам не включит его одним касанием. */
.hr-sound {
  position: absolute; z-index: 4; top: 0; right: max(0px, 50% - 250px); display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 44px; min-height: 44px; padding: 0 8px; border: 0; border-radius: 22px; background: none; cursor: pointer;
  font: inherit; font-size: 12.5px; color: var(--muted);
}
.hr-sound:hover, .hr-sound[aria-pressed="true"] { color: var(--bronze); }
.hr-sound[aria-pressed="true"] .hr-off, .hr-sound[aria-pressed="false"] .hr-on { display: none; }
@media (max-width: 519px) { .hr-sound span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); } }

/* ---------- полоса награды ---------- */
.hr-bar { display: grid; gap: 10px; justify-items: center; margin: 2px 0 16px; }
#home3 .hr-phrase { font-family: var(--font-serif, Georgia, serif); font-size: clamp(18px, 4.8vw, 21px); line-height: 1.35; color: var(--bronze); text-wrap: balance; }
.hr-ribbon { max-width: 100%; }
#home3 .hr-ribbon > summary {
  display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px; min-height: 44px; padding: 8px 16px;
  border: 1px solid var(--gold); border-radius: 22px; background: color-mix(in srgb, var(--gold) 12%, transparent);
}
.hr-ribbon > summary::-webkit-details-marker { display: none; }
.hr-ribbon summary b { font-size: 11.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--bronze); }
.hr-ribbon summary b::before { content: "✦ "; }
.hr-ribbon summary span { font-size: 13.5px; color: var(--muted); text-decoration: underline; text-underline-offset: 4px; }
#home3 .hr-ribbon > p { max-width: 34em; margin-top: 10px; font-size: 14.5px; line-height: 1.6; text-align: left; }
#home3 .hr-ribbon > .hr-note { font-size: 13px; color: var(--muted); }
#home3 .hr-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 0; padding: 0; list-style: none; }
.hr-chips li { padding: 7px 13px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); font-size: 13.5px; line-height: 1.35; }
.hr-chips .hr-chip-gold { border-color: var(--gold); }
.hr-chips .hr-chip-gold::before { content: "✦ "; color: var(--bronze); }
.hr-gift {
  position: relative; display: grid; gap: 6px; justify-items: start; width: 100%; padding: 14px 16px; overflow: hidden;
  border: 1px solid var(--gold); border-radius: 12px; background: var(--card); text-align: left; font-size: 15px; line-height: 1.55;
}
.hr-gift > b { font-size: 11.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--bronze); }
/* Появление по очереди: фраза, знак, награды, подарок. */
.hr-fresh > * { animation: hr-rise .55s cubic-bezier(.2, .8, .2, 1) both; }
.hr-fresh > :nth-child(2) { animation-delay: .16s; }
.hr-fresh > :nth-child(3) { animation-delay: .32s; }
.hr-fresh > :nth-child(4) { animation-delay: .5s; }
.hr-fresh .hr-chips li { animation: hr-rise .5s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(.4s + var(--hr-i, 0) * .14s); }
.hr-fresh .hr-chips li:nth-child(2) { --hr-i: 1; }
.hr-fresh .hr-chips li:nth-child(3) { --hr-i: 2; }
.hr-fresh .hr-chips li:nth-child(4) { --hr-i: 3; }
.hr-fresh .hr-gift::after {
  content: ""; position: absolute; inset: 0; translate: -120% 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, color-mix(in srgb, var(--gold-pale) 38%, transparent) 50%, transparent 65%); animation: hr-sweep 1.1s ease-out .9s forwards;
}
@keyframes hr-rise { from { opacity: 0; translate: 0 10px; } }
@keyframes hr-sweep { to { translate: 120% 0; } }

/* ---------- карточка дня и альбом ---------- */
.hr-more { margin-top: 14px; }
#home3 .hr-actions { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; justify-content: center; margin-top: 12px; }
#home3 .hr-actions .hm-btn { min-height: 48px; padding: 11px 22px; font-size: 15px; }
.hr-share { margin-top: 14px; }
#home3 .hr-day-share .hm-btn { min-height: 44px; padding: 6px 12px; font-size: 14px; }
.hr-poster { display: block; width: min(220px, 62vw); height: auto; aspect-ratio: 9 / 16; background: #0d1426; margin: 0 auto 10px; border-radius: 14px; box-shadow: 0 18px 40px #02040a80; }
#home3 .hr-album h3 { margin: 14px 0 8px; font-size: 15px; font-family: inherit; font-weight: 600; letter-spacing: .04em; color: var(--bronze); }
#home3 .hr-suit { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.hr-suit li { position: relative; }
.hr-suit a { position: relative; display: block; }
.hr-suit img { display: block; width: 100%; height: auto; border-radius: 4px; }
.hr-suit a i { position: absolute; top: -4px; right: -3px; font-style: normal; font-size: 12px; color: var(--gold-pale); text-shadow: 0 1px 3px #000; }
.hr-slot {
  display: grid; place-items: center; aspect-ratio: 56 / 95; border: 1px dashed var(--line); border-radius: 4px;
  font-size: 15px; color: var(--muted); opacity: .7;
}
.hr-backs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }
.hr-backs > b { flex-basis: 100%; font-size: 15px; font-weight: 600; color: var(--bronze); }
.hr-back { min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 22px; background: none; cursor: pointer; font: inherit; font-size: 14px; color: var(--text); }
.hr-back[aria-pressed="true"] { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, transparent); }
.hr-back:disabled { border-style: dashed; color: var(--muted); cursor: default; }
.hr-circle { margin-top: 18px; padding-top: 4px; border-top: 1px solid var(--line); }
#home3 .hr-circle-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 12px 0 0; padding: 0; list-style: none; }
.hr-circle-row li { display: grid; gap: 4px; justify-items: center; align-content: start; font-size: 13px; line-height: 1.45; text-align: center; }
.hr-circle-row img { width: 72px; height: auto; border-radius: 5px; }
.hr-circle-row small { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--bronze); }

/* Gift artwork shares the original card geometry. */
#home3:is([data-hr-back="moon"], [data-hr-back="gold"]) #hm-day-scene .cm-back img { content: var(--hr-back-image); }
#home3:is([data-hr-back="moon"], [data-hr-back="gold"]) #hm-day-scene [data-cards]::before,
#home3:is([data-hr-back="moon"], [data-hr-back="gold"]) #hm-day-scene [data-cards]::after { background-image: var(--hr-back-image); }
@media (max-width: 600px) {
  #home3:is([data-hr-back="moon"], [data-hr-back="gold"]) #hm-day-scene .cm-back img { content: var(--hr-back-small); }
  #home3:is([data-hr-back="moon"], [data-hr-back="gold"]) #hm-day-scene [data-cards]::before,
  #home3:is([data-hr-back="moon"], [data-hr-back="gold"]) #hm-day-scene [data-cards]::after { background-image: var(--hr-back-small); }
}

@media (prefers-reduced-motion: reduce) {
  :is(#home3,#daily-card-master) #hm-day-scene[data-hr] .cm-card, #hm-day-scene[data-hr] .hr-glow, #hm-day-scene[data-hr] .hr-glow::before, #hm-day-scene[data-hr] .hr-flash,
  #hm-day-scene[data-hr] .hr-ring, #hm-day-scene[data-hr] .hr-ring rect, #home3 .hr-whisper, .hr-fresh > *, .hr-fresh .hr-chips li, .hr-fresh .hr-gift::after { animation: none !important; transition: none !important; }
}

/* The idle mist sits behind the closed Oracle deck. The flash takes over on tap. */
#oracle .oracle-halo::after {
  content: ''; position: absolute; inset: -8%; border-radius: inherit; pointer-events: none;
  background: radial-gradient(ellipse at 32% 55%, #d4aa6b47, transparent 40%),
              radial-gradient(ellipse at 67% 41%, #9da3b536, transparent 38%);
  opacity: .54;
}
#oracle:is([aria-busy], [data-turn]) .oracle-halo::after { opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  #oracle:not([aria-busy]):not([data-turn]) .oracle-halo::after {
    animation: oracle-idle-mist 8s ease-in-out infinite alternate;
  }
  @keyframes oracle-idle-mist {
    from { transform: translate(-3%, 2%) scale(.96); opacity: .46; }
    to { transform: translate(4%, -3%) scale(1.05); opacity: .79; }
  }
}
