/* Вкладка «Таро», экран-ритуал «Карта дня»: продолжение app.css (те же переменные, шрифты и рамки).
   Движение только на transform и opacity. Состояния экрана задаёт ritual.js классами на #screen-day:
   is-loading → is-closed → is-flipping → is-open (is-instant: открыта без анимации, is-reduced: без движения). */

/* ---------- экран ---------- */
.screen--day {
  --day-chrome: 258px;                               /* всё, кроме карты: отступы, заголовок, подпись, панель вкладок */
  --ch-fit: calc(var(--vh) - var(--day-chrome) - var(--top) - var(--bottom));
  --ch: min(var(--ch-fit), calc(min(72vw, 300px) * 12 / 7));
  --cw: calc(var(--ch) * 7 / 12);
  --flip: 1100ms;                                    /* длительность переворота; ritual.js читает её отсюда */
  --t90: 429ms;                                      /* когда карта встаёт ребром (ritual.js считает точно) */
  position: relative;
  margin: 0 calc(-1 * var(--gutter));
  padding-left: var(--gutter);
  padding-right: var(--gutter);
  overflow: hidden;                                  /* лучи и свет шире экрана: не даём им создать прокрутку */
  text-align: center;
}
html.in-tg .screen--day { --day-chrome: 268px; }
.screen--day.is-open { --ch: clamp(220px, calc(var(--vh) * .4), 340px); padding-bottom: calc(26px + var(--dock-room, var(--bottom))); }
.screen--day ::selection { background: rgba(192, 146, 70, .276); color: #1e2347; }
.screen--day.is-entering { animation-name: day-enter; }     /* без сдвига: иначе на полсекунды появляется прокрутка */
@keyframes day-enter { from { opacity: 0; } to { opacity: 1; } }

.day-head { position: relative; z-index: 2; }
.day-date { margin: 4px 0 0; font: italic 500 22px/1.2 var(--serif); color: var(--cream); }

.day-stage {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 10px 0 2vh;
}
.screen--day.is-open .day-stage { flex: none; padding: 12px 0 0; }

.day-rig { position: relative; flex: none; width: var(--cw); height: var(--ch); transition: opacity .35s ease; }
.screen--day.is-loading .day-rig { opacity: 0; }

/* свет под картой */
.day-aura {
  position: absolute;
  inset: -16% -46%;
  background: radial-gradient(closest-side, rgba(192, 146, 70, .12), rgba(70, 96, 190, .2) 46%, rgba(255, 250, 241, 0) 74%);
  pointer-events: none;
}
.screen--day.is-closed .day-aura { animation: day-aura 6.4s ease-in-out infinite; }
.screen--day.is-open:not(.is-flipping) .day-aura { animation: day-aura 6.4s ease-in-out infinite; }   /* и у открытой (07.10.2026) */
@keyframes day-aura { 0%, 100% { opacity: .62; transform: scale(.97); } 50% { opacity: 1; transform: scale(1.05); } }

/* лучи ар-деко: спят под закрытой картой, расходятся в момент разворота и остаются ореолом */
.day-rays {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--ch) * 1.7);
  height: calc(var(--ch) * 1.7);
  margin: calc(var(--ch) * -.85) 0 0 calc(var(--ch) * -.85);
  opacity: 0;
  transform: scale(.6) rotate(-12deg);
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 26% 50% at 50% 50%, #000 56%, transparent 100%);
  mask-image: radial-gradient(ellipse 26% 50% at 50% 50%, #000 56%, transparent 100%);
}
.day-rays svg { width: 100%; height: 100%; }
.day-rig.is-lit .day-rays { animation: day-rays 1.7s cubic-bezier(.16, 1, .3, 1) both; }
.screen--day.is-open .day-rays { opacity: .34; transform: none; }
@keyframes day-rays {
  0% { opacity: 0; transform: scale(.55) rotate(-14deg); }
  20% { opacity: .85; }
  100% { opacity: .34; transform: none; }
}

/* колода под верхней картой */
.day-under { position: absolute; inset: 0; transition: opacity .5s ease; pointer-events: none; }
.day-under svg {                                     /* те же рубашки, чуть в тени: верхняя карта лежит на колоде */
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: calc(var(--cw) * .05);
  box-shadow: 0 12px 26px rgba(92, 58, 18, .189);
  filter: brightness(.62);
}
.day-under svg:first-child { transform: translate(-7px, 9px) rotate(-3.4deg); }
.day-under svg:last-child { transform: translate(8px, 12px) rotate(2.6deg); }
.screen--day.is-open .day-under { opacity: 0; }

