/* ==========================================================================
   tarot.free — mystical dark theme (the only theme)
   Deep indigo-black base, gold accents, Cormorant Garamond display serif,
   CSS starfield, soft-glow panels, buttery card animations.
   8px spacing scale; transitions <= 200ms; visible focus rings; AA contrast.
   ========================================================================== */

:root {
  --tf-bg: #0d0b1e;
  --tf-bg-2: #131029;
  --tf-panel: #171335;
  --tf-panel-2: #1d1842;
  --tf-line: rgba(212, 175, 95, 0.22);
  --tf-line-soft: rgba(190, 182, 226, 0.14);
  --tf-gold: #d4af5f;
  --tf-gold-bright: #e9c87a;
  --tf-gold-deep: #a8853f;
  --tf-ink: #ece9f7;
  --tf-ink-dim: #b7b1d4;
  --tf-ink-faint: #8d87ad;
  --tf-serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --tf-radius: 22px;
  --tf-radius-sm: 14px;
  --tf-glow: 0 0 0 1px rgba(212, 175, 95, 0.16), 0 18px 48px rgba(0, 0, 0, 0.5);
  --tf-glow-hover: 0 0 0 1px rgba(212, 175, 95, 0.38), 0 22px 56px rgba(0, 0, 0, 0.55), 0 0 32px rgba(212, 175, 95, 0.10);
  --tf-speed: 180ms;
}

html { scroll-behavior: smooth; }

body {
  background: var(--tf-bg);
  color: var(--tf-ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 1.02rem;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

main { flex: 1 0 auto; position: relative; z-index: 1; }

/* ---------- starfield (pure CSS, no assets) -------------------------------- */
.tf-stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 12% 24%, rgba(236, 233, 247, 0.85) 50%, transparent 51%),
    radial-gradient(1px 1px at 34% 68%, rgba(236, 233, 247, 0.5) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 48% 12%, rgba(233, 200, 122, 0.8) 50%, transparent 51%),
    radial-gradient(1px 1px at 61% 43%, rgba(236, 233, 247, 0.6) 50%, transparent 51%),
    radial-gradient(1px 1px at 73% 79%, rgba(236, 233, 247, 0.45) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 86% 31%, rgba(236, 233, 247, 0.7) 50%, transparent 51%),
    radial-gradient(1px 1px at 92% 62%, rgba(233, 200, 122, 0.55) 50%, transparent 51%),
    radial-gradient(1px 1px at 25% 88%, rgba(236, 233, 247, 0.5) 50%, transparent 51%),
    radial-gradient(1px 1px at 7% 55%, rgba(236, 233, 247, 0.4) 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 55% 92%, rgba(236, 233, 247, 0.55) 50%, transparent 51%),
    radial-gradient(ellipse 80% 55% at 50% -10%, rgba(50, 38, 110, 0.55), transparent 65%);
  background-size: 900px 900px, 900px 900px, 900px 900px, 900px 900px, 900px 900px,
    900px 900px, 900px 900px, 900px 900px, 900px 900px, 900px 900px, 100% 100%;
  animation: tf-twinkle 9s ease-in-out infinite alternate;
}

@keyframes tf-twinkle {
  from { opacity: 0.75; }
  to { opacity: 1; }
}

/* ---------- typography ----------------------------------------------------- */
h1, h2, h3, h4, .tf-serif {
  font-family: var(--tf-serif);
  font-weight: 600;
  color: var(--tf-ink);
  letter-spacing: 0.01em;
}

h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); line-height: 1.15; }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); }
h3 { font-size: clamp(1.25rem, 2.4vw, 1.6rem); }

