/**
 * Homepage sections below the calendar sheet — festivals, month grid,
 * Pournami/Amavasya, muhurtham, about/FAQ and the data-provenance panel.
 *
 * Sole owner of these components. Everything is scoped under .tdc-sec so no
 * other stylesheet can collide with it — the same isolation that fixed the
 * sheet. Do not add !important here (outside print): if a rule seems to need
 * it, something else is leaking in and should be removed at the source.
 *
 * These sections carry the *theme* language — cream paper, maroon rules, navy
 * section bars, Laila for display — not the sheet's broadsheet black-and-white.
 * The tear-off sheet is deliberately the one high-contrast object on the page;
 * everything below it recedes so the sheet stays the focal point.
 */

/*
 * Tokens sit on :root, not on .tdc-sec, because the shared row renderers in
 * inc/template-tags.php also emit .tdc-sec__row on the festivals, muhurtham and
 * month templates, where there is no .tdc-sec wrapper. Scoping them to the
 * wrapper left those pages with no borders and no display face.
 *
 * .tdc-sheet declares the same names on itself, which still wins inside the
 * sheet — an element-scoped custom property beats an inherited one. That is
 * what keeps the calendar black-and-white while these tokens are themed.
 */
:root {
  --s-w: 820px;
  --s-ink: var(--dc-ink, #1a1a1a);
  --s-paper: var(--dc-card, #fffdf6);
  --s-rule-c: var(--dc-line, #d4c4a8);
  --s-rule: 1px solid var(--s-rule-c);
  --s-frame: 1px solid var(--dc-maroon, #7a1e2e);
  --s-hair: 1px solid var(--dc-line, #d4c4a8);
  --s-muted: var(--dc-mute, #5c5346);
  --s-wash: var(--dc-wash, #f5e6c8);
  --s-display: var(--dc-display, "Laila", Georgia, serif);
  --s-te: var(--dc-te, "Noto Sans Telugu", sans-serif);
  --s-sans: var(--dc-sans, "Roboto", system-ui, sans-serif);

  /* Section chrome */
  --s-navy: var(--dc-navy, #12355b);
  --s-maroon: var(--dc-maroon, #7a1e2e);
  --s-cream: var(--dc-cream, #fffdf6);
  --s-gold: #ffc600;

  /* States — warm, low-saturation; never the sheet's highlighter yellow */
  --s-yellow: #ffe8a3;
  --s-today: #fff8e0;
  --s-hover: #f3ede1;
  --s-focus: var(--dc-maroon, #7a1e2e);

  /* Vertical rhythm — one scale, so every section sits on the same beat */
  --s-gap: 40px;
}

.tdc-sec {
  box-sizing: border-box;
  /*
   * Content settles at exactly --s-w so these line up with the sheet, while the
   * page inset (shared with the sheet's wrapper) keeps them off the screen edge
   * on narrow viewports.
   */
  --s-pad: var(--dc-pad-x, 20px);
  max-width: calc(var(--s-w) + 2 * var(--s-pad));
  margin: 0 auto var(--s-gap);
  padding: 0 var(--s-pad);
  color: var(--s-ink);
  font-family: var(--s-sans);
}

.tdc-sec *,
.tdc-sec *::before,
.tdc-sec *::after {
  box-sizing: inherit;
}

.tdc-sec [hidden] {
  display: none;
}

.tdc-sec .telugu,
.tdc-sec [lang="te"] {
  font-family: var(--s-te);
}

/*
 * ── Section header: navy bar, title left, link right ───────
 * One masthead treatment for every section. Previously only #festivals had
 * this and the rest wore a bare hairline rule, which is why the page read as
 * two unrelated designs stacked on each other.
 */
.tdc-sec__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  flex-wrap: wrap;
  margin: 0;
  padding: 10px 14px;
  border: 1px solid #0e2a48;
  border-bottom: 1px solid #fff;
  background: var(--s-navy);
  color: var(--s-cream);
}

/* Title + scope travel together so the "View all" link stays hard right */
.tdc-sec__heading {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
}

.tdc-sec__title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 0;
  font-family: 'Roboto', sans-serif;
  font-size: clamp(18px, 2.2vw, 18px);
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.25;
  text-transform: none;
  color: var(--s-cream);
}

.tdc-sec__title .telugu {
  font-size: 1em;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.tdc-sec__title-sep {
  opacity: 0.5;
  font-weight: 400;
}

.tdc-sec__scope {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(255, 253, 246, 0.72);
}

.tdc-sec__more {
  flex: 0 0 auto;
  padding: 2px 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.3;
  color: var(--s-gold) !important;
  text-decoration: none;
  border-bottom: 1px solid var(--s-gold);
  white-space: nowrap;
}

.tdc-sec__more:hover,
.tdc-sec__more:focus-visible {
  background: rgba(255, 198, 0, 0.18);
  color: #ffe08a;
}

.tdc-sec__more:focus-visible {
  outline: 2px solid var(--s-gold);
  outline-offset: 2px;
}

.tdc-sec__body {
  margin: 0;
  border: var(--s-rule);
  border-top: 0;
  background: var(--s-paper);
  box-shadow: 0 1px 0 rgba(122, 30, 46, 0.04);
}

/* ── Ruled rows — festivals and muhurtham share this ──────── */
.tdc-sec__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tdc-sec__row {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 16px;
  padding: 11px 14px;
  border-bottom: var(--s-hair);
}

.tdc-sec__row:last-child {
  border-bottom: 0;
}

/* Today reads as a marked row, not just a tint — the stripe survives at a glance */
.tdc-sec__row.is-today {
  background: var(--s-today);
  box-shadow: inset 3px 0 0 var(--s-maroon);
}

.tdc-sec__rdate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 0;
  text-align: center;
}

.tdc-sec__rday {
  font-family: var(--s-display);
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  color: var(--s-maroon);
  font-variant-numeric: tabular-nums;
}

.tdc-sec__rmon {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--s-navy);
  white-space: nowrap;
}

.tdc-sec__rname {
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.tdc-sec__rname a {
  color: inherit;
  text-decoration: none;
}

.tdc-sec__rname a:hover {
  text-decoration: underline;
  text-decoration-color: var(--s-maroon);
  text-underline-offset: 2px;
}

.tdc-sec__rname a:focus-visible {
  outline: 2px solid var(--s-focus);
  outline-offset: 3px;
  text-decoration: none;
}

.tdc-sec__rname .telugu {
  font-weight: 600;
}

.tdc-sec__rsub {
  display: block;
  margin-top: 1px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--s-muted);
}

/* Outline tag in the theme's wash + navy, not the sheet's black outline */
.tdc-sec__badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border: 1px solid var(--s-rule-c);
  background: var(--s-wash);
  color: var(--s-navy);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.5;
  text-transform: uppercase;
  white-space: nowrap;
}

.tdc-sec__badge .telugu,
.tdc-sec__badge-te {
  font-family: var(--s-te);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.3;
  text-transform: none;
}

.tdc-sec__badge--vrata {
  background: #f3ebe0;
}

.tdc-sec__badge--holiday {
  background: var(--s-yellow);
  border-color: #e0c060;
}

.tdc-sec__badge--pournami,
.tdc-sec__badge--amavasya {
  background: none;
  border: none;
  padding: 0;
  font-size: 22px;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1;
}

.tdc-sec__badge--pournami {
  color: #bfa000;
}

.tdc-sec__badge--amavasya {
  color: #404050;
}

/* Muhurtham rows put a time in the third column instead of a badge */
.tdc-sec__rtime {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--s-navy);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tdc-sec__empty {
  margin: 0;
  padding: 18px 14px;
  text-align: center;
  font-size: 14px;
  line-height: 1.6;
  color: var(--s-muted);
}

.tdc-sec__empty a {
  display: inline-block;
  margin-left: 4px;
  color: var(--s-maroon);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--s-maroon);
}

.tdc-sec__empty a:hover {
  background: var(--s-yellow);
}

.tdc-sec__empty a:focus-visible {
  outline: 2px solid var(--s-focus);
  outline-offset: 2px;
}

/* ── Two-up: month grid + moon phases ─────────────────────── */
.tdc-sec__split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  border: var(--s-rule);
  border-top: 0;
  background: var(--s-paper);
  box-shadow: 0 1px 0 rgba(122, 30, 46, 0.04);
}

.tdc-sec__pane {
  min-width: 0;
  border-right: var(--s-rule);
}

.tdc-sec__pane:last-child {
  border-right: 0;
}

/* Sub-head inside a pane: washed strip, a step quieter than the navy bar */
.tdc-sec__pane-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 2px solid var(--s-maroon);
  background: var(--s-navy);
  color: var(--s-cream);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.tdc-sec__pane-head .telugu {
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
}

.tdc-sec__pane-body {
  padding: 10px 12px 12px;
}

/* ── Month grid ───────────────────────────────────────────── */
.tdc-sec .month-calendar {
  width: 100%;
  border-collapse: separate;
  border-spacing: 1px;
  table-layout: fixed;
}

.tdc-sec .month-calendar th {
  padding: 4px 2px 6px;
  border-bottom: 2px solid var(--s-rule-c);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--s-muted);
}

/* Weekend column headers — warm accent so Sun/Sat are easy to spot */
.tdc-sec .month-calendar th:first-child,
.tdc-sec .month-calendar th:last-child {
  color: var(--s-maroon);
}

.tdc-sec .month-calendar td {
  padding: 1px;
  text-align: center;
  vertical-align: middle;
}

.tdc-sec .month-calendar td a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 100%;
  min-height: 36px;
  padding: 3px 2px;
  border: 0px solid transparent;
  border-radius: 0px;
  color: var(--s-ink);
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.tdc-sec .month-calendar td a:hover {
  background: var(--s-hover);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.tdc-sec .month-calendar td a:focus-visible {
  outline: 2px solid var(--s-focus);
  outline-offset: -2px;
  border-radius: 8px;
}

/* Weekend cells — subtle warm tint on Sun/Sat */
.tdc-sec .month-calendar td:first-child a,
.tdc-sec .month-calendar td:last-child a {
  color: #8b3535;
}

.tdc-sec .month-cal-day {
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* Festival days: golden accent with a small dot indicator at bottom */
.tdc-sec .month-calendar td.is-festival:not(.is-today) a {
  background: #fff7d6;
  border-color: transparent;
  border-radius: 0px;
  color: var(--s-ink);
}

.tdc-sec .month-calendar td.is-festival:not(.is-today) .month-cal-day {
  color: #5a3e00;
  font-weight: 700;
}

/* Festival dot — small amber accent below the number */
.tdc-sec .month-calendar td.is-festival:not(.is-today) a::after {
  content: '';
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #c8860a;
  margin-top: 2px;
}

/* Viewed day: outlined in maroon with a light fill */
.tdc-sec .month-calendar td.is-viewing a {
  border-color: var(--s-maroon);
  background: rgba(122, 30, 46, 0.06);
  font-weight: 700;
}

/* Today: maroon pill — the section's strongest emphasis */
.tdc-sec .month-calendar td.is-today a {
  background: #7a1e2e;
  border-color: var(--s-maroon);
  color: var(--s-cream);
  font-weight: 700;
}

.tdc-sec .month-calendar td.is-today .month-cal-day {
  color: var(--s-cream);
  font-size: 14px;
}

.tdc-sec .month-calendar td.is-empty {
  background: transparent;
}

.tdc-sec .month-cal-marks {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 5px;
}

.tdc-sec .month-cal-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

/* ── Month navigation row (prev/next month buttons) ──────── */
.tdc-sec__cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  border-bottom: var(--s-rule);
  background: var(--s-wash);
}

.tdc-sec__cal-nav-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--s-navy);
  letter-spacing: 0;
  min-width: 0;
  text-align: center;
  flex: 1;
}

.tdc-sec__cal-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--s-rule-c);
  border-radius: 6px;
  background: var(--s-paper);
  color: var(--s-navy);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  flex-shrink: 0;
  line-height: 1;
}

.tdc-sec__cal-nav-btn:hover {
  background: var(--s-navy);
  border-color: var(--s-navy);
  color: var(--s-cream);
}

.tdc-sec__cal-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ── Legend ────────────────────────────────────────────────── */
.tdc-sec__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font-size: 11px;
  color: var(--s-muted);
}

