/* HolidayTally design system, direction C "Calendar".
   Spec: docs/design/2026-11-07-design-system.md. Mobile first: base rules are
   for a 360px phone, then 48rem and 64rem widen the layout. The dark theme
   changes tokens only. */

/* 1. Tokens */

:root {
  /* Colour: light */
  --bg: #f6f8f8;
  --surface: #eef3f3;
  --card: #ffffff;
  --text: #14201f;
  --muted: #55636a;
  --border: #dbe3e3;
  --border-strong: #b7c4c4;
  --control-border: #6f7f84;
  --accent: #0b6e69;
  --accent-strong: #084f4b;
  --accent-text: #ffffff;
  --soft: #e3f2f0;
  --soft-text: #0a5c58;
  --warn-bg: #fff1cc;
  --warn-text: #6b4a00;
  --focus: #0b6e69;
  --shadow: 0 1px 2px rgba(16, 32, 32, 0.06), 0 4px 14px rgba(16, 32, 32, 0.05);

  /* Type */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;
  --fs-xs: 0.8125rem;
  --fs-sm: 0.875rem;
  --fs-body: 1rem;
  --fs-lead: 1.125rem;
  --fs-h3: 1.125rem;
  --fs-h2: 1.375rem;
  --fs-h1: 1.75rem;
  --fs-stat: 2rem;

  /* Space (4px base) */
  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 0.75rem;
  --s4: 1rem;
  --s5: 1.5rem;
  --s6: 2rem;
  --s7: 3rem;
  --s8: 4rem;
  --gutter: 1rem;

  /* Shape */
  --radius: 12px;
  --radius-control: 10px;
  --radius-sm: 6px;
  --radius-pill: 999px;
  --target: 44px;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1315;
    --surface: #141b1e;
    --card: #172024;
    --text: #e5ecec;
    --muted: #9fb0b4;
    --border: #2a3639;
    --border-strong: #3f5054;
    --control-border: #73878c;
    --accent: #5fd0c8;
    --accent-strong: #8fe3dc;
    --accent-text: #062321;
    --soft: #16302f;
    --soft-text: #8fe3dc;
    --warn-bg: #3a2f12;
    --warn-text: #f3d68a;
    --focus: #5fd0c8;
    --shadow: none;
  }
}

/* 2. Base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.6;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--accent);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

img,
svg {
  max-width: 100%;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 10;
  padding: var(--s2) var(--s4);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 650;
}

.skip:focus {
  left: var(--s2);
  top: var(--s2);
}

h1,
h2,
h3 {
  text-wrap: balance;
}

h1 {
  margin: var(--s4) 0 var(--s3);
  font-size: var(--fs-h1);
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

h2 {
  margin: var(--s7) 0 var(--s3);
  font-size: var(--fs-h2);
  font-weight: 700;
  line-height: 1.2;
}

h3 {
  margin: var(--s5) 0 var(--s2);
  font-size: var(--fs-h3);
  font-weight: 700;
  line-height: 1.25;
}

p,
ul,
ol,
dl {
  margin: 0 0 var(--s4);
}

/* Readable line length for prose; lists of controls, cards and tables keep their width. */
main p,
main li {
  max-width: 70ch;
}

