/*
  Printable Calendar. Loaded after the PDF tools' stylesheet (../pdf_tools/app.css),
  whose segmented switches, fields, checkboxes and steps it shares. Plain CSS, not
  built by Tailwind; the tool's colours come from the site's theme tokens. The
  calendar pages (.pc-sheet) are paper: ink on white in any theme, sized in
  inches so the preview and the printout are the same page.
*/

/* ---- The tool ---- */

.pc-app {
  --pdft-line: var(--color-base-300);
  --pdft-accent: var(--color-primary);
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}
.pc-app [hidden] { display: none !important; }
/* On phones the preview and its Print button come first; the settings follow. */
@media (max-width: 59.99rem) { .pc-view { order: -1; } }
@media (min-width: 60rem) {
  .pc-app { grid-template-columns: minmax(19rem, 23rem) minmax(0, 1fr); }
  .pc-view { position: sticky; top: 5.5rem; }
}

.pc-panel {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--pdft-line);
  border-radius: 0.875rem;
  background: var(--color-base-100);
}
@media (min-width: 40rem) { .pc-panel { padding: 1.25rem; } }

.pc-section { display: flex; flex-direction: column; gap: 0.85rem; min-width: 0; margin: 0; padding: 1rem 0 0; border: 0; border-top: 1px solid var(--pdft-line); }
.pc-section:first-child { padding-top: 0; border-top: 0; }
.pc-legend { float: left; width: 100%; padding: 0; font-size: 0.9375rem; font-weight: 650; }
.pc-legend + * { clear: both; }

.pc-year-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.pc-year-input { width: 6.25rem; font-variant-numeric: tabular-nums; }
.pc-year-input[aria-invalid="true"] { border-color: var(--color-error); }
.pc-chip[aria-pressed="true"] { background: var(--color-base-content); border-color: var(--color-base-content); color: var(--color-base-100); }
.pc-error { font-size: 0.8125rem; color: var(--color-error); }
.pc-error:empty { display: none; }

.pc-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 0.75rem; align-items: start; }
.pc-checks { display: flex; flex-direction: column; gap: 0.6rem; }
.pc-checks .pdft-check { align-items: center; font-size: 0.875rem; }
.pc-checks .pdft-check input { margin-top: 0; }
.pc-seg span { display: flex; align-items: center; justify-content: center; min-height: 2rem; }

.pc-inks { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pc-ink { position: relative; cursor: pointer; }
.pc-ink input { position: absolute; opacity: 0; pointer-events: none; }
.pc-ink span {
  display: block;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--swatch);
  border: 3px solid var(--color-base-100);
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--color-base-content) 30%, transparent);
}
.pc-ink input:checked + span { box-shadow: 0 0 0 2px var(--color-base-content); }
.pc-ink input:focus-visible + span { outline: 2px solid var(--pdft-accent); outline-offset: 3px; }

.pc-view { display: flex; flex-direction: column; gap: 0.75rem; min-width: 0; }
.pc-stage {
  display: flex;
  justify-content: center;
  min-height: 12rem;
  padding: 1rem;
  overflow: hidden;
  border-radius: 0.875rem;
  background: var(--color-base-200);
}
@media (max-width: 39.99rem) { .pc-stage { padding: 0.6rem; } }
.pc-scaler { position: relative; flex: none; box-shadow: 0 1px 3px rgb(0 0 0 / 0.14), 0 8px 24px rgb(0 0 0 / 0.08); }
.pc-scaler > .pc-sheet { position: absolute; top: 0; left: 0; transform-origin: top left; }
.pc-loading { align-self: center; color: var(--muted); }
.pc-app.is-ready .pc-loading { display: none; }

.pc-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; }
.pc-pager { display: flex; align-items: center; gap: 0.35rem; font-size: 0.875rem; }
.pc-pager span { min-width: 0; }
.pc-status, .pc-notice { font-size: 0.875rem; color: var(--muted); }
.pc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.pc-actions .btn { gap: 0.4rem; }

/* ---- Page copy below the tool ---- */

