/* Chickadee's public theme.

   A town chooses two colours, a theme and a few options in Town settings. The colours
   arrive as --primary and --accent; the theme and options arrive as data- attributes on
   <html> (see chickadee/core/look.py). Everything below is written against the tokens in
   the first block, and the blocks after it only change tokens, so every combination uses
   the same, tested components.

   Colour rules that keep every combination readable (checked when Town settings is
   saved, in chickadee/core/contrast.py):
     - --primary is dark: white text goes on it, and it is the heading colour on light.
     - --accent is light: dark text (--on-accent) goes on it.
   So text on --primary is always --on-primary, text on --accent is always --on-accent,
   and --primary is never used as a text colour directly: use --heading. */
:root {
  --primary: #5c0a2e;
  --accent: #f2b632;
  --on-primary: #ffffff;
  --on-accent: #1f2328;
  --primary-deep: color-mix(in srgb, var(--primary) 78%, #000);

  --ink: #1f2328;
  --muted: #55606b;
  --line: #d5d9de;
  --surface: #ffffff;
  --page: #f4f5f3;
  --link: #0b4f9e;
  --danger: #a4161a;
  --heading: var(--primary);
  --tint: color-mix(in srgb, var(--primary) 6%, #fff);
  --field-line: var(--muted);
  --success-bg: #e9f6ec;
  --success-line: #1a7f37;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-heading: var(--serif);
  --font-body: var(--sans);
  --heading-weight: 700;

  --radius: 6px;
  --radius-small: 4px;
  --shadow-card: none;
  --shadow-raised: 0 10px 24px rgb(0 0 0 / 0.1);

  --header-bg: var(--surface);
  --header-ink: var(--ink);
  --header-brand: var(--heading);
  --header-muted: var(--muted);
  --header-rule: 6px solid var(--primary);
  --header-hover: var(--heading);

  --footer-bg: var(--primary-deep);
  --footer-ink: #ffffff;
  --footer-link: #ffffff;
  --footer-line: rgb(255 255 255 / 0.25);
  --footer-border: 0;

  --hero-height: clamp(19rem, 46vw, 33rem);
  --hero-title: clamp(3rem, 9vw, 6.5rem);
  --hero-pad: 2rem 5.5rem;
  --measure: 68ch;
}

/* ---------- Options (Town settings → Adjust the theme) ---------- */
[data-fonts="sans"] { --font-heading: var(--sans); --heading-weight: 750; }
[data-fonts="serif"] { --font-heading: var(--serif); --font-body: var(--serif); }

[data-corners="square"] { --radius: 0px; --radius-small: 0px; }
[data-corners="round"] { --radius: 14px; --radius-small: 8px; }

[data-header="colour"] {
  --header-bg: var(--primary);
  --header-ink: var(--on-primary);
  --header-brand: var(--on-primary);
  --header-muted: rgb(255 255 255 / 0.85);
  --header-rule: 0;
  --header-hover: var(--on-primary);
}

[data-hero="compact"] {
  --hero-height: clamp(10rem, 20vw, 15rem);
  --hero-title: clamp(2.2rem, 5vw, 3.6rem);
  --hero-pad: 1.5rem 4.6rem;
}

[data-footer="dark"] { --footer-bg: #1b1f24; }
[data-footer="light"] {
  --footer-bg: var(--surface);
  --footer-ink: var(--ink);
  --footer-link: var(--link);
  --footer-line: var(--line);
  --footer-border: 1px solid var(--line);
}

/* ---------- Dark, for visitors whose device asks for it ---------- */
/* The town's colours stay where they have white or dark text on them (header band,
   banner, buttons). Page, text and headings switch; headings become a pale tint of the
   town colour, which is always light enough because the colour itself must be dark. */
@media (prefers-color-scheme: dark) {
  [data-scheme="auto"] {
    color-scheme: dark;
    --ink: #e7e9ec;
    --muted: #a9b1bb;
    --line: #333a44;
    --surface: #1b1f24;
    --page: #14171b;
    --link: #8ab4f8;
    --danger: #b3261e;
    --heading: color-mix(in srgb, var(--primary) 28%, #fff);
    --tint: color-mix(in srgb, var(--primary) 30%, #1b1f24);
    --field-line: #7d8794;
    --success-bg: #12301b;
    --success-line: #3fb950;
    --shadow-raised: 0 10px 24px rgb(0 0 0 / 0.5);
  }
  [data-scheme="auto"][data-footer="dark"] { --footer-bg: #0e1114; }
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 106.25%; scroll-padding-top: 6rem; }
body { margin: 0; overflow-x: clip; font-family: var(--font-body); line-height: 1.55; color: var(--ink); background: var(--page); }
a { color: var(--link); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
/* Two rings, light and dark, so the focus mark shows on any background. */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; box-shadow: 0 0 0 5px var(--on-accent); }
h1, h2, h3, h4 { font-family: var(--font-heading); line-height: 1.15; color: var(--heading); margin: 1.6em 0 0.5em; font-weight: var(--heading-weight); }
h1 { font-size: 2.4rem; margin-top: 0.4em; letter-spacing: -0.01em; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; }
img { max-width: 100%; height: auto; }
svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.flip { transform: scaleX(-1); }
.wrap { width: min(100% - 2rem, 76rem); margin-inline: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--surface); color: var(--ink); padding: 0.6rem 1rem; z-index: 30; }
.skip-link:focus { left: 0; }

/* Alert banner */
.alert-banner { background: var(--danger); color: #fff; padding: 0.5rem 1rem; text-align: center; }
.alert-banner p { margin: 0.15rem 0; }
.alert-banner a { color: #fff; font-weight: 700; }

/* Header: white, with the town's colour as a rule along the top. It stays in view. */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--header-bg); color: var(--header-ink); border-top: var(--header-rule); box-shadow: 0 1px 0 var(--line), 0 6px 16px rgb(0 0 0 / 0.06); }
.site-header__inner { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem; padding-block: 0.7rem; }
.brand { display: grid; grid-template-columns: auto auto; column-gap: 0.7rem; align-items: center; color: var(--header-brand); text-decoration: none; margin-right: auto; }
.brand__name, .brand__state { grid-column: 2; }
.brand__seal { grid-column: 1; grid-row: 1 / span 2; width: 56px; height: 56px; border-radius: 50%; }
.brand__name { font-family: var(--font-heading); font-size: 1.75rem; font-weight: 700; line-height: 1; }
.brand__state { font-size: 0.8rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--header-muted); }
button, .button { font: inherit; padding: 0.5rem 1rem; border-radius: var(--radius); border: 1px solid var(--ink); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-block; }
.button--accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.main-nav__toggle { display: none; }
.main-nav__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.main-nav__item { position: relative; }
.main-nav__item > a, .main-nav__button { display: block; padding: 0.55rem 0.8rem; color: var(--header-ink); background: none; border: 0; border-bottom: 3px solid transparent; border-radius: 0; font-weight: 600; font-size: 0.98rem; text-decoration: none; }
.main-nav__item > a:hover, .main-nav__button:hover, .main-nav__button[aria-expanded="true"] { color: var(--header-hover); border-bottom-color: var(--accent); }
.main-nav__button::after { content: ""; display: inline-block; width: 0.42em; height: 0.42em; margin-left: 0.45em; border-right: 2px solid; border-bottom: 2px solid; transform: translateY(-0.2em) rotate(45deg); }
.main-nav__submenu { position: absolute; z-index: 25; left: 0; top: calc(100% + 0.5rem); min-width: 17rem; max-height: 72vh; overflow: auto; list-style: none; margin: 0; padding: 0.6rem; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 0 0 var(--radius) var(--radius); box-shadow: 0 14px 34px rgb(0 0 0 / 0.16); color: var(--ink); }
.main-nav__submenu--wide { columns: 2 15rem; column-gap: 0.5rem; width: min(38rem, 92vw); }
.main-nav__submenu--end { left: auto; right: 0; }
.main-nav__submenu li { break-inside: avoid; }
.main-nav__submenu a { display: block; padding: 0.4rem 0.7rem; color: var(--ink); text-decoration: none; border-radius: var(--radius-small); }
.main-nav__submenu a:hover, .main-nav__submenu a:focus { background: var(--tint); color: var(--heading); text-decoration: underline; }
.main-nav__all a { font-weight: 700; color: var(--heading); }
.site-search { display: flex; }
.site-search input { width: 11rem; padding: 0.45rem 0.7rem; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--field-line); border-right: 0; border-radius: var(--radius) 0 0 var(--radius); }
.site-search button { display: grid; place-items: center; padding: 0 0.7rem; background: var(--primary); border-color: var(--primary); color: var(--on-primary); border-radius: 0 var(--radius) var(--radius) 0; }
[data-header="colour"] .site-search input { border-color: var(--surface); }
[data-header="colour"] .site-search button { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
[data-header="colour"] .main-nav__toggle { background: transparent; color: var(--on-primary); border-color: var(--on-primary); }
.site-search svg { width: 1.2rem; height: 1.2rem; }
.search-form input { padding: 0.45rem 0.6rem; color: var(--ink); background: var(--surface); border: 1px solid var(--field-line); border-radius: var(--radius-small); font: inherit; min-width: 12rem; }

/* Forms */
.button--primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); font-weight: 700; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: 1rem 0; padding: 0.6rem 1rem 1rem; }
legend { font-weight: 700; color: var(--heading); padding-inline: 0.4rem; }
.sub-form input[type="email"], .web-form input, .web-form textarea, .web-form select { display: block; font: inherit; padding: 0.45rem 0.6rem; color: var(--ink); background: var(--surface); border: 1px solid var(--field-line); border-radius: var(--radius-small); width: min(100%, 28rem); }
.sub-form label, .web-form label { font-weight: 600; }
.sub-grid td { text-align: center; }
.sub-grid input, .sub-urgent input { width: 1.2rem; height: 1.2rem; }
.sub-urgent label { font-weight: 400; }
.web-form__field { margin-block: 0.9rem; }
.web-form__field .file-meta { display: block; }
.hp { position: absolute; left: -9999px; }
.form-errors { color: var(--danger); font-weight: 600; display: block; }
.form-errors ul { list-style: none; padding: 0; margin: 0; }
.form-success { border-left: 5px solid var(--success-line); background: var(--success-bg); padding: 0.5rem 1rem; }

/* Layout */
main { padding-block: 1.2rem 3rem; }
main:focus { outline: none; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0; margin: 0 0 0.6rem; font-size: 0.9rem; }
.breadcrumbs li + li::before { content: "›"; margin-right: 0.4rem; color: var(--muted); }
article, aside > *, .columns > section { background: var(--surface); }
article, .columns > section { padding: 1.2rem 1.5rem 1.6rem; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card); }
.narrow, .rich { max-width: var(--measure); }
.with-sidebar { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; gap: 1.5rem; align-items: start; }
.with-sidebar article .columns > section { border: 0; padding: 0; }
aside > * { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8rem 1.1rem 1rem; margin-bottom: 1.2rem; }
aside h2 { font-size: 1.1rem; margin-top: 0.3rem; }
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1.5rem; margin-top: 1.5rem; }
.columns h2 { margin-top: 0.2em; border-bottom: 2px solid var(--accent); padding-bottom: 0.3rem; }