a { color: var(--tf-gold-bright); text-decoration: none; transition: color var(--tf-speed) ease; }
a:hover { color: #f4dfa8; }

p { color: var(--tf-ink-dim); }
.tf-lead { color: var(--tf-ink-dim); font-size: 1.12rem; max-width: 46rem; }
.tf-eyebrow {
  color: var(--tf-gold);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.74rem;
  font-weight: 600;
}
.tf-fine { color: var(--tf-ink-faint); }

::selection { background: rgba(212, 175, 95, 0.35); color: #fff; }

/* visible focus rings everywhere */
a:focus-visible, button:focus-visible, .btn:focus-visible,
input:focus-visible, textarea:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--tf-gold-bright);
  outline-offset: 2px;
  box-shadow: none !important;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- nav ------------------------------------------------------------ */
.tf-nav {
  background: rgba(13, 11, 30, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--tf-line-soft);
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
  z-index: 20;
}

.tf-brand {
  font-family: var(--tf-serif);
  font-weight: 700;
  font-size: 1.45rem;
  color: var(--tf-ink) !important;
  letter-spacing: 0.02em;
}
.tf-brand-mark { color: var(--tf-gold); margin-right: 0.45rem; }

.tf-nav .nav-link {
  color: var(--tf-ink-dim);
  font-size: 0.95rem;
  border-radius: 10px;
  padding: 0.4rem 0.8rem;
  transition: color var(--tf-speed) ease, background var(--tf-speed) ease;
}
.tf-nav .nav-link:hover { color: var(--tf-ink); background: rgba(236, 233, 247, 0.06); }
.tf-nav .nav-link.active { color: var(--tf-gold-bright); }

.tf-nav .dropdown-menu, .dropdown-menu {
  background: var(--tf-panel-2);
  border: 1px solid var(--tf-line);
  border-radius: var(--tf-radius-sm);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
  padding: 0.4rem;
}
.dropdown-item { color: var(--tf-ink-dim); border-radius: 9px; padding: 0.45rem 0.9rem; }
.dropdown-item:hover, .dropdown-item:focus { color: var(--tf-ink); background: rgba(212, 175, 95, 0.12); }
.tf-lang-menu { max-height: 22rem; overflow-y: auto; }

/* ---------- buttons --------------------------------------------------------- */
.btn { border-radius: 12px; transition: transform var(--tf-speed) ease, box-shadow var(--tf-speed) ease, background var(--tf-speed) ease, color var(--tf-speed) ease, border-color var(--tf-speed) ease; }

.tf-btn-gold, .btn-primary {
  --bs-btn-bg: transparent;
  background: linear-gradient(140deg, var(--tf-gold-bright), var(--tf-gold-deep));
  border: none;
  color: #241b04;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.6rem 1.5rem;
  border-radius: 12px;
  box-shadow: 0 6px 22px rgba(212, 175, 95, 0.22);
}
.tf-btn-gold:hover, .btn-primary:hover,
.tf-btn-gold:focus, .btn-primary:focus,
.tf-btn-gold:active, .btn-primary:active {
  background: linear-gradient(140deg, #f4dfa8, var(--tf-gold));
  color: #241b04;
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(212, 175, 95, 0.32);
}
.tf-btn-gold.btn-lg { padding: 0.85rem 2.2rem; font-size: 1.08rem; }
.tf-btn-gold:disabled, .btn-primary:disabled { background: #4a4468; color: #9d97bc; box-shadow: none; }

.tf-btn-ghost, .btn-outline-primary, .btn-outline-secondary, .btn-secondary {
  background: transparent;
  border: 1px solid var(--tf-line);
  color: var(--tf-ink-dim);
  border-radius: 12px;
  padding: 0.6rem 1.4rem;
}
.tf-btn-ghost:hover, .btn-outline-primary:hover, .btn-outline-secondary:hover, .btn-secondary:hover {
  background: rgba(212, 175, 95, 0.1);
  border-color: var(--tf-gold);
  color: var(--tf-gold-bright);
  transform: translateY(-2px);
}

/* ---------- panels ----------------------------------------------------------- */
.tf-panel {
  background: linear-gradient(165deg, var(--tf-panel-2), var(--tf-panel));
  border: 1px solid var(--tf-line-soft);
  border-radius: var(--tf-radius);
  box-shadow: var(--tf-glow);
  padding: 2rem;
}

.tf-panel-tight { padding: 1.25rem 1.5rem; }

a.tf-panel, .tf-panel-hover {
  display: block;
  color: inherit;
  transition: transform var(--tf-speed) ease, box-shadow var(--tf-speed) ease, border-color var(--tf-speed) ease;
}
a.tf-panel:hover, .tf-panel-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--tf-glow-hover);
  border-color: var(--tf-line);
}

.tf-divider {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--tf-line), transparent);
  margin: 2rem 0;
  opacity: 1;
}

.tf-ornament {
  text-align: center;
  color: var(--tf-gold);
  letter-spacing: 0.8em;
  padding-left: 0.8em; /* balance the letter-spacing tail */
  margin: 1.5rem 0;
  user-select: none;
}

