/* ===== Oracle Sestralya — palette & fondations ===== */
:root {
  --creme: #f0ebe0;
  --creme-light: #f7f3ea;
  --sauge: #8a9e7a;
  --or: #c9a96e;
  --or-light: #ddc59a;
  --bordeaux: #7e2d3f;
  --bordeaux-deep: #5a1f2c;
  --terracotta: #c47a5a;
  --nuit: #1f2a44;
  --nuit-deep: #131a2c;
  --nuit-soft: #2a3858;
  --noir: #1a1410;
  --texte: #2a221b;
  --texte-soft: #5a4d3e;

  --font-display: "Italiana", "Playfair Display", Georgia, serif;
  --font-serif: "Playfair Display", Georgia, serif;
  --font-body: "Cormorant Garamond", Georgia, serif;
  --font-meta: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  --shadow-card: 0 8px 24px rgba(20, 16, 12, .35), 0 2px 6px rgba(20, 16, 12, .2);
  --shadow-soft: 0 4px 16px rgba(20, 16, 12, .15);

  --radius-card: 14px;
  --radius-soft: 8px;

  --t-fast: 220ms cubic-bezier(.4, 0, .2, 1);
  --t-slow: 600ms cubic-bezier(.4, 0, .2, 1);
}

@font-face {
  font-family: "Italiana";
  src: url("https://fonts.gstatic.com/s/italiana/v18/QldNNTtLClFmMW0DSEhf.woff2") format("woff2");
  font-display: swap;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow-x: hidden; }
body {
  font-family: var(--font-body);
  background: var(--noir);
  color: var(--creme);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
a { color: var(--or-light); text-decoration: none; }
a:hover { color: var(--or); }

/* ===== App layout ===== */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse at top, #2b211a 0%, var(--noir) 60%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 10px;
  border-bottom: 1px solid rgba(201, 169, 110, .12);
}
.brand {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: .35em;
  color: var(--or);
  text-transform: uppercase;
}
.brand-tagline {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--texte-soft);
  letter-spacing: .15em;
}

main { flex: 1; padding: 26px 18px 100px; }
.view { display: none; animation: fade .25s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ===== Hero (vue accueil) ===== */
.hero {
  text-align: center;
  padding: 30px 0 24px;
}
.hero-eyebrow {
  font-family: var(--font-meta);
  font-size: 11px;
  letter-spacing: .4em;
  color: var(--or);
  text-transform: uppercase;
  margin-bottom: 14px;
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(34px, 8vw, 52px);
  font-weight: 400;
  line-height: 1.1;
  color: var(--creme);
  margin-bottom: 18px;
  letter-spacing: .02em;
}
.hero-quote {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(15px, 3.6vw, 18px);
  color: var(--or-light);
  max-width: 460px;
  margin: 0 auto 28px;
  line-height: 1.5;
}
.hero-deck {
  width: 200px;
  height: 280px;
  margin: 0 auto 30px;
  position: relative;
  perspective: 1200px;
}
.hero-deck .deck-card {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-card);
  background: linear-gradient(150deg, var(--bordeaux-deep) 0%, var(--bordeaux) 60%, #4a1a26 100%);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(201, 169, 110, .25);
  transition: transform var(--t-slow);
}
.hero-deck .deck-card:nth-child(1) { transform: rotate(-6deg) translate(-8px, -6px); }
.hero-deck .deck-card:nth-child(2) { transform: rotate(-2deg) translate(-3px, -2px); }
.hero-deck .deck-card:nth-child(3) { transform: rotate(2deg); }
.hero-deck:hover .deck-card:nth-child(1) { transform: rotate(-12deg) translate(-20px, -10px); }
.hero-deck:hover .deck-card:nth-child(3) { transform: rotate(8deg) translate(20px, -10px); }

.deck-back {
  position: relative;
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.deck-back::before, .deck-back::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(201, 169, 110, .35);
  border-radius: 8px;
}
.deck-back::after { inset: 14px; border-color: rgba(201, 169, 110, .15); }
.deck-back svg { width: 72px; height: 72px; color: var(--or); position: relative; z-index: 1; }

/* ===== Tirages — boutons mécaniques ===== */
.draws {
  display: grid;
  gap: 12px;
  max-width: 460px;
  margin: 0 auto 24px;
}
.draw-btn {
  background: linear-gradient(135deg, rgba(201, 169, 110, .08), rgba(201, 169, 110, .03));
  border: 1px solid rgba(201, 169, 110, .25);
  border-radius: var(--radius-soft);
  padding: 16px 18px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all var(--t-fast);
}
.draw-btn:hover, .draw-btn:active {
  background: linear-gradient(135deg, rgba(201, 169, 110, .18), rgba(201, 169, 110, .06));
  border-color: var(--or);
  transform: translateY(-1px);
}
.draw-btn .icon {
  flex: 0 0 36px;
  width: 36px; height: 36px;
  color: var(--or);
}
.draw-btn .label {
  flex: 1;
}
.draw-btn .label .title {
  font-family: var(--font-serif);
  font-size: 19px;
  font-style: italic;
  color: var(--creme);
  margin-bottom: 2px;
}
.draw-btn .label .desc {
  font-family: var(--font-meta);
  font-size: 11.5px;
  color: var(--texte-soft);
  letter-spacing: .05em;
}
.draw-btn.sos {
  background: linear-gradient(135deg, var(--bordeaux), var(--bordeaux-deep));
  border-color: var(--bordeaux);
  animation: pulse 2.6s ease-in-out infinite;
}
.draw-btn.sos .label .title { color: var(--creme); }
.draw-btn.sos .label .desc { color: var(--or-light); }
.draw-btn.sos .icon { color: var(--or-light); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(126, 45, 63, .55); }
  50% { box-shadow: 0 0 0 18px rgba(126, 45, 63, 0); }
}

