/* EastCambs.co.uk
   Palette: Fen night indigo, rapeseed yellow, sedge green, big-sky blue on cream.
   All text/background pairs meet WCAG 2.2 AA (most meet AAA); see README. */

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/assets/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/assets/fonts/atkinson-hyperlegible-latin-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/assets/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("/assets/fonts/fraunces-latin-600-normal.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("/assets/fonts/fraunces-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --ink: #1c1b29;
  --indigo: #2b2d6e;
  --indigo-deep: #1d1e4f;
  --rapeseed: #f5c518;
  --rapeseed-soft: #fdf1c2;
  --sedge: #2e6b4f;
  --sedge-soft: #e3efe7;
  --sky: #9fc0e8;
  --sky-soft: #e8eff9;
  --poppy: #b8321f;
  --cream: #fbf8f1;
  --white: #fff;
  --muted: #474a5e;
  --line: #d9d3c4;
  --on-dark: #f3f1fb;
  --on-dark-muted: #d4d4ec;
  --poppy-soft: #fbe9e6;

  /* Colour roles: what most rules use, so dark mode only needs to redefine these */
  --page: var(--cream);
  --surface: var(--white);
  --text: var(--ink);
  --heading: var(--indigo-deep);
  --link: var(--indigo);
  --link-hover: var(--indigo-deep);
  --link-visited: #5b2f7d;
  --accent-text: var(--sedge);

  /* Dark mode palette (used when the device is set to dark; see below) */
  --dark-page: #15162b;
  --dark-surface: #1f2042;
  --dark-text: #ecebf5;
  --dark-heading: #f3f1fb;
  --dark-link: #b7c4ff;
  --dark-link-visited: #e0bdf5;
  --dark-accent: #8fd3ad;
  --dark-muted: #b8bad0;
  --dark-line: #3b3d68;
  --dark-sky-soft: #1c2846;
  --dark-sedge-soft: #1a3328;
  --dark-rapeseed-soft: #3b3214;
  --dark-poppy-soft: #41201b;

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --radius: 14px;
  --gutter: 16px;
  --measure: 68ch;
}

/* Dark mode follows the visitor's device setting. Brand panels (header photo
   bands, footer, buttons) keep their colours; page, cards, text and links switch. */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: var(--dark-page);
    --surface: var(--dark-surface);
    --text: var(--dark-text);
    --heading: var(--dark-heading);
    --link: var(--dark-link);
    --link-hover: var(--white);
    --link-visited: var(--dark-link-visited);
    --accent-text: var(--dark-accent);
    --muted: var(--dark-muted);
    --line: var(--dark-line);
    --sky-soft: var(--dark-sky-soft);
    --sedge-soft: var(--dark-sedge-soft);
    --rapeseed-soft: var(--dark-rapeseed-soft);
    --poppy-soft: var(--dark-poppy-soft);
  }
  .photo img, .dev-map--live { filter: brightness(.92); }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--page);
}

img, svg { display: block; max-width: 100%; height: auto; }

h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.15; color: var(--heading); text-wrap: balance; }
h1 { font-size: clamp(2.2rem, 5.5vw, 3.75rem); margin: 0 0 1rem; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); margin: 0 0 .75rem; }
h3 { font-size: 1.3rem; font-weight: 600; margin: 0 0 .4rem; }
p, ul, ol, dl { margin: 0 0 1rem; }
p { max-width: var(--measure); }

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--link-hover); text-decoration-thickness: 3px; }
a:visited { color: var(--link-visited); }

/* GOV.UK-style focus: high-visibility yellow with dark underline, works on any background */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid transparent;
  color: var(--ink) !important;
  background-color: var(--rapeseed);
  box-shadow: 0 -2px var(--rapeseed), 0 4px var(--ink);
  text-decoration: none;
}
button:focus-visible { box-shadow: 0 0 0 3px var(--rapeseed), 0 0 0 6px var(--ink); }
main:focus { outline: none; }

/* External links get a visual cue; the alt text after the slash keeps it silent for screen readers */
/* Drawn as an SVG mask in the link colour: a text arrow (U+2197) isn't in our fonts,
   and iOS would fall back to a blue emoji. */
a[href^="http"]:not(.btn)::after {
  content: "";
  display: inline-block;
  width: .7em;
  height: .7em;
  margin-left: .2em;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 2h7v7H8V5.4L2.7 10.7 1.3 9.3 6.6 4H3z'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 2h7v7H8V5.4L2.7 10.7 1.3 9.3 6.6 4H3z'/%3E%3C/svg%3E") no-repeat center / contain;
}

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