/* Home: the town's name over its own landscape, then the jobs people come to do. */
.hero { position: relative; display: grid; align-items: end; min-height: var(--hero-height); background: var(--primary); color: var(--on-primary); overflow: hidden; }
/* The lines are a mask over a block of the highlight colour, not drawn elements: a
   drawing's lines reach past the banner, which stops accessibility checkers working out
   what is behind the text near it. --contour-strength is set per town (base.html) so
   that white text stays readable even where a line crosses it. */
.hero__contours { position: absolute; inset: 0; background: var(--accent); opacity: var(--contour-strength, 0.38); -webkit-mask: url("contours.0a113df9f226.svg") center / cover no-repeat; mask: url("contours.0a113df9f226.svg") center / cover no-repeat; }
.hero__slides, .hero__slide { position: absolute; inset: 0; margin: 0; }
.hero__slide { opacity: 0; visibility: hidden; transition: opacity 0.9s ease, visibility 0.9s; }
.hero__slide.is-current { opacity: 1; visibility: visible; }
.hero__slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero__slide figcaption { position: absolute; right: 1rem; bottom: 4.4rem; padding: 0.2rem 0.6rem; font-size: 0.85rem; background: rgb(0 0 0 / 0.62); border-radius: var(--radius-small); color: #fff; }
/* Over a photograph the words get their own darkening, tied to the block of text, so
   it is behind them whatever the size of the screen or the length of the town's name.
   At 0.62 or more, white text measures at least 6 to 1 over pure white, the worst a
   photo can do; it fades out above the text. Do not go below 0.54 (4.5 to 1). */
.hero--photo .hero__text::before { content: ""; position: absolute; z-index: -1; inset: -6rem -100vmax 0; background: linear-gradient(to top, rgb(0 0 0 / 0.74) 0, rgb(0 0 0 / 0.62) calc(100% - 6rem), rgb(0 0 0 / 0) 100%); pointer-events: none; }
.hero__text { position: relative; z-index: 2; padding-block: var(--hero-pad); }
.hero h1 { color: var(--on-primary); margin: 0; font-size: var(--hero-title); line-height: 0.95; letter-spacing: -0.02em; text-wrap: balance; }
.hero__state { display: block; margin-top: 0.9rem; padding-top: 0.7rem; width: max-content; border-top: 3px solid var(--accent); font-family: var(--sans); font-size: 0.95rem; font-weight: 600; letter-spacing: 0.3em; text-transform: uppercase; }
[data-hero="compact"] .hero__state { display: inline-block; margin: 0 0 0 1rem; padding: 0 0 0 1rem; border-top: 0; border-left: 3px solid var(--accent); vertical-align: middle; }
[data-hero="compact"] .hero__tagline { font-size: 1.05rem; }
.hero__tagline { margin: 0.7rem 0 0; font-family: var(--font-heading); font-style: italic; font-size: 1.25rem; max-width: 34ch; }
.hero__controls { position: absolute; z-index: 3; inset: auto 0 4.2rem 0; display: flex; justify-content: flex-end; gap: 0.4rem; pointer-events: none; }
.hero__controls button { pointer-events: auto; display: grid; place-items: center; width: 2.6rem; height: 2.6rem; padding: 0; border-radius: 50%; background: rgb(0 0 0 / 0.62); border: 1px solid rgb(255 255 255 / 0.7); color: #fff; }
.hero__controls svg { width: 1.2rem; height: 1.2rem; }
.hero__controls + * { margin: 0; }
.is-home .hero__slide figcaption { right: auto; left: 1rem; bottom: auto; top: 1rem; }

/* Home page sections, in the order the town put them. Tiles that come first sit half
   over the banner. */
.home-section { margin-top: 2.6rem; }
.home-section--first { margin-top: 2rem; }
.home-section--tiles.home-section--first { margin-top: -3.4rem; }
.home-section > .rich-text, .home-section--text, .home-section--callout, .home-section--documents { max-width: var(--measure); }
/* Embedded maps and players fill the column and never push the page sideways. */
.home-section--embed_html { overflow-x: auto; }
.home-section--embed_html iframe { max-width: 100%; }
.tiles { position: relative; z-index: 4; display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.8rem; }
.tile { display: grid; justify-items: start; gap: 0.7rem; padding: 1.1rem 1.1rem 1rem; background: var(--surface); color: var(--ink); text-decoration: none; border: 1px solid var(--line); border-bottom: 4px solid var(--primary); border-radius: var(--radius); box-shadow: var(--shadow-raised); }
.tile:hover, .tile:focus-visible { border-bottom-color: var(--accent); background: var(--tint); }
.tile__icon { width: 2.1rem; height: 2.1rem; color: var(--heading); }
.tile__label { font-weight: 700; line-height: 1.25; }
.tile:hover .tile__label { text-decoration: underline; }

.is-home main { padding-top: 0; }
.home-columns { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(17rem, 1fr); gap: 3rem; }
/* On its own, the list of dates runs in columns across the page. */
.home-section--events .date-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); column-gap: 2.5rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; border-bottom: 3px solid var(--accent); margin-bottom: 1.2rem; }
.section-head h2 { margin: 0 0 0.35rem; font-size: 1.9rem; }
.section-head a { font-weight: 600; white-space: nowrap; }