.tdc-sec__legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tdc-sec__swatch {
  width: 12px;
  height: 12px;
  border: 1px solid var(--s-rule-c);
  border-radius: 3px;
  flex-shrink: 0;
}

.tdc-sec__swatch--fest {
  background: #fff7d6;
  border-color: #e8c84a;
}

.tdc-sec__swatch--today {
  background: var(--s-maroon);
  border-color: var(--s-maroon);
  border-radius: 4px;
}

/* ── Moon phase list ──────────────────────────────────────── */
.tdc-sec .sidebar-moon-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tdc-sec .sidebar-moon-item {
  border-bottom: var(--s-hair);
}

.tdc-sec .sidebar-moon-item:last-child {
  border-bottom: 0;
}

.tdc-sec .sidebar-moon-item__link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 8px 0;
  color: inherit;
  text-decoration: none;
}

.tdc-sec .sidebar-moon-item__link:hover .sidebar-moon-item__type {
  text-decoration: underline;
  text-decoration-color: var(--s-maroon);
  text-underline-offset: 2px;
}

.tdc-sec .sidebar-moon-item__link:focus-visible {
  outline: 2px solid var(--s-focus);
  outline-offset: -2px;
}

.tdc-sec .sidebar-moon-item__icon {
  flex: 0 0 auto;
  color: var(--s-maroon);
}

