/* ============================================================
 * Mayan Tzolk'in — standalone single stylesheet (pillar 1)
 * ------------------------------------------------------------
 * The module stage rules mirror ClairvoyantOracle.com/jsmodules/
 * Mayan.css (which is @imported by the timeline main.css); here
 * they are unscoped because the standalone stage lives in
 * #mayan-stage rather than #mayan-oracle-section.
 * ============================================================ */

/* ---------- the module stage (mirrors jsmodules/Mayan.css) ---------- */
.mayan-heading {
  font-family: 'Pirata One', serif; font-size: 2rem; color: #d9a441; text-align: center; margin: 1rem 0;
}
/* today's date, above the wheel's top centre — makes clear that the tiles the
   wheel selects are TODAY's (owner request 2026-09-29) */
.mayan-today-date { text-align: center; margin: .1rem auto .4rem; }
.mayan-today-date-label {
  display: inline-block; font-family: 'Pirata One', serif; font-size: .95rem;
  letter-spacing: .14em; text-transform: uppercase; color: #d9a441; margin-right: .55rem;
  text-shadow: 0 0 10px rgba(217, 164, 65, .3);
}
.mayan-today-date-value { font-family: 'Noto Serif KR', serif; font-size: 1.02rem; color: #f3e6c4; }
.mayan-wheel-wrap { position: relative; display: flex; justify-content: center; }
.mayan-wheel { position: relative; z-index: 1; width: min(90vw, 460px); height: auto; overflow: visible; }
/* The rings must rotate about the wheel centre: SVG's default transform
   origin is (0 0), which swings the rotated group off the viewBox and
   overflows narrow viewports (mobile gate). Pin it to the 400×400 centre. */
.mayan-ring { transform-box: view-box; transform-origin: 200px 200px; }
/* stone material (SDXL) behind the drawn rings — the semi-transparent cells let
   it read as carved into stone. The var is only set by renderMayanStage; when
   absent, `background-image: none` renders nothing (fully inert — no tint, no
   layout shift, no request). */
.mayan-wheel-wrap::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(90vw, 460px);
  max-width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background-image: var(--mayan-plate, none);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-blend-mode: luminosity;
  opacity: .22;
  pointer-events: none;
  z-index: 0;
}
@supports not (aspect-ratio: 1 / 1) {
  .mayan-wheel-wrap::before { display: none; }
}
/* carved-stone backdrop (SDXL) — a soft stage atmosphere behind the whole
   reading. renderMayanStage adds `.mayan-backdrop` and sets the var only when
   the plates are available; the default `none` renders nothing (no tint, no
   request, no layout shift) and the wheel/readout always paint above it. */
.mayan-backdrop { position: relative; }
.mayan-backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: var(--mayan-backdrop, none);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: .12;
  pointer-events: none;
  z-index: 0;
}
.mayan-backdrop > * { position: relative; z-index: 1; }
/* top-right hero motif (owner pick 2026-09-24) — the Maya lord beside the
   calendar, set diagonally in the top-right corner behind the reading, with a
   gentle scroll parallax. Mirrors jsmodules/Mayan.css; keep in sync. */
