/* The printed calendar (calendar.html). The page is paper in both themes: black,
   greys and one accent, so it reads the same printed in greyscale. The box is fixed
   in inches and the week rows flex, so a cell's content never sets a row's height. */

:root {
  --paper: #ffffff;
  --ink: #141414;
  --ink-2: #55544f;
  --ink-3: #8a8983;
  --rule: #bdbcb5;
  --out-bg: #f7f7f5;
  --cal-accent: #2a78d6;
  --key-tint: #dce8f9;
}

@page { size: letter landscape; margin: 0.4in; }

/* ---------- Screen: toolbar and a scaled preview of the paper ---------- */

.cal-toolbar { max-width: 1180px; margin: 0 auto; padding: 16px 16px 4px; }
.cal-toolbar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.cal-toolbar a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.month-nav { display: flex; align-items: center; gap: 2px; font-weight: 600; }
.month-nav span { min-width: 9.5em; text-align: center; }
.month-nav .btn { min-width: 40px; font-size: 1.2rem; line-height: 1; padding: 6px 10px; }
.cal-toolbar .hint { margin: 10px 0 0; }
.cal-empty { max-width: 560px; margin: 40px auto; padding: 0 16px; color: var(--text-2); }

/* --fit (set by js/calendar.js) shrinks the sheet to the window, phones included. */
.pages { zoom: var(--fit, 1); display: grid; justify-content: center; gap: 28px; padding: 18px 16px 56px; }
@media screen {
  .page { box-sizing: content-box; padding: 0.4in; box-shadow: 0 2px 16px rgba(0, 0, 0, 0.18); border-radius: 2px; }
}

/* ---------- The sheet ---------- */

.page {
  width: 10.2in; height: 7.7in; overflow: hidden;
  display: grid; grid-template-rows: auto 1fr auto; gap: 0.08in;
  background: var(--paper); color: var(--ink);
  font: 9pt/1.25 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  break-after: page;
  print-color-adjust: exact; -webkit-print-color-adjust: exact;
}

.page .page-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 0.25in;
  padding-bottom: 4pt; border-bottom: 1.5pt solid var(--ink);
}
.page h1 { display: inline; font-size: 14pt; font-weight: 750; margin-right: 8pt; }
.page .sport { font-size: 9pt; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); }
.page .legend { margin-left: 12pt; font-size: 8pt; color: var(--ink-2); }
.page .page-race { font-size: 10pt; color: var(--ink-2); text-align: right; }
.page .page-race b { color: var(--ink); }

/* Week label, seven days, week totals */
.page .cal {
  display: grid; grid-template-columns: 0.62in repeat(7, minmax(0, 1fr)) 1.02in;
  min-height: 0; border-left: 0.75pt solid var(--rule);
}
.page .cell {
  min-width: 0; min-height: 0; overflow: hidden; padding: 3pt 4pt;
  border-right: 0.75pt solid var(--rule); border-bottom: 0.75pt solid var(--rule);
}
.page .hd {
  padding: 2pt 4pt; border-top: 0.75pt solid var(--rule);
  font-size: 7.5pt; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2);
}
.page .wk { display: flex; flex-direction: column; gap: 2pt; font-size: 7.5pt; color: var(--ink-2); }
.page .wk .out { font-weight: 700; color: var(--ink); }
.page .wk .ph { text-transform: capitalize; }
.page .tot { display: flex; flex-direction: column; gap: 1.5pt; font-size: 7.5pt; color: var(--ink-2); }
.page .tot b { font-size: 8.5pt; color: var(--ink); }
.page .tot .nw { white-space: nowrap; }
.page .tot .vd { font-size: 7pt; font-weight: 750; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink); }

/* Days */
.page .cday { display: flex; flex-direction: column; gap: 2pt; }
.page .cday.out { background: var(--out-bg); }
.page .cday.key { background: var(--key-tint); box-shadow: inset 2.5pt 0 0 var(--cal-accent); }
.page .cday-top { display: flex; justify-content: space-between; align-items: baseline; }
.page .num { font-size: 9pt; font-weight: 750; }
.page .cday.today .num { color: var(--paper); background: var(--cal-accent); border-radius: 50%; min-width: 13pt; text-align: center; }
.page .cd { font-size: 7pt; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.page .badge {
  align-self: flex-start; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: var(--ink); color: var(--paper); font-weight: 700; font-size: 8pt; border-radius: 3pt; padding: 1pt 4pt;
}
.page .items { list-style: none; margin: 0; padding: 0; display: grid; gap: 2.5pt; }
.page .items li { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.page .items .key { font-weight: 700; }
/* In All sports each workout carries its sport's letter: R, P, B, S. */
.page .lt {
  display: inline-block; min-width: 8.5pt; margin-right: 2.5pt; padding: 0 1.5pt; border: 0.75pt solid var(--ink-2); border-radius: 2pt;
  font-size: 6.5pt; font-weight: 700; line-height: 1.25; text-align: center; color: var(--ink-2); vertical-align: 0.5pt;
}
.page .items .m { font-weight: 400; color: var(--ink-2); white-space: nowrap; }
.page .items .rest, .page .items .missed { color: var(--ink-3); }
.page .items .missed .m { color: var(--ink-3); }
.page .items .more { color: var(--ink-2); font-style: italic; }
.page .mark { display: inline-block; width: 7pt; height: 7pt; margin-right: 3pt; vertical-align: -0.5pt; }
.page .mark.box { border: 0.9pt solid var(--ink); border-radius: 1.5pt; }
.page .mark.circle { width: 6pt; height: 6pt; border: 0.9pt solid var(--ink-3); border-radius: 50%; }
.page .mark.tick { width: auto; height: auto; font-weight: 800; color: var(--cal-accent); }

.page .page-foot { display: grid; gap: 1pt; font-size: 9pt; color: var(--ink-2); }
.page .page-foot p { margin: 0; }
.page .page-foot p:last-child { color: var(--ink); font-weight: 650; }

/* ---------- Print ---------- */

@media print {
  .no-print { display: none !important; }
  body.calendar-page { background: none; }
  .pages { zoom: 1; display: block; padding: 0; }
  .page { box-shadow: none; padding: 0; border-radius: 0; }
  .page:last-child { break-after: auto; }
}