.day-shadow {
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: -30px;
  height: 34px;
  background: radial-gradient(50% 50% at 50% 50%, rgba(255, 250, 241, .84), rgba(255, 250, 241, 0) 72%);
  pointer-events: none;
  transition: opacity .5s ease;
}
.screen--day.is-closed .day-shadow { animation: day-shadow 6.4s ease-in-out infinite; }
.screen--day.is-open .day-shadow { opacity: .55; }
@keyframes day-shadow { 0%, 100% { opacity: .9; transform: scale(1); } 50% { opacity: .55; transform: scale(.9); } }

/* вспышка и полоса света в момент, когда карта стоит ребром */
.day-flash {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--ch) * 1.5);
  height: calc(var(--ch) * 1.5);
  margin: calc(var(--ch) * -.75) 0 0 calc(var(--ch) * -.75);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(192, 146, 70, .576), rgba(192, 146, 70, .372) 26%, rgba(192, 146, 70, .18) 54%, rgba(192, 146, 70, .02) 74%);
  opacity: 0;
  transform: scale(.2);
  pointer-events: none;
}
.day-rig.is-lit .day-flash { animation: day-flash .95s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes day-flash {
  0% { opacity: 0; transform: scale(.2); }
  16% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.22); }
}
.day-blade {
  position: absolute;
  left: 50%;
  top: -8%;
  bottom: -8%;
  width: 46px;
  margin-left: -23px;
  background: radial-gradient(closest-side, #ffffff 0%, rgba(192, 146, 70, .576) 20%, rgba(192, 146, 70, .3) 50%, rgba(192, 146, 70, 0) 100%);
  opacity: 0;
  z-index: 5;
  pointer-events: none;
}
.day-rig.is-lit .day-blade { animation: day-blade .52s ease-out both; }
@keyframes day-blade {
  0% { opacity: 0; transform: scale(.12, .5); }
  22% { opacity: 1; transform: scale(.36, 1.05); }
  100% { opacity: 0; transform: scale(2.6, 1.13); }
}

/* ---------- карта ---------- */
.day-card {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  perspective: 1300px;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.day-card:disabled { cursor: default; }
.screen--day.is-open .day-card { cursor: zoom-in; }
.day-card:focus { outline: none; }
.day-card:focus-visible .day-card__inner { outline: 2px solid var(--ink); outline-offset: 5px; border-radius: calc(var(--cw) * .05); }
.day-card__float, .day-card__tilt, .day-card__lift, .day-card__inner {
  position: absolute;
  inset: 0;
  display: block;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
}
.screen--day.is-closed .day-card__float { animation: day-float 6.4s ease-in-out infinite; }
@keyframes day-float {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(-.45deg); }
  50% { transform: translate3d(0, -9px, 0) rotate(.45deg); }
}
.day-card__tilt {
  transform: rotateX(var(--tx, 0deg)) rotateY(var(--ty, 0deg)) scale(var(--press, 1));
  transition: transform .28s cubic-bezier(.2, .7, .2, 1);
}
.screen--day.is-flipping .day-card__lift { animation: day-lift var(--flip) cubic-bezier(.3, .55, .2, 1) both; will-change: transform; }
@keyframes day-lift {
  0% { transform: translate3d(0, 0, 0); }
  34% { transform: translate3d(0, -14px, 48px); }
  100% { transform: translate3d(0, 0, 0); }
}
.screen--day.is-flipping .day-card__inner { animation: day-flip var(--flip) both; will-change: transform; }
@keyframes day-flip {
  0% { transform: rotateY(0deg); animation-timing-function: cubic-bezier(.4, 0, .6, 1); }
  13% { transform: rotateY(-11deg); animation-timing-function: cubic-bezier(.32, .02, .12, 1); }
  100% { transform: rotateY(180deg); }
}
.screen--day.is-open .day-card__inner { transform: rotateY(180deg); }

.day-card__back, .day-card__face {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: calc(var(--cw) * .05);
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  box-shadow: 0 16px 34px rgba(92, 58, 18, .21);
}
.day-card__back svg { width: 100%; height: 100%; pointer-events: none; }
.day-card__sheen {                                   /* блик на рубашке */
  position: absolute;
  inset: 0;
  background: linear-gradient(104deg, rgba(192, 146, 70, 0) 36%, rgba(192, 146, 70, .12) 50%, rgba(192, 146, 70, 0) 64%);
  transform: translateX(-130%);
}
.screen--day.is-closed .day-card__sheen { animation: day-sheen 5.2s ease-in-out 1.4s infinite; }
.screen--day.is-flipping .day-card__sheen { animation: day-sheen-fast .5s ease-in both; }
@keyframes day-sheen { 0% { transform: translateX(-130%); } 27%, 100% { transform: translateX(130%); } }
@keyframes day-sheen-fast { 0% { transform: translateX(-130%); } 100% { transform: translateX(130%); } }

.day-card__face { transform: rotateY(180deg); background: var(--night); opacity: 0; }
/* Страховка к backface-visibility: стороны переключаются явно в тот миг, когда карта стоит ребром.
   Там, где движок не умеет прятать оборот (проверено в WebKit без видеоускорения), закрытая карта
   иначе показывала бы зеркальное лицо. */
.screen--day.is-flipping .day-card__face { animation: day-side-on 1ms linear var(--t90) both; }
.screen--day.is-flipping .day-card__back { animation: day-side-off 1ms linear var(--t90) both; }
.screen--day.is-open .day-card__face { opacity: 1; }
.screen--day.is-open .day-card__back { opacity: 0; }
@keyframes day-side-on { from { opacity: 0; } to { opacity: 1; } }
@keyframes day-side-off { from { opacity: 1; } to { opacity: 0; } }
.day-card__face img { width: 100%; height: 100%; object-fit: cover; }
.day-card__face::after {                             /* тонкая золотая кромка, как у рубашки */
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(192, 146, 70, .275);
  pointer-events: none;
}
.day-card__gleam { position: absolute; inset: 0; pointer-events: none; }
.day-card__gleam::before {                           /* лицо карты проступает из света */
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 50% 44%, #fffaf0 0%, #fff1d2 52%, #c09246 100%);
  opacity: 0;
}
.day-card__gleam::after {                            /* блик по лицу после разворота */
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(104deg, rgba(192, 146, 70, 0) 34%, rgba(192, 146, 70, .18) 50%, rgba(192, 146, 70, 0) 66%);
  transform: translateX(-130%);
}
.screen--day.is-flipping .day-card__gleam::before { animation: day-expose .8s ease-out var(--t90) both; }
.screen--day.is-flipping .day-card__gleam::after { animation: day-sheen-fast .9s cubic-bezier(.3, 0, .2, 1) calc(var(--flip) - 150ms) both; }
@keyframes day-expose { 0% { opacity: .92; } 100% { opacity: 0; } }

.day-card__fallback {                                /* если картинка не загрузилась */
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: inherit;
  text-align: center;
  font: 600 30px/1.1 var(--serif);
  color: var(--ink);
}
.day-card__face.no-img img { display: none; }
.day-card__face.no-img .day-card__fallback { display: flex; }

/* подпись под картой: приглашение, потом «Ваша карта на сегодня» */
.day-hint {
  position: relative;
  z-index: 2;
  min-height: 26px;
  margin: 26px 0 0;
  font: italic 500 21px/1.24 var(--serif);
  color: var(--cream);
  opacity: 0;
  transition: opacity .4s ease;
}
.screen--day.is-closed .day-hint { opacity: 1; animation: day-hint 3.2s ease-in-out .6s infinite; }
@keyframes day-hint { 0%, 100% { opacity: 1; } 50% { opacity: .8; } }
.screen--day.is-open .day-hint {
  min-height: 15px;
  margin-top: 20px;
  font: 700 12.5px/1.25 var(--sans);
  letter-spacing: .01em;
  color: var(--gold-ink);
  opacity: 1;
  transition: opacity .6s ease .15s;
}

/* ---------- раскрытая карта: название, слова, текст, шаг ---------- */
.day-reading { position: relative; z-index: 2; }
.day-reading[hidden] { display: none; }
.rv { opacity: 0; transform: translateY(14px); }
.screen--day.is-open .rv {
  opacity: 1;
  transform: none;
  transition: opacity .6s ease, transform .75s cubic-bezier(.16, 1, .3, 1);
  transition-delay: calc(var(--rv-base, 0ms) + var(--i, 0) * 110ms);
}
.screen--day.is-instant .rv, .screen--day.is-instant .day-hint, .screen--day.is-instant .day-rig { transition: none; }

.day-titles { margin-top: 14px; }
.day-num {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0;
  font: 600 19px/1 var(--serif);
  letter-spacing: .16em;
  color: var(--gold-ink);
}
.day-num::before, .day-num::after { content: ''; width: 42px; height: 1px; background: linear-gradient(90deg, rgba(192, 146, 70, .02), var(--line)); }
.day-num::after { background: linear-gradient(270deg, rgba(192, 146, 70, .02), var(--line)); }
.day-name { margin: 8px 0 0; font: 600 44px/1.02 var(--serif); letter-spacing: .01em; color: var(--ink); text-wrap: balance; }
.day-name.is-long { font-size: 38px; }                /* «Верховная Жрица», «Колесо Фортуны»: в одну строку */
.day-name:focus { outline: none; }
.day-keys { margin: 8px 0 0; font: italic 500 23px/1.25 var(--serif); color: var(--cream); text-wrap: balance; }
.day-keys[hidden] { display: none; }
/* текст дня по оси экрана, как ответ раскладов (владелец 07.10.2026): по центру вместе с разделами «Любовь», «Работа»,
   «Вопрос дня», строки выровнены по длине; было по левому краю в коробке 38ch, и абзац читался прижатым влево */
.day-text { margin: 16px auto 0; max-width: 38ch; font-size: 17px; line-height: 1.5; color: var(--ivory); text-align: center; text-wrap: balance; }
.day-text.is-short { text-align: center; }
.day-text p { margin: 0; }
.day-text p + p { margin-top: 10px; }

.day-step {
  position: relative;
  max-width: 360px;
  margin: 22px auto 0;
  padding: 20px 20px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 250, 241, .77);
}
.day-step[hidden] { display: none; }
.day-step::before {                                  /* вторая линия рамки, как у первого экрана */
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  pointer-events: none;
}
.day-step__label { margin: 0; font: 700 13px/1.25 var(--sans); letter-spacing: .01em; color: var(--gold-ink); }
.day-step__text { margin: 9px 0 0; font: italic 500 22px/1.3 var(--serif); color: var(--cream); text-wrap: balance; }
.day-tomorrow { margin: 18px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--muted); text-align: center; }
/* «Если Майя помогла…» (ritual.js, владелец 07.10.2026): вторая тихая строка внутри «Завтра можно будет…», подпись, а
   не кнопка; ссылка как «Просто перемешать» у раскладов */