.mayan-backdrop { overflow: hidden; }
.mayan-hero { position: absolute; top: 0; right: 0; width: min(46%, 340px); pointer-events: none; }
.mayan-backdrop > .mayan-hero { z-index: 0; }
.mayan-hero img {
  display: block; width: 100%; height: auto;
  /* pivot at the top-right corner so the 6deg rotation keeps the image inside
     the container's right edge (no horizontal overflow at iPhone width) */
  transform-origin: top right;
  transform: translate3d(0, var(--mayan-hero-drift, 0px), 0) rotate(6deg);
  /* pushed well back: dim, desaturated, and masked to fade early so it reads as
     deep background in the top-right corner rather than an illustration */
  filter: saturate(.85) brightness(.68);
  -webkit-mask-image: linear-gradient(210deg, #000 26%, rgba(0, 0, 0, .28) 58%, transparent 94%);
  mask-image: linear-gradient(210deg, #000 26%, rgba(0, 0, 0, .28) 58%, transparent 94%);
  opacity: .6;
}
@media (max-width: 640px) {
  .mayan-hero { width: 54%; top: 0; right: 0; }
  .mayan-hero img { opacity: .5; }
}
/* top-LEFT hero motif (owner pick 2026-09-24: hero-serpent-relief, seed 980548
   — the feathered Kukulkan serpent). The mirror of the right-hand hero:
   diagonal, dim, scroll parallax, masked to fade toward the lower-right. */
.mayan-hero-left { position: absolute; top: 0; left: -30px; width: min(46%, 340px); pointer-events: none; }
.mayan-backdrop > .mayan-hero-left { z-index: 0; }
.mayan-hero-left img {
  display: block; width: 100%; height: auto;
  transform-origin: top left;
  transform: translate3d(0, var(--mayan-hero-drift, 0px), 0) rotate(-6deg);
  filter: saturate(.85) brightness(.68);
  -webkit-mask-image: linear-gradient(135deg, #000 26%, rgba(0, 0, 0, .28) 58%, transparent 94%);
  mask-image: linear-gradient(135deg, #000 26%, rgba(0, 0, 0, .28) 58%, transparent 94%);
  opacity: .6;
}
@media (max-width: 640px) {
  .mayan-hero-left { width: 54%; top: 0; left: -25px; }
  .mayan-hero-left img { opacity: .5; }
}
/* the cells carry the bright gold from the very first frame, so the colour stays
   visible WHILE THE WHEEL SPINS (the old base #b8860b read as flat black against
   the dark stage until `.mayan-aligned` lit it after the grind) */
.mayan-cell-sign, .mayan-cell-tone { fill: rgba(58, 42, 20, .5); stroke: #ffd97a; stroke-width: .8; }
/* the gold HIGHLIGHT (glow) is on from the first frame, so it is visible WHILE the
   wheel spins — not only once `.mayan-aligned` lands after the grind */
.mayan-cell-sign:not(.mayan-natal-cell):not(.mayan-today-cell), .mayan-cell-tone:not(.mayan-natal-cell):not(.mayan-today-cell) {
  filter: drop-shadow(0 0 2.6px rgba(255, 217, 122, .62));
  transition: filter .6s;
}
.mayan-cell-label { fill: #e8dcc0; font-size: 9px; text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.mayan-cell-tone-label { font-size: 12px; fill: #f3e6c4; }
.mayan-pointer { fill: #d9a441; }
.mayan-modifiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; margin: 1rem 0; }
/* 2026-10-04 — the reading (today's date, modifiers, natal card) is revealed only
   after the wheel settles, so it is never readable during the grind. */
.mayan-today-date, .mayan-modifiers, .mayan-natal { opacity: 0; transition: opacity 0.5s ease; }
.mayan-revealed .mayan-today-date, .mayan-revealed .mayan-modifiers, .mayan-revealed .mayan-natal { opacity: 1; }
.mayan-modifier { border: 1px solid #b8860b66; border-radius: 10px; padding: .6rem .8rem; background: rgba(20, 14, 10, .5); }
.mayan-modifier-k { color: #d9a441; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.mayan-modifier-v { font-family: 'Noto Serif KR', serif; font-size: 1.05rem; color: #f3e6c4; margin: .2rem 0; }
.mayan-modifier-d { color: #c9bda0; font-size: .85rem; }
.mayan-natal { border: 1px solid #b8860b66; border-radius: 10px; padding: .8rem 1rem; text-align: center; background: rgba(20, 14, 10, .5); }
.mayan-natal-title { color: #d9a441; font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; }
.mayan-natal-body { font-family: 'Noto Serif KR', serif; font-size: 1.1rem; color: #f3e6c4; margin-top: .3rem; }
.mayan-natal-desc { color: #c9bda0; font-size: .85rem; }
.mayan-tradition-note { color: #8f8266; font-size: .75rem; margin-top: .8rem; text-align: center; }
@keyframes mayanJudder { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-1.5px); } 75% { transform: translateX(1.5px); } }
.mayan-grinding .mayan-wheel-wrap { animation: mayanJudder .12s linear 3; }
.mayan-aligned .mayan-cell-sign:not(.mayan-natal-cell):not(.mayan-today-cell), .mayan-aligned .mayan-cell-tone:not(.mayan-natal-cell):not(.mayan-today-cell) { stroke: #ffe89a; filter: drop-shadow(0 0 5px #ffd97a); transition: stroke .6s, filter .6s; }
/* the CURRENT day's sign + tone — glow LIGHT PURPLE (always; renderMayanStage marks
   `.mayan-today-cell`). Before the natal block so the green birth glow wins on overlap. */
.mayan-cell.mayan-today-cell {
  fill: rgba(150, 110, 220, .42);
  stroke: #c9a3ff;
  stroke-width: 1.2;
  animation: mayanTodayPulse 2.6s ease-in-out infinite;
  transition: fill .4s, stroke .4s;
}
.mayan-cell-label.mayan-today-cell { fill: #e3d0ff; font-weight: 700; filter: drop-shadow(0 0 3px rgba(201, 163, 255, .7)); }
.mayan-aligned .mayan-cell.mayan-today-cell { filter: drop-shadow(0 0 6px #c9a3ff); }
@keyframes mayanTodayPulse { 0%, 100% { opacity: .72; } 50% { opacity: 1; } }
/* the participant's BIRTH day sign + tone — glow GREEN on the wheel (only when a
   birth date is set; renderMayanStage marks the matching cells `.mayan-natal-cell`) */
.mayan-cell.mayan-natal-cell {
  fill: rgba(46, 160, 67, .42);
  stroke: #4fdd77;
  stroke-width: 1.2;
  animation: mayanNatalPulse 2.6s ease-in-out infinite;
  transition: fill .4s, stroke .4s;
}
.mayan-cell-label.mayan-natal-cell { fill: #86ffa8; font-weight: 700; filter: drop-shadow(0 0 3px rgba(79, 221, 119, .7)); }
.mayan-aligned .mayan-cell.mayan-natal-cell { filter: drop-shadow(0 0 6px #4fdd77); }
@keyframes mayanNatalPulse { 0%, 100% { opacity: .72; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .mayan-grinding .mayan-wheel-wrap { animation: none; }
  .mayan-cell.mayan-natal-cell, .mayan-cell.mayan-today-cell { animation: none; }
}
/* ELECTRIC LIGHTNING STRIKE — a sharp bolt from the top-left to the bottom-right
   of the calendar div the instant the wheel stops (settle() adds `.mayan-strike`
   at 2.5s and removes it at 3.8s). Drawn as a crisp vector path (core + glow +
   branches), not an image, so it stays razor sharp at any size. Decorative only.
   Mirrors jsmodules/Mayan.css; keep in sync. */
.mayan-lightning { position: absolute; inset: 0; pointer-events: none; opacity: 0; overflow: hidden; }
.mayan-backdrop > .mayan-lightning { z-index: 6; }
.mayan-lightning .mayan-bolt { width: 100%; height: 100%; display: block; }
.mayan-bolt path { fill: none; vector-effect: non-scaling-stroke; }
.mayan-lightning .bolt-glow { stroke: #7ad0ff; stroke-width: 7; opacity: .45; filter: blur(3.5px); }
.mayan-lightning .bolt-halo { stroke: #d6f1ff; stroke-width: 2.2; opacity: .9; }
.mayan-lightning .bolt-core { stroke: #ffffff; stroke-width: 1; filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 3.5px #9fe0ff); }
.mayan-lightning .bolt-branch { stroke: #eaf8ff; stroke-width: .6; opacity: .95; filter: drop-shadow(0 0 1.5px #9fe0ff); }
.mayan-lightning .bolt-branch-thin { stroke-width: .35; opacity: .7; }
.mayan-strike .mayan-lightning { animation: mayanStrike 1.15s ease-out 1 forwards; }
@keyframes mayanStrike {
  0% { opacity: 0; } 3% { opacity: 1; } 8% { opacity: .12; } 13% { opacity: 1; }
  20% { opacity: .18; } 26% { opacity: 1; } 55% { opacity: .85; } 100% { opacity: 0; }
}
/* a brief electric flash across the whole calendar div */
.mayan-strike.mayan-backdrop::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 5; border-radius: inherit;
  background: radial-gradient(120% 90% at 8% 0%, rgba(196, 238, 255, .42), rgba(120, 200, 255, .12) 35%, transparent 70%);
  animation: mayanFlash 1.15s ease-out 1 forwards;
}
@keyframes mayanFlash { 0% { opacity: 0; } 4% { opacity: 1; } 10% { opacity: .14; } 15% { opacity: .8; } 30% { opacity: .3; } 55% { opacity: .08; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .mayan-strike .mayan-lightning, .mayan-strike.mayan-backdrop::after { animation: none; opacity: 0; }
}

/* ---------- standalone page chrome ---------- */
.mayan-page { padding-top: 1.4rem; }
/* the standalone header already names the module — suppress the renderer duplicate
   (the timeline stage keeps its own .mayan-heading) */
.mayan-page .mayan-heading { display: none; }

.mayan-standalone-header {
  text-align: center;
  margin: 0 0 1rem;
}
.mayan-standalone-header h1 {
  font-family: 'Pirata One', 'Liberation Serif', serif;
  font-size: 2.6rem;
  letter-spacing: 2px;
  color: #d9a441;
  margin: 0;
  text-shadow: 0 0 18px rgba(217, 164, 65, .35);
}
.mayan-sub {
  font-family: 'Noto Serif KR', serif;
  color: #c9bda0;
  font-size: 1rem;
  margin: .35rem 0 0;
}

.mayan-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .6rem 1rem;
  border: 1px solid #b8860b66;
  border-radius: 10px;
  padding: .8rem 1rem;
  margin: 0 0 1.2rem;
  background: rgba(20, 14, 10, .5);
}
.mayan-controls label { color: #e8dcc0; font-size: .9rem; }
.mayan-controls input[type="date"] {
  font-family: inherit;
  font-size: .95rem;
  color: #f3e6c4;
  background: rgba(10, 7, 5, .7);
  border: 1px solid #b8860b99;
  border-radius: 8px;
  padding: .4rem .6rem;
  color-scheme: dark;
}
.mayan-controls button {
  font-family: 'Pirata One', 'Liberation Serif', serif;
  font-size: 1.05rem;
  letter-spacing: 1px;
  color: #1a1208;
  background: linear-gradient(180deg, #e8c874, #c79a2e);
  border: 1px solid #8a6a1c;
  border-radius: 8px;
  padding: .45rem 1.1rem;
  cursor: pointer;
  transition: filter .2s, transform .1s;
}
.mayan-controls button:hover { filter: brightness(1.08); }
.mayan-controls button:active { transform: translateY(1px); }

#mayan-stage {
  border: 1px solid #b8860b66;
  border-radius: 14px;
  padding: 1rem;
  background: rgba(14, 9, 8, .45);
}

@media (max-width: 480px) {
  .mayan-standalone-header h1 { font-size: 2rem; }
  .mayan-controls { flex-direction: column; text-align: center; }
  #mayan-stage { padding: .6rem; }
}
