/* Feuille propre au calendrier lunaire. Jetons, polices, en-tête, barre
   latérale, boutons et pied de page viennent de socle.css : cette page ne
   déclare que les deux teintes du ciel et de la Lune, qui ne suivent pas le
   thème — la nuit est sombre dans les deux. */
:root { --lune-claire: #f2efe6; --lune-sombre: #2b3446; }
:root[data-theme='sombre'] { --lune-claire: #f5f2e9; --lune-sombre: #1a2130; }
@media (prefers-color-scheme: dark) {
  :root[data-theme='auto'] { --lune-claire: #f5f2e9; --lune-sombre: #1a2130; }
}

/* --- Mise en page ------------------------------------------------------ */
.page { max-width: 1120px; margin: 0 auto; padding: 32px 16px 72px; display: grid; gap: 24px; }
@media (min-width: 768px) { .page { padding: 40px 24px 88px; } }
.bloc { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--r); box-shadow: var(--e3); padding: 24px; }
h1 { font-size: clamp(2rem, 1.5rem + 2.2vw, 3rem); line-height: 1.1; margin: 0 0 10px; letter-spacing: -.024em; }
.sous-titre { margin: 0 0 4px; max-width: 62ch; color: var(--encre-3); font-size: 1.0625rem; }
h2 { font-size: 1.625rem; margin: 2px 0 6px; letter-spacing: -.015em; }
.bloc-tete { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.bloc-tete h2 { font-size: 1.375rem; margin: 0; }
.tab { font-variant-numeric: tabular-nums; }

/* --- Lune : dessin -----------------------------------------------------
   Le rendu vient d'un calcul d'éclairement par pixel (lune-rendu.js). Le CSS
   ne fait que le mettre en scène : ciel, halo, entrée. */
.glyphe-lune { display: block; }

/* --- Bloc « aujourd'hui » ---------------------------------------------- */
.lune-hero { display: flex; gap: 30px; align-items: center; flex-wrap: wrap; }
.lune-visuel {
  position: relative; flex: none;
  width: 232px; height: 232px; border-radius: 50%;
  display: grid; place-items: center;
  background:
    radial-gradient(circle at 50% 50%, rgba(120,150,200,.16), transparent 62%),
    radial-gradient(circle at 30% 22%, #16202f, #070b12 78%);
  box-shadow: inset 0 0 40px rgba(0,0,0,.6);
  overflow: hidden;
}
/* Champ d'étoiles : deux couches de points, pour qu'un ciel noir uni ne
   donne pas l'impression d'un trou dans la page. */
.lune-visuel::before {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background-image:
    radial-gradient(1.4px 1.4px at 22% 18%, rgba(255,255,255,.75), transparent),
    radial-gradient(1px 1px at 78% 26%, rgba(255,255,255,.55), transparent),
    radial-gradient(1.1px 1.1px at 64% 78%, rgba(255,255,255,.6), transparent),
    radial-gradient(1px 1px at 15% 72%, rgba(255,255,255,.45), transparent),
    radial-gradient(1.3px 1.3px at 88% 58%, rgba(255,255,255,.5), transparent),
    radial-gradient(.9px .9px at 42% 8%, rgba(255,255,255,.4), transparent),
    radial-gradient(1px 1px at 8% 40%, rgba(255,255,255,.35), transparent);
  animation: scintiller 7s ease-in-out infinite alternate;
}
#lune-canvas {
  position: relative; z-index: 1;
  width: 190px; height: 190px; display: block;
  /* Le halo n'est pas un effet : une Lune brillante diffuse réellement dans
     l'atmosphère, et sans lui le disque semble collé sur le fond. */
  filter: drop-shadow(0 0 18px rgba(220,230,255,.30)) drop-shadow(0 0 46px rgba(190,205,240,.16));
  animation: paraitre .9s cubic-bezier(.22,.8,.3,1) both;
}
@keyframes scintiller { from { opacity: .55; } to { opacity: 1; } }
@keyframes paraitre { from { opacity: 0; transform: scale(.86); } to { opacity: 1; transform: none; } }

/* Les vignettes du calendrier apparaissent en cascade : la grille se remplit
   au lieu de surgir d'un bloc. */
@keyframes monter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.cal-case { animation: monter .32s ease-out both; }
#lune-prochaines li { animation: monter .3s ease-out both; }

@media (prefers-reduced-motion: reduce) {
  .lune-visuel::before, #lune-canvas, .cal-case, #lune-prochaines li { animation: none; }
}
.lune-texte { flex: 1 1 300px; min-width: 260px; }
.lune-sur { margin: 0; font-size: .8125rem; color: var(--encre-3); }
.lune-mention { margin: 6px 0 0; font-size: .875rem; color: var(--encre-2); }
.lune-mention strong { color: var(--soleil); }
.lune-suite { margin: 8px 0 14px; font-size: .9375rem; color: var(--encre-2); }
.lune-chiffres { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0; font-size: .875rem; }
.lune-chiffres dt { color: var(--encre-3); }
.lune-chiffres dd { margin: 0; font-weight: 700; text-align: right; }
.lune-lc { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.lc-case { background: var(--carte-2); border-radius: var(--r-sm); padding: 11px 14px; }
.lc-nom { display: block; font-size: .75rem; color: var(--encre-3); }
.lc-case strong { font-size: 1.1875rem; }

/* --- Recherche de lieu -------------------------------------------------- */
.lune-champ { position: relative; max-width: 340px; }
.lune-champ input {
  width: 100%; min-height: 48px; padding: 9px 18px; border: 1px solid var(--bord-fort); border-radius: var(--pilule);
  background: var(--carte); color: var(--encre); font: inherit; font-size: .875rem;
}
.sugg {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20;
  background: var(--carte); border: 1px solid var(--bord); border-radius: var(--r-sm);
  box-shadow: var(--ombre); overflow: hidden;
}
.sugg:empty { display: none; }
.sugg button {
  display: block; width: 100%; text-align: left; border: 0; background: none;
  padding: 9px 12px; font: inherit; font-size: .875rem; color: var(--encre); cursor: pointer;
}
.sugg button:hover { background: var(--carte-2); }
.sugg button span { display: block; font-size: .75rem; color: var(--encre-3); }

/* --- Prochaines phases -------------------------------------------------- */
#lune-prochaines { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
#lune-prochaines li {
  display: grid; grid-template-columns: 40px 1fr auto auto; align-items: center;
  gap: 14px; padding: 9px 8px; border-radius: var(--r-sm);
}
#lune-prochaines li:nth-child(odd) { background: var(--carte-2); }
.pp-nom { font-weight: 650; font-size: .9063rem; }
.pp-date { color: var(--encre-2); font-size: .875rem; }
.pp-heure { color: var(--encre-3); font-size: .8438rem; min-width: 62px; text-align: right; }

/* --- Calendrier --------------------------------------------------------- */
.cal-nav { display: flex; align-items: center; gap: 10px; }
#lune-mois { font-weight: 800; font-size: 1.0625rem; min-width: 150px; text-align: center; text-transform: capitalize; }
.cal-entetes, #lune-calendrier { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-entetes { margin-bottom: 6px; }
.cal-entetes span { text-align: center; font-size: .6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--encre-3); }
.cal-case {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 3px; border: 1px solid transparent; border-radius: var(--r-sm);
  background: linear-gradient(180deg, #131c2b, #0a1018);
  cursor: pointer; min-height: 100px;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.cal-case:hover { border-color: #f3bd49; transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.28); }
.cal-case .cal-n { color: #9fb0c6; }
.cal-case .cal-pct { color: #7f8ea3; }
.cal-case .glyphe-lune { filter: drop-shadow(0 0 6px rgba(210,225,255,.22)); }
.cal-case.vide { background: none; cursor: default; min-height: 0; animation: none; }
/* Les cases du calendrier sont un ciel de nuit dans les DEUX thèmes : leurs
   repères sont donc en or fixe, et non en couleur de thème — le terracotta du
   thème clair tombait à 2,9:1 sur ce fond sombre. */
.cal-case.aujourd { border-color: #f3bd49; box-shadow: inset 0 0 0 1px #f3bd49, 0 0 22px rgba(243,189,73,.22); }
.cal-case.principale { background: linear-gradient(180deg, #1a2740, #0d1522); border-color: #2c3d59; }
.cal-n { font-size: .7813rem; font-weight: 700; color: var(--encre-2); }
.cal-pct { font-size: .6563rem; color: var(--encre-3); }
.cal-etiq { font-size: .6875rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; color: #f3bd49; text-align: center; line-height: 1.2; }

#lune-detail { position: relative; margin-top: 14px; background: var(--carte-2); border-radius: var(--r-sm); padding: 16px; }
.fermer { position: absolute; top: 10px; right: 10px; width: 44px; min-height: 44px; padding: 0; font-size: 1.125rem; line-height: 1; }
.det-tete { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.det-tete h3 { margin: 0; font-size: 1.0625rem; text-transform: capitalize; }
.det-tete p { margin: 2px 0 0; color: var(--encre-3); font-size: .875rem; }

/* --- Éphémérides du jour ------------------------------------------------ */
.ep-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.ep-case {
  background: var(--carte-2); border-radius: var(--r-sm); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px;
}
.ep-t { font-size: .6875rem; text-transform: uppercase; letter-spacing: .07em; color: var(--encre-3); font-weight: 700; }
.ep-v { font-size: 1.125rem; letter-spacing: -.01em; }
.ep-d { font-size: .7813rem; color: var(--encre-3); line-height: 1.4; }
.note-trad { margin-top: 16px; font-size: .8125rem; color: var(--encre-2); }
.note-trad summary { cursor: pointer; color: var(--encre-3); font-weight: 600; }
.note-trad p { margin: 10px 0 0; max-width: 78ch; }

.note { font-size: .7813rem; color: var(--encre-3); margin: 14px 0 0; }

@media (max-width: 640px) {
  .lune-lc { grid-template-columns: 1fr; }
  #lune-prochaines li { grid-template-columns: 34px 1fr auto; }
  .pp-heure { grid-column: 3; }
  .pp-date { grid-column: 2; font-size: .8125rem; }
  .cal-case { min-height: 74px; padding: 6px 2px; }
  .cal-etiq { display: none; }
}


/* Repères de données : la couleur vient d'un attribut, posé par menu.js. */
.ep-case[data-bord] { border-left: 4px solid transparent; }
.lune-source { margin: 0; max-width: 70ch; font-size: .9063rem; color: var(--encre-2); }