/* ---------- hero -------------------------------------------------------------- */
.tf-hero { padding: clamp(3rem, 8vh, 6rem) 0 clamp(3rem, 7vh, 5rem); text-align: center; }
.tf-hero-cards {
  display: flex;
  justify-content: center;
  gap: 0.9rem;
  margin-bottom: 2rem;
}
.tf-hero-card {
  width: 78px;
  height: 134px;
  border-radius: 10px;
  border: 1px solid rgba(212, 175, 95, 0.5);
  background: var(--tf-bg-2) url('/static/cards/card-back.svg') center / cover no-repeat;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55), 0 0 22px rgba(212, 175, 95, 0.18);
}
.tf-hero-card:nth-child(1) { transform: rotate(-9deg) translateY(10px); }
.tf-hero-card:nth-child(3) { transform: rotate(9deg) translateY(10px); }
.tf-hero-card:nth-child(2) { transform: translateY(-6px) scale(1.06); z-index: 2; }
.tf-hero h1 {
  font-size: clamp(2.6rem, 6.5vw, 4.4rem);
  font-weight: 700;
  margin-bottom: 1rem;
}
.tf-hero h1 em {
  font-style: italic;
  color: var(--tf-gold-bright);
}
.tf-hero .tf-lead { margin: 0 auto 2rem; }

/* ---------- card imagery -------------------------------------------------------- */
/* RWS faces sit on a parchment frame with a soft gold border + hover glow. */
.tf-card-frame {
  display: block;
  border-radius: 12px;
  padding: 5px;
  background: linear-gradient(160deg, #f4ecd8, #e2d3ae);
  border: 1px solid var(--tf-gold-deep);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.5);
  transition: transform var(--tf-speed) ease, box-shadow var(--tf-speed) ease;
}
.tf-card-frame img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}
.tf-card-frame.tf-rev img { transform: rotate(180deg); }
a:hover > .tf-card-frame, .tf-card-frame:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55), 0 0 26px rgba(212, 175, 95, 0.28);
}

/* encyclopedia grid tiles */
.tf-card-tile { text-align: center; }
.tf-card-tile .tf-card-name {
  display: block;
  margin-top: 0.6rem;
  font-family: var(--tf-serif);
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--tf-ink);
  line-height: 1.3;
}
.tf-card-tile:hover .tf-card-name { color: var(--tf-gold-bright); }

/* ---------- quick-reference box (card page) -------------------------------------- */
.tf-quickref {
  border-left: 3px solid var(--tf-gold);
}
.tf-quickref dt {
  color: var(--tf-gold);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.7rem;
  font-weight: 600;
}
.tf-quickref dd { color: var(--tf-ink); margin-bottom: 0.9rem; }

.tf-chip {
  display: inline-block;
  background: rgba(212, 175, 95, 0.1);
  border: 1px solid var(--tf-line);
  color: var(--tf-ink-dim);
  border-radius: 999px;
  padding: 0.15rem 0.75rem;
  font-size: 0.82rem;
  margin: 0 0.3rem 0.4rem 0;
}

.tf-verdict {
  display: inline-block;
  font-family: var(--tf-serif);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--tf-gold-bright);
}

/* long-form article body (encyclopedia) */
.tf-article h2 {
  margin-top: 2.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--tf-line-soft);
}
.tf-article p { max-width: 44rem; }

.tf-breadcrumbs { font-size: 0.85rem; color: var(--tf-ink-faint); }
.tf-breadcrumbs a { color: var(--tf-ink-faint); }
.tf-breadcrumbs a:hover { color: var(--tf-gold-bright); }

/* ---------- FAQ accordion --------------------------------------------------------- */
.tf-faq .accordion-item {
  background: transparent;
  border: 1px solid var(--tf-line-soft);
  border-radius: var(--tf-radius-sm) !important;
  margin-bottom: 0.75rem;
  overflow: hidden;
}
.tf-faq .accordion-button {
  background: var(--tf-panel);
  color: var(--tf-ink);
  font-weight: 600;
  padding: 1.1rem 1.4rem;
  box-shadow: none;
}
.tf-faq .accordion-button:not(.collapsed) {
  background: var(--tf-panel-2);
  color: var(--tf-gold-bright);
}
.tf-faq .accordion-button::after {
  filter: invert(80%) sepia(30%) saturate(500%) hue-rotate(360deg);
}
.tf-faq .accordion-body { background: var(--tf-panel); color: var(--tf-ink-dim); padding: 1.1rem 1.4rem; }