.tdc-sec .sidebar-moon-item__main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.tdc-sec .sidebar-moon-item__type {
  font-size: 13.5px;
  font-weight: 700;
}

.tdc-sec .sidebar-moon-item__name {
  font-size: 12.5px;
  color: var(--s-muted);
}

.tdc-sec .sidebar-moon-item__date {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tdc-sec .sidebar-moon-item__weekday {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--s-muted);
}

.tdc-sec .sidebar-moon-more {
  margin: 10px 0 0;
  font-size: 12px;
}

.tdc-sec .sidebar-moon-more a {
  color: var(--s-maroon);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--s-maroon);
}

.tdc-sec .sidebar-moon-more a:hover {
  background: var(--s-yellow);
}

.tdc-sec .sidebar-moon-more a:focus-visible {
  outline: 2px solid var(--s-focus);
  outline-offset: 2px;
}

.tdc-sec .sidebar-moon-empty {
  margin: 0;
  font-size: 13px;
  color: var(--s-muted);
}

/* ── About + FAQ ──────────────────────────────────────────── */
.tdc-sec__prose {
  padding: 14px;
  font-size: 14.5px;
  line-height: 1.7;
}

.tdc-sec__prose p {
  margin: 0 0 10px;
}

.tdc-sec__prose p:last-child {
  margin-bottom: 0;
}

