/**
 * Dashboard template styles — faithful port of the reference dashboard
 * (dryvemarketingllc.github.io/talmud-daily/dashboard.html).
 *
 * Every rule is scoped under `.td-page .td-dash` so the generic reference class
 * names (.today, .filters, .week, .chip, .dot, …) never leak to other pages.
 * Enqueued only on the Dashboard template (see lib/dashboard.php).
 */

/* PAGE HEADER */
.td-page .td-dash .page-header {
  max-width: 1240px;
  margin: 0 auto;
  padding: 56px 48px 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
  gap: 48px;
  align-items: end;
  border-bottom: 1px solid var(--rule);
}
.td-page .td-dash .page-header .title-block .kicker {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--burgundy);
  font-weight: 600;
  margin-bottom: 16px;
}
.td-page .td-dash .page-header h1 {
  font-family: var(--serif);
  font-size: clamp(46px, 5.6vw, 74px);
  font-weight: 400;
  line-height: 1.0;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin-bottom: 16px;
}
.td-page .td-dash .page-header h1 em { font-style: italic; }
.td-page .td-dash .page-header .lede {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.4;
  color: var(--muted);
  max-width: 46ch;
}
.td-page .td-dash .page-header .progress-block {
  min-width: 300px;
  padding-bottom: 6px;
}
.td-page .td-dash .progress-block .stat {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 10px;
}
.td-page .td-dash .progress-block .stat em {
  color: var(--burgundy);
  font-style: normal;
  font-weight: 700;
}
.td-page .td-dash .progress-block .bar {
  height: 6px;
  background: var(--rule);
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
}
.td-page .td-dash .progress-block .bar-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  background: var(--burgundy);
}
.td-page .td-dash .progress-block .caption {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--muted);
}

/* TODAY CARD */
.td-page .td-dash .today {
  max-width: 1240px;
  margin: 0 auto;
  padding: 40px 48px 0;
}
.td-page .td-dash .today .today-band {
  background: var(--burgundy);
  color: var(--paper);
  position: relative;
  overflow: hidden;
  padding: 40px 48px;
  display: flex;
  align-items: center;
  gap: 48px;
  flex-wrap: wrap;
}
.td-page .td-dash .today .today-band .td-watermark {
  position: absolute;
  right: -60px; top: 50%;
  transform: translateY(-50%);
  width: 380px; height: 470px;
  background: url("../images/talmud-daily/monogram-cream.svg") no-repeat center/contain;
  opacity: 0.07;
  pointer-events: none;
}
.td-page .td-dash .today .today-copy { position: relative; z-index: 1; flex: 1 1 60%; min-width: 0; }
.td-page .td-dash .today .today-eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--sage);
  font-weight: 600;
  margin-bottom: 12px;
}
.td-page .td-dash .today .today-title {
  font-family: var(--serif);
  font-size: clamp(30px, 3.4vw, 44px);
  line-height: 1.05;
  color: var(--paper);
  margin-bottom: 12px;
}
.td-page .td-dash .today .today-title em { font-style: italic; }
.td-page .td-dash .today .today-cta {
  position: relative; z-index: 1;
  background: var(--paper);
  color: var(--burgundy);
  border: none;
  padding: 20px 34px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}
.td-page .td-dash .today .today-cta:hover { background: var(--sage); color: var(--ink); }
.td-page .td-dash .today .today-cta svg { width: 14px; height: 14px; }

/* FILTERS */
.td-page .td-dash .filters {
  max-width: 1240px;
  margin: 0 auto;
  padding: 40px 48px 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.td-page .td-dash .filters .filter-label {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-right: 8px;
}
.td-page .td-dash .chip {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--rule);
  padding: 9px 16px;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.15s;
  white-space: nowrap;
}
.td-page .td-dash .chip:hover { color: var(--burgundy); border-color: var(--burgundy); }
.td-page .td-dash .chip.active {
  background: var(--burgundy);
  color: var(--paper);
  border-color: var(--burgundy);
}