.news-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1.2rem; }
.news-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card); overflow: hidden; display: flex; flex-direction: column; }
.news-card__image { width: 100%; height: auto; display: block; }
.news-card__body { padding: 0.9rem 1.1rem 1.1rem; }
.news-card time { color: var(--muted); font-size: 0.86rem; }
.news-card h3 { margin: 0.2rem 0 0.4rem; font-size: 1.25rem; }
.news-card h3 a { color: var(--heading); text-decoration: none; }
.news-card h3 a:hover { text-decoration: underline; }
.news-card p { margin: 0; }

.date-list { list-style: none; margin: 0; padding: 0; }
.date-item { display: grid; grid-template-columns: 3.6rem 1fr; gap: 0.9rem; align-items: center; padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.date-block { display: grid; justify-items: center; background: var(--surface); border: 1px solid var(--line); border-top: 5px solid var(--primary); border-radius: var(--radius-small); padding: 0.15rem 0 0.3rem; line-height: 1; }
.date-block__month { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--heading); padding-top: 0.25rem; }
.date-block__day { font-family: var(--font-heading); font-size: 1.7rem; font-weight: 700; }
.date-item__title { font-weight: 700; }
.date-item__when { display: block; color: var(--muted); font-size: 0.9rem; }
.date-item--cancelled .date-item__title { text-decoration: line-through; }