/* ===== Vue tirage — cartes révélées ===== */
.draw-header {
  text-align: center;
  margin-bottom: 30px;
}
.draw-header .eyebrow {
  font-family: var(--font-meta);
  font-size: 11px;
  letter-spacing: .35em;
  color: var(--or);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.draw-header h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 7vw, 40px);
  font-weight: 400;
  color: var(--creme);
}

.spread {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  justify-content: center;
  align-items: flex-start;
  margin-bottom: 32px;
}
.spread .slot {
  width: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.spread .slot .slot-label {
  font-family: var(--font-meta);
  font-size: 10.5px;
  letter-spacing: .25em;
  color: var(--or);
  text-transform: uppercase;
  margin-bottom: 10px;
  text-align: center;
}
.flip-card {
  width: 180px;
  height: 252px;
  perspective: 1200px;
  cursor: pointer;
}
.flip-inner {
  position: relative;
  width: 100%; height: 100%;
  transition: transform .9s cubic-bezier(.6, 0, .25, 1);
  transform-style: preserve-3d;
}
.flip-card.flipped .flip-inner { transform: rotateY(180deg); }
.flip-front, .flip-back {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.flip-front {
  background: linear-gradient(150deg, var(--bordeaux-deep) 0%, var(--bordeaux) 60%, #4a1a26 100%);
  border: 1px solid rgba(201, 169, 110, .3);
  display: flex; align-items: center; justify-content: center;
}
.flip-front svg { width: 60%; height: 60%; color: var(--or); opacity: .85; }
.flip-back {
  transform: rotateY(180deg);
  background: var(--card-bg);
  color: var(--or);
  display: flex; flex-direction: column;
  padding: 14px 14px 18px;
  border: 1px solid rgba(201, 169, 110, .35);
}
.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  position: relative;
}
.card-roman {
  font-family: var(--font-meta);
  font-size: 10px;
  letter-spacing: .35em;
  color: var(--or-light);
  text-align: center;
}
.card-family {
  font-family: var(--font-meta);
  font-size: 9px;
  letter-spacing: .3em;
  color: rgba(221, 197, 154, .8);
  text-align: center;
  text-transform: uppercase;
  margin-top: 2px;
}
.card-symbol {
  width: 130px;
  height: 130px;
  margin: 8px 0 4px;
  color: var(--or-light);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .35));
}
.card-divider {
  width: 28px;
  height: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--or);
  margin-bottom: 6px;
}
.card-divider::before {
  content: "";
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--or), transparent);
}
.card-name {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
  text-align: center;
  color: var(--creme);
  line-height: 1.18;
  padding: 0 4px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}
