/* CALENDA (asset-design-brief/1, docs/DESIGN-BRIEF.md): a French practical almanac. Ink on paper, rules instead of cards,
   holiday red only where a date is a holiday, serif headings and figures, tabular numerals. No external font. */
:root {
  --paper: #fbfaf7;
  --ink: #1b1a17;
  --muted: #5b5850;
  --rule: #d6d1c6;
  --red: #a8251c;
  --link: #1d4f7a;
  --field: #ffffff;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #171612; --ink: #ece8de; --muted: #aba596; --rule: #3b382f; --red: #f0897d; --link: #9fc5ea; --field: #1f1e19; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.55 var(--sans); font-variant-numeric: lining-nums; }
header, main, footer { max-width: 46rem; margin: 0 auto; padding: 0 1rem; }

/* The masthead: the title and the index, over a double rule. */
header { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; align-items: baseline; justify-content: space-between; padding-top: 1.25rem; padding-bottom: 0.5rem; border-bottom: 3px double var(--ink); }
.brand { font: 700 1.3rem/1.2 var(--serif); color: var(--ink); text-decoration: none; padding: 0.25rem 0; }
.brand::before { content: ""; display: inline-block; width: 0.55em; height: 0.55em; margin-right: 0.45em; background: var(--red); vertical-align: 0.05em; }
nav { display: flex; flex-wrap: wrap; column-gap: 1.1rem; }
nav a, footer a { display: inline-block; padding: 0.4rem 0; }
a { color: var(--link); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }

main { padding-top: 0.5rem; padding-bottom: 2rem; }
h1, h2 { font-family: var(--serif); font-weight: 700; line-height: 1.2; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.15rem); margin: 1.25rem 0 0.5rem; }
h2 { font-size: 1.3rem; margin: 2rem 0 0.5rem; padding-top: 0.75rem; border-top: 1px solid var(--rule); }
.tool + h2 { border-top: 0; padding-top: 0; }
p, li { max-width: 40rem; }
sup { font-size: 0.7em; line-height: 0; }
.note { color: var(--muted); font-size: 0.93rem; }

/* The calculator: the product, first on the page, ruled like a form, never a floating card. */
.tool { margin: 1rem 0 0; padding: 1rem 0 1.25rem; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); }
.calculator { display: grid; gap: 0.75rem 1rem; grid-template-columns: repeat(auto-fit, minmax(min(10.5rem, 100%), 1fr)); align-items: end; }
.calculator label { display: grid; gap: 0.3rem; font-size: 0.95rem; font-weight: 600; }
input, select, button { font: inherit; min-height: 2.75rem; padding: 0.45rem 0.6rem; border: 1px solid var(--muted); border-radius: 2px; background: var(--field); color: var(--ink); width: 100%; min-width: 0; }
input { font-variant-numeric: tabular-nums; }
button { background: var(--ink); color: var(--paper); border-color: var(--ink); font-weight: 700; cursor: pointer; }
button:hover { background: var(--red); border-color: var(--red); }
.method { margin: 0.75rem 0 0; color: var(--muted); font-size: 0.9rem; }

/* The result: the three counts as figures, then each holiday of the period with its effect. */
output { display: block; }
output[data-state] { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
.period { margin: 0 0 0.75rem; font-weight: 600; }
.figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 1rem; margin: 0; }
.figure { border-left: 2px solid var(--ink); padding-left: 0.6rem; }
.figure:first-child { border-left-color: var(--red); }
.figure dt { font-variant-caps: all-small-caps; letter-spacing: 0.03em; font-weight: 700; }
.figure .count { margin: 0; font: 700 clamp(2.1rem, 1.5rem + 2.5vw, 3rem)/1.05 var(--serif); font-variant-numeric: lining-nums tabular-nums; }
.figure .detail { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.85rem; line-height: 1.35; }
.holidays-heading { margin: 1.25rem 0 0.25rem; font-weight: 700; }
.holidays { list-style: none; padding: 0; margin: 0; }
.holiday { display: grid; grid-template-columns: minmax(11rem, auto) 1fr; gap: 0 1rem; padding: 0.4rem 0; border-bottom: 1px solid var(--rule); }
.holiday .when { color: var(--red); font-weight: 600; font-variant-numeric: tabular-nums; }
.holiday.weekend .when { color: var(--muted); }
.holiday .effect { grid-column: 2; color: var(--muted); font-size: 0.85rem; }
.error { color: var(--red); font-weight: 600; }

/* Reference tables: a calendar's rows, the weekday apart, the weekend days set back. */
table { border-collapse: collapse; width: 100%; margin: 1rem 0 1.5rem; font-variant-numeric: tabular-nums; }
caption { text-align: left; font: 700 1.05rem/1.3 var(--serif); padding-bottom: 0.4rem; }
th { font-size: 0.85rem; font-variant-caps: all-small-caps; letter-spacing: 0.03em; text-align: left; border-bottom: 2px solid var(--ink); padding: 0.3rem 0.5rem 0.3rem 0; }
td { padding: 0.45rem 0.5rem 0.45rem 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
td.date { color: var(--red); font-weight: 600; }
td.weekday { white-space: nowrap; }
tr.weekend td.weekday, tr.weekend td.date { color: var(--muted); font-weight: 400; }

/* Indexes: the years as large numerals, the regions in columns. */
.years { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; list-style: none; padding: 0; margin: 0.5rem 0; }
.years a { display: inline-block; padding: 0.15rem 0; font: 700 1.6rem/1.2 var(--serif); font-variant-numeric: lining-nums; }
.regions { columns: 2 14rem; column-gap: 2rem; padding: 0; list-style: none; margin: 0.5rem 0; }
.regions li { break-inside: avoid; }
.regions a { display: inline-block; padding: 0.3rem 0; }

footer { color: var(--muted); font-size: 0.9rem; padding-bottom: 2rem; border-top: 1px solid var(--rule); }
@media (max-width: 30rem) {
  table { font-size: 0.92rem; }
  th, td { padding-right: 0.35rem; }
  th { letter-spacing: 0; font-size: 0.8rem; }
  .holiday { grid-template-columns: 1fr; }
  .holiday .effect { grid-column: 1; }
  /* One count per row: the numeral left, its label and detail beside it. */
  .figures { grid-template-columns: 1fr; gap: 0.6rem; }
  .figure { display: grid; grid-template-columns: 4.6rem 1fr; column-gap: 0.75rem; align-items: baseline; }
  .figure .count { grid-column: 1; grid-row: 1 / span 2; }
  .figure dt, .figure .detail { grid-column: 2; }
}
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