main table li,
main .breadcrumb li,
main .years li,
main .year-links li,
main .month-nav li,
main .jurisdictions li,
main .nav li,
main .stats li,
main .month-strip li,
main .legend li,
main .toc li,
main .rail li,
main ul.breaks li,
main .country-grid li,
main .region-grid li,
main .tool-cards li,
main .jur-chips li,
main .result-holidays li,
main .result-breaks li {
  max-width: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.lead {
  font-size: var(--fs-lead);
  line-height: 1.5;
}

.lead strong {
  color: var(--accent);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.muted,
.note {
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.45;
}

/* 3. Layout */

.wrap {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

main.wrap {
  padding-bottom: var(--s6);
}

/* Year page with a side rail (phase 2):
   <div class="page-layout"><div class="page-main">…</div><aside class="rail">…</aside></div>
   Below 64rem the rail is hidden and the .toc chips do its job. */
.page-layout {
  display: block;
}

.page-main {
  min-width: 0;
}

.panel {
  margin: 0 0 var(--s4);
  padding: var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.panel > :first-child {
  margin-top: 0;
}

.panel > :last-child {
  margin-bottom: 0;
}

/* 4. Header and nav */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.header-inner {
  display: block;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  min-height: 48px;
  color: var(--text);
  font-size: 1.125rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand img {
  display: block;
  width: 24px;
  height: 24px;
}

.brand:hover {
  text-decoration: underline;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-header nav {
  margin: 0 calc(var(--gutter) * -1);
  border-top: 1px solid var(--border);
}

.site-header .nav li {
  flex: 1 1 auto;
}

.site-header .nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--target);
  padding: 0 var(--s2);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

.site-header .nav a:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.site-header .nav a[aria-current="page"] {
  color: var(--accent);
  box-shadow: inset 0 -3px 0 var(--accent);
}

/* 5. Breadcrumb */

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  list-style: none;
  margin: var(--s4) 0 0;
  padding: 0;
  color: var(--text);
  font-size: var(--fs-sm);
  line-height: 1.45;
}

.breadcrumb li + li::before {
  content: "/";
  margin: 0 0.5em;
  color: var(--border-strong);
}

.breadcrumb a {
  display: inline-block;
  min-height: 24px;
  padding: 2px 0;
  color: var(--muted);
}

.breadcrumb a:hover {
  color: var(--accent);
}

/* 6. Eyebrow and page heading */

.eyebrow {
  margin: var(--s4) 0 var(--s1);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.eyebrow + h1 {
  margin-top: 0;
}

/* 7. Buttons */

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: var(--target);
  padding: 0 var(--s4);
  border: 2px solid var(--accent);
  border-radius: var(--radius-control);
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button:hover,
button:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: var(--accent-text);
  text-decoration: none;
}

.button-secondary {
  background: transparent;
  color: var(--accent);
}

.button-secondary:hover {
  border-color: var(--accent);
  background: var(--soft);
  color: var(--soft-text);
}

button:disabled,
.button[aria-disabled="true"] {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--muted);
  cursor: not-allowed;
}

/* 8. Year selector: .years (year pages, feasts) and .year-links (feast index) */

.years ul,
.year-links,
.month-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  list-style: none;
  margin: 0 0 var(--s5);
  padding: 0;
}

.years a,
.years span,
.year-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.25rem;
  min-height: var(--target);
  padding: 0 var(--s3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--card);
  color: var(--accent);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}

.years a:hover,
.year-links a:hover {
  border-color: var(--accent);
  text-decoration: underline;
}

.years span[aria-current] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

/* Month page previous / next (today at the bottom, in phase 2 also under the h1). */
.month-nav a {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  min-height: var(--target);
  padding: 0 var(--s4);
  border: 2px solid var(--accent);
  border-radius: var(--radius-control);
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
}

.month-nav a:hover {
  background: var(--soft);
  color: var(--soft-text);
}

/* 9. At a glance stats: data of the year from the build, never a live counter.
   <ul class="stats" aria-label="2027 in numbers"><li class="stat"><b>10</b> <span>bank holidays counted</span></li>…</ul> */

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s2);
  list-style: none;
  margin: 0 0 var(--s4);
  padding: 0;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  padding: var(--s3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.stat b {
  color: var(--accent);
  font-size: var(--fs-stat);
  font-weight: 750;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat span {
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.35;
}

/* 10. Actions */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin: 0 0 var(--s4);
}

/* 11. On this page: chips under 64rem, side rail from 64rem */

.toc ul {
  display: flex;
  gap: var(--s2);
  list-style: none;
  margin: 0 0 var(--s4);
  padding: 2px 2px var(--s2);
  overflow-x: auto;
  scrollbar-width: thin;
}

.toc a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 var(--s3);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}

.toc a:hover {
  background: var(--soft);
  color: var(--soft-text);
}

.rail {
  display: none;
}