/* Bands run the full width of the window from inside the centred column. */
.band { background: var(--primary); color: var(--on-primary); margin-inline: calc(50% - 50vw); padding: 2.4rem calc(50vw - 50%) 2.8rem; }
.home-section--how_do_i:last-child { margin-bottom: -3rem; }
.band h2 { color: var(--on-primary); margin: 0 0 1rem; font-size: 1.9rem; }
.band__links { list-style: none; margin: 0; padding: 0; columns: 3 16rem; column-gap: 2.5rem; }
.band__links li { break-inside: avoid; border-bottom: 1px solid rgb(255 255 255 / 0.25); }
.band__links a { display: block; padding: 0.6rem 0; color: var(--on-primary); text-decoration: none; font-weight: 600; }
.band__links a:hover { text-decoration: underline; text-decoration-thickness: 2px; }

.signup { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 2rem; padding: 1.4rem 1.6rem; background: var(--tint); border: 1px solid var(--line); border-left: 6px solid var(--accent); border-radius: var(--radius); }
.signup h2 { margin: 0 0 0.2rem; font-size: 1.5rem; }
.signup p { margin: 0; }

.gallery__grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.6rem; }
.gallery__grid img { display: block; width: 100%; height: auto; border-radius: var(--radius-small); }

/* Lists */
.side-nav ul, .posting-list, .news-list, .occurrence-list, .file-list, .card-list, .result-list, .az-jump ul, .year-nav ul { list-style: none; padding: 0; margin: 0; }
.side-nav li { border-top: 1px solid var(--line); }
.side-nav li a { display: block; padding: 0.45rem 0; }
.side-nav [aria-current] { font-weight: 700; color: var(--ink); }
.news-list li, .occurrence-list li, .result-list li, .posting-list li { padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.news-list time, .meta, .file-meta, .occurrence__group { color: var(--muted); font-size: 0.88rem; }
.news-list time { display: block; }
.lede { font-size: 1.15rem; line-height: 1.5; margin: 0.8rem 0 1.2rem; }
.news-list p { margin: 0.3rem 0 0; }
.occurrence time { display: block; font-size: 0.9rem; }
.occurrence__date { font-weight: 700; }
.occurrence__group { display: block; }
.occurrence--cancelled a { text-decoration: line-through; }
.file-list li { padding: 0.3rem 0; }
.card-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 0.6rem; }
.card-list a { display: block; padding: 0.8rem 1rem; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--primary); border-radius: var(--radius-small); font-weight: 600; }
.tag { display: inline-block; padding: 0.05rem 0.5rem; border-radius: var(--radius-small); background: var(--accent); color: var(--on-accent); font-size: 0.85rem; }
.tag--cancelled { background: var(--danger); color: #fff; }
.az-jump ul, .year-nav ul, .pager { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-block: 0.8rem; }
.az-jump a, .year-nav a { display: inline-block; min-width: 2.2rem; text-align: center; padding: 0.25rem 0.5rem; border: 1px solid var(--line); border-radius: var(--radius-small); background: var(--surface); }
.year-nav [aria-current] { background: var(--primary); color: var(--on-primary); }

/* Content */
.callout { border-left: 5px solid var(--accent); background: var(--page); padding: 0.4rem 1rem; margin-block: 1rem; }
.callout h2 { font-size: 1.1rem; margin-top: 0.5rem; }
.content-image { margin: 1rem 0; }
.faq { border-bottom: 1px solid var(--line); padding: 0.5rem 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1.2rem; }
.facts dt { font-weight: 700; }
.facts dd { margin: 0; }

/* Tables */
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; margin-block: 0.8rem; background: var(--surface); }
caption { text-align: left; font-weight: 700; font-size: 1.15rem; color: var(--heading); padding-block: 0.5rem; }
th, td { text-align: left; vertical-align: top; padding: 0.5rem 0.7rem; border: 1px solid var(--line); }
thead th { background: var(--page); }