.pc-sets { display: grid; gap: 1rem; margin-top: 1.25rem; }
@media (min-width: 40rem) { .pc-sets { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pc-set { padding: 1.1rem 1.2rem; border: 1px solid var(--color-base-300); border-radius: 0.875rem; background: var(--color-base-100); }
.pc-set h3 { font-weight: 650; }
.pc-set ul { display: grid; gap: 0.3rem; margin: 0.75rem 0 0; padding: 0; list-style: none; font-size: 0.875rem; line-height: 1.4; }
.pc-set li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 0.75rem; }
.pc-set li span:last-child { color: var(--muted); }
.pc-set p { margin-top: 0.75rem; font-size: 0.8125rem; line-height: 1.5; color: var(--muted); }
.pc-set .pc-kind { margin-top: 0.15rem; }

/* ---- Calendar pages (preview and print) ---- */

.pc-sheet {
  --line: #c4c4cb;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 0.16in;
  width: var(--w);
  height: var(--h);
  padding: 0.45in;
  overflow: hidden;
  background: #fff;
  color: #1d1b22;
  font-family: "Archivo", Arial, Helvetica, sans-serif;
  font-size: 9pt;
  line-height: 1.2;
  text-align: left;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.pc-sheet *, .pc-sheet *::before, .pc-sheet *::after { box-sizing: border-box; }
/* No weight of its own, so the page's classes below set the type. */
.pc-sheet :where(h2, h3, p, ul) { margin: 0; padding: 0; font: inherit; }

/* The year on one page */
.pc-year-head { display: flex; flex: none; align-items: baseline; justify-content: space-between; gap: 0.3in; padding-bottom: 0.05in; border-bottom: 2pt solid var(--ink); }
.pc-year-title { font-size: 36pt; font-weight: 800; line-height: 1; letter-spacing: -0.01em; color: var(--ink); }
.pc-year-sub { font-size: 8pt; color: #62626c; }
.pc-year-months {
  display: grid;
  flex: 1;
  min-height: 0;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows), minmax(0, 1fr));
  gap: 0.14in 0.3in;
}

.pc-mini, .pc-thumb { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pc-mini-name { flex: none; padding-bottom: 0.03in; font-size: 11pt; font-weight: 700; color: var(--ink); }
.pc-mini-grid {
  display: grid;
  flex: 1;
  min-height: 0;
  grid-template-columns: repeat(var(--c), minmax(0, 1fr));
  grid-template-rows: auto repeat(6, minmax(0, 1fr));
  font-size: 8.5pt;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.pc-mini-grid > span { display: flex; align-items: center; justify-content: center; min-height: 0; }
.pc-mini-dow { padding: 0.02in 0; border-bottom: 0.75pt solid var(--ink); font-size: 6.5pt; font-weight: 700; color: #55555f; }
.pc-mini-wk { font-size: 6pt; color: #8b8b95; }
.pc-mini-dow.pc-mini-wk { font-size: 5.5pt; font-weight: 600; }
.shade-weekends .pc-mini-day.is-weekend { background: var(--soft); }
.pc-mini-day.is-hol > span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75em;
  height: 1.75em;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
}

.pc-hol-list { flex: none; padding-top: 0.06in; border-top: 0.75pt solid var(--line); }
.pc-hol-list ul { columns: var(--hcols); column-gap: 0.3in; list-style: none; font-size: 7.5pt; line-height: 1.4; }
.pc-hol-list li { break-inside: avoid; }
.pc-hol-list b { display: inline-block; min-width: 3.7em; font-weight: 700; color: var(--ink); }

/* A month per page */
.pc-month-head { display: flex; flex: none; align-items: flex-end; justify-content: space-between; gap: 0.3in; }
.pc-month-title { font-size: 30pt; line-height: 1; white-space: nowrap; color: var(--ink); }
.pc-month-name { font-weight: 800; letter-spacing: -0.01em; }
.pc-month-year { font-weight: 400; }
.pc-thumbs { display: flex; flex: none; gap: 0.22in; }
.pc-thumb { width: 1.3in; height: 0.95in; }
.pc-thumb .pc-mini-name { padding-bottom: 0.02in; font-size: 6.5pt; }
.pc-thumb .pc-mini-grid { font-size: 5.5pt; }
.pc-thumb .pc-mini-dow { border-bottom-width: 0.5pt; font-size: 5pt; }
.pc-thumb .pc-mini-wk { font-size: 4.5pt; }

.pc-month-grid {
  display: grid;
  flex: 1;
  min-height: 0;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: 0.27in repeat(var(--rows), minmax(0, 1fr));
  border-left: 0.75pt solid var(--line);
}
.pc-month-grid.has-wk { grid-template-columns: 0.3in repeat(7, minmax(0, 1fr)); }
.pc-dow {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-right: 0.75pt solid var(--ink);
  background: var(--ink);
  color: #fff;
  font-size: 8pt;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}
.pc-dow.pc-wk-head { font-size: 6.5pt; letter-spacing: 0.02em; }
.pc-day, .pc-wk { min-width: 0; min-height: 0; overflow: hidden; border-right: 0.75pt solid var(--line); border-bottom: 0.75pt solid var(--line); }
.pc-day { display: flex; flex-direction: column; justify-content: space-between; gap: 0.03in; padding: 0.05in 0.07in; }
.shade-weekends .pc-day.is-weekend { background: var(--soft); }
.pc-num { font-size: 13pt; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.pc-day.is-hol .pc-num { color: var(--ink); }
.pc-hol { font-size: 6.5pt; font-weight: 600; line-height: 1.15; color: var(--ink); overflow-wrap: anywhere; }
.pc-wk { display: flex; justify-content: center; padding-top: 0.07in; font-size: 7pt; font-variant-numeric: tabular-nums; color: #8b8b95; }
.is-portrait .pc-num { font-size: 12pt; }

.pc-notes { display: flex; flex: none; flex-direction: column; justify-content: space-between; height: 0.95in; }
.pc-notes-label { font-size: 7.5pt; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink); }
.pc-notes-line { display: block; height: 0; border-bottom: 0.75pt solid var(--line); }

/* ---- Printing: app.js fills .pc-print with every page and sets @page to the paper size. ---- */

.pc-print { display: none; }
@media print {
  html, body { margin: 0 !important; padding: 0 !important; background: #fff !important; }
  body > *:not(.pc-print) { display: none !important; }
  .pc-print { display: block; }
  .pc-print .pc-sheet { break-after: page; page-break-after: always; }
  .pc-print .pc-sheet:last-child { break-after: auto; page-break-after: auto; }
}
