/**
 * Daily calendar sheet — printed tear-off almanac page.
 *
 * Sole owner of the sheet, its date bar, and the print stylesheet.
 * Everything is scoped under .tdc-sheet / .tdc-bar so no other theme
 * stylesheet can collide with it. Do not add !important here — if a
 * rule needs it, something else is leaking in and should be removed
 * at the source instead.
 */

.tdc-sheet {
  --s-w: 820px;
  --s-ink: #111;
  --s-paper: #fff;
  --s-rule-w: 1px;
  --s-rule-c: #1a1a1a;
  --s-rule: var(--s-rule-w) solid var(--s-rule-c);
  --s-frame: 1.5px solid var(--s-rule-c);
  --s-yellow: #ffe14a;
  --s-muted: #555;
  --s-rasi-w: 196px;
  --s-pad: 8px;
  --s-display: "Anton", "Archivo Black", Impact, "Haettenschweiler", var(--font-sans, sans-serif);
  --s-te: var(--font-telugu, "Noto Sans Telugu", sans-serif);
  --s-sans: var(--font-sans, system-ui, sans-serif);

  box-sizing: border-box;
  max-width: var(--s-w);
  margin: 0 auto 28px;
  border: var(--s-frame);
  background: var(--s-paper);
  color: var(--s-ink);
  font-family: var(--s-sans);
  line-height: 1.3;
  transition: opacity 0.15s ease;
}

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

.tdc-sheet.is-loading {
  opacity: 0.5;
  pointer-events: none;
}

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

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

/* ── Hero date ─────────────────────────────────────────── */
.tdc-sheet__hero {
  padding: 14px 10px 10px;
  text-align: center;
}

.tdc-sheet__date {
  margin: 0;
  font-family: var(--s-display);
  font-size: clamp(3.4rem, 13vw, 7rem);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: 0.01em;
  color: var(--s-ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tdc-sheet__date-sep {
  padding: 0 0.06em;
}

.tdc-sheet__caption {
  margin: 8px 0 0;
  font-family: var(--s-te);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--s-ink);
}

/* ── Body grid: left stack + rasi column ───────────────── */
.tdc-sheet__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--s-rasi-w);
  grid-template-areas:
    "head   rasihead"
    "prose  rasi"
    "shubha rasi"
    "times  rasi"
    "extra  rasi";
  border-top: var(--s-frame);
}

/* No zodiac data for this date — collapse to a single column. */
.tdc-sheet__body:has(#cal-rasi-aside[hidden]) {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "head" "prose" "shubha" "times" "extra";
}