/* Calendar */
.calendar-filter { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.calendar-filter select { font: inherit; padding: 0.4rem; max-width: 100%; color: var(--ink); background: var(--surface); border: 1px solid var(--field-line); border-radius: var(--radius-small); }
.calendar-nav { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1rem; }
.calendar-nav h2 { margin: 0; }
.calendar-views ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0; margin: 1rem 0 0; }
.calendar-views a { display: inline-block; padding: 0.3rem 0.8rem; border: 1px solid var(--line); border-radius: var(--radius-small); background: var(--surface); }
.calendar-views [aria-current] { background: var(--primary); color: var(--on-primary); }
.week-list section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.2rem 1rem 0.6rem; margin-block: 0.6rem; }
.week-list section.is-today { border-left: 5px solid var(--primary); }
.week-list h3 { margin-top: 0.6rem; }
.year-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; margin-top: 1rem; }
.mini-month { margin: 0; font-size: 0.85rem; }
.mini-month caption { font-size: 1rem; }
.mini-month th, .mini-month td { text-align: center; padding: 0.25rem; }
.mini-month .is-busy { display: block; font-weight: 700; background: var(--accent); color: var(--on-accent); border-radius: var(--radius-small); }
.mini-month .is-today { outline: 2px solid var(--primary); outline-offset: -2px; }
.month-grid { table-layout: fixed; min-width: 46rem; }
.month-grid td { height: 6.5rem; padding: 0.3rem; font-size: 0.8rem; }
.month-grid .is-outside { background: var(--page); color: var(--muted); }
.month-grid .is-today { outline: 2px solid var(--primary); outline-offset: -2px; }
.month-grid__day { font-weight: 700; font-size: 0.9rem; color: inherit; }
.month-grid ul { list-style: none; margin: 0.2rem 0 0; padding: 0; }
.month-grid li { border-left: 4px solid var(--primary); padding-left: 0.3rem; margin-bottom: 0.3rem; line-height: 1.25; }
.month-grid__time { display: block; color: var(--muted); }
.month-grid .is-cancelled a { text-decoration: line-through; }

