/* Tarot: the 1909 scans on a night-blue cloth with gold. The shell is in
   base.css; here its colors are switched to indigo. */

.o-tarot {
  --bg: #0c0d1f;
  --ink: #ece6d6;
  --muted: #b2adc6;
  --faint: #7c7898;
  --gold: #d9b867;
  --gold-hi: #f3dc9a;
  --line: rgba(217, 184, 103, 0.28);
  /* the rounded corners baked into the pictures: 4.5% of the width */
  --corner: 4.5% / 2.6%;
  background:
    radial-gradient(120% 55% at 50% -10%, #2a2a5c 0%, #17183a 50%, rgba(12, 13, 31, 0) 80%),
    var(--bg);
}

.o-tarot .lang option {
  background: #1c1d40;
}

.tc {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 14px var(--gutter) 0;
  text-align: center;
}

.tc-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(38px, 11vw, 58px);
  line-height: 1.1;
  letter-spacing: 0.08em;
  color: var(--gold-hi);
  background: linear-gradient(180deg, #fff3cf 0%, #e9c77c 52%, #a77f3c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.6));
}

.tc-subtitle {
  margin: 6px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  color: var(--muted);
}

.tc-h {
  margin: 30px 0 12px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--gold-hi);
}

/* ---------- spreads ---------- */