.tdc-sec__faq {
  border-top: var(--s-rule);
}

.tdc-sec__faq details {
  border-bottom: var(--s-hair);
}

.tdc-sec__faq details:last-child {
  border-bottom: 0;
}

.tdc-sec__faq summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  /* 13px vertical clears the 44px tap target at this line-height */
  padding: 13px 14px;
  list-style: none;
  cursor: pointer;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.4;
}

.tdc-sec__faq summary::-webkit-details-marker {
  display: none;
}

.tdc-sec__faq summary::after {
  content: "+";
  flex: 0 0 auto;
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
  color: var(--s-maroon);
}

.tdc-sec__faq details[open] summary {
  background: var(--s-wash);
}

.tdc-sec__faq details[open] summary::after {
  content: "–";
}

.tdc-sec__faq summary:hover {
  background: var(--s-hover);
}

.tdc-sec__faq summary:focus-visible {
  outline: 2px solid var(--s-focus);
  outline-offset: -2px;
}

.tdc-sec__faq details p {
  margin: 0;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--s-muted);
}

.tdc-sec__faq details p a {
  color: var(--s-maroon);
  font-weight: 600;
}

/* ── Data provenance panel ────────────────────────────────── */
.tdc-sec__data {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  border-top: var(--s-rule);
  background: var(--s-wash);
}