/* DASHBOARD LIST */
.td-page .td-dash .dashboard {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 48px 96px;
}

/* SEDER SECTION HEADER */
.td-page .td-dash .seder-block { margin-bottom: 56px; }
.td-page .td-dash .seder-block:last-child { margin-bottom: 0; }
.td-page .td-dash .seder-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 32px;
  align-items: baseline;
  padding: 16px 0 12px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 4px;
}
.td-page .td-dash .seder-head .h-label {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--burgundy);
  font-weight: 600;
}
.td-page .td-dash .seder-head .h-title {
  font-family: var(--serif);
  font-size: 28px;
  color: var(--ink);
  line-height: 1.05;
}
.td-page .td-dash .seder-head .h-title .translation {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  margin-left: 12px;
  vertical-align: 4px;
}
.td-page .td-dash .seder-head .h-meta {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
}
.td-page .td-dash .seder-head .h-meta em { color: var(--burgundy); font-style: normal; font-weight: 700; }

/* WEEK CARD (collapsible) */
.td-page .td-dash details.week {
  border-bottom: 1px solid var(--rule);
}
.td-page .td-dash details.week > summary {
  list-style: none;
  cursor: pointer;
  padding: 22px 0;
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) auto auto 24px;
  align-items: center;
  gap: 32px;
  transition: color 0.15s;
}
.td-page .td-dash details.week > summary::-webkit-details-marker { display: none; }
.td-page .td-dash details.week > summary:hover .wk-title { color: var(--burgundy); }

.td-page .td-dash .wk-num {
  font-family: var(--serif);
  font-style: italic;
  font-size: 20px;
  color: var(--sage);
  line-height: 1;
}
.td-page .td-dash .wk-title-block { min-width: 0; }
.td-page .td-dash .wk-title {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 3px;
  transition: color 0.15s;
}
.td-page .td-dash .wk-title em { font-style: italic; }
.td-page .td-dash .wk-sub {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.06em;
}
.td-page .td-dash .wk-sub .sep { color: var(--rule); margin: 0 8px; }
/*
 * Empty and hidden until the learner's own state arrives, so it costs an
 * anonymous visitor nothing and shifts no layout when it appears.
 */