/* ---------- forms ------------------------------------------------------------------- */
.form-control, .form-select, textarea {
  background: rgba(13, 11, 30, 0.6);
  border: 1px solid var(--tf-line-soft);
  color: var(--tf-ink);
  border-radius: 12px;
  padding: 0.65rem 1rem;
}
.form-control:focus, .form-select:focus, textarea:focus {
  background: rgba(13, 11, 30, 0.8);
  border-color: var(--tf-gold);
  color: var(--tf-ink);
  box-shadow: 0 0 0 3px rgba(212, 175, 95, 0.18);
}
.form-control::placeholder { color: var(--tf-ink-faint); }
label, .form-label { color: var(--tf-ink-dim); }

/* auth / static pages inherit the panel look for stock .card */
.card {
  background: linear-gradient(165deg, var(--tf-panel-2), var(--tf-panel));
  border: 1px solid var(--tf-line-soft);
  border-radius: var(--tf-radius);
  box-shadow: var(--tf-glow);
  color: var(--tf-ink);
}
.card .card-header { background: transparent; border-bottom: 1px solid var(--tf-line-soft); color: var(--tf-ink); }
.card .card-body { color: var(--tf-ink-dim); }
.card .card-title, .card h1, .card h2, .card h3, .card h5 { color: var(--tf-ink); }

.alert-danger {
  background: rgba(146, 44, 68, 0.22);
  border: 1px solid rgba(220, 90, 120, 0.4);
  color: #f2c7d2;
  border-radius: var(--tf-radius-sm);
}
.alert-success {
  background: rgba(46, 125, 88, 0.2);
  border: 1px solid rgba(90, 200, 145, 0.35);
  color: #bfe9d4;
  border-radius: var(--tf-radius-sm);
}
.alert-info, .alert-warning {
  background: rgba(212, 175, 95, 0.1);
  border: 1px solid var(--tf-line);
  color: var(--tf-ink-dim);
  border-radius: var(--tf-radius-sm);
}

.table { color: var(--tf-ink-dim); --bs-table-bg: transparent; --bs-table-color: var(--tf-ink-dim); border-color: var(--tf-line-soft); }
.text-muted { color: var(--tf-ink-faint) !important; }

/* ---------- footer ------------------------------------------------------------------- */
.tf-footer {
  background: rgba(9, 7, 22, 0.85);
  border-top: 1px solid var(--tf-line-soft);
  position: relative;
  z-index: 1;
}
.tf-fhead {
  font-family: var(--tf-serif);
  font-weight: 700;
  color: var(--tf-gold);
  font-size: 1.05rem;
  margin-bottom: 0.75rem;
}
.tf-fcol a {
  display: block;
  color: var(--tf-ink-faint);
  padding: 0.22rem 0;
  font-size: 0.92rem;
}
.tf-fcol a:hover { color: var(--tf-gold-bright); }

/* ==========================================================================
   INTERACTIVE READER
   ========================================================================== */
.tf-reader { position: relative; }

/* deck fan: face-down cards to pick from */
.tf-fan {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  padding: 1rem 0 0.5rem;
}
.tf-fan .tf-deck-card {
  width: 62px;
  height: 106px;
  aspect-ratio: 35 / 60;
  border-radius: 7px;
  border: 1px solid rgba(212, 175, 95, 0.45);
  background: var(--tf-bg-2) url('/static/cards/card-back.svg') center / cover no-repeat;
  cursor: pointer;
  transition: transform var(--tf-speed) ease, box-shadow var(--tf-speed) ease, opacity var(--tf-speed) ease;
  padding: 0;
  min-width: 44px; /* tap target */
}
.tf-fan .tf-deck-card:hover:not(:disabled) {
  transform: translateY(-10px);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.6), 0 0 18px rgba(212, 175, 95, 0.3);
}
.tf-fan .tf-deck-card:disabled { opacity: 0.28; cursor: default; }
.tf-fan .tf-deck-card.tf-picked { opacity: 0; pointer-events: none; transform: scale(0.6); }