.tdc-sec__data-item {
  padding: 12px 14px;
  border-right: var(--s-hair);
}

.tdc-sec__data-item:last-child {
  border-right: 0;
}

.tdc-sec__data-label {
  display: block;
  margin-bottom: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--s-navy);
}

.tdc-sec__data-label .telugu {
  font-size: 11.5px;
  letter-spacing: 0;
  text-transform: none;
}

.tdc-sec__data-value {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
}

.tdc-sec__data-note {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--s-muted);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 720px) {
  .tdc-sec__split {
    grid-template-columns: minmax(0, 1fr);
  }

  .tdc-sec__pane {
    border-right: 0;
    border-bottom: var(--s-rule);
  }

  .tdc-sec__pane:last-child {
    border-bottom: 0;
  }

  .tdc-sec__data-item {
    border-right: 0;
    border-bottom: var(--s-hair);
  }

  .tdc-sec__data-item:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 480px) {
  .tdc-sec {
    --s-gap: 28px;
  }

  .tdc-sec__head {
    gap: 6px 12px;
    padding: 10px 12px;
  }

  .tdc-sec__row {
    grid-template-columns: 46px minmax(0, 1fr);
    row-gap: 5px;
    column-gap: 12px;
    padding: 10px 12px;
  }

  .tdc-sec__rday {
    font-size: 22px;
  }

  .tdc-sec__rname {
    font-size: 14px;
  }

  /* Badge / time drop under the name rather than squeezing the row */
  .tdc-sec__badge,
  .tdc-sec__rtime {
    grid-column: 2;
    justify-self: start;
  }

  .tdc-sec__title {
    font-size: 18px;
  }

  .tdc-sec__scope {
    font-size: 12px;
  }

  .tdc-sec__more {
    font-size: 11px;
  }
}

/* ── Print: the sheet prints alone; hide these ────────────── */
@media print {
  .tdc-sec {
    display: none !important;
  }
}

/* =========================================================================
 * Festivals — Telugu-first bilingual rows.
 *
 * Everything this block used to override (tokens, navy head, themed rows and
 * badges) is now the shared .tdc-sec default, so only what is genuinely
 * specific to festivals survives here: the stacked TE/EN name and the
 * centred empty state.
 * ========================================================================= */
.tdc-sec--festivals .tdc-sec__scope::before {
  content: "·";
  margin-right: 10px;
  opacity: 0.55;
}

.tdc-sec--festivals .tdc-sec__rname a {
  display: block;
}

.tdc-sec--festivals .tdc-sec__rname-en {
  font-size: 15px;
  font-weight: 600;
  color: var(--s-ink);
  line-height: 1.35;
}

.tdc-sec--festivals .tdc-sec__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 22px 16px;
}

.tdc-sec--festivals .tdc-sec__empty a {
  margin: 8px 0 0;
}