.tc-spreads {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.tc-spread {
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}

.tc-spread:hover {
  color: var(--ink);
  border-color: rgba(217, 184, 103, 0.6);
}

.tc-spread[aria-pressed="true"] {
  color: #1a1408;
  border-color: var(--gold);
  background: var(--gold);
}

.tc-actions {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.tc-btn {
  min-width: min(100%, 280px);
  min-height: 52px;
  padding: 14px 32px;
  border: 1px solid #f3dc9a;
  border-radius: 999px;
  color: #1a1408;
  background: linear-gradient(180deg, #fff1c4 0%, #e3bf6a 55%, #b48a3c 100%);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5);
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: transform 0.12s, filter 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.tc-btn:hover {
  filter: brightness(1.05);
}

.tc-btn:active {
  transform: translateY(1px);
}

.tc-btn:disabled {
  filter: brightness(0.75);
  cursor: default;
  transform: none;
}

.tc-hint,
.tc-note {
  max-width: 480px;
  margin: 12px auto 0;
  font-size: 14px;
  color: var(--faint);
  text-wrap: balance;
}

.tc-note {
  color: var(--muted);
}

/* ---------- the table ---------- */

.tc-table {
  position: relative;
  width: min(100%, var(--table-w, 600px));
  aspect-ratio: var(--ratio, 1);
  margin: 26px auto 0;
}

.tc-day {
  --table-w: 230px;
}

.tc-three {
  --table-w: 600px;
}

/* the cross is tall: keep it within the screen height */
.tc-celtic {
  --table-w: min(620px, calc(84vh * var(--ratio, 1)));
}

.tc-card {
  position: absolute;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  perspective: 1200px;
  -webkit-tap-highlight-color: transparent;
}

.tc-card:focus-visible {
  outline: 2px solid var(--gold-hi);
  outline-offset: 3px;
  border-radius: 6px;
}

.tc-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.3, 0.7, 0.3, 1);
}

.tc-card.open .tc-inner {
  transform: rotateY(180deg);
}

.tc-face {
  position: absolute;
  inset: 0;
  border-radius: var(--corner);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.55);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.tc-front {
  transform: rotateY(180deg);
}

.tc-face > img {
  display: block;
  width: 100%;
  height: 100%;
}

/* a card face: the scan and its title over it */
.tc-art {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1109 / 1920;
}

.tc-art > img {
  display: block;
  width: 100%;
  height: 100%;
}

.tc-caption {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.tc-caption text {
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: 0.04em;
  fill: #1e1915;
}

.tc-caption text:lang(ar) {
  letter-spacing: 0;
}

.tc-turned {
  transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
  .tc-inner {
    transition: none;
  }
}

/* ---------- readings ---------- */

.tc-readings {
  display: grid;
  gap: 14px;
  margin-top: 22px;
  text-align: start;
}

.tc-readings:empty {
  display: none;
}

.tc-reading {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  scroll-margin-top: 12px;
}

.tc-reading-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.tc-thumb {
  flex: none;
  width: 56px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
}

.tc-names {
  min-width: 0;
}

.tc-pos {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}

.tc-name {
  margin: 2px 0 0;
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1.2;
  color: var(--gold-hi);
}

.tc-rev {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #e0a35f;
}

.tc-kw {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--muted);
}

.tc-text {
  margin: 12px 0 0;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
}

.o-tarot .status {
  margin-top: 18px;
}

.tc-how {
  margin: 40px auto 0;
  text-align: start;
}

.tc-how .tc-h {
  text-align: center;
}

.tc-how p {
  margin: 0 0 12px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--muted);
}

.o-tarot .noscript {
  color: var(--muted);
}

:is(:lang(ar), :lang(he), :lang(ka), :lang(hy)) :is(.tc-subtitle, .tc-kw, .sheet-kw) {
  font-style: normal;
}

:is(:lang(ka), :lang(ar)) .tc-pos {
  text-transform: none;
  letter-spacing: 0;
}

/* ---------- card sheet ---------- */

.sheet {
  width: 100%;
  max-width: 100vw;
  max-height: 94vh;
  max-height: 94dvh;
  margin: auto 0 0;
  padding: 0;
  border: 0;
  border-radius: 20px 20px 0 0;
  color: var(--ink);
  background: linear-gradient(180deg, #24254d 0%, #111229 100%);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.6);
  overscroll-behavior: contain;
}

.sheet::backdrop {
  background: rgba(5, 5, 14, 0.76);
}

.sheet[open] {
  animation: sheet-up 0.34s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes sheet-up {
  from {
    transform: translateY(48px);
    opacity: 0;
  }
}

.sheet-inner {
  display: flex;
  flex-direction: column;
  padding: 6px 18px calc(14px + env(safe-area-inset-bottom));
}

.sheet-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
}

.sheet-pos {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.icon-btn,
.nav-btn {
  all: unset;
  display: grid;
  place-items: center;
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.icon-btn {
  width: 44px;
  height: 44px;
  margin-inline-end: -10px;
}

.nav-btn {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
}

.nav-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.icon-btn:focus-visible,
.nav-btn:focus-visible {
  outline: 2px solid var(--gold-hi);
  outline-offset: 2px;
}

.icon-btn svg,
.nav-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sheet-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  touch-action: pan-y;
}

.sheet-card {
  width: min(58vw, 280px);
  flex: none;
}

.tc-big {
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.6));
}

.sheet-text {
  width: 100%;
  max-width: 520px;
}

.sheet-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  color: var(--gold-hi);
}

.sheet-sub {
  margin: 6px 0 0;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #e0a35f;
}

.sheet-sub:empty {
  display: none;
}

.sheet-kw {
  margin: 10px 0 0;
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  color: var(--gold);
}

.sheet-meaning {
  margin: 12px 0 0;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.5;
}

.sheet-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
}

.sheet-count {
  font-size: 14px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

@media (min-width: 760px) {
  .sheet {
    width: min(880px, calc(100vw - 48px));
    max-height: calc(100dvh - 48px);
    margin: auto;
    border-radius: 20px;
  }

  .sheet-inner {
    padding: 8px 26px 20px;
  }

  .sheet-main {
    flex-direction: row;
    align-items: flex-start;
    gap: 30px;
  }

  .sheet-card {
    width: 300px;
  }

  .sheet-title,
  .sheet-sub,
  .sheet-kw {
    text-align: start;
  }

  .sheet-text {
    padding-top: 8px;
  }
}
