article.door-part > h1 {
  margin-top: 2rem;
}
h1[id], h2[id] { scroll-margin-top: 4.5rem; }
.stotra {
  margin: 0.4rem 0 1rem;
  line-height: 1.75;
}
ol.chapters {
  margin: 0.2rem 0 1.4rem;
  padding-left: 1.5rem;
}
ol.chapters li { margin: 0.15rem 0; }
ol.chapters a { font-weight: 650; }

figure.plate {
  margin: 0.35rem 0 1.15rem;
}
figure.plate svg,
figure.plate img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
}
html[data-theme="dark"] figure.plate img {
  box-shadow: 0 4px 22px rgba(0, 0, 0, 0.45);
}
figure.plate figcaption {
  margin-top: 0.45rem;
  font-size: 1rem;
  line-height: 1.45;
  color: #5c4636;
}
figure.plate figcaption .deva {
  display: block;
  margin-top: 0.12rem;
}
html[data-theme="dark"] figure.plate figcaption {
  color: #ddcbb8;
}

/* Fix: Keep Devanagari subtitles inside parentheses inline so brackets don't break onto separate lines */
h1 > span.deva,
h2 > span.deva,
h3 > span.deva {
  display: inline;
  font-weight: 500;
}

/* The patro month is four moon shapes, not four color boxes. */
figure.moon-month .moon-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem 0.55rem;
  margin: 0;
  padding: 0.9rem 0.75rem 0.75rem;
  background: #172033;
  border-radius: 14px;
}
figure.moon-month .moon-step { margin: 0; text-align: center; color: #f6ead4; }
figure.moon-month .moon-step p {
  margin: 0.3rem 0 0;
  font-size: 0.92rem;
  line-height: 1.35;
}
figure.moon-month .moon-step b { font-weight: 750; }
figure.moon-month .moon-end {
  grid-column: 1 / -1;
  margin: 0.15rem 0 0;
  text-align: center;
  color: #f3e2a8;
  font-weight: 650;
}
figure.moon-month svg {
  border-radius: 0;
  box-shadow: none;
}
@media (max-width: 720px) {
  figure.moon-month .moon-strip { grid-template-columns: 1fr 1fr; }
}

/* The sun's month and the moon's month share a name and not a span of days. */
figure.plate.sun-span .sun-board {
  background: #172033;
  border-radius: 14px;
  padding: 0.85rem 0.8rem 0.75rem;
  color: #f6ead4;
}
figure.plate.sun-span .deva { color: inherit; }
figure.plate.sun-span .sun-name,
figure.plate.sun-span .sun-end {
  margin: 0;
  text-align: center;
  color: #f3e2a8;
  font-weight: 750;
}
figure.plate.sun-span .sun-hint {
  margin: 0.2rem 0 0;
  text-align: center;
  color: #f6ead4;
  font-size: 0.88rem;
  line-height: 1.35;
}
figure.plate.sun-span .span-row {
  display: grid;
  grid-template-columns: 4.6rem minmax(0, 1fr);
  gap: 0.35rem 0.65rem;
  align-items: center;
  margin-top: 0.85rem;
}
figure.plate.sun-span .span-kicker {
  margin: 0;
  text-align: center;
  font-weight: 750;
  line-height: 1.2;
}
figure.plate.sun-span .span-lane { min-width: 0; }
figure.plate.sun-span .span-note {
  margin: 0.28rem 0 0;
  font-size: 0.86rem;
  line-height: 1.35;
}
figure.plate.sun-span .gate-track,
figure.plate.sun-span .lane-ghost {
  height: 22px;
  border-bottom: 2px solid #f6d56a;
  background-image: repeating-linear-gradient(
    90deg,
    #e7c98a 0 2px,
    transparent 2px calc(100% / 31)
  );
  background-size: 100% 12px;
  background-repeat: no-repeat;
  background-position: left bottom 2px;
}
figure.plate.sun-span .gate-nums {
  position: relative;
  height: 1.15rem;
  margin: 0.12rem 0 0;
  font-size: 0.78rem;
  font-weight: 650;
}
figure.plate.sun-span .gate-nums .n1 { position: absolute; left: 0; }
figure.plate.sun-span .gate-nums .n15 {
  position: absolute;
  left: 45%;
  transform: translateX(-50%);
}
figure.plate.sun-span .gate-nums .nlast { position: absolute; right: 0; }
figure.plate.sun-span .moon-lane {
  position: relative;
  height: 48px;
}
figure.plate.sun-span .lane-ghost {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  border-bottom-color: rgba(246, 213, 106, 0.35);
  opacity: 0.45;
}
figure.plate.sun-span .moon-window {
  position: absolute;
  left: 14%;
  width: 72%;
  top: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 2px solid #f3e2a8;
  padding: 0 0.15rem 4px;
  box-sizing: border-box;
}
figure.plate.sun-span .moon-window::before,
figure.plate.sun-span .moon-window::after {
  content: "";
  position: absolute;
  bottom: -2px;
  width: 2px;
  height: 14px;
  background: #f3e2a8;
}
figure.plate.sun-span .moon-window::before { left: 0; }
figure.plate.sun-span .moon-window::after { right: 0; }
figure.plate.sun-span .moon-note {
  margin-left: 14%;
  width: 72%;
  text-align: center;
}
figure.plate.sun-span svg.day-mark,
figure.plate.sun-span svg.moon-phase {
  display: block;
  width: 36px;
  height: 36px;
  margin: 0 auto 0.15rem;
  border-radius: 0;
  box-shadow: none;
}
figure.plate.sun-span svg.moon-phase {
  width: 34px;
  height: 34px;
  margin: 0;
  flex: 0 0 auto;
}
@media (max-width: 720px) {
  figure.plate.sun-span .span-row { grid-template-columns: 3.4rem minmax(0, 1fr); }
  figure.plate.sun-span svg.day-mark { width: 28px; height: 28px; }
  figure.plate.sun-span svg.moon-phase { width: 26px; height: 26px; }
}

/* Intra-month navigation pill ribbon */
nav.month-toc {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.6rem;
  margin: 0.6rem 0 1.6rem;
  padding: 0.6rem 0.75rem;
  background: rgba(44, 34, 26, 0.04);
  border: 1px solid rgba(44, 34, 26, 0.08);
  border-radius: 12px;
}
html[data-theme="dark"] nav.month-toc {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}
nav.month-toc .toc-label {
  font-size: 0.86rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #7b6452;
  margin-right: 0.2rem;
}
html[data-theme="dark"] nav.month-toc .toc-label {
  color: #c9b7a4;
}
nav.month-toc a {
  display: inline-block;
  padding: 0.22rem 0.65rem;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  background: #ffffff;
  color: #2c221a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: background 0.15s ease, color 0.15s ease;
}
html[data-theme="dark"] nav.month-toc a {
  background: rgba(255, 255, 255, 0.1);
  color: #f6ead4;
}
nav.month-toc a:hover {
  background: #f6d56a;
  color: #172033;
}

/* Parametric festival metadata table */
.katha-table {
  margin: 0.85rem 0 1.25rem;
  font-size: 0.94rem;
}
.katha-table th {
  width: 32%;
  background: rgba(44, 34, 26, 0.04);
  font-weight: 650;
  color: inherit;
}
html[data-theme="dark"] .katha-table th {
  background: rgba(255, 255, 255, 0.05);
}
.katha-table td {
  line-height: 1.5;
}

/* Thematic motif tag chips */
.katha-motifs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0.65rem 0 1.15rem;
  font-size: 0.86rem;
}
.katha-motifs .motifs-label {
  font-size: 0.82rem;
  font-weight: 650;
  color: #7b6452;
  margin-right: 0.2rem;
}
html[data-theme="dark"] .katha-motifs .motifs-label {
  color: #c9b7a4;
}
.katha-motif-tag {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 6px;
  background: rgba(44, 34, 26, 0.06);
  color: inherit;
  text-decoration: none;
  font-weight: 550;
  transition: background 0.15s ease;
}
html[data-theme="dark"] .katha-motif-tag {
  background: rgba(255, 255, 255, 0.08);
}
.katha-motif-tag:hover {
  background: rgba(246, 213, 106, 0.4);
}
