/* TarotScope — Shared Dark Theme Foundation
   Include this FIRST, then page-specific CSS. */

/* ═══════ DESIGN TOKENS ═══════ */
:root {
  --bg: #1a1610;
  --bg2: #1e1a14;
  --bg3: #252018;
  --gold: #c9a84c;
  --gb: #e8d48b;
  --gf: #a8872e;
  --gd: #7a6220;
  --terra: #a0513a;
  --teal: #2a6b5e;
  --green: #3a7a4a;
  --blue: #3a5080;
  --purple: #6b3fa0;
  --rose: #9a4a5a;
  --cream: #e8d8b8;
  --cdim: #a89878;
  --txt: #d8ccb0;
  --dim: #8a7a60;
  --faint: #5a4e3a;
}

/* ═══════ RESET + BODY ═══════ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--txt);
  font-family: 'Cormorant Garamond', serif;
  overflow-x: hidden;
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ═══════ PARCHMENT NOISE OVERLAY ═══════ */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.65' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.035'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

/* ═══════ LINKS ═══════ */
a { color: var(--cdim); text-decoration: none; transition: color .3s; }
a:hover { color: var(--gold); }

/* ═══════ TOP BAR ═══════ */
.ts-top-bar {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 100;
  padding: .6rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(26,22,16,.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(168,135,46,.1);
}

.ts-logo {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: .08em;
  text-decoration: none;
}
.ts-logo span { color: var(--cdim); font-weight: 400; }

.ts-top-right {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.ts-nav-link {
  font-family: 'Cinzel', serif;
  font-size: .7rem;
  color: var(--cdim);
  text-decoration: none;
  letter-spacing: .1em;
  text-transform: uppercase;
  transition: color .3s;
  border-bottom: none;
}
.ts-nav-link:hover { color: var(--gold); border-bottom: none; }

.ts-user-link {
  text-decoration: none;
  border-bottom: none;
}
.ts-user-link:hover .ts-avatar {
  border-color: var(--gold);
  background: rgba(201,168,76,.15);
}

.ts-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--gf);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: .8rem;
  color: var(--gold);
  background: rgba(201,168,76,.08);
  cursor: pointer;
  transition: border-color .3s, background .3s;
}

.ts-logout-btn {
  font-family: 'Cinzel', serif;
  font-size: .65rem;
  color: var(--cdim);
  text-decoration: none;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .5;
  transition: opacity .3s, color .3s;
  border-bottom: none;
}
.ts-logout-btn:hover { opacity: 1; color: var(--gold); border-bottom: none; }

/* ═══════ ORNATE DIVIDER ═══════ */
.ts-ornate {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  padding: 1.2rem 0;
  color: var(--gd);
  font-size: .7rem;
  letter-spacing: .3em;
  opacity: .4;
}
.ts-ornate::before, .ts-ornate::after {
  content: '';
  flex: 1;
  max-width: 80px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gd), transparent);
}

/* ═══════ BUTTONS ═══════ */
.ts-btn {
  display: inline-block;
  padding: .8rem 1.5rem;
  font-family: 'Cinzel', serif;
  font-size: .8rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .3s;
  border: none;
  text-align: center;
  text-decoration: none;
}

.ts-btn--primary {
  background: linear-gradient(135deg, var(--gold), var(--gf));
  color: var(--bg);
  font-weight: 700;
}
.ts-btn--primary:hover {
  box-shadow: 0 4px 20px rgba(201,168,76,.2);
  transform: translateY(-1px);
}

.ts-btn--outline {
  background: transparent;
  border: 1px solid rgba(168,135,46,.2);
  color: var(--cdim);
}
.ts-btn--outline:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.ts-btn:disabled, .ts-btn--disabled {
  opacity: .4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ═══════ FLASH MESSAGES ═══════ */
.ts-flash {
  padding: .8rem 1.2rem;
  margin-bottom: 1rem;
  border-left: 3px solid;
  font-size: .85rem;
}
.ts-flash--error {
  border-color: var(--terra);
  color: var(--terra);
  background: rgba(160,81,58,.08);
}
.ts-flash--success {
  border-color: var(--teal);
  color: var(--teal);
  background: rgba(42,107,94,.08);
}

/* ═══════ SCROLL REVEAL ═══════ */
.ts-reveal {
  opacity: 0;
  transform: translateY(15px);
  transition: opacity .6s ease, transform .6s ease;
}
.ts-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ═══════ FOOTER ═══════ */
.ts-footer {
  padding: 2rem;
  text-align: center;
  border-top: 1px solid rgba(168,135,46,.06);
  margin-top: 1rem;
}
.ts-footer .ts-logo { font-size: .9rem; margin-bottom: .2rem; display: block; }
.ts-footer p { font-size: .75rem; color: var(--faint); font-style: italic; margin: 0; }

/* ═══════ CENTERED PAGE CARD ═══════ */
.ts-page-center {
  max-width: 520px;
  margin: 0 auto;
  padding: 5.5rem 1.5rem 3rem;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ts-page-card {
  width: 100%;
  border: 1px solid rgba(201,168,76,.15);
  padding: 2.5rem 2rem;
  text-align: center;
  position: relative;
}
.ts-page-card::before {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(201,168,76,.06);
  pointer-events: none;
}

.ts-glyph {
  font-size: 2.5rem;
  color: var(--gold);
  margin-bottom: 1rem;
  display: block;
}

.ts-page-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  color: var(--gold);
  margin-bottom: .3rem;
}

.ts-page-subtitle {
  font-size: .95rem;
  color: var(--cdim);
  font-style: italic;
  margin-bottom: 1.5rem;
}

/* ═══════ LOADING ANIMATION ═══════ */
.ts-loading-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 1.5rem 0;
}
.ts-loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gd);
  animation: tsDotPulse 1.4s ease-in-out infinite;
}
.ts-loading-dots span:nth-child(2) { animation-delay: .2s; }
.ts-loading-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes tsDotPulse {
  0%, 80%, 100% { opacity: .3; transform: scale(.8); }
  40% { opacity: 1; transform: scale(1.2); }
}

.ts-glyph--spin {
  animation: tsGlyphSpin 4s linear infinite;
}
@keyframes tsGlyphSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ═══════ RESULT LAYOUT ═══════ */
.ts-result-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 4.5rem 1.5rem 3rem;
}

.ts-result-header {
  text-align: center;
  margin-bottom: 2rem;
}

.ts-result-name {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.5rem;
  color: var(--gold);
  margin-bottom: .2rem;
}

.ts-result-date {
  font-family: 'Cinzel', serif;
  font-size: .8rem;
  color: var(--dim);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.ts-result-body {
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--cream);
}
.ts-result-body p { margin-bottom: 1rem; }

.ts-result-actions {
  display: flex;
  justify-content: center;
  gap: .8rem;
  margin-top: 2rem;
}

/* ═══════ RESPONSIVE ═══════ */
@media (max-width: 768px) {
  .ts-top-bar { padding: .5rem 1rem; }
  .ts-page-center { padding: 4.5rem 1rem 2rem; }
  .ts-result-page { padding: 4rem 1rem 2rem; }
}

@media (max-width: 480px) {
  .ts-top-right { gap: .6rem; }
  .ts-nav-link { font-size: .6rem; }
}
