/* Oustory Moon — home-page moon for the Covenant Bible app.
   Concordance language: solid, ruled, typographic. No glass slabs.
   Colors: ink #141210, parchment #f5f0e6, gold #c9a227.
   v2: the stage bleeds to the card edges and flows with the page;
   deep-space background with depth; Earth view is a full 3D yard. */

.moon-stage {
  position: relative;
  aspect-ratio: 4 / 3.3;
  width: auto;
  margin: 12px -21px 6px;
  overflow: hidden;
  border-radius: 14px;
  background:
    radial-gradient(90% 60% at 18% 0%, rgba(96, 102, 178, 0.20) 0%, rgba(96, 102, 178, 0) 55%),
    radial-gradient(70% 55% at 88% 100%, rgba(201, 162, 39, 0.07) 0%, rgba(201, 162, 39, 0) 60%),
    radial-gradient(130% 95% at 50% 40%, #121b31 0%, #0a1020 54%, #04060c 100%);
  border-top: 1px solid rgba(201, 162, 39, 0.45);
  border-bottom: 1px solid rgba(201, 162, 39, 0.45);
}
@media (max-width: 390px) {
  .moon-stage { margin-inline: -17px; }
}
.moon-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.moon-disc-fallback {
  position: absolute;
  inset: 0;
  margin: auto;
  width: min(62%, 280px);
  height: auto;
  aspect-ratio: 1 / 1;
}
/* Cinematic letterbox */
.moon-stage::before,
.moon-stage::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 0;
  background: #000;
  z-index: 3;
  transition: height 0.7s ease;
  pointer-events: none;
}
.moon-stage::before { top: 0; }
.moon-stage::after { bottom: 0; }
.moon-stage.moon-letterbox::before,
.moon-stage.moon-letterbox::after { height: 11%; }

.moon-rows { margin-top: 8px; }
.moon-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(245, 240, 230, 0.09);
}
.moon-row:last-child { border-bottom: none; }
.moon-key {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(245, 240, 230, 0.55);
  white-space: nowrap;
}
.moon-val {
  font-size: 15px;
  color: #f5f0e6;
  text-align: right;
}
.moon-covenant {
  margin: 10px 0 0;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: #c9a227;
}
.moon-stamp {
  margin: 4px 0 0;
  font-size: 12px;
  color: rgba(245, 240, 230, 0.5);
}

.moon-switch {
  display: flex;
  gap: 4px;
  margin-top: 12px;
  border-top: 1px solid rgba(245, 240, 230, 0.12);
  padding-top: 10px;
}
.moon-view-btn {
  flex: 1;
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: rgba(245, 240, 230, 0.62);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 2px 7px;
  cursor: pointer;
}
.moon-view-btn.is-active {
  color: #c9a227;
  border-bottom-color: #c9a227;
}

.moon-open-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  appearance: none;
  background: transparent;
  border: 1px solid rgba(201, 162, 39, 0.65);
  border-radius: 2px;
  color: #c9a227;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 11px 14px;
  cursor: pointer;
}

/* The Moon page: full-screen surface behind the card. */
body.moonpage-open { overflow: hidden; }
.moonpage {
  position: fixed;
  inset: 0;
  z-index: 1900;
  overflow-y: auto;
  background: #141210;
  color: #f5f0e6;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 21px 48px;
}
.moonpage-head { position: relative; }
.moonpage-eyebrow {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #c9a227;
}
.moonpage-title { margin: 6px 44px 0 0; font-size: 30px; font-weight: 600; }
.moonpage-close {
  position: absolute;
  top: -6px;
  right: -6px;
  appearance: none;
  background: transparent;
  border: none;
  color: #c9a227;
  font-size: 30px;
  line-height: 1;
  padding: 8px;
  cursor: pointer;
}
.moonpage-disc-wrap { display: flex; justify-content: center; margin: 18px 0 4px; }
.moonpage-disc {
  width: min(74vw, 300px);
  height: auto;
  aspect-ratio: 1 / 1;
  filter: drop-shadow(0 0 26px rgba(238, 234, 220, 0.22));
}
.moonpage-caption {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(245, 240, 230, 0.72);
  text-align: center;
}
.moonpage-block { margin-top: 30px; }
.moonpage-block-title {
  margin: 0 0 10px;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #c9a227;
  border-bottom: 1px solid rgba(201, 162, 39, 0.4);
  padding-bottom: 7px;
}
.mp-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.mp-cell {
  appearance: none;
  background: #1c1916;
  border: 1px solid rgba(245, 240, 230, 0.14);
  border-radius: 2px;
  padding: 7px 2px 6px;
  cursor: pointer;
  font: inherit;
  color: #f5f0e6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.mp-disc { width: 82%; height: auto; aspect-ratio: 1 / 1; display: block; }
.mp-cell.is-past .mp-disc { opacity: 0.45; }
.mp-cell.is-shabbat { border-color: #c9a227; }
.mp-cell.is-today { outline: 2px solid #c9a227; outline-offset: 1px; }
.mp-day { font-size: 14px; }
.mp-cell.is-shabbat .mp-day { color: #c9a227; }
.mp-kind {
  font-size: 8px;
  letter-spacing: 0.14em;
  color: rgba(245, 240, 230, 0.55);
  min-height: 10px;
}
.mp-cell.is-shabbat .mp-kind { color: #c9a227; }
.mp-detail {
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.55;
  color: #c9a227;
  min-height: 22px;
}

/* Earth view: everything disappears into the yard. */
body.moon-earth-open { overflow: hidden; }
.moon-earth {
  position: fixed;
  inset: 0;
  z-index: 2000;
  overflow: hidden;
  background: #04060f;
}
.moon-earth > canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.moon-earth-fallback {
  background: linear-gradient(180deg, #04060f 0%, #081020 52%, #0a1120 78%, #060a06 100%);
}
.moon-earth-disc {
  position: absolute;
  top: 12%;
  right: 13%;
  width: 118px;
  height: 118px;
  filter: drop-shadow(0 0 22px rgba(238, 234, 220, 0.35));
}
.moon-earth-scene {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
}
.moon-earth-scene svg {
  width: 100%;
  height: auto;
  display: block;
}
.moon-earth-back {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  left: 14px;
  z-index: 5;
  appearance: none;
  background: rgba(5, 7, 13, 0.6);
  border: 1px solid rgba(201, 162, 39, 0.65);
  color: #f5f0e6;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 9px 14px;
  border-radius: 2px;
  cursor: pointer;
}