.day-thanks { display: block; margin: 4px auto 0; max-width: 36ch; text-wrap: balance; }
.day-thanks__link { color: var(--gold-ink); text-decoration: underline; text-decoration-color: rgba(192, 146, 70, .5); text-underline-offset: 3px;
  padding: 8px 0; -webkit-tap-highlight-color: transparent; }
.day-thanks__link:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 3px; }

/* ---------- колода ---------- */
.day-deck { margin-top: 20px; }
.day-deck__count { margin: 12px 0 0; font: 600 27px/1.15 var(--serif); color: var(--ink); }
.day-deck__grid { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.day-deck__row { display: flex; justify-content: center; gap: 6px; }
.day-cell {
  position: relative;
  flex: 0 0 calc((100% - 42px) / 8);
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: none;
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
}
.day-cell::before { content: ''; display: block; padding-top: 171.4286%; }
.day-cell > svg, .day-cell > img { position: absolute; inset: 0; width: 100%; height: 100%; }
.day-cell > svg { opacity: .5; }
.day-cell > img { object-fit: cover; opacity: 0; transition: opacity .5s ease; }
.day-cell.is-got { cursor: zoom-in; touch-action: manipulation; }
.day-cell.is-got > img { opacity: 1; }
.day-cell.is-got::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(192, 146, 70, .248);
  pointer-events: none;
}
.day-cell.is-today::after { box-shadow: inset 0 0 0 1.5px var(--gold-2); }
.day-cell.is-new > img { opacity: 0; }
.day-cell.is-new.is-in > img { opacity: 1; transition: opacity .7s ease; }
.day-cell.is-new.is-in { animation: day-cell-in .9s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes day-cell-in { 0% { transform: scale(1); } 35% { transform: scale(1.22); } 100% { transform: scale(1); } }
/* карта дня летит в свою клетку (07.10.2026, «оживление»): копия по дуге, клетка вспыхивает, число в счёте сменяется */
.day-flyer { position: fixed; left: 0; top: 0; z-index: 7; border-radius: 6px; overflow: hidden; pointer-events: none; transform-origin: 0 0;
  box-shadow: 0 14px 30px rgba(92, 58, 18, .231); }
.day-flyer img { display: block; width: 100%; height: 100%; object-fit: cover; }
.day-odo { position: relative; display: inline-block; overflow: hidden; vertical-align: bottom; }
.day-odo__n { display: inline-block; }
.day-odo::before { content: attr(data-old); position: absolute; left: 0; right: 0; top: 0; text-align: center; opacity: 0; }
.day-odo.is-wait .day-odo__n { opacity: 0; }
.day-odo.is-wait::before { opacity: 1; }
.day-odo.is-roll::before { animation: day-odo-out .32s cubic-bezier(.4, 0, .2, 1) both; }
.day-odo.is-roll .day-odo__n { animation: day-odo-in .42s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes day-odo-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-90%); } }
@keyframes day-odo-in { from { opacity: 0; transform: translateY(90%); } to { opacity: 1; transform: none; } }
.day-cell:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.day-actions { display: flex; flex-direction: column; gap: 10px; max-width: 380px; margin: 26px auto 0; }
.day-actions .btn[hidden] { display: none; }
.day-actions .btn--line { min-height: 56px; }