.tdc-sheet__body:has(#cal-rasi-aside[hidden]) .tdc-sheet__prose,
.tdc-sheet__body:has(#cal-rasi-aside[hidden]) .tdc-sheet__shubha,
.tdc-sheet__body:has(#cal-rasi-aside[hidden]) .tdc-sheet__times {
  border-right: 0;
}

/* ── Header strip ──────────────────────────────────────── */
.tdc-sheet__head {
  grid-area: head;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  border-bottom: var(--s-rule);
}

.tdc-sheet__hcell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  padding: 7px 6px;
  border-right: var(--s-rule);
  text-align: center;
}

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

.tdc-sheet__hlabel {
  font-family: var(--s-te);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
}

.tdc-sheet__hlabel .lang-en-only {
  font-family: var(--s-sans);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tdc-sheet__hvalue {
  font-family: var(--s-te);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
}

.tdc-sheet__hvalue .lang-en-only {
  font-family: var(--s-sans);
  font-size: 14px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.tdc-sheet__hnum {
  font-family: var(--s-display);
  font-size: 30px;
  font-weight: 400;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.tdc-sheet__adhika {
  font-family: var(--s-te);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* ── Panchang prose ────────────────────────────────────── */
.tdc-sheet__prose {
  grid-area: prose;
  padding: 9px 12px;
  border-right: var(--s-rule);
  border-bottom: var(--s-rule);
  font-family: var(--s-te);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.55;
  text-align: center;
}

.tdc-sheet__prose .lang-en-only {
  font-family: var(--s-sans);
  font-size: 14.5px;
}

/* Elements read as one flowing sentence, each kept unbreakable. */
.tdc-sheet__prose-item {
  display: inline;
  white-space: nowrap;
}

.tdc-sheet__prose-item + .tdc-sheet__prose-item::before {
  content: "  ";
  white-space: pre;
}

.tdc-sheet__prose-time {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.tdc-sheet__note {
  display: block;
  margin-top: 5px;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--s-muted);
}

.tdc-sheet__note .lang-en-only {
  font-family: var(--s-sans);
}

/* Festival chips under the hero date */
.tdc-sheet__festivals {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 10px;
  margin: 7px 0 0;
  padding: 0;
  list-style: none;
}

.tdc-sheet__festivals .cal-tear-festivals__item {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-size: 14px;
  font-weight: 700;
}

.tdc-sheet__festivals .cal-tear-festivals__name {
  color: inherit;
  text-decoration: none;
}

.tdc-sheet__festivals .cal-tear-festivals__name:hover {
  text-decoration: underline;
}

.tdc-sheet__festivals .cal-tear-festivals__name-te {
  font-family: var(--s-te);
}

.tdc-sheet__festivals .cal-tear-festivals__name-en {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--s-muted);
}

.tdc-sheet__festivals .cal-tear-festivals__badge {
  padding: 1px 6px;
  border: var(--s-rule);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.tdc-sheet__festivals .cal-tear-festivals__badge-te {
  font-family: var(--s-te);
  text-transform: none;
}

/* ── Shubha samayam line ───────────────────────────────── */
.tdc-sheet__shubha {
  grid-area: shubha;
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding: 7px 12px;
  border-right: var(--s-rule);
  border-bottom: var(--s-rule);
  font-size: 15px;
  text-align: center;
}

.tdc-sheet__shubha-label {
  font-family: var(--s-te);
  font-weight: 700;
}

.tdc-sheet__shubha-label .lang-en-only {
  font-family: var(--s-sans);
}

.tdc-sheet__shubha-val {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ── Timings strips ────────────────────────────────────── */
.tdc-sheet__times {
  grid-area: times;
  border-right: var(--s-rule);
}

.tdc-sheet__times--extra {
  grid-area: extra;
}

.tdc-sheet__times-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  border-bottom: var(--s-rule);
}

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

/* JS toggles .is-active on .cal-classic-timing-field when a window is live */
.tdc-sheet .cal-classic-timing-field {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: var(--s-rule);
}

.tdc-sheet .cal-classic-timing-field:last-child {
  border-right: 0;
}

.tdc-sheet__th {
  padding: 5px 4px 4px;
  border-bottom: var(--s-rule);
  font-family: var(--s-te);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.tdc-sheet__th .lang-en-only {
  font-family: var(--s-sans);
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.tdc-sheet .cal-classic-timing-table__cell {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  text-align: center;
}

.tdc-sheet .cal-classic-timing-table__time {
  font-family: var(--s-sans);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.tdc-sheet .cal-classic-timing-table__time.telugu,
.tdc-sheet .cal-classic-timing-table__time[lang="te"] {
  font-family: var(--s-te);
}

.tdc-sheet .cal-classic-timing-field.is-active {
  background: #fff8dc;
}

/* ── Rasi column ───────────────────────────────────────── */
.tdc-sheet__rasi-head {
  grid-area: rasihead;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 6px;
  border-bottom: var(--s-rule);
  font-family: var(--s-te);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}

.tdc-sheet__rasi-head .lang-en-only {
  font-family: var(--s-sans);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tdc-sheet__rasi {
  grid-area: rasi;
  display: flex;
  min-width: 0;
}

/* #cal-rasi-list is rebuilt by main.js — style the classes it emits. */
.tdc-sheet #cal-rasi-list {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Two columns so the separators line up down the list, as on the printed sheet. */
.tdc-sheet #cal-rasi-list li {
  display: grid;
  grid-template-columns: minmax(0, 5.9em) minmax(0, 1fr);
  column-gap: 7px;
  flex: 1 1 auto;
  align-items: baseline;
  min-height: 21px;
  padding: 2px 9px;
  font-size: 13.5px;
  line-height: 1.3;
}

.tdc-sheet #cal-rasi-list .cal-rname {
  display: flex;
  justify-content: space-between;
  gap: 3px;
  min-width: 0;
  font-family: var(--s-te);
  font-weight: 600;
}

.tdc-sheet #cal-rasi-list .cal-rname .lang-en-only {
  font-family: var(--s-sans);
}

.tdc-sheet #cal-rasi-list .cal-rname::after {
  content: ":";
  opacity: 0.65;
}

.tdc-sheet #cal-rasi-list .cal-rword {
  min-width: 0;
  max-width: none;
  font-family: var(--s-te);
  font-weight: 600;
  text-align: left;
  color: var(--s-ink);
  word-break: break-word;
}

.tdc-sheet #cal-rasi-list .cal-rword .lang-en-only {
  font-family: var(--s-sans);
}

/* main.js injects a zodiac glyph on non-classic skins; not used here. */
.tdc-sheet #cal-rasi-list .vd-rasi__icon,
.tdc-sheet #cal-rasi-list .vd-rasi__sep {
  display: none;
}

/* ── Yellow quote footer ───────────────────────────────── */
.tdc-sheet__quote {
  margin: 0;
  padding: 7px 12px;
  border-top: var(--s-frame);
  background: var(--s-yellow);
  font-family: var(--s-te);
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

.tdc-sheet__quote .lang-en-only {
  font-family: var(--s-sans);
}

.tdc-sheet__quote-cite {
  font-size: 12px;
  font-weight: 500;
  font-style: normal;
  opacity: 0.75;
}

/* ── Empty state ───────────────────────────────────────── */
.tdc-sheet__empty {
  margin: 0;
  padding: 24px 16px;
  text-align: center;
  font-size: 15px;
  color: var(--s-muted);
}

/* ── Date bar (above the sheet) ────────────────────────── */
.cal-date-bar.tdc-bar,
.tdc-bar {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  max-width: var(--tdc-bar-w, 820px);
  margin: 0 auto 14px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.tdc-bar.is-loading {
  opacity: 0.6;
}

.tdc-bar__btn,
.tdc-bar__date {
  box-sizing: border-box;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--dc-line, #d4c4a8);
  border-radius: 0;
  background: var(--dc-card, #fffdf6);
  color: var(--dc-navy, #12355b);
  font-family: var(--dc-sans, "Roboto", system-ui, sans-serif);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.tdc-bar__date {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 320px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--dc-ink, #1a1a1a);
  border-color: var(--dc-navy, #12355b);
}

.tdc-bar__btn:hover,
.tdc-bar__date:hover {
  background: rgba(122, 30, 46, 0.06);
  color: var(--dc-maroon, #7a1e2e);
  border-color: var(--dc-maroon, #7a1e2e);
}

.tdc-bar__btn:focus-visible,
.tdc-bar__date:focus-visible {
  outline: 2px solid var(--dc-maroon, #7a1e2e);
  outline-offset: 2px;
}

.tdc-bar__today {
  background: var(--dc-maroon, #7a1e2e);
  border-color: var(--dc-maroon, #7a1e2e);
  color: var(--dc-cream, #fffdf6);
}

.tdc-bar__today:hover {
  background: var(--dc-burgundy-dark, #611723);
  border-color: var(--dc-burgundy-dark, #611723);
  color: var(--dc-cream, #fffdf6);
}

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

.tdc-bar .telugu,
.tdc-bar [lang="te"],
.tdc-bar .lang-te-only {
  font-family: var(--dc-te, "Noto Sans Telugu", sans-serif);
  font-weight: 600;
}

/* Jump form stays in the DOM for SPA sync but is not shown. */
.tdc-bar__jump {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  pointer-events: none;
}

/*
 * The sheet's rail. Content settles at exactly 820px so the sheet and the
 * .tdc-sec sections below share one edge, with a page inset that keeps both
 * off the screen edge on narrow viewports. Owned here rather than by the
 * shared page rail so the two cannot drift apart.
 */
.cal-home-sheet__calendar,
#today.cal-home-sheet__calendar {
  box-sizing: border-box;
  max-width: calc(820px + 2 * var(--dc-pad-x, 20px));
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--dc-pad-x, 20px);
  padding-right: var(--dc-pad-x, 20px);
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 640px) {
  .tdc-sheet {
    --s-pad: 6px;
  }

  .tdc-sheet__body,
  .tdc-sheet__body:not(:has(.tdc-sheet__rasi)) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "prose" "shubha" "times" "extra" "rasihead" "rasi";
  }

  .tdc-sheet__prose,
  .tdc-sheet__shubha,
  .tdc-sheet__times {
    border-right: 0;
  }

  .tdc-sheet__rasi-head {
    border-top: var(--s-rule);
    border-bottom: var(--s-rule);
  }

  /* Two-up zodiac grid so the list stays compact on phones. */
  .tdc-sheet #cal-rasi-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .tdc-sheet #cal-rasi-list li {
    min-height: 26px;
    padding: 3px 8px;
  }

  .tdc-sheet #cal-rasi-list li:nth-child(odd) {
    border-right: var(--s-rule);
  }

  .tdc-sheet__prose {
    font-size: 15px;
  }

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

  .tdc-sheet__th .lang-en-only {
    font-size: 10px;
  }

  .tdc-sheet .cal-classic-timing-table__time {
    font-size: 12px;
  }

  .tdc-bar__btn-label {
    display: none;
  }

  .tdc-bar__btn {
    padding: 0 10px;
  }
}

@media (max-width: 420px) {
  .tdc-sheet__hcell {
    padding: 5px 3px;
  }

  .tdc-sheet__hlabel {
    font-size: 13px;
  }

  .tdc-sheet__hvalue {
    font-size: 15px;
  }

  .tdc-sheet__hnum {
    font-size: 24px;
  }

  .tdc-sheet .cal-classic-timing-table__time {
    font-size: 11px;
  }
}

/* ── Print: the sheet alone, on one page ───────────────── */
@media print {
  .tdc-bar,
  .cal-home-jump,
  .site-header,
  .site-footer,
  .utility-bar,
  .sidebar,
  .home-sheet-body,
  .ad-slot,
  .mp-top-bar,
  .dc-info-strip,
  .vr-ticker,
  .page-layout--home-sheet > :not(.cal-home-sheet),
  .cal-home-sheet > :not(.cal-home-sheet__calendar):not(.home-sheet-body) {
    display: none !important;
  }

  body,
  body.home {
    background: #fff !important;
  }

  .page-layout--home-sheet,
  .cal-home-sheet,
  .cal-home-sheet__calendar {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    visibility: visible !important;
  }

  .tdc-sheet {
    max-width: none;
    margin: 0;
    border-color: #000;
  }

  .tdc-sheet__quote {
    background: var(--s-yellow);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tdc-sheet,
  .tdc-bar__btn,
  .tdc-bar__date {
    transition: none;
  }
}