.rail h2 {
  margin: 0 0 var(--s2);
  color: var(--muted);
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.rail ul {
  list-style: none;
  margin: 0 0 var(--s4);
  padding: 0;
}

.rail a:not(.button) {
  display: block;
  padding: var(--s1) 0;
  font-size: var(--fs-sm);
  text-decoration: none;
}

.rail a:not(.button):hover {
  text-decoration: underline;
}

.rail .button {
  width: 100%;
}

/* 12. Callout: legal note of the jurisdiction only (tool results use .result). */

.callout {
  margin: 0 0 var(--s4);
  padding: var(--s3) var(--s4);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--soft);
  color: var(--text);
  font-size: 0.9375rem;
}

/* Lists of short sentences ("at a glance" today). */
.notes {
  padding-left: 1.25rem;
}

.notes li {
  margin-bottom: var(--s1);
}

.notes li::marker {
  color: var(--accent);
}

/* 13. Tables: each sits in a card; wide ones scroll inside it. */

.table-wrap {
  margin: 0 0 var(--s4);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.table-wrap:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

th,
td {
  padding: var(--s2) var(--s3);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

thead th {
  background: var(--surface);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 650;
  line-height: 1.3;
  white-space: nowrap;
}

tbody th {
  font-weight: 400;
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}

tfoot th,
tfoot td {
  border-top: 2px solid var(--border-strong);
  border-bottom: 0;
  font-weight: 700;
}

table.numeric td {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

table.numeric thead th:not(:first-child) {
  text-align: right;
}

table.numeric td.text,
table.numeric thead th.text {
  text-align: left;
}

/* The row of the page itself in a comparison table. */
tr.self th,
tr.self td {
  background: var(--soft);
}

tr.self th {
  font-weight: 700;
}

.nowrap {
  white-space: nowrap;
}

td.date {
  min-width: 7.5rem;
}

td.name {
  min-width: 8rem;
  font-weight: 600;
  overflow-wrap: anywhere;
  hyphens: auto;
}

td.notes {
  min-width: 12rem;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.45;
}

tr.weekend {
  background: var(--surface);
}

tr.weekend th,
tr.weekend td {
  color: var(--muted);
}

tr.weekend td.name {
  font-weight: 500;
}

/* A date cell holding only a chip needs no text width. */
td.date:has(.chip) {
  min-width: 0;
  width: 1%;
}

/* 14. Date chip: partials/date_chip.html (full date read from a hidden span) */

.chip {
  display: inline-grid;
  justify-items: center;
  width: 3.4em;
  padding: 4px 0 5px;
  border-radius: var(--radius-sm);
  background: var(--soft);
  color: var(--soft-text);
  line-height: 1.05;
  vertical-align: top;
}

.chip small {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chip strong {
  font-size: 1.375rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

tr.weekend .chip {
  background: var(--card);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

/* Large chip for the date of a moving feast (phase 2). */
.chip-lg {
  width: 4rem;
  padding: 6px 0 7px;
  font-size: 1.15rem;
}

.date-hero {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin: 0 0 var(--s4);
}

.date-hero p {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.25;
}

/* 15. Badges and legend */

.badge {
  display: inline-block;
  margin-right: 0.25em;
  padding: 1px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--soft);
  color: var(--soft-text);
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1.5;
  white-space: nowrap;
  vertical-align: 0.05em;
}

.badge-observed {
  background: var(--soft);
  color: var(--soft-text);
}

.badge-warn {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.badge-muted {
  border-color: var(--border-strong);
  background: transparent;
  color: var(--muted);
}

.badge-next {
  background: var(--accent);
  color: var(--accent-text);
}

/* <ul class="legend"><li><span class="badge badge-observed">observed</span> substitute weekday off</li>…</ul> */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1) var(--s4);
  list-style: none;
  margin: calc(var(--s2) * -1) 0 var(--s4);
  padding: 0;
  color: var(--muted);
  font-size: var(--fs-sm);
}

/* 16. Month strip: working days per month, 4 then 6 per row. */

.month-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s2);
  list-style: none;
  margin: 0 0 var(--s4);
  padding: 0;
}

.month-strip a,
.month-strip li > span {
  display: flex;
  flex-direction: column;
  min-height: 64px;
  height: 100%;
  padding: var(--s2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  line-height: 1.2;
  text-decoration: none;
}

.month-strip a:hover {
  border-color: var(--accent);
}

.month-strip .m {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.month-strip .w {
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.dots {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: auto;
  padding-top: 3px;
}

.dots i {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* 17. Long weekends and breaks.
   ul.breaks: one card row per break; phase 2 adds
   <span class="dur"><b>3</b> <small>days</small></span> before the dates. */

ul.breaks {
  display: grid;
  gap: var(--s2);
  list-style: none;
  margin: 0 0 var(--s4);
  padding: 0;
}

ul.breaks > li {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin: 0;
  padding: var(--s3) var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

ul.breaks > li.is-next {
  border-color: var(--accent);
  box-shadow: inset 4px 0 0 var(--accent), var(--shadow);
}

.dur {
  display: grid;
  flex: none;
  justify-items: center;
  min-width: 2.75rem;
  color: var(--accent);
  line-height: 1;
}

.dur b {
  font-size: 1.375rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.dur small {
  color: var(--muted);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

ol.breaks {
  margin: var(--s2) 0 var(--s1);
  padding-left: 1.5rem;
}

ol.breaks li {
  margin-bottom: var(--s1);
}

details {
  margin: 0 0 var(--s2);
  padding: 0 var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

details[open] {
  padding-bottom: var(--s3);
}

summary {
  padding: 0.625rem 0;
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
}

summary::marker {
  color: var(--accent);
}

/* 18. Countdown and downloads */

.counter {
  margin: 0 0 var(--s2);
  padding: var(--s3) var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: var(--fs-lead);
  font-weight: 600;
  line-height: 1.4;
}

#counters .counter:last-of-type {
  margin-bottom: var(--s4);
}

.download-card {
  margin: 0 0 var(--s3);
  padding: var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.download-card .actions {
  margin: 0;
}

/* 19. Country cards (home), region cards (hubs), tool cards, legacy home cards */

.country-grid,
.region-grid,
.tool-cards {
  display: grid;
  gap: var(--s2);
  list-style: none;
  margin: 0 0 var(--s4);
  padding: 0;
}

.country-grid {
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
}

.region-grid {
  grid-template-columns: repeat(auto-fill, minmax(9.25rem, 1fr));
}

.tool-cards {
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

.country-card,
.region-card,
.tool-card {
  display: grid;
  align-content: center;
  height: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.country-card:hover,
.region-card:hover,
.tool-card:hover {
  border-color: var(--accent);
}

.country-card {
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: var(--s2);
  min-height: 52px;
  padding: var(--s2) var(--s3);
}

.country-card .code {
  grid-row: 1 / span 2;
  align-self: center;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--soft);
  color: var(--soft-text);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
}

.country-card .name {
  font-weight: 650;
  line-height: 1.3;
}

.country-card .meta {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.78125rem;
  line-height: 1.3;
}

.region-card {
  min-height: 56px;
  padding: var(--s2) var(--s3);
  font-weight: 600;
  line-height: 1.3;
}

.region-card small {
  color: var(--accent);
  font-size: 0.78125rem;
  font-weight: 650;
}

.tool-card {
  gap: var(--s1);
  padding: var(--s4);
}

.tool-card strong {
  color: var(--accent);
  font-size: var(--fs-h3);
}

.tool-card span {
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.45;
}

/* Home: areas of country cards, then every jurisdiction in <details id="all">. */
.area h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s1) var(--s3);
}

.area-count {
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 600;
}

details.all-list {
  margin-top: var(--s5);
}

.all-group h3 {
  margin: var(--s3) 0 var(--s2);
  color: var(--muted);
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.all-group .link-list {
  margin: 0 0 var(--s2);
  padding-left: 0;
  list-style: none;
  columns: 15rem;
  column-gap: var(--s5);
}

.all-group .link-list li {
  margin-bottom: var(--s1);
  break-inside: avoid;
}

.all-group .link-list .muted {
  font-size: var(--fs-sm);
}

/* Hub: the national page first, set apart from the regions. */
.region-card-national {
  border-color: var(--accent);
  background: var(--soft);
  color: var(--soft-text);
}

/* Each working-days figure of the hub table links to that year's page. */
.hub-table td a,
.feast-table td a {
  display: inline-block;
  min-width: 2.75em;
  min-height: 24px;
  padding: 2px 0;
}

/* Jurisdiction filter (phase 2, static/js/find.mjs). Hidden until the module runs:
   <div class="filter" hidden><label for="ht-find">Find a country or region</label>
   <input id="ht-find" type="search" autocomplete="off"><p class="filter-status" aria-live="polite"></p></div> */
.filter {
  display: grid;
  gap: var(--s1);
  max-width: 32rem;
  margin: 0 0 var(--s4);
}

.filter-status {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-sm);
}

/* Moving feast, dates grouped (phase 2):
   <section class="date-group"><h3>Monday 29 March 2027</h3>
   <p class="date-group-country">United Kingdom</p><ul class="jur-chips"><li><a href="…">Scotland</a></li></ul>
   <p class="jur-note">…</p></section> */
.date-group {
  margin: 0 0 var(--s3);
  padding: var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.date-group h3 {
  margin: 0 0 var(--s2);
}

.date-group-country {
  margin: var(--s3) 0 var(--s1);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.jur-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  list-style: none;
  margin: 0;
  padding: 0;
}

.jur-chips a,
.jur-chips span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 var(--s3);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
}

.jur-chips a {
  color: var(--accent);
}

.jur-chips a:hover {
  background: var(--soft);
  text-decoration: underline;
}

.jur-note {
  margin: var(--s1) 0 0;
  color: var(--muted);
  font-size: var(--fs-sm);
}

/* Feast index: one row per moving holiday, the dates of the window, the rule. */
.feast-table th[scope="row"] a {
  font-weight: 650;
}

.feast-table td.text {
  color: var(--muted);
  font-size: var(--fs-sm);
}

@media (min-width: 48rem) {
  .feast-table td:not(.text) {
    white-space: nowrap;
  }
}

/* Month calendar grid (phase 2): a real table, Monday first.
   <table class="month-cal"><caption class="visually-hidden">May 2027</caption>
   <thead><tr><th scope="col"><abbr title="Monday">Mon</abbr></th>…</tr></thead>
   <tbody><tr><td class="is-out"></td>…<td class="is-holiday"><span class="d">3</span>
   <span class="visually-hidden">May Day</span></td>…</tr></tbody></table>
   States: is-weekend, is-holiday, is-observed, is-out (outside the month), is-today (JS). */
.month-cal {
  width: 100%;
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
}

.month-cal th,
.month-cal td {
  padding: var(--s1);
  border: 1px solid var(--border);
  text-align: center;
  vertical-align: middle;
}

.month-cal thead th {
  border-width: 0 0 1px;
}

.month-cal abbr {
  text-decoration: none;
}

.month-cal td {
  height: 2.75rem;
  font-weight: 600;
}

.month-cal .d {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-pill);
}

.month-cal td.is-weekend {
  background: var(--surface);
  color: var(--muted);
  font-weight: 400;
}

.month-cal td.is-holiday .d,
.month-cal td.is-observed .d {
  background: var(--accent);
  color: var(--accent-text);
}

.month-cal td.is-observed .d {
  background: var(--soft);
  color: var(--soft-text);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.month-cal td.is-out {
  background: transparent;
  border-color: transparent;
}

/* A Saturday or Sunday worked by decree: a working day, ringed in the warning colour. */
.month-cal td.is-workday .d {
  box-shadow: inset 0 0 0 2px var(--warn-text);
}

.cal-wrap {
  max-width: 34rem;
}

.cal-legend {
  margin-top: 0;
}

.cal-key {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  margin-right: 0.15em;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  vertical-align: -0.15em;
}

.cal-key.is-holiday {
  border-color: var(--accent);
  background: var(--accent);
}

.cal-key.is-observed {
  border-color: transparent;
  background: var(--soft);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.cal-key.is-weekend {
  border-radius: 3px;
  background: var(--surface);
}

.cal-key.is-workday {
  border-color: transparent;
  background: var(--card);
  box-shadow: inset 0 0 0 2px var(--warn-text);
}

.month-cal td.is-today {
  outline: 2px solid var(--text);
  outline-offset: -3px;
}

/* 20. Tools: form and result */

.tool {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--s3) var(--s4);
  margin: 0 0 var(--s4);
  padding: var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.field {
  display: flex;
  flex: 1 1 12rem;
  flex-direction: column;
  gap: var(--s1);
  min-width: 0;
}

.tool button {
  flex: 1 1 100%;
  min-height: 48px;
}

label {
  font-size: 0.9375rem;
  font-weight: 650;
}

input,
select {
  width: 100%;
  font: inherit;
  min-height: 48px;
  padding: var(--s2) var(--s3);
  border: 1px solid var(--control-border);
  border-radius: var(--radius-control);
  background: var(--card);
  color: var(--text);
}

input:hover,
select:hover {
  border-color: var(--accent);
}

input:focus-visible,
select:focus-visible {
  outline-offset: 1px;
}

/* Chromium focuses the picker icon of a date field without :focus-visible on the input. */
input[type="date"]:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

.result {
  margin: 0 0 var(--s4);
  padding: var(--s4);
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

/* The JS writes the answer as the first paragraph of an ok result. */
.result[data-ht-state="ok"] > p:first-child:not(.result-figure) {
  font-size: 1.25rem;
  font-weight: 650;
  line-height: 1.4;
}

.result[data-ht-state="error"] {
  border-top-color: var(--warn-text);
}

.result[data-ht-state="empty"] {
  border-top-color: var(--border-strong);
}

.result[aria-busy="true"] {
  color: var(--muted);
}

.result p:last-child,
.result ul:last-child,
.result ol:last-child,
.result dl:last-child {
  margin-bottom: 0;
}

.result ol,
.result ul {
  padding-left: 1.25rem;
}

.result li {
  margin-bottom: var(--s1);
}

/* Result components for the JS rewrite (phase 2). */
.result-figure {
  margin: 0 0 var(--s2);
  font-size: var(--fs-lead);
  font-weight: 600;
  line-height: 1.2;
}

.result-figure strong {
  display: inline-block;
  margin-right: 0.15em;
  color: var(--accent);
  font-size: 2.5rem;
  font-weight: 750;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.result-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s2);
  margin: 0 0 var(--s4);
}

.result-facts div {
  padding: var(--s2) var(--s3);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.result-facts dt {
  color: var(--muted);
  font-size: var(--fs-xs);
}

.result-facts dd {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.result-holidays,
.result-breaks {
  display: grid;
  gap: var(--s2);
  list-style: none;
  padding: 0;
}

.result .result-holidays,
.result .result-breaks {
  padding-left: 0;
}

.result-breaks > li {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin: 0;
  padding: var(--s2) var(--s3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* Leave planner, current year: a break that has already ended stays in the
   plan, since the totals cover the whole year, but is greyed out. --muted keeps
   at least 4.5:1 on --card and --surface in both schemes (no opacity), and the
   label says it in words. */
.result li.past {
  color: var(--muted);
}

.past-label {
  font-weight: 600;
  white-space: nowrap;
}

/* Long "How it counts" text split into items. */
.points {
  padding-left: 1.25rem;
}

.points li {
  margin-bottom: var(--s2);
}

.points li::marker {
  color: var(--accent);
}

/* 21. Footer */

.site-footer {
  margin-top: var(--s6);
  padding: var(--s5) 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.45;
}

.site-footer .nav {
  gap: 0 var(--s4);
}

.site-footer .nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
  color: var(--text);
}

.site-footer .nav a:hover {
  color: var(--accent);
}

.site-footer p {
  max-width: 70ch;
  margin: var(--s3) 0 0;
}

/* 22. Ad slots: space reserved before the ad loads (no layout shift), label in
   CSS so it is not page text. Only rendered when ads are on (partials/ad_slot.html). */

.ad-slot {
  min-height: 280px;
  margin: var(--s6) 0;
}

.ad-slot::before {
  content: "Advertisements";
  display: block;
  margin-bottom: var(--s1);
  color: var(--muted);
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ad-slot:has(ins[data-ad-format="autorelaxed"]) {
  min-height: 300px;
}

/* 23. Prose and legal pages */

.prose {
  max-width: 44rem;
}

.prose h2 {
  margin-top: var(--s6);
}

.prose a,
.result a,
main td a,
.sources {
  overflow-wrap: anywhere;
}

.sources {
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.45;
}

/* Bare source links reach the 24px target (WCAG 2.5.8). */
.sources li + li {
  margin-top: var(--s1);
}

.sources a {
  display: inline-block;
  padding-block: 2px;
}

.link-list {
  padding-left: 1.25rem;
}

.link-list li {
  margin-bottom: var(--s2);
}

/* Standalone links in lists and table headers reach the 24px target (WCAG 2.5.8). */
.link-list a,
tbody th > a {
  display: inline-block;
  min-height: 24px;
  padding: 2px 0;
}

/* 24. Wider screens */

@media (min-width: 48rem) {
  /* Reserve the height the fetched answer fills, so the tools do not shift the page (CLS). */
  #ht-lp-result {
    min-height: 24rem;
  }

  #ht-bd-result {
    min-height: 20rem;
  }

  :root {
    --fs-body: 1.0625rem;
    --fs-h1: 2.25rem;
    --fs-h2: 1.5rem;
    --fs-h3: 1.1875rem;
    --fs-stat: 2.25rem;
    --gutter: 1.5rem;
  }

  .lead {
    font-size: 1.1875rem;
  }

  .header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s4);
  }

  .site-header nav {
    margin: 0;
    border-top: 0;
  }

  .site-header .nav {
    flex-wrap: nowrap;
    gap: var(--s1);
  }

  .site-header .nav a {
    min-height: 56px;
    padding: 0 var(--s3);
  }

  .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .month-strip {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .country-grid {
    grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr));
  }

  .tool button {
    flex: 0 0 auto;
  }

  .panel,
  .tool,
  .result {
    padding: var(--s4) var(--s5);
  }

  .result-figure strong {
    font-size: 3rem;
  }

  .result-facts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .ad-slot {
    min-height: 250px;
  }

  /* Numbers stay near their labels instead of 400px away. */
  .table-wrap:has(> table.numeric) {
    max-width: 44rem;
  }
}

@media (min-width: 64rem) {
  .page-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 15rem;
    gap: var(--s6);
    align-items: start;
  }

  .page-layout .toc {
    display: none;
  }

  .rail {
    position: sticky;
    top: var(--s4);
    display: block;
    margin-top: var(--s4);
    padding: var(--s4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
  }
}

@media (prefers-reduced-motion: no-preference) {
  a,
  .button,
  button,
  input,
  select {
    transition: border-color 120ms ease, background-color 120ms ease;
  }
}

/* 25. Narrow screens: holiday and break tables become one block per row, so
   nothing scrolls sideways and no row is padded by an off-screen cell. */

@media (max-width: 36rem) {
  table.stack,
  table.stack tbody {
    display: block;
  }

  /* Header row stays in the accessibility tree: clipped, never display: none. */
  table.stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  /* The name column never drops below 7.5rem: on very narrow screens or with a
     large default font the date column gives way first. Fixed tracks keep the
     rows aligned, since each row is its own grid. */
  table.stack tr {
    display: grid;
    grid-template-columns: minmax(0, 10.5rem) minmax(7.5rem, 1fr);
    column-gap: var(--s3);
    padding: var(--s3);
    border-bottom: 1px solid var(--border);
  }

  table.stack tbody tr:last-child {
    border-bottom: 0;
  }

  table.stack th,
  table.stack td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    text-align: left;
  }

  table.stack td.date,
  table.stack td.name,
  table.stack td.notes {
    min-width: 0;
  }

  table.stack td.date {
    font-weight: 600;
  }

  /* An empty Notes cell is an empty block with no padding: it takes no space and
     stays in the accessibility tree under its column header. */
  table.stack td.notes {
    grid-column: 1 / -1;
    font-size: var(--fs-sm);
  }

  table.stack td.notes .badge {
    white-space: normal;
  }

  /* Rows with a date chip: the chip spans two rows on the left, name and notes
     stack on the right. */
  table.holidays-table tr:has(td.date .chip) {
    grid-template-columns: auto minmax(7.5rem, 1fr);
    padding: var(--s2) var(--s3);
  }

  table.holidays-table tr:has(td.date .chip) td.date {
    grid-row: 1 / span 2;
    width: auto;
  }

  table.holidays-table tr:has(td.date .chip) td.notes {
    grid-column: 2;
  }

  /* Best single breaks: dates first, then leave days, days off, days to take.
     The labels are for sighted readers; screen readers already hear the column
     header, so the alternative text is empty. A browser without the "/ alt"
     syntax drops the second declaration and keeps the first. */
  table.stack [data-label]::before {
    content: attr(data-label) ": ";
    content: attr(data-label) ": " / "";
    color: var(--muted);
    font-weight: 400;
  }

  table.breaks-table td.break {
    grid-column: 1 / -1;
    grid-row: 1;
    font-weight: 600;
  }

  table.breaks-table th {
    grid-column: 1;
    grid-row: 2;
    font-weight: 400;
  }

  table.breaks-table td.days-off {
    grid-column: 2;
    grid-row: 2;
  }

  table.breaks-table td.leave {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  /* Free-text tables of the month page as stacks (phase 2): name, then the three
     numbers in a row, then the holidays at full width. */
  table.stack.figures-table tr {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  table.stack.figures-table th[scope="row"] {
    grid-column: 1 / -1;
    font-weight: 600;
  }

  table.stack.figures-table td.text {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: var(--fs-sm);
  }

  /* Other wide tables keep their scroll box but fit 360px where they can. */
  thead th,
  .nowrap {
    white-space: normal;
  }

  table.numeric {
    font-size: var(--fs-sm);
  }

  table.numeric th,
  table.numeric td {
    padding: 0.4rem 0.3rem;
  }

  .actions .button {
    flex: 1 1 auto;
  }
}

@media (max-width: 30rem) {
  th,
  td {
    padding: 0.45rem 0.5rem;
  }
}

/* 26. Forced colours: backgrounds and shadows drop, so boxes keep a border. */

@media (forced-colors: active) {
  .chip,
  .badge,
  .stat,
  .month-strip a,
  .table-wrap,
  .result,
  .callout,
  .panel,
  .counter,
  .download-card,
  ul.breaks > li,
  .country-card,
  .region-card,
  .tool-card,
  .date-group,
  .jur-chips a,
  .toc a,
  .cal-key,
  .years span[aria-current] {
    border: 1px solid CanvasText;
  }

  .dots i,
  .month-cal td.is-holiday .d,
  .cal-key.is-holiday {
    background: CanvasText;
    forced-color-adjust: none;
  }

  /* Rings drawn with box-shadow vanish here: an outline takes their place. */
  .month-cal td.is-observed .d,
  .month-cal td.is-workday .d {
    outline: 2px dashed CanvasText;
    outline-offset: -2px;
  }

  .site-header .nav a[aria-current="page"] {
    text-decoration: underline;
  }
}

/* 27. Print */

@media print {
  .site-header nav,
  .site-footer nav,
  .skip,
  .ad-slot,
  .tool,
  .toc,
  .rail,
  .actions,
  .years,
  .month-nav {
    display: none;
  }

  .table-wrap,
  .stat,
  .panel,
  details,
  ul.breaks > li,
  .result {
    box-shadow: none;
  }
}
