/* =========================================================
   Metatron — design tokens
   ========================================================= */
:root {
  /* Palette */
  --bg-primary: #0B0E23;
  --bg-primary-deep: #06070F;
  --bg-secondary: #2E1A47;
  --accent: #9B6DFF;
  --accent-soft: #B79CFF;
  --gold: #C9A85C;
  --text-primary: #F4F2FA;
  --text-muted: #B9B4CC;

  /* Typographie */
  --font-title: 'Cinzel', 'Cormorant Garamond', serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;

  /* Rythme */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --space-xl: 7rem;

  --radius: 10px;
  --max-width: 1080px;
}

/* =========================================================
   Reset minimal
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: var(--font-title);
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.01em;
}

p { margin: 0; }

a { color: inherit; text-decoration: none; }

ol, ul { margin: 0; padding: 0; list-style: none; }

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* =========================================================
   Fond étoilé + halo violet
   ========================================================= */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(ellipse at 50% -10%, var(--bg-secondary) 0%, transparent 55%),
    linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-primary-deep) 100%);
}

.stars {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    radial-gradient(1.5px 1.5px at 10% 20%, #ffffff 100%, transparent 0),
    radial-gradient(1px 1px at 25% 65%, #ffffff 100%, transparent 0),
    radial-gradient(2px 2px at 40% 15%, #ffffff 100%, transparent 0),
    radial-gradient(1px 1px at 55% 80%, #ffffff 100%, transparent 0),
    radial-gradient(1.5px 1.5px at 70% 35%, #ffffff 100%, transparent 0),
    radial-gradient(1px 1px at 85% 55%, #ffffff 100%, transparent 0),
    radial-gradient(2px 2px at 92% 10%, #ffffff 100%, transparent 0),
    radial-gradient(1px 1px at 15% 90%, #ffffff 100%, transparent 0),
    radial-gradient(1.5px 1.5px at 60% 92%, #ffffff 100%, transparent 0),
    radial-gradient(1px 1px at 33% 40%, #ffffff 100%, transparent 0);
  background-repeat: repeat;
  background-size: 600px 600px;
  opacity: 0.35;
  animation: twinkle 6s ease-in-out infinite alternate;
}

@keyframes twinkle {
  from { opacity: 0.2; }
  to   { opacity: 0.45; }
}

.glow {
  position: fixed;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 60vw;
  height: 60vw;
  max-width: 900px;
  max-height: 900px;
  z-index: -1;
  background: radial-gradient(circle, rgba(155, 109, 255, 0.25) 0%, transparent 70%);
  pointer-events: none;
}

/* =========================================================
   Header
   ========================================================= */
.site-header {
  padding: var(--space-md) 0;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.nav-account {
  font-size: 0.9rem;
  color: var(--text-muted);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease, color 0.25s ease;
}

.nav-account:hover,
.nav-account:focus-visible {
  color: var(--accent-soft);
  border-color: var(--accent-soft);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

.logo-glyph {
  color: var(--gold);
  font-size: 1.1rem;
}

.logo-text {
  font-family: var(--font-title);
  font-size: 1.2rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* =========================================================
   Hero
   ========================================================= */
.hero {
  padding: var(--space-xl) 0 var(--space-lg);
  text-align: center;
}

.hero-content {
  max-width: 680px;
  animation: fade-up 0.9s ease-out both;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  font-family: var(--font-body);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-soft);
  margin-bottom: var(--space-sm);
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.25;
  margin-bottom: var(--space-md);
}

.lead {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin: 0 auto var(--space-md);
  max-width: 540px;
}

.cta {
  display: inline-block;
  padding: 0.9rem 2.4rem;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--bg-primary-deep);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.02em;
  box-shadow: 0 0 0 rgba(155, 109, 255, 0);
  transition: box-shadow 0.35s ease, transform 0.25s ease, background 0.25s ease;
}

.cta:hover,
.cta:focus-visible {
  background: var(--accent-soft);
  box-shadow: 0 0 32px rgba(155, 109, 255, 0.55);
  transform: translateY(-2px);
}

.fine-print {
  margin-top: var(--space-md);
  font-size: 0.85rem;
  color: var(--text-muted);
  opacity: 0.75;
}

/* =========================================================
   Choix du tirage (accueil)
   ========================================================= */
.reading-options {
  padding: 0 0 var(--space-lg);
}

.option-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  max-width: 620px;
  margin: 0 auto;
}

.option-card {
  background: rgba(46, 26, 71, 0.35);
  border: 1px solid rgba(155, 109, 255, 0.18);
  border-radius: var(--radius);
  padding: var(--space-md);
  text-align: center;
  animation: fade-up 0.9s ease-out both;
}

.option-card--main {
  border-color: rgba(201, 168, 92, 0.4);
}

.option-card--soon {
  opacity: 0.6;
}

.option-eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-soft);
  margin-bottom: var(--space-xs);
}

.option-badge {
  display: inline-block;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid rgba(201, 168, 92, 0.4);
  border-radius: 999px;
  padding: 0.25rem 0.8rem;
  margin-bottom: var(--space-sm);
}

.option-card h2 {
  font-size: 1.3rem;
  margin-bottom: var(--space-xs);
}

.option-card > p:not(.option-eyebrow):not(.option-badge):not(.fine-print) {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: var(--space-sm);
}

.option-card .cta {
  margin-top: var(--space-xs);
}

/* =========================================================
   How it works
   ========================================================= */
.how-it-works {
  padding: var(--space-lg) 0 var(--space-xl);
  border-top: 1px solid rgba(155, 109, 255, 0.15);
}

.section-title {
  text-align: center;
  font-size: 1.6rem;
  max-width: 620px;
  margin: 0 auto var(--space-lg);
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.step {
  background: rgba(46, 26, 71, 0.35);
  border: 1px solid rgba(155, 109, 255, 0.18);
  border-radius: var(--radius);
  padding: var(--space-md);
}

.step-number {
  display: block;
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 0.95rem;
  margin-bottom: var(--space-sm);
  letter-spacing: 0.08em;
}

.step h3 {
  font-size: 1.15rem;
  margin-bottom: var(--space-xs);
}

.step p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* =========================================================
   History (histoire du tarot)
   ========================================================= */
.history {
  padding: 0 0 var(--space-xl);
}

.history-content {
  max-width: 680px;
  text-align: center;
  margin: 0 auto;
}

.history h2 {
  font-size: 1.6rem;
  margin-bottom: var(--space-sm);
}

.history p {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: var(--space-sm);
}

.link-more {
  display: inline-block;
  color: var(--accent-soft);
  font-weight: 600;
  font-size: 0.95rem;
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease, color 0.25s ease;
}

.link-more:hover,
.link-more:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
  padding: var(--space-md) 0 var(--space-lg);
  text-align: center;
}

.site-footer p {
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.7;
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 720px) {
  .steps {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: var(--space-lg) 0 var(--space-md);
  }
}

/* =========================================================
   Tirage
   ========================================================= */
.reading {
  padding: var(--space-xl) 0 var(--space-xl);
  min-height: 70vh;
}

.reading-intro {
  max-width: 620px;
  margin: 0 auto;
  text-align: center;
  animation: fade-up 0.9s ease-out both;
}

.reading-intro h1 {
  font-size: clamp(2rem, 4.5vw, 2.8rem);
  line-height: 1.25;
  margin: var(--space-sm) 0 var(--space-md);
}

.reading-intro .lead {
  margin-bottom: var(--space-lg);
}

.cta-ghost {
  background: transparent;
  border: 1px solid rgba(155, 109, 255, 0.4);
  color: var(--accent-soft);
  box-shadow: none;
}

.cta-ghost:hover,
.cta-ghost:focus-visible {
  background: rgba(155, 109, 255, 0.1);
  box-shadow: none;
  color: var(--text-primary);
}

.question-field {
  margin: var(--space-md) 0;
  text-align: left;
  max-width: 480px;
}

.question-field label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.optional-tag {
  opacity: 0.7;
}

.field-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: var(--space-xs);
}

.question-field textarea {
  width: 100%;
  resize: vertical;
  background: var(--bg-secondary);
  border: 1px solid rgba(155, 109, 255, 0.35);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: var(--space-xs) var(--space-sm);
  transition: border-color 0.2s ease;
}

.question-field textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

.question-field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* =========================================================
   Compte (inscription / connexion)
   ========================================================= */
.auth-section {
  max-width: 420px;
  margin: 0 auto;
  padding: var(--space-md);
  background: rgba(46, 26, 71, 0.35);
  border: 1px solid rgba(155, 109, 255, 0.18);
  border-radius: var(--radius);
  animation: fade-up 0.9s ease-out both;
}

#auth-loading {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
}

.auth-tabs {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}

.auth-tab {
  flex: 1;
  padding: var(--space-xs) var(--space-sm);
  background: transparent;
  border: 1px solid rgba(155, 109, 255, 0.35);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.auth-tab:hover,
.auth-tab:focus-visible {
  color: var(--text-primary);
}

.auth-tab[aria-selected="true"] {
  border-color: var(--accent);
  color: var(--text-primary);
  background: rgba(155, 109, 255, 0.14);
}

.auth-form {
  text-align: left;
}

.auth-field {
  margin-bottom: var(--space-sm);
}

.auth-field label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.auth-field input {
  width: 100%;
  background: var(--bg-primary-deep);
  border: 1px solid rgba(155, 109, 255, 0.35);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.7rem var(--space-sm);
  transition: border-color 0.2s ease;
}

.auth-field input:focus {
  outline: none;
  border-color: var(--accent);
}

.auth-form .cta {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: var(--space-xs);
}

.auth-message {
  margin-top: var(--space-sm);
  font-size: 0.9rem;
  line-height: 1.5;
}

.auth-message[data-tone="error"] {
  color: #E8A0A0;
}

.auth-message[data-tone="success"] {
  color: var(--accent-soft);
}

.auth-connected {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-sm);
  text-align: center;
}

/* L'attribut HTML `hidden` (utilisé par js/compte.js pour basculer entre les vues)
   pose display:none avec une spécificité égale à une règle de classe : sans cette
   ligne, la règle `.auth-connected { display: flex }` ci-dessus l'emporterait quand
   même et le bloc resterait visible malgré l'attribut hidden. */
.auth-connected[hidden] {
  display: none;
}

.auth-connected p {
  color: var(--text-muted);
}

#quota-info {
  color: var(--accent-soft);
  font-weight: 600;
}

.auth-connected .cta,
.auth-connected .cta-ghost {
  display: block;
  width: 100%;
  text-align: center;
}

.reading-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.card-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.card-slot-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.02em;
  min-height: 2.4em;
}

.card {
  position: relative;
  width: 100%;
  max-width: 140px;
  aspect-ratio: 2 / 3.4;
  perspective: 1000px;
}

.card-back,
.card-face {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  backface-visibility: hidden;
  transition: transform 0.6s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.card-back {
  background:
    radial-gradient(circle at 50% 50%, rgba(155, 109, 255, 0.25) 0%, transparent 70%),
    var(--bg-secondary);
  border: 1px solid rgba(155, 109, 255, 0.35);
  transform: rotateY(0deg);
}

.card-back::after {
  content: "✦";
  color: var(--gold);
  font-size: 1.4rem;
  opacity: 0.7;
}

.card-face {
  background: linear-gradient(160deg, var(--bg-secondary) 0%, var(--bg-primary-deep) 100%);
  border: 1px solid rgba(201, 168, 92, 0.4);
  transform: rotateY(-180deg);
  padding: var(--space-xs);
  flex-direction: column;
  gap: 0.4em;
}

.card-image {
  width: 100%;
  flex: 1;
  min-height: 0;
  object-fit: contain;
  border-radius: calc(var(--radius) * 0.6);
}

.card-name {
  font-family: var(--font-title);
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.3;
}

.card.revealed .card-back {
  transform: rotateY(180deg);
}

.card.revealed .card-face {
  transform: rotateY(0deg);
}

.interpretation {
  max-width: 680px;
  margin: var(--space-lg) auto 0;
  padding: var(--space-md);
  background: linear-gradient(160deg, var(--bg-secondary) 0%, var(--bg-primary-deep) 100%);
  border: 1px solid rgba(201, 168, 92, 0.3);
  border-radius: var(--radius);
  animation: fade-up 0.6s ease-out both;
}

.interpretation p {
  color: var(--text-primary);
  font-size: 0.98rem;
  line-height: 1.7;
}

.interpretation p + p {
  margin-top: var(--space-sm);
}

.interpretation.is-loading p {
  color: var(--text-muted);
  font-style: italic;
}

.interpretation.is-error p {
  color: var(--accent-soft);
}

.interpretation.is-limited p {
  color: var(--text-muted);
  font-style: italic;
}

.reading-actions {
  margin-top: var(--space-lg);
  text-align: center;
  animation: fade-up 0.6s ease-out both;
}

.reading-note {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: var(--space-sm);
}

@media (max-width: 720px) {
  .reading-board {
    grid-template-columns: repeat(2, 1fr);
  }

  .card {
    max-width: 160px;
  }
}

/* =========================================================
   Carte du jour
   ========================================================= */
.daily-card-board {
  display: flex;
  justify-content: center;
  margin-top: var(--space-md);
}

.daily-card-visual {
  max-width: 220px;
}

.daily-card-meaning {
  max-width: 480px;
  margin: var(--space-lg) auto 0;
  padding: var(--space-md);
  text-align: center;
  background: linear-gradient(160deg, var(--bg-secondary) 0%, var(--bg-primary-deep) 100%);
  border: 1px solid rgba(201, 168, 92, 0.3);
  border-radius: var(--radius);
  animation: fade-up 0.6s ease-out both;
}

.daily-keywords {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-soft);
  margin-bottom: var(--space-sm);
}

.daily-card-meaning #daily-text {
  color: var(--text-primary);
  font-size: 0.98rem;
  line-height: 1.7;
}

/* =========================================================
   Page article (histoire du tarot, etc.)
   ========================================================= */
.article {
  padding: var(--space-xl) 0;
}

.article-content {
  max-width: 680px;
  margin: 0 auto;
  animation: fade-up 0.9s ease-out both;
}

.article-content h1 {
  font-size: clamp(2rem, 4.5vw, 2.6rem);
  line-height: 1.25;
  margin: var(--space-sm) 0 var(--space-md);
}

.article-content .lead {
  margin: 0 0 var(--space-lg);
  max-width: none;
}

.article-content h2 {
  font-size: 1.35rem;
  margin: var(--space-lg) 0 var(--space-sm);
}

.article-content p {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: var(--space-sm);
}

.article-content p strong {
  color: var(--text-primary);
  font-weight: 600;
}

.article-back {
  display: inline-block;
  margin-top: var(--space-lg);
}