/* у Cormorant по умолчанию старинные цифры («1o» вместо «10»), а запись font: сбрасывает настройку из app.css */
.day-date, .day-name, .day-keys, .day-num, .day-step__text, .day-deck__count { font-variant-numeric: lining-nums; }

/* золотая пыль (холст #day-dust): её стили в today.css, холст стоит в разметке с первого кадра */

/* ---------- невысокие и узкие экраны ---------- */
@media (max-height: 640px) {
  .screen--day { --day-chrome: 224px; padding-bottom: calc(8px + var(--dock-room, var(--bottom))); }
  html.in-tg .screen--day { --day-chrome: 234px; }
  .screen--day .title--sm { font-size: 34px; margin-top: 2px; }
  .day-date { font-size: 19px; margin-top: 2px; }
  .day-hint { margin-top: 22px; font-size: 19px; }
  .day-stage { padding-top: 6px; }
}
@media (max-width: 350px) {
  .day-name { font-size: 38px; }
  .day-name.is-long { font-size: 32px; }
  .day-keys { font-size: 21px; }
  .day-step { padding-left: 16px; padding-right: 16px; }
  .day-step__text { font-size: 20.5px; }
  .day-deck__grid, .day-deck__row { gap: 5px; }
  .day-cell { flex-basis: calc((100% - 35px) / 8); }
}