/* shuffle overlay animation */
.tf-shuffle-stage {
  position: relative;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tf-shuffle-stage .tf-shuffle-card {
  position: absolute;
  width: 110px;
  height: 189px;
  aspect-ratio: 35 / 60;
  border-radius: 9px;
  border: 1px solid rgba(212, 175, 95, 0.5);
  background: var(--tf-bg-2) url('/static/cards/card-back.svg') center / cover no-repeat;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
}
@keyframes tf-shuffle-a {
  0% { transform: translateX(0) rotate(0deg); }
  25% { transform: translateX(-90px) rotate(-9deg); }
  50% { transform: translateX(0) rotate(0deg); }
  75% { transform: translateX(90px) rotate(9deg); }
  100% { transform: translateX(0) rotate(0deg); }
}
@keyframes tf-shuffle-b {
  0% { transform: translateX(0) rotate(0deg); }
  25% { transform: translateX(90px) rotate(8deg); }
  50% { transform: translateX(0) rotate(0deg); }
  75% { transform: translateX(-90px) rotate(-8deg); }
  100% { transform: translateX(0) rotate(0deg); }
}
.tf-shuffle-stage .s1 { animation: tf-shuffle-a 0.9s ease-in-out 2; }
.tf-shuffle-stage .s2 { animation: tf-shuffle-b 0.9s ease-in-out 2; animation-delay: 0.08s; }
.tf-shuffle-stage .s3 { animation: tf-shuffle-a 0.9s ease-in-out 2; animation-delay: 0.16s; }

/* spread slots + 3D flip */
.tf-slots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem;
  padding: 1rem 0;
}
.tf-slot { text-align: center; width: 132px; }
.tf-slot .tf-slot-label {
  font-size: 0.78rem;
  color: var(--tf-ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 0.5rem;
  min-height: 2.1em;
  line-height: 1.35;
}
.tf-flip {
  perspective: 900px;
  width: 132px;
  height: 226px;
  aspect-ratio: 35 / 60;
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0;
}
.tf-flip-inner {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.tf-flip.tf-flipped .tf-flip-inner { transform: rotateY(180deg); }
.tf-flip-face {
  display: block;
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid rgba(212, 175, 95, 0.5);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55);
}
.tf-flip-back { background: var(--tf-bg-2) url('/static/cards/card-back.svg') center / cover no-repeat; }
.tf-flip-front { transform: rotateY(180deg); background: #efe6cf; }
.tf-flip-front img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tf-flip-front.tf-rev img { transform: rotate(180deg); }
.tf-slot .tf-slot-card-name {
  margin-top: 0.55rem;
  font-family: var(--tf-serif);
  font-weight: 600;
  color: var(--tf-ink);
  font-size: 0.98rem;
  line-height: 1.3;
  min-height: 2.5em;
  opacity: 0;
  transition: opacity var(--tf-speed) ease;
}
.tf-slot .tf-slot-card-name.tf-show { opacity: 1; }
.tf-slot .tf-slot-card-name .tf-rev-tag { color: var(--tf-gold); font-size: 0.8rem; display: block; }

/* empty slot placeholder */
.tf-slot-empty {
  width: 132px;
  height: 226px;
  aspect-ratio: 35 / 60;
  border: 1.5px dashed var(--tf-line);
  border-radius: 9px;
  background: rgba(23, 19, 53, 0.5);
}

/* AI panel */
.tf-ai-answer {
  white-space: pre-wrap;
  color: var(--tf-ink);
  font-size: 1.03rem;
}
.tf-spinner {
  width: 1.4rem;
  height: 1.4rem;
  border: 2px solid var(--tf-line);
  border-top-color: var(--tf-gold-bright);
  border-radius: 50%;
  display: inline-block;
  animation: tf-spin 0.8s linear infinite;
  vertical-align: middle;
}
@keyframes tf-spin { to { transform: rotate(360deg); } }

/* pricing */
.tf-price {
  font-family: var(--tf-serif);
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--tf-ink);
}
.tf-price small { font-size: 1.1rem; color: var(--tf-ink-faint); }

/* daily page hero card */
.tf-daily-card { max-width: 280px; margin: 0 auto; }

/* ---------- responsive tweaks ------------------------------------------------ */
@media (max-width: 575.98px) {
  .tf-panel { padding: 1.4rem; }
  .tf-fan .tf-deck-card { width: 46px; height: 79px; }
  .tf-slot, .tf-flip, .tf-slot-empty { width: 104px; }
  .tf-flip, .tf-slot-empty { height: 178px; }
  .tf-hero { padding-top: 3rem; }
}