.card-signature {
  font-family: var(--font-meta);
  font-size: 8px;
  letter-spacing: .5em;
  color: rgba(201, 169, 110, .5);
  text-align: center;
  margin-top: 8px;
}
.card-frame::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(221, 197, 154, .35);
  border-radius: 7px;
  pointer-events: none;
}
.card-frame::after {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(221, 197, 154, .12);
  border-radius: 5px;
  pointer-events: none;
}
.card-sparkle {
  position: absolute;
  width: 4px; height: 4px;
  background: var(--or);
  border-radius: 50%;
  opacity: .6;
}

/* couleurs par famille — gradients foncés pour contraste optimal avec l'or */
.fam-lignee { --card-bg: linear-gradient(160deg, #6e2535 0%, var(--bordeaux) 50%, #4a1a26 100%); }
.fam-guidance { --card-bg: linear-gradient(160deg, #4d6645 0%, #3d5236 50%, #2d3e28 100%); }
.fam-feminin { --card-bg: linear-gradient(160deg, #8e4f33 0%, #6e3a23 50%, #4f2715 100%); }
.fam-symboles { --card-bg: linear-gradient(160deg, #2c3a5a 0%, var(--nuit) 50%, var(--nuit-deep) 100%); }

/* ===== Détails du tirage (sous les cartes) ===== */
.detail-cards {
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 600px;
  margin: 0 auto 32px;
}
.detail-card {
  background: linear-gradient(160deg, rgba(201, 169, 110, .04), rgba(201, 169, 110, 0));
  border: 1px solid rgba(201, 169, 110, .18);
  border-radius: 12px;
  padding: 22px 22px 26px;
  opacity: 0;
  transform: translateY(8px);
  animation: rise .55s ease forwards;
}
.detail-card:nth-child(1) { animation-delay: .1s; }
.detail-card:nth-child(2) { animation-delay: .25s; }
.detail-card:nth-child(3) { animation-delay: .4s; }
.detail-card:nth-child(4) { animation-delay: .55s; }
.detail-card:nth-child(5) { animation-delay: .7s; }
@keyframes rise { to { opacity: 1; transform: none; } }

.detail-card .position {
  font-family: var(--font-meta);
  font-size: 10.5px;
  letter-spacing: .3em;
  color: var(--or);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.detail-card h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 26px;
  font-weight: 400;
  color: var(--creme);
  margin-bottom: 14px;
}
.detail-card .message {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 17px;
  color: var(--or-light);
  line-height: 1.55;
  margin-bottom: 18px;
  border-left: 2px solid var(--or);
  padding-left: 14px;
}
.detail-card .message p { margin-bottom: 4px; }
.detail-card .field {
  margin-bottom: 14px;
}
.detail-card .field-label {
  font-family: var(--font-meta);
  font-size: 10px;
  letter-spacing: .25em;
  color: var(--or);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.detail-card .field-value {
  font-family: var(--font-body);
  font-size: 17px;
  color: var(--creme);
  line-height: 1.55;
}
.detail-card .mantra {
  font-family: var(--font-display);
  font-style: italic;
  text-align: center;
  font-size: 19px;
  color: var(--or-light);
  margin-top: 10px;
  padding: 14px;
  border: 1px dashed rgba(201, 169, 110, .35);
  border-radius: 6px;
}

/* ===== Action bar bas tirage ===== */
.draw-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 28px;
}
.btn {
  font-family: var(--font-meta);
  font-size: 12px;
  letter-spacing: .15em;
  text-transform: uppercase;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid rgba(201, 169, 110, .4);
  color: var(--or);
  transition: all var(--t-fast);
  background: rgba(201, 169, 110, .03);
}
.btn:hover { background: var(--or); color: var(--noir); }
.btn-primary {
  background: var(--or);
  color: var(--noir);
  border-color: var(--or);
}
.btn-primary:hover { background: var(--or-light); }
.btn-ghost { border-color: rgba(201, 169, 110, .2); color: var(--texte-soft); }

/* ===== Galerie 52 cartes ===== */
.gallery-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 24px;
}
.filter-btn {
  font-family: var(--font-meta);
  font-size: 10.5px;
  letter-spacing: .2em;
  text-transform: uppercase;
  padding: 8px 14px;
  border: 1px solid rgba(201, 169, 110, .25);
  border-radius: 999px;
  color: var(--texte-soft);
  transition: all var(--t-fast);
}
.filter-btn.active, .filter-btn:hover {
  border-color: var(--or);
  color: var(--or);
  background: rgba(201, 169, 110, .07);
}
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  max-width: 900px;
  margin: 0 auto;
}
.gallery-card {
  aspect-ratio: 5/7;
  border-radius: 10px;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
  background: var(--card-bg);
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(201, 169, 110, .25);
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}
.gallery-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-card); }
.gallery-card .roman {
  font-family: var(--font-meta);
  font-size: 9px;
  letter-spacing: .25em;
  color: rgba(201, 169, 110, .6);
}
.gallery-card .gsymbol {
  width: 88px; height: 88px;
  color: var(--or-light);
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .3));
}
.gallery-card .gname {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 13px;
  text-align: center;
  color: var(--creme);
  line-height: 1.18;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}

/* ===== Détail carte (modal) ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .8);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fade .25s ease;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--noir);
  border: 1px solid rgba(201, 169, 110, .3);
  border-radius: 14px;
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 30px 26px 36px;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(201, 169, 110, .12);
  color: var(--or);
  font-size: 18px;
  line-height: 30px;
  text-align: center;
  z-index: 1;
}
.modal .full-card {
  width: 200px;
  margin: 0 auto 22px;
  aspect-ratio: 5/7;
  border-radius: 12px;
  background: var(--card-bg);
  border: 1px solid rgba(201, 169, 110, .35);
  padding: 14px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

/* ===== Historique & journal ===== */
.history-list {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.history-item {
  background: rgba(201, 169, 110, .04);
  border: 1px solid rgba(201, 169, 110, .15);
  border-radius: 10px;
  padding: 16px 20px;
  cursor: pointer;
  transition: all var(--t-fast);
}
.history-item:hover { border-color: var(--or); }
.history-item .date {
  font-family: var(--font-meta);
  font-size: 10px;
  letter-spacing: .25em;
  color: var(--or);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.history-item .summary {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 16px;
  color: var(--creme);
  margin-bottom: 6px;
}
.history-item .cards-line {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--texte-soft);
}
.history-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--texte-soft);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 16px;
}
.note-area {
  width: 100%;
  background: rgba(201, 169, 110, .04);
  border: 1px solid rgba(201, 169, 110, .2);
  border-radius: 8px;
  padding: 14px;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--creme);
  resize: vertical;
  min-height: 100px;
}
.note-area:focus { outline: 2px solid var(--or); outline-offset: 1px; }

/* ===== Bottom navigation ===== */
.nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: rgba(20, 16, 12, .95);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(201, 169, 110, .18);
  z-index: 50;
}
.nav button {
  flex: 1;
  padding: 12px 4px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--texte-soft);
  transition: color var(--t-fast);
}
.nav button.active { color: var(--or); }
.nav button .icon { width: 22px; height: 22px; }
.nav button .lbl {
  font-family: var(--font-meta);
  font-size: 9.5px;
  letter-spacing: .15em;
  text-transform: uppercase;
}

/* ===== Sparkles décoratifs (fond app) ===== */
.bg-sparkles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: .4;
}
.bg-sparkles span {
  position: absolute;
  width: 2px; height: 2px;
  background: var(--or);
  border-radius: 50%;
  animation: twinkle 4s ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(.5); }
  50% { opacity: .8; transform: scale(1); }
}

/* ===== Petits écrans ===== */
@media (max-width: 480px) {
  main { padding: 18px 14px 100px; }
  .flip-card { width: 160px; height: 224px; }
  .spread .slot { width: 160px; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Mode déploiement Vercel : light flash si JS désactivé ===== */
.no-js-warning {
  display: none;
  text-align: center;
  padding: 24px;
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--or);
}