/* очень старые движки без min() и clamp(): карта постоянного размера */
@supports not (width: min(1px, 2px)) {
  .screen--day { --ch: 400px; }
  .screen--day.is-open { --ch: 280px; }
}

/* ---------- без движения: карта проявляется, ничего не летит ---------- */
@media (prefers-reduced-motion: reduce) {
  .screen--day .day-card__float, .screen--day .day-card__lift, .screen--day .day-card__inner,
  .screen--day .day-card__sheen, .screen--day .day-aura, .screen--day .day-shadow, .screen--day .day-hint { animation: none !important; }
  .screen--day .day-card__inner, .screen--day.is-open .day-card__inner { transform: none; }
  .screen--day .day-card__tilt { transform: none; }
  .screen--day .day-card__face { transform: none; opacity: 0; transition: opacity .7s ease !important; }
  .screen--day.is-open .day-card__face { opacity: 1; }
  .screen--day.is-open .day-card__back { opacity: 1; }           /* рубашка остаётся под проявляющимся лицом */
  .screen--day .day-card__face, .screen--day .day-card__back { animation: none !important; }
  .screen--day .day-flash, .screen--day .day-blade, .screen--day .day-card__gleam { display: none; }
  .screen--day .rv { transform: none !important; }
  .screen--day.is-open .rv { transition: opacity .5s ease !important; transition-delay: 0s !important; }
  .screen--day.is-open .day-rays { transition: opacity .7s ease !important; }
  .screen--day.is-instant .day-card__face, .screen--day.is-instant .rv, .screen--day.is-instant .day-rays { transition: none !important; }
  .day-cell.is-new.is-in { animation: none !important; }
  .day-dust { display: none !important; }
}