.wrap { width: 100%; max-width: 1140px; margin-left: auto; margin-right: auto; padding-left: var(--gutter); padding-right: var(--gutter); }
@media (min-width: 640px) { :root { --gutter: 24px; } }
.section { padding-top: clamp(48px, 8vw, 88px); padding-bottom: clamp(48px, 8vw, 88px); }
.section--tint { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section--sky { background: var(--sky-soft); }
.lede { font-size: clamp(1.15rem, 2vw, 1.35rem); max-width: 60ch; }
.kicker { font-weight: 700; font-size: .9rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-text); margin-bottom: .5rem; }
.muted { color: var(--muted); }
.small { font-size: .95rem; }

/* Skip link */
.skip-link {
  position: absolute; left: var(--gutter); top: -100px; z-index: 100;
  background: var(--rapeseed); color: var(--ink); font-weight: 700;
  padding: 12px 16px; text-decoration: underline;
}
.skip-link:focus { top: 8px; }

/* Header and navigation */
.site-header { background: var(--surface); border-bottom: 4px solid var(--rapeseed); }
/* Keep the header (and its open drop-down menus) above the page. Without this, the
   view-transition-name given to the header when animations are on puts it in its own
   stacking layer, and the hero photo, which comes later in the page, paints over the menus. */
.site-header { position: relative; z-index: 100; }
.site-header__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; min-height: 72px; padding-top: 8px; padding-bottom: 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--heading); }
.brand:visited { color: var(--heading); }
.brand img { width: 44px; height: 44px; }
.brand__name { font-family: var(--serif); font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em; }
.brand__name span { color: var(--accent-text); }