/* Footer */
.site-footer { background: var(--footer-bg); color: var(--footer-ink); border-top: var(--footer-border); padding-block: 2.4rem 1.2rem; }
.site-footer__inner { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 2.5rem; }
.site-footer h2 { color: var(--footer-ink); font-size: 1.25rem; margin-top: 0; }
.site-footer a { color: var(--footer-link); }
.site-footer .button--accent { color: var(--on-accent); }
.site-footer address { font-style: normal; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { padding: 0.15rem 0; }
.site-footer__base { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--footer-line); font-size: 0.9rem; }
.site-footer__base > :last-child { margin-left: auto; }

@media (max-width: 62rem) {
  .home-columns { grid-template-columns: 1fr; gap: 2rem; }
  .main-nav__toggle { display: inline-block; order: 2; }
  .site-search { order: 3; }
  .main-nav { order: 4; flex-basis: 100%; }
  .main-nav__list { display: none; flex-direction: column; }
  .main-nav__list.is-open { display: flex; }
  .main-nav__submenu, .main-nav__submenu--wide { position: static; width: auto; columns: 1; box-shadow: none; max-height: none; border: 0; border-left: 3px solid var(--accent); border-radius: 0; }
}
@media (max-width: 52rem) {
  .with-sidebar { grid-template-columns: 1fr; }
  .site-header { position: static; }
  .site-search input { width: 8rem; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  [data-hero="compact"] .hero__state { display: block; margin: 0.6rem 0 0; padding: 0.5rem 0 0; border-left: 0; border-top: 3px solid var(--accent); }
}
@media (prefers-reduced-motion: reduce) {
  .hero__slide { transition: none; }
}
@media print {
  .site-header, .site-footer, aside, .alert-banner, .breadcrumbs, .calendar-filter, .hero__controls, .band, .signup { display: none; }
  body { background: #fff; }
  article { border: 0; padding: 0; }
}

/* Bids, jobs and notices */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; margin-block: 1rem; }
.facts dt { font-weight: 700; }
.facts dd { margin: 0; }
.sub-urgent label { display: block; margin-bottom: 0.4rem; }

/* ---------- Themes (Settings → Themes) ---------- */
/* A theme sets the options above (in look.py) and adds the few touches here. */

/* Modern: cards lift off a white page; rules give way to space. */
[data-theme="modern"] { --page: #ffffff; --shadow-card: 0 1px 2px rgb(16 24 40 / 0.06), 0 8px 24px rgb(16 24 40 / 0.07); --shadow-raised: 0 12px 32px rgb(16 24 40 / 0.14); }
[data-theme="modern"] h1, [data-theme="modern"] h2 { letter-spacing: -0.02em; }
[data-theme="modern"] .site-header { border-top: 0; }
[data-theme="modern"] .tile { border: 0; padding: 1.3rem 1.2rem; }
[data-theme="modern"] .tile__icon { width: 2.6rem; height: 2.6rem; padding: 0.5rem; background: var(--tint); border-radius: var(--radius-small); }
[data-theme="modern"] .section-head { border-bottom: 0; }
[data-theme="modern"] .section-head h2::before { content: ""; display: inline-block; width: 0.5rem; height: 1.2rem; margin-right: 0.6rem; background: var(--accent); border-radius: 999px; vertical-align: -0.1em; }
[data-theme="modern"] .news-card, [data-theme="modern"] article, [data-theme="modern"] .columns > section { border-color: transparent; }
[data-theme="modern"] .date-block { border: 0; background: var(--tint); padding: 0.4rem 0 0.5rem; }
[data-theme="modern"] button, [data-theme="modern"] .button { border-radius: 999px; padding-inline: 1.2rem; }
[data-theme="modern"] .site-search input { border-radius: 999px 0 0 999px; padding-left: 1rem; }
[data-theme="modern"] .site-search button { border-radius: 0 999px 999px 0; }
@media (prefers-color-scheme: dark) {
  [data-theme="modern"][data-scheme="auto"] { --page: #14171b; --shadow-card: none; }
  [data-theme="modern"][data-scheme="auto"] .news-card, [data-theme="modern"][data-scheme="auto"] article { border-color: var(--line); }
}

/* Heritage: a town report. Fine rules, centred titles, no shadows. */
[data-theme="heritage"] { --shadow-raised: none; --page: #f7f5f0; }
[data-theme="heritage"] .site-header { box-shadow: none; border-bottom: 4px double var(--accent); }
[data-theme="heritage"] .hero__text { text-align: center; }
[data-theme="heritage"] .hero__state { margin-inline: auto; }
[data-theme="heritage"] .hero__tagline { margin-inline: auto; }
[data-theme="heritage"] .tile { justify-items: center; text-align: center; border: 1px solid var(--line); border-top: 4px solid var(--primary); }
[data-theme="heritage"] .section-head { border-bottom: 1px solid var(--heading); box-shadow: 0 3px 0 var(--page), 0 4px 0 var(--heading); }
[data-theme="heritage"] .section-head h2 { font-variant-caps: small-caps; letter-spacing: 0.03em; font-size: 1.6rem; }
[data-theme="heritage"] .date-block { border-top-width: 1px; }
@media (prefers-color-scheme: dark) {
  [data-theme="heritage"][data-scheme="auto"] { --page: #14171b; }
}

/* Plain: nothing that is not a link, a heading or text. */
[data-theme="plain"] { --page: #ffffff; --shadow-raised: none; }
[data-theme="plain"] .site-header { box-shadow: 0 1px 0 var(--line); }
[data-theme="plain"] .hero__contours { display: none; }
[data-theme="plain"] .tile { border: 2px solid var(--ink); gap: 0.4rem; }
[data-theme="plain"] .tile__label { text-decoration: underline; text-underline-offset: 0.15em; }
[data-theme="plain"] .tile:hover, [data-theme="plain"] .tile:focus-visible { border-color: var(--ink); background: var(--tint); }
[data-theme="plain"] .section-head { border-bottom: 2px solid var(--ink); }
[data-theme="plain"] .news-card { border: 0; border-top: 1px solid var(--line); background: none; }
[data-theme="plain"] .news-card__body { padding-inline: 0; }
[data-theme="plain"] .news-card h3 a { text-decoration: underline; }
[data-theme="plain"] .date-block { border: 0; border-left: 4px solid var(--primary); background: none; }
[data-theme="plain"] .signup { background: none; }
@media (prefers-color-scheme: dark) {
  [data-theme="plain"][data-scheme="auto"] { --page: #14171b; }
}

/* Shown only to staff who are trying a theme before choosing it. */
.preview-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.2rem 1.5rem; padding: 0.5rem 1rem; background: #1f2328; color: #fff; font-family: var(--sans); font-size: 0.95rem; }
.preview-bar p { margin: 0; }
.preview-bar a { color: #fff; margin-left: 0.8rem; }
@media print { .preview-bar { display: none; } }