.td-page .td-dash .wk-sub .wk-progress { color: var(--complete); font-weight: 600; }
.td-page .td-dash .wk-sub .wk-progress::before { content: "·"; color: var(--rule); margin: 0 8px; font-weight: 400; }
.td-page .td-dash .wk-dates {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
  white-space: nowrap;
}
.td-page .td-dash .wk-dots {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.td-page .td-dash .wk-dots .dot {
  display: block;
  flex: 0 0 auto;
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: transparent;
  box-sizing: border-box;
}
/*
 * Four status colours, in precedence order. Completed wins over everything,
 * including the current lesson: once a learner has finished today's lesson,
 * "you did it" is the more useful thing for the page to be saying.
 *
 *   completed  → --complete (#557A2F)   added by the learner's own browser
 *   current    → --burgundy (#500e0f)   the lesson the programme has reached
 *   available  → --sage     (#a7a885)   released, not yet finished
 *   locked     → empty                  not released
 *
 * Colour is never the only signal: every dot carries a `title` naming its
 * state, and the row beside it says the same thing in words.
 */
.td-page .td-dash .wk-dots .dot.is-available {
  background: var(--sage);
  border-color: var(--sage);
}
.td-page .td-dash .wk-dots .dot.is-current {
  background: var(--burgundy);
  border-color: var(--burgundy);
}
.td-page .td-dash .wk-dots .dot.is-completed {
  background: var(--complete);
  border-color: var(--complete);
}
/* Locked keeps the default: a hairline ring over the page, and no fill. */
.td-page .td-dash .wk-caret {
  color: var(--burgundy);
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1;
  text-align: center;
  transition: transform 0.2s;
}
.td-page .td-dash details.week[open] .wk-caret { transform: rotate(180deg); }

/* Current week emphasis */
.td-page .td-dash details.week.current > summary {
  background: linear-gradient(90deg, rgba(80,14,15,0.06) 0%, rgba(80,14,15,0) 100%);
  margin: 0 -12px;
  padding-left: 12px;
  padding-right: 12px;
}
.td-page .td-dash details.week.current .wk-num { color: var(--burgundy); }
.td-page .td-dash .current-flag {
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.28em;
  color: var(--burgundy);
  font-weight: 700;
  background: rgba(80,14,15,0.1);
  padding: 3px 8px;
  display: inline-block;
  margin-left: 10px;
  vertical-align: 3px;
}

/* Completed week — subtle */
.td-page .td-dash details.week.done > summary .wk-title { color: var(--muted); }
.td-page .td-dash details.week.done .wk-num { opacity: 0.65; }

/* Future week — very subtle */
.td-page .td-dash details.week.future > summary .wk-title { color: var(--muted); }
.td-page .td-dash details.week.future .wk-num { opacity: 0.55; }
.td-page .td-dash details.week.future .wk-dates { color: var(--muted); }

/* Expanded body */
.td-page .td-dash .wk-body {
  padding: 4px 0 28px 122px;
}
.td-page .td-dash .wk-body .ep-row {
  display: grid;
  grid-template-columns: 44px 88px minmax(0, 1fr) 22px;
  gap: 24px;
  padding: 14px 0;
  border-top: 1px dotted var(--rule);
  text-decoration: none;
  color: inherit;
  align-items: baseline;
}
.td-page .td-dash .wk-body .ep-row:first-child { border-top: none; padding-top: 8px; }
.td-page .td-dash .wk-body .ep-row:hover .ep-title { color: var(--burgundy); }
.td-page .td-dash .wk-body .ep-row .day-no {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  color: var(--sage);
  line-height: 1;
  white-space: nowrap;
}
.td-page .td-dash .wk-body .ep-row .weekday {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.4;
}
.td-page .td-dash .wk-body .ep-row .weekday .date {
  color: var(--muted);
  display: block;
  font-size: 10px;
  letter-spacing: 0.14em;
  margin-top: 2px;
}
.td-page .td-dash .wk-body .ep-row .ep-title {
  font-family: var(--serif);
  font-size: 19px;
  color: var(--ink);
  line-height: 1.25;
  margin-bottom: 2px;
  transition: color 0.15s;
}
.td-page .td-dash .wk-body .ep-row .ep-title em { font-style: italic; }
.td-page .td-dash .wk-body .ep-row .check {
  color: var(--complete);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 4px;
}
.td-page .td-dash .wk-body .ep-row .check svg { width: 15px; height: 15px; }

/* Today row inside expanded week */
.td-page .td-dash .wk-body .ep-row.is-today {
  background: linear-gradient(90deg, rgba(80,14,15,0.06) 0%, rgba(80,14,15,0) 100%);
  margin: 0 -12px;
  padding-left: 12px;
  padding-right: 12px;
  border-bottom: 1px solid var(--burgundy);
}
.td-page .td-dash .wk-body .ep-row.is-today .day-no { color: var(--burgundy); font-style: italic; }
.td-page .td-dash .today-badge {
  display: inline-block;
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.24em;
  color: var(--burgundy);
  font-weight: 700;
  background: rgba(80,14,15,0.1);
  padding: 2px 7px;
  margin-right: 8px;
  vertical-align: 2px;
}

/* Future / placeholder episode row (no title yet) */
.td-page .td-dash .wk-body .ep-row.placeholder .ep-title {
  color: var(--muted);
  font-style: italic;
  opacity: 0.75;
}
.td-page .td-dash .wk-body .ep-row.placeholder .day-no,
.td-page .td-dash .wk-body .ep-row.placeholder .weekday { opacity: 0.55; }

/* Empty state note when a week has no titles yet */
.td-page .td-dash .wk-body .titles-note {
  font-family: var(--serif);
  font-style: italic;
  color: var(--muted);
  font-size: 14px;
  padding: 8px 0 4px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.td-page .td-dash .wk-body .titles-note::before {
  content: "";
  width: 24px; height: 1px;
  background: var(--rule);
  display: inline-block;
}

/* Locked (not-yet-released) episodes — not clickable */
.td-page .td-dash .wk-body .ep-row.is-locked { cursor: default; }
.td-page .td-dash .wk-body .ep-row.is-locked .ep-title { color: var(--muted); }
.td-page .td-dash .wk-body .ep-row.is-locked:hover .ep-title { color: var(--muted); }
.td-page .td-dash .wk-body .ep-row.is-locked .day-no { opacity: 0.7; }
.td-page .td-dash .wk-body .ep-row.is-locked .check { color: var(--rule); }

/* Disabled "today" CTA when the featured episode isn't live yet */
.td-page .td-dash .today .today-cta.is-disabled {
  background: rgba(234,226,208,0.18);
  color: var(--sage);
  cursor: default;
}
.td-page .td-dash .today .today-cta.is-disabled:hover {
  background: rgba(234,226,208,0.18);
  color: var(--sage);
}

/* JUMP ellipsis between sections */
.td-page .td-dash .jump {
  margin: 44px 0;
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  color: var(--muted);
  font-size: 15px;
  position: relative;
}
.td-page .td-dash .jump::before, .td-page .td-dash .jump::after {
  content: "";
  position: absolute;
  top: 50%;
  width: calc(50% - 220px);
  height: 1px;
  background: var(--rule);
}
.td-page .td-dash .jump::before { left: 0; }
.td-page .td-dash .jump::after { right: 0; }

/* RESPONSIVE */
@media (max-width: 900px) {
  .td-page .td-dash .page-header,
  .td-page .td-dash .today,
  .td-page .td-dash .filters,
  .td-page .td-dash .dashboard { padding-left: 24px; padding-right: 24px; }
  .td-page .td-dash .page-header { grid-template-columns: 1fr; gap: 28px; }
  .td-page .td-dash .page-header .progress-block { min-width: 0; }
  .td-page .td-dash .today .today-band { padding: 28px 24px; gap: 20px; }
  .td-page .td-dash details.week > summary {
    grid-template-columns: 60px minmax(0, 1fr) 24px;
    gap: 18px;
    padding: 18px 0;
  }
  /*
   * The dates and the status dots each get a row of their own. They shared one
   * cell, and drew on top of each other — which mattered little when the dots
   * were decoration, and matters a great deal now that they are how a learner
   * reads which lessons they have finished.
   */
  .td-page .td-dash .wk-dates { grid-column: 2; grid-row: 2; margin-top: 4px; }
  .td-page .td-dash .wk-dots { grid-column: 2; grid-row: 3; margin-top: 8px; }
  .td-page .td-dash .wk-body { padding-left: 78px; }
  .td-page .td-dash .wk-body .ep-row {
    grid-template-columns: 36px 68px minmax(0, 1fr) 22px;
    gap: 14px;
  }
  .td-page .td-dash .wk-body .ep-row .ep-title { font-size: 17px; }
  .td-page .td-dash .seder-head { grid-template-columns: 1fr; gap: 8px; }
  .td-page .td-dash .seder-head .h-meta { text-align: left; }
}

/*
 * On a phone the episode row ran out of width: the indent, the day number, the
 * weekday, and the tick left the title about ninety pixels, so it wrapped one
 * word per line. The meta keeps the first line and the title takes a full-width
 * second one.
 */
@media (max-width: 560px) {
  .td-page .td-dash .wk-body { padding-left: 0; }
  .td-page .td-dash .wk-body .ep-row {
    grid-template-columns: 40px minmax(0, 1fr) 22px;
    row-gap: 6px;
    column-gap: 12px;
  }
  .td-page .td-dash .wk-body .ep-row .weekday { grid-column: 2; grid-row: 1; }
  .td-page .td-dash .wk-body .ep-row .check { grid-column: 3; grid-row: 1; padding-top: 0; }
  .td-page .td-dash .wk-body .ep-row .ep-copy { grid-column: 1 / -1; grid-row: 2; }
}