.nav-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  font: 700 1rem var(--sans); color: var(--heading);
  background: var(--surface); border: 2px solid var(--heading); border-radius: 999px;
  padding: 8px 16px; min-height: 44px; cursor: pointer;
}
.nav-toggle[hidden] { display: none; }
.nav-toggle__icon, .nav-toggle__icon::before, .nav-toggle__icon::after {
  display: block; width: 18px; height: 2px; background: currentColor; position: relative; content: "";
}
.nav-toggle__icon::before { position: absolute; top: -6px; }
.nav-toggle__icon::after { position: absolute; top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle__icon { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle__icon::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__icon::after { top: 0; transform: rotate(-45deg); }

.site-nav { flex-basis: 100%; }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.site-nav a {
  display: block; padding: 10px 12px; border-radius: 8px; min-height: 44px;
  font-weight: 700; color: var(--text); text-decoration: none;
}
.site-nav a:visited { color: var(--text); }
.site-nav a:hover { background: var(--sky-soft); text-decoration: underline; }
.site-nav a[aria-current="page"] { box-shadow: inset 0 -4px var(--sedge); border-radius: 8px 8px 0 0; }
.js .site-nav[data-collapsed="true"] { display: none; }

/* Menu groups: a link to the group's hub page, and (with JavaScript) a button that
   opens the group's pages. Without JavaScript the drop-downs stay closed on wide
   screens (the hub pages link to everything) and open on small screens. */
.nav-item { position: relative; display: flex; flex-wrap: wrap; align-items: center; }
.nav-item--current > .nav-link { box-shadow: inset 0 -4px var(--sedge); border-radius: 8px 8px 0 0; }
.nav-sub-toggle {
  display: inline-grid; place-items: center; width: 36px; min-height: 44px; margin-left: -6px;
  border: 0; border-radius: 8px; background: none; color: var(--text); cursor: pointer;
}
.nav-sub-toggle[hidden] { display: none; }
.nav-sub-toggle:hover { background: var(--sky-soft); }
.nav-sub-toggle svg { transition: transform .15s ease; }
.nav-sub-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.nav-sub { list-style: none; margin: 0; padding: 0 0 6px 18px; flex-basis: 100%; }
.nav-sub a { font-weight: 400; }
.nav-sub a[aria-current="page"] { font-weight: 700; box-shadow: inset 4px 0 var(--sedge); border-radius: 0 8px 8px 0; }
.js .nav-sub { display: none; }
.js .nav-sub-toggle[aria-expanded="true"] + .nav-sub { display: block; }
@media (min-width: 1100px) {
  .nav-sub, .js .nav-sub { display: none; }
  .nav-sub, .js .nav-sub-toggle[aria-expanded="true"] + .nav-sub {
    position: absolute; top: calc(100% + 4px); left: 0; z-index: 50; min-width: 250px; padding: 8px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
    box-shadow: 0 10px 30px rgb(0 0 0 / .15);
  }
  .js .nav-sub-toggle[aria-expanded="true"] + .nav-sub { display: block; }
  .nav-sub--columns { columns: 2; column-gap: 8px; min-width: 420px; }
  .nav-sub--columns li { break-inside: avoid; }
  .nav-item:last-child .nav-sub, .nav-item:nth-last-child(2) .nav-sub { left: auto; right: 0; }
}
@media (prefers-reduced-motion: reduce) { .nav-sub-toggle svg { transition: none; } }
@media (forced-colors: active) { .nav-sub { border: 1px solid CanvasText; } .nav-item--current > .nav-link { text-decoration: underline; } }

/* "In this section" links under the page header */
.section-nav { background: var(--surface); border-bottom: 1px solid var(--line); }
.section-nav ul { list-style: none; margin: 0; padding: 6px 0; display: flex; flex-wrap: wrap; gap: 2px 4px; }
.section-nav a { display: inline-block; padding: 10px 12px; min-height: 44px; border-radius: 8px; font-weight: 700; text-decoration: none; color: var(--text); }
.section-nav a:visited { color: var(--text); }
.section-nav a:hover { background: var(--sky-soft); text-decoration: underline; }
.section-nav a[aria-current="page"] { box-shadow: inset 0 -4px var(--sedge); border-radius: 8px 8px 0 0; }

/* Nearby places and related links at the end of a page */
.section--related { background: var(--surface); border-top: 1px solid var(--line); padding-top: 40px; padding-bottom: 40px; }
.related-grid { display: grid; gap: 24px 48px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.related-links { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: 8px; }
.related-links a { font-weight: 700; }

/* A to Z of places */
.place-index { list-style: none; padding: 0; margin: 1rem 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.place-index a {
  display: inline-block; padding: 8px 16px; min-height: 44px; border: 2px solid var(--line); border-radius: 999px;
  background: var(--surface); font-weight: 700; text-decoration: none; line-height: 1.5;
}
.place-index a:hover { border-color: var(--link); text-decoration: underline; }
.places-map { margin-top: 1.25rem; }
.places-map:empty { display: none; }
.places-map .dev-map--live { height: 440px; }

@media (max-width: 1099px) {
  .nav-list { flex-direction: column; padding-bottom: 8px; }
}
/* When JavaScript is available, start the small-screen menu collapsed before first paint,
   so nothing jumps when site.js runs. Without JavaScript the menu stays open and usable. */
@media (max-width: 1099px) and (scripting: enabled) {
  .nav-toggle[hidden] { display: inline-flex; }
  .site-nav:not([data-collapsed="false"]) { display: none; }
}
@media (min-width: 1100px) {
  .site-nav { flex-basis: auto; }
  .js .site-nav[data-collapsed="true"] { display: block; }
  .nav-toggle { display: none !important; }
}

/* Breadcrumbs */
.breadcrumbs { font-size: 1rem; padding-top: 14px; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; }
.breadcrumbs li + li::before { content: "\203A"; content: "\203A" / ""; margin-right: 6px; color: var(--on-dark-muted); }
.breadcrumbs a, .breadcrumbs a:visited { color: var(--on-dark); }
.breadcrumbs [aria-current] { color: var(--on-dark-muted); }

/* Home hero */
.hero { background: var(--indigo); color: var(--on-dark); position: relative; overflow: hidden; }
.hero__text { padding-top: clamp(48px, 9vw, 104px); padding-bottom: 24px; position: relative; z-index: 1; }
.hero h1 { color: var(--white); max-width: 16ch; }
.hero .kicker { color: var(--rapeseed); }
.hero .lede { color: var(--on-dark); }
.hero__art { width: 100%; height: clamp(140px, 22vw, 260px); margin-top: -10px; }
.hero { display: grid; border-bottom: 14px solid var(--rapeseed); }
.hero__text { padding-bottom: clamp(32px, 6vw, 72px); }
.hero .photo--hero { margin: 0; position: relative; }
.hero .photo--hero img { border-radius: 0; height: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.hero .photo--hero figcaption {
  position: absolute; right: 0; bottom: 0; margin: 0; max-width: 100%;
  padding: 6px 12px; border-top-left-radius: 10px;
  background: var(--indigo-deep); color: var(--on-dark-muted); font-size: .85rem;
}
.hero .photo--hero figcaption a, .hero .photo--hero figcaption a:visited { color: var(--on-dark); }
@media (min-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: min(600px, 75vh); }
  .hero__text {
    max-width: none; margin: 0; align-self: center;
    padding-left: max(var(--gutter), calc((100vw - 1100px) / 2)); padding-right: 40px;
  }
  .hero h1 { max-width: 14ch; }
  .hero .photo--hero img { aspect-ratio: auto; position: absolute; inset: 0; }
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.5rem; }

/* Page header for inner pages */
.page-header { background: var(--indigo); color: var(--on-dark); }
.page-header__inner { padding-top: 8px; padding-bottom: clamp(32px, 6vw, 56px); }
.page-header h1 { color: var(--white); margin-top: 1rem; }
.page-header .lede { color: var(--on-dark); margin-bottom: 0; }
.page-header::after {
  content: ""; display: block; height: 14px;
  background: linear-gradient(to bottom, var(--sedge) 0 50%, var(--rapeseed) 50% 100%);
}

/* Page header with a photo: text and photo side by side on wider screens */
.page-header--photo .page-header__inner { display: grid; gap: 0 40px; align-items: center; }
.page-header--photo .breadcrumbs { grid-column: 1 / -1; }
.page-header--photo .photo { margin: 24px 0 0; }
.page-header .photo img { aspect-ratio: 16 / 9; object-fit: cover; }
@media (min-width: 860px) {
  .page-header--photo .page-header__inner { grid-template-columns: 3fr 2fr; }
  .page-header .photo img { aspect-ratio: 3 / 2; }
}
.page-header .photo figcaption { color: var(--on-dark-muted); }
.page-header .photo figcaption a, .page-header .photo figcaption a:visited { color: var(--on-dark); }

/* Photos, always with a caption crediting the photographer and licence */
.photo { margin: 0 0 1.5rem; }
.photo img { display: block; width: 100%; height: auto; border-radius: var(--radius); background: var(--line); }
.photo figcaption { font-size: .9rem; line-height: 1.45; color: var(--muted); margin-top: 8px; }
.photo__credit { white-space: normal; }
.card > .photo:first-child { margin: -24px -24px 12px; }
.card > .photo:first-child img { border-radius: calc(var(--radius) - 7px) calc(var(--radius) - 7px) 0 0; aspect-ratio: 3 / 2; object-fit: cover; }
.card > .photo:first-child figcaption { padding: 0 24px; }
.split .photo img { aspect-ratio: 3 / 2; object-fit: cover; }
.credits { padding-left: 1.2em; }
.credits li { margin-bottom: .5rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 22px; border-radius: 999px;
  font-weight: 700; text-decoration: none; border: 2px solid transparent;
}
.btn--primary, .btn--primary:visited { background: var(--rapeseed); color: var(--ink); }
.btn--primary:hover { background: #ffd84d; color: var(--ink); }
.btn--ghost, .btn--ghost:visited { color: var(--white); border-color: var(--on-dark); }
.btn--ghost:hover { background: var(--indigo-deep); color: var(--white); }
.btn--dark, .btn--dark:visited { background: var(--indigo); color: var(--white); }
.btn--dark:hover { background: var(--indigo-deep); color: var(--white); }

/* Cards and grids */
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); padding: 0; margin: 1.5rem 0 0; list-style: none; }
.grid--2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; display: flex; flex-direction: column; gap: 4px;
  border-top: 6px solid var(--sedge);
}
.card--rapeseed { border-top-color: var(--rapeseed); }
.card--sky { border-top-color: var(--sky); }
.card--indigo { border-top-color: var(--indigo); }
.card p { margin: 0 0 .5rem; }
.card p:last-child { margin-bottom: 0; }
.card .meta { font-size: 1rem; color: var(--muted); }
.card__links { margin-top: auto; padding-top: 8px; display: flex; flex-wrap: wrap; gap: 4px 16px; font-weight: 700; }

/* Card whose whole surface is a link, with a single accessible name from the heading */
.card--link { position: relative; transition: transform .15s ease; }
.card--link h3 a { text-decoration: none; }
.card--link h3 a::before { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: var(--radius); }
.card--link:hover { border-color: var(--indigo); }
.card--link:hover h3 a { text-decoration: underline; }
.card--link:focus-within { box-shadow: 0 0 0 3px var(--rapeseed), 0 0 0 6px var(--ink); }
.card--link h3 a:focus-visible { background: none; box-shadow: none; text-decoration: underline; }
@media (prefers-reduced-motion: no-preference) { .card--link:hover { transform: translateY(-2px); } }

.icon-badge { width: 52px; height: 52px; margin-bottom: 8px; }

/* Directory listings */
.directory { list-style: none; margin: 1.25rem 0 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.directory li { background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--sky); border-radius: 10px; padding: 16px 18px; }
.directory h3 { font-size: 1.15rem; margin-bottom: .25rem; }
.directory p { margin: 0; font-size: 1.05rem; }
.directory .where { font-size: .95rem; color: var(--muted); margin-top: 6px; }
.directory--compact { gap: 0 32px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.directory--compact li { background: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 14px 0; }
.back-top { margin: 1.25rem 0 0; font-size: 1rem; }

/* What's on */
.event-list { list-style: none; margin: 1.25rem 0 0; padding: 0; display: grid; gap: 14px; }
.event-list > li {
  display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px;
}
.event-list h3 { font-size: 1.2rem; margin: 0 0 .25rem; }
.event-list p { margin: 0 0 .35rem; }
.event-list .where { font-weight: 700; color: var(--text); }
.event-date {
  display: grid; place-items: center; width: 4.2rem; padding: 8px 0; margin: 0; border-radius: 10px;
  background: var(--indigo); color: var(--white); line-height: 1.1; text-align: center;
}
.event-date__day { font-family: var(--serif); font-size: 1.7rem; font-weight: 700; }
.event-date__month { font-size: .9rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--rapeseed); }
.year-list { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; gap: 28px; }
.year-list > li { display: grid; gap: 4px 32px; }
@media (min-width: 860px) { .year-list > li { grid-template-columns: 10rem 1fr; } }
.year-list h3 { margin: 12px 0 0; color: var(--accent-text); }
.year-list .directory--compact { margin-top: 0; }
.year-list h4 { font-size: 1.1rem; margin: 0 0 .25rem; }
@media (forced-colors: active) { .event-date { border: 1px solid CanvasText; } }

.section-intro { display: grid; gap: 8px; margin-bottom: 1rem; }
.toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; margin-top: 1.5rem; }
.toc h2 { font-size: 1.2rem; font-family: var(--sans); color: var(--text); }
.toc ul { columns: 2 220px; margin: 0; padding-left: 1.2rem; }

/* Feature split */
.split { display: grid; gap: 32px; align-items: start; }
@media (min-width: 860px) { .split { grid-template-columns: 3fr 2fr; } }
.panel { background: var(--indigo); color: var(--on-dark); border-radius: var(--radius); padding: 28px; }
.panel h2, .panel h3 { color: var(--rapeseed); }
.panel a, .panel a:visited { color: var(--white); }
.facts { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.facts li { padding-left: 28px; position: relative; }
.facts li::before { content: ""; position: absolute; left: 0; top: .5em; width: 14px; height: 14px; border-radius: 50%; background: var(--rapeseed); }

.callout { background: var(--rapeseed-soft); border-left: 8px solid var(--rapeseed); padding: 20px 24px; border-radius: 0 var(--radius) var(--radius) 0; margin: 1.5rem 0; }
.callout p:last-child { margin-bottom: 0; }
.callout--urgent { background: var(--poppy-soft); border-left-color: var(--poppy); }

.calendar { list-style: none; padding: 0; margin: 1.25rem 0 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.calendar li { background: var(--surface); border-radius: var(--radius); padding: 20px; border: 1px solid var(--line); }
.calendar .when { display: inline-block; font-weight: 700; background: var(--sedge); color: var(--white); padding: 2px 10px; border-radius: 999px; font-size: .95rem; margin-bottom: 8px; }

.prose { max-width: var(--measure); }
.prose h2 { margin-top: 2.5rem; font-size: 1.75rem; }
.prose h3 { margin-top: 1.75rem; }
.prose li { margin-bottom: .4rem; }

/* Footer */
.site-footer { background: var(--indigo-deep); color: var(--on-dark); padding-top: 56px; padding-bottom: 32px; margin-top: 0; }
.site-footer a, .site-footer a:visited { color: var(--white); }
.site-footer h2 { font-family: var(--sans); font-size: 1.05rem; letter-spacing: .08em; text-transform: uppercase; color: var(--rapeseed); margin-bottom: .75rem; }
.footer-grid { display: grid; gap: 32px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.footer-places ul { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
.footer-subhead { margin-top: 1.5rem; }
@media (min-width: 1100px) {
  .footer-grid { grid-template-columns: 1.3fr 1fr 1.7fr 1.1fr 1.3fr; }
}
.footer-grid a { display: inline-block; padding-top: 2px; padding-bottom: 2px; }
.footer-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-family: var(--serif); font-size: 1.5rem; font-weight: 700; color: var(--white); }
.footer-brand img { width: 48px; height: 48px; }
.footer-base { border-top: 1px solid #3c3e7c; margin-top: 40px; padding-top: 20px; font-size: 1rem; color: var(--on-dark-muted); display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
.footer-base p { margin: 0; }

/* 404 */
.notfound { text-align: center; display: grid; justify-items: center; gap: 4px; }
.notfound img { width: 120px; height: 120px; margin-bottom: 1rem; }
.notfound p { margin-left: auto; margin-right: auto; }

/* Windows High Contrast / forced colours */
@media (forced-colors: active) {
  .card, .directory li, .calendar li, .toc, .panel, .callout { border: 1px solid CanvasText; }
  .site-nav a[aria-current="page"] { text-decoration: underline; }
  a:focus-visible, button:focus-visible { outline: 3px solid Highlight; }
  .card--link:focus-within { outline: 3px solid Highlight; }
}

@media print {
  .site-header, .site-nav, .site-footer, .skip-link, .hero__art, .nav-toggle { display: none !important; }
  body { background: #fff; color: #000; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; width: auto; height: auto; background: none; -webkit-mask: none; mask: none; }
}

/* Live here: development map and numbered list */
.dev-layout { display: grid; gap: 24px; align-items: start; margin-top: 1.5rem; }
@media (min-width: 960px) {
  .dev-layout { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
}
.dev-map { width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.dev-map text { font-family: var(--sans); }
.dev-map--live { height: 360px; z-index: 0; font-family: var(--sans); font-size: 1rem; }
@media (min-width: 960px) {
  .dev-map-wrap { position: sticky; top: 24px; }
  .dev-map-wrap .dev-map { position: static; }
  .dev-map--live { height: min(620px, calc(100vh - 48px)); }
}
.dev-pin span {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--indigo); color: var(--white); border: 3px solid var(--white);
  font-weight: 700; font-size: 1rem; box-shadow: 0 1px 4px rgb(0 0 0 / .4);
}
.dev-pin--approx span { border-style: dashed; }
.attractions-map { margin: 1.25rem 0 0; }
.dev-pin--dot.dev-pin--in-water span { background: #1f4f86; }
.dev-pin--dot.dev-pin--in-arts span { background: var(--poppy); }
.dev-pin--dot.dev-pin--in-nature span { background: #7a5b00; }
.map-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: .5rem 0 0; font-size: 1rem; }
.map-legend__item { display: inline-flex; align-items: center; gap: 8px; }
.map-legend__item::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--white); box-shadow: 0 0 0 1px var(--line); background: var(--sedge); }
.map-legend__item--water::before { background: #1f4f86; }
.map-legend__item--arts::before { background: var(--poppy); }
.map-legend__item--nature::before { background: #7a5b00; }
.attractions-map:empty { display: none; }
.attractions-map .dev-map--live { height: 420px; }
.map-fallback { margin: 0; padding: 20px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface); }
.dev-pin--dot span { width: 26px; height: 26px; background: var(--sedge); border-width: 3px; }
.dev-pin:focus-visible { outline: none; }
.dev-pin:focus-visible span { box-shadow: 0 0 0 3px var(--rapeseed), 0 0 0 6px var(--ink); }
.leaflet-container a { color: var(--indigo); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--text); }
.leaflet-popup-content a { color: var(--link); }
.leaflet-popup-content { font-size: 1rem; line-height: 1.45; margin: 12px 16px; }
.leaflet-popup-content p { margin: .25rem 0 .4rem; }
.link-button {
  align-self: flex-start; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: .95rem; font-weight: 700; color: var(--link);
  text-decoration: underline; text-underline-offset: .18em;
}
.link-button:hover { text-decoration-thickness: 3px; }
@media (forced-colors: active) { .dev-pin span { border-color: CanvasText; forced-color-adjust: none; } }
.map-town { font-size: 15px; fill: var(--ink); }
.map-town--big { font-size: 19px; font-weight: 700; }
.map-context { font-size: 14px; fill: var(--muted); font-style: italic; }
.map-river { font-size: 13px; fill: #1f4f86; font-style: italic; }
.map-marker text { font-size: 14px; font-weight: 700; fill: #fff; }
.dev-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.dev-list > li { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.dev-list h3 { font-size: 1.15rem; margin: 0; }
.dev-list p { margin: 0; font-size: 1.05rem; }
.dev-list .where { font-size: .95rem; color: var(--muted); }
.dev-list .card__links { margin-top: 0; padding-top: 0; }
.dev-statuses { list-style: none; margin: auto 0 0; padding: 6px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.dev-num { display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--indigo); color: var(--white); font-family: var(--sans); font-size: .85em; vertical-align: .1em; margin-right: .2em; }
.dev-status { display: inline-block; padding: 2px 12px; border-radius: 999px; font-size: .9rem; font-weight: 700; color: var(--text); background: var(--sedge-soft); border: 2px solid var(--sedge); }
.dev-status--soon { background: var(--rapeseed-soft); border-color: var(--rapeseed); }
.dev-status--building, .dev-status--check { background: var(--sky-soft); border-color: var(--sky); }
.dev-status--last { background: var(--poppy-soft); border-color: var(--poppy); }
.sub-heading { margin-top: 2.5rem; font-size: 1.5rem; }
@media (forced-colors: active) { .dev-num { border: 1px solid CanvasText; } }

/* Header search link */
.search-link { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; color: var(--heading); margin-left: auto; }
.search-link:visited { color: var(--heading); }
.search-link:hover { background: var(--sky-soft); }
.search-link__icon { width: 22px; height: 22px; }


/* Header layout: logo left; search + menu button right on small screens; menu then search on wide screens */
.brand { order: 1; }
.search-link { order: 2; }
.nav-toggle { order: 3; }
.site-nav { order: 4; }
@media (max-width: 1099px) {
  .site-header__inner { column-gap: 8px; }
  .search-link { margin-left: auto; }
}
@media (max-width: 400px) {
  .brand__name { font-size: 1.4rem; }
  .brand img { width: 38px; height: 38px; }
}
@media (min-width: 1100px) {
  .site-header__inner { flex-wrap: nowrap; column-gap: 12px; }
  .site-nav { order: 2; margin-left: auto; }
  .search-link { order: 3; margin-left: 0; flex: none; }
  .site-nav a { padding-left: 10px; padding-right: 10px; }
}

/* Search page */
.search-page { max-width: 820px; }
.search-form label { display: block; font-weight: 700; font-size: 1.15rem; margin-bottom: 8px; }
.search-form__row { display: flex; flex-wrap: wrap; gap: 12px; }
.search-form__town { margin-top: 14px; }
.search-form__town label { font-size: 1rem; margin-bottom: 4px; }
.search-form__town select {
  min-height: 48px; padding: 8px 12px; border: 2px solid var(--heading); border-radius: 10px;
  background: var(--surface); color: var(--text); font: inherit; max-width: 100%;
}
.search-form__row input { flex: 1 1 260px; min-height: 52px; padding: 8px 14px; font: inherit; font-size: 1.15rem; border: 2px solid var(--text); border-radius: 8px; background: var(--surface); color: var(--text); }
.search-form__row input:focus-visible { outline: 3px solid var(--rapeseed); outline-offset: 0; box-shadow: 0 0 0 6px var(--ink); }
.search-status { margin: 1.25rem 0 .5rem; font-weight: 700; color: var(--accent-text); min-height: 1.6em; }
.search-results { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.search-result { background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--indigo); border-radius: 10px; padding: 16px 20px; }
.search-result__title { font-size: 1.2rem; margin: 0 0 .3rem; }
.search-result p { margin: 0; color: var(--muted); }
.search-subresults { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: 10px; }
.search-subresults li { border-top: 1px solid var(--line); padding-top: 10px; }
.search-subresults a { font-weight: 700; }
.search-subresults p { margin: 2px 0 0; color: var(--muted); }
.search-result mark { background: var(--rapeseed-soft); color: var(--text); padding: 0 2px; }

/* Utility: style a heading as a smaller level without changing document structure */
.h3 { font-size: 1.35rem; font-weight: 600; }

/* ------------------------------------------------------------------
   Motion. Everything here is opt-in via prefers-reduced-motion, uses
   only transform/opacity (no layout shift), plays once (no looping
   motion, WCAG 2.2.2), and never hides content from search engines:
   without support or with reduced motion the page is simply static.
   ------------------------------------------------------------------ */
@media (prefers-reduced-motion: no-preference) {
  /* Smooth cross-fade between pages in browsers that support it; the header stays put */
  @view-transition { navigation: auto; }
  .site-header { view-transition-name: site-header; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .25s; }

  /* Home hero: sun rises over the fen, text settles in. The h1 animates
     transform only, so it is visible (and counts for LCP) from the first paint. */
  .hero__sun { transform-box: fill-box; transform-origin: center; animation: sun-rise 1.8s cubic-bezier(.2, .7, .2, 1) both; }
  .hero__reeds { transform-box: fill-box; transform-origin: bottom; animation: reeds-sway 2.4s ease-in-out .4s both; }
  .hero__river { animation: river-drift 2.4s ease-out both; }
  .hero h1 { animation: settle .8s cubic-bezier(.2, .7, .2, 1) both; }
  .hero .kicker, .hero .lede, .hero__actions { animation: fade-up .7s cubic-bezier(.2, .7, .2, 1) both; }
  .hero .lede { animation-delay: .12s; }
  .hero__actions { animation-delay: .22s; }

  .page-header h1 { animation: settle .6s cubic-bezier(.2, .7, .2, 1) both; }
  .page-header .lede { animation: fade-up .6s cubic-bezier(.2, .7, .2, 1) .08s both; }

  /* Cards and listings rise into place as they scroll into view (scroll-driven, no JavaScript).
     Movement only, no fading, so text is at full contrast at every point of the animation.
     Items already on screen when the page loads are shown at their final state. */
  @supports (animation-timeline: view()) {
    .card, .directory li, .calendar li, .panel, .callout {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 40%;
    }
  }

  .btn { transition: transform .15s ease, background-color .15s ease; }
  .btn:hover { transform: translateY(-1px); }
  a[href^="http"]:not(.btn)::after { transition: transform .15s ease; }
  a[href^="http"]:not(.btn):hover::after { transform: translate(2px, -2px); }
}

@keyframes fade-up { from { opacity: 0; transform: translateY(18px); } }
@keyframes rise { from { transform: translateY(28px); } }
@keyframes settle { from { transform: translateY(14px); } }
@keyframes sun-rise { from { transform: translateY(70px) scale(.92); } }
@keyframes reeds-sway { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(4deg); } 65% { transform: rotate(-2deg); } }
@keyframes river-drift { from { transform: translateX(-40px); opacity: .4; } }

/* Listing filters (built by site.js; absent without JavaScript) */
.filters:empty { display: none; }
.filters { margin-top: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--rapeseed); border-radius: var(--radius); padding: 20px 24px; }
.filters__title { font-family: var(--sans); font-size: 1.2rem; color: var(--text); margin-bottom: .75rem; }
.filters__row { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.filters__field label, .filters__types legend { display: block; font-weight: 700; margin-bottom: 6px; }
.filters__field input, .filters__field select {
  width: 100%; min-height: 48px; padding: 8px 12px; font: inherit; color: var(--text);
  background: var(--surface); border: 2px solid var(--text); border-radius: 8px;
}
.filters__field input:focus-visible, .filters__field select:focus-visible { outline: 3px solid var(--rapeseed); outline-offset: 0; box-shadow: 0 0 0 6px var(--ink); }
.filters__types { border: 0; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.filters__types legend { padding: 0; margin-bottom: 8px; float: left; width: 100%; }
.filters__check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.filters__check input { width: 22px; height: 22px; accent-color: var(--link); }
.filters__summary { margin: 12px 0 8px; font-weight: 700; color: var(--accent-text); }
.filters__reset { min-height: 44px; }
.filters-wrap { padding-top: 8px; }
.filters__empty { margin-top: 2rem; }
[hidden] { display: none !important; }

/* Town pages */
.see-all { margin-top: 1.25rem; font-weight: 700; }

/* 404 page */
.notfound__search { margin: 1.5rem 0; }
.notfound__links { columns: 2 14rem; padding-left: 1.2em; }

/* Suggest a listing */
.suggest-form { display: grid; gap: 20px; margin-bottom: 1.5rem; }
.suggest-form label { display: block; font-weight: 700; margin-bottom: 6px; }
.suggest-form .optional { font-weight: 400; color: var(--muted); }
.suggest-form .hint { margin: 0 0 6px; color: var(--muted); font-size: 1rem; }
.suggest-form input, .suggest-form select, .suggest-form textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--surface); border: 2px solid var(--text); border-radius: 8px;
}
.suggest-form button { justify-self: start; }
.field-error { margin: 0; padding: 10px 14px; border-left: 6px solid var(--poppy); background: var(--poppy-soft); font-weight: 700; }
