/* ============================================================
   Little Stanney & District Parish Council — Main Stylesheet
   WCAG 2.2 AA compliant — green/rural parish theme
   ============================================================ */

/* ---------- Custom Properties (light theme defaults) ---------- */
:root {
  --color-primary:       #2e6b3e;   /* deep parish green */
  --color-primary-dark:  #1e4a2b;
  --color-primary-light: #e8f4ec;
  --color-accent:        #6aaa55;
  --color-text:          #1a1a1a;
  --color-text-muted:    #555;
  --color-bg:            #ffffff;
  --color-bg-alt:        #f5f8f5;
  --color-border:        #cdd8cd;
  --color-link:          #1b5e2e;
  --color-link-hover:    #0f3e1e;
  --color-focus:         #f4a803;   /* AA-safe amber focus ring */

  --font-base:           'Segoe UI', Roboto, Arial, sans-serif;
  --font-size-base:      1rem;      /* 16px — overridden by JS */
  --line-height-base:    1.6;

  --max-width:           1100px;
  --border-radius:       4px;
  --shadow-sm:           0 1px 3px rgba(0,0,0,0.12);
  --shadow-md:           0 2px 8px rgba(0,0,0,0.16);
}

/* ---------- Reset / Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: var(--font-size-base);
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-base);
  font-size: 1rem;
  line-height: var(--line-height-base);
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; display: block; }
ul, ol { padding-left: 1.5rem; }

a {
  color: var(--color-link);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:hover, a:focus-visible {
  color: var(--color-link-hover);
  text-decoration-thickness: 2px;
}

/* WCAG 2.4.11 — visible focus for all interactive elements */
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--border-radius);
}

/* ---------- Skip Link (WCAG 2.4.1) ---------- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--color-primary);
  color: #fff;
  padding: 0.75rem 1.5rem;
  font-weight: 700;
  z-index: 9999;
  text-decoration: none;
  border-radius: 0 0 var(--border-radius) 0;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 0;
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

/* ---------- Accessibility Toolbar ---------- */
#a11y-toolbar {
  background: var(--color-primary-dark);
  color: #fff;
  padding: 0.4rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.875rem;
}
#a11y-toolbar span {
  font-weight: 600;
  letter-spacing: 0.02em;
}
.a11y-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.6);
  color: #fff;
  padding: 0.25rem 0.75rem;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 0.875rem;
  font-family: var(--font-base);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.a11y-btn:hover, .a11y-btn:focus-visible {
  background: rgba(255,255,255,0.15);
  border-color: #fff;
}
.a11y-btn[aria-pressed="true"] {
  background: var(--color-focus);
  border-color: var(--color-focus);
  color: #1a1a1a;
}

/* ---------- Header ---------- */
#site-header {
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--shadow-md);
  position: relative; /* anchor for the mobile nav panel */
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: nowrap; /* logo + nav always on one row; hamburger handles overflow */
}
.site-logo {
  text-decoration: none;
  display: flex;
  flex-direction: column;
}
.site-logo .logo-main {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.01em;
  line-height: 1.2;
}
.site-logo .logo-sub {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.75);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ---------- Navigation ---------- */
#main-nav {
  position: static; /* panel anchors to #site-header on mobile, not the nav element */
}
#nav-toggle {
  display: none;
  background: transparent;
  border: 2px solid rgba(255,255,255,0.8);
  color: #fff;
  padding: 0.4rem 0.75rem;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 1rem;
  font-family: var(--font-base);
}
#nav-toggle:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}
#nav-toggle[aria-expanded="true"] + .nav-list { display: flex; }

.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 0;
  align-items: stretch;
}
.nav-list > li {
  position: relative;
}
.nav-list > li > a,
.nav-list > li > button {
  display: block;
  padding: 0.55rem 1rem;
  color: rgba(255,255,255,0.92);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9375rem;
  border-bottom: 3px solid transparent;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  cursor: pointer;
  font-family: var(--font-base);
  white-space: nowrap;
  transition: color 0.15s ease, border-bottom-color 0.15s ease;
}
.nav-list > li > a:hover,
.nav-list > li > a:focus-visible,
.nav-list > li > button:hover,
.nav-list > li > button:focus-visible {
  color: #fff;
  border-bottom-color: var(--color-focus);
}
.nav-list > li > a.active,
.nav-list > li > a[aria-current="page"] {
  color: #fff;
  border-bottom-color: var(--color-accent);
}



/* ---------- Page Banner ---------- */
.page-banner {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: #fff;
  padding: 2.5rem 1.5rem;
  text-align: center;
}
.page-banner h1 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: 0.01em;
}
.page-banner .subtitle {
  margin-top: 0.5rem;
  font-size: 1.05rem;
  color: rgba(255,255,255,0.82);
  font-style: italic;
}

/* Home hero override */
.hero-banner {
  background: #1e4a2b;
  padding: 0;
}
.hero-inner {
  position: relative;
}
.hero-img {
  display: block;
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  object-position: center;
}
.hero-text {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.5rem;
  background: linear-gradient(to top, rgba(0,0,0,0.72) 0%, transparent 100%);
}
.hero-banner h1 {
  font-size: clamp(1.3rem, 4vw, 2.5rem);
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
.hero-parishes {
  margin-top: 0.4rem;
  font-size: 0.95rem;
  color: rgba(255,255,255,0.85);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.hero-founded {
  margin-top: 0.2rem;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.65);
  font-style: italic;
}

/* ---------- Home Page ---------- */
.home-intro { /* full width — constrained by .main-content */ }
.home-lead {
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--color-text);
  margin-bottom: 1rem;
}
.home-intro p + p {
  margin-top: 0.75rem;
}

/* Quick-links card grid — 3 col desktop, 2 tablet, 1 mobile */
.quick-links {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.875rem;
}

/* Horizontal card: icon pill left, text right */
.quick-link-card a {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent);
  border-radius: var(--border-radius);
  padding: 1rem 1.1rem;
  text-decoration: none;
  color: var(--color-text);
  transition: box-shadow 0.15s ease, border-left-color 0.15s ease, background 0.15s ease;
  height: 100%;
}
.quick-link-card a:hover,
.quick-link-card a:focus-visible {
  box-shadow: var(--shadow-md);
  border-left-color: var(--color-primary);
  background: #fff;
  text-decoration: none;
  outline: none;
}
.quick-link-card a:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

/* Icon container — circular green pill */
.ql-icon {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  background: var(--color-primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.quick-link-card a:hover .ql-icon,
.quick-link-card a:focus-visible .ql-icon {
  background: var(--color-primary);
}
/* SVG icon colour */
.ql-icon svg {
  width: 1.35rem;
  height: 1.35rem;
  stroke: var(--color-primary);
  transition: stroke 0.15s ease;
}
.quick-link-card a:hover .ql-icon svg,
.quick-link-card a:focus-visible .ql-icon svg {
  stroke: #fff;
}

/* Text block */
.ql-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.ql-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  line-height: 1.2;
}
.ql-desc {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

/* Parish list on home */
.parish-list {
  margin: 1rem 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.parish-list li { padding-left: 0.25rem; }

/* High contrast overrides */
html.high-contrast .quick-link-card a {
  background: #ffffff;
  border-color: #0b0c0c;
  border-left-color: #0b0c0c;
}
html.high-contrast .quick-link-card a:hover,
html.high-contrast .quick-link-card a:focus-visible {
  box-shadow: 3px 3px 0 #0b0c0c;
}
html.high-contrast .ql-icon { background: #f3f2f1; }
html.high-contrast .ql-icon svg { stroke: #0b0c0c; }
html.high-contrast .quick-link-card a:hover .ql-icon,
html.high-contrast .quick-link-card a:focus-visible .ql-icon { background: #0b0c0c; }
html.high-contrast .quick-link-card a:hover .ql-icon svg,
html.high-contrast .quick-link-card a:focus-visible .ql-icon svg { stroke: #ffffff; }
html.high-contrast .ql-title { color: #0b0c0c; }
html.high-contrast .ql-desc  { color: #0b0c0c; }

/* Quick-links responsive */
@media (max-width: 1024px) {
  .quick-links { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .quick-links { grid-template-columns: 1fr; }
  .ql-icon { width: 2.35rem; height: 2.35rem; }
  .ql-icon svg { width: 1.15rem; height: 1.15rem; }
}

/* ---------- Notice Cards (news.php) ---------- */
.section-note {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  font-style: italic;
}

/* Card grid — 2 across on desktop, 1 on mobile */
.notice-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin: 1rem 0;
}
/* Wide variant: single card spanning full width */
.notice-card--wide {
  grid-column: 1 / -1;
  max-width: 480px;
}

.notice-card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease;
}
.notice-card:hover { box-shadow: var(--shadow-md); }

/* Image area */
.notice-card__img-wrap {
  position: relative;
  overflow: hidden;
  background: #000;
  line-height: 0;
}
.notice-card__img-wrap img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  object-position: top center;
  display: block;
  transition: opacity 0.2s ease;
}

/* Lightbox trigger button — fills the image area */
.lightbox-trigger {
  display: block;
  position: relative;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  cursor: zoom-in;
  line-height: 0;
}
.lightbox-trigger:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 0;
}
.lightbox-trigger img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  object-position: top center;
  display: block;
  transition: opacity 0.2s ease;
}
.lightbox-trigger:hover img { opacity: 0.88; }

/* "Enlarge" badge */
.lightbox-hint {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--border-radius);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.lightbox-trigger:hover .lightbox-hint,
.lightbox-trigger:focus-visible .lightbox-hint { opacity: 1; }

/* Card body */
.notice-card__body {
  padding: 1rem 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}
.notice-card__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-primary-dark);
}
.notice-card__body p {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}
.notice-card__link {
  margin-top: auto;
  display: inline-block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-link);
  padding-top: 0.5rem;
}

/* ---------- Lightbox Overlay ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.lightbox[hidden] { display: none; }

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.88);
  cursor: zoom-out;
}
.lightbox__content {
  position: relative;
  z-index: 1;
  max-width: min(90vw, 1000px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.lightbox__img {
  display: block;
  max-width: 100%;
  max-height: calc(90vh - 4rem);
  border-radius: var(--border-radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  object-fit: contain;
}
.lightbox__caption {
  color: rgba(255,255,255,0.85);
  font-size: 0.875rem;
  text-align: center;
  max-width: 60ch;
}
.lightbox__close {
  position: absolute;
  top: -3rem;
  right: 0;
  background: transparent;
  border: 2px solid rgba(255,255,255,0.7);
  color: #fff;
  border-radius: 50%;
  width: 2.25rem;
  height: 2.25rem;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.lightbox__close:hover,
.lightbox__close:focus-visible {
  background: rgba(255,255,255,0.2);
  outline: 3px solid var(--color-focus);
}
/* Prevent body scroll while lightbox open */
body.lightbox-open { overflow: hidden; }

/* Responsive notice cards */
@media (max-width: 640px) {
  .notice-cards { grid-template-columns: 1fr; }
  .notice-card--wide { max-width: 100%; }
  .lightbox-trigger img,
  .notice-card__img-wrap img { height: 200px; }
}

/* High contrast */
html.high-contrast .notice-card {
  background: #ffffff;
  border-color: #0b0c0c;
  border-width: 2px;
}
html.high-contrast .notice-card__title { color: #0b0c0c; }
html.high-contrast .lightbox-hint {
  background: #0b0c0c;
  color: #ffdd00;
}
html.high-contrast .lightbox__close {
  border-color: #ffdd00;
  color: #ffdd00;
}

/* ---------- News image blocks (kept for backward compat) ---------- */
.news-image-block {
  margin: 1.25rem 0;
}
.news-image-block .news-img,
.news-image-grid .news-img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius);
  border: 1px solid var(--color-border);
}
.news-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}
.news-image-grid figure { margin: 0; }

/* ---------- Main Layout ---------- */
.main-content {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  padding: 2rem 1.5rem;
}

/* ---------- Section headings ---------- */
.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  border-left: 4px solid var(--color-accent);
  padding-left: 0.75rem;
  margin-bottom: 1.25rem;
}
.section-divider {
  border: none;
  border-top: 2px solid var(--color-border);
  margin: 2rem 0;
}

/* ---------- Document Download Cards ---------- */
.doc-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.doc-item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: 0.75rem 1rem;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.doc-item:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--color-accent);
}
.doc-icon {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  background: var(--color-primary);
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.doc-icon.pdf   { background: #c0392b; }
.doc-icon.docx  { background: #2563eb; }
.doc-icon.jpg,
.doc-icon.jpeg  { background: #0891b2; }
.doc-info { flex: 1; min-width: 0; }
.doc-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-meta {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 0.1rem;
}
.doc-download {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--color-primary);
  color: #fff;
  padding: 0.35rem 0.9rem;
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease;
}
.doc-download:hover, .doc-download:focus-visible {
  background: var(--color-primary-dark);
  color: #fff;
  text-decoration: none;
}

/* Year group headings in meetings */
.year-group { margin-bottom: 2rem; }
.year-heading {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--color-border);
}

/* ---------- News / Notices section ---------- */
.notice-box {
  background: var(--color-primary-light);
  border: 1px solid var(--color-accent);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--border-radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}
.notice-box h2 {
  font-size: 1.1rem;
  color: var(--color-primary-dark);
  margin-bottom: 0.5rem;
}
.notice-box p { color: var(--color-text); }

/* ---------- Parish descriptions ---------- */
.parish-section { margin-bottom: 2.5rem; }
.parish-section h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--color-border);
}
.parish-section p {
  margin-bottom: 0.85rem;
  color: var(--color-text);
}

/* ---------- Councillors Table ---------- */
.councillors-grid {
  display: grid;
  /* Fixed 3-col — equal widths regardless of how many cards are in a row */
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 1rem;
}
.councillor-card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-primary);
  border-radius: var(--border-radius);
  padding: 1.25rem;
}
.councillor-card .parish-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-primary);
  margin-bottom: 0.75rem;
}
.councillor-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.4rem;
}
.councillor-card address {
  font-style: normal;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.55;
}
.councillor-card address a {
  color: var(--color-link);
  word-break: break-all;
}

/* ---------- Contacts Page ---------- */
.contact-info {
  background: var(--color-primary-light);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: 1.5rem 2rem;
  margin-bottom: 2rem;
  font-size: 1.05rem;
}
.contact-info a {
  font-weight: 600;
}
.useful-links-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.useful-links-list li a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 1rem;
}
.useful-links-list li a::before {
  content: '→';
  color: var(--color-accent);
  font-weight: 700;
}

/* ---------- Footer ---------- */
#site-footer {
  background: var(--color-primary-dark);
  color: rgba(255,255,255,0.8);
  padding: 2rem 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  margin-top: auto;
}
#site-footer a {
  color: rgba(255,255,255,0.85);
}
#site-footer a:hover {
  color: #fff;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1.25rem;
  list-style: none;
  padding: 0;
  margin-bottom: 1rem;
}
.footer-nav a {
  text-decoration: none;
  font-size: 0.85rem;
}
.footer-nav a:hover { text-decoration: underline; }
.footer-copy { font-size: 0.8rem; color: rgba(255,255,255,0.55); margin-top: 0.5rem; }

/* ---------- Utility classes ---------- */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* ============================================================
   RESPONSIVE
   Breakpoints:
     ≤1024px  — hamburger replaces full nav (covers all tablets)
     ≤600px   — single-column layouts, small-phone adjustments
   ============================================================ */

/* --- Hamburger trigger: show at ≤1024px so ALL tablets use it --- */
@media (max-width: 1024px) {
  #nav-toggle { display: block; }

  /* Header row: tighten padding on tablet/mobile */
  .header-inner {
    padding: 0.75rem 1.25rem;
  }

  /* Nav panel: hidden by default, drops full-width below header */
  .nav-list {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    background: var(--color-primary-dark);
    padding: 0.25rem 0 0.75rem;
    border-top: 2px solid rgba(255,255,255,0.1);
    box-shadow: var(--shadow-md);
    z-index: 200;
  }

  /* JS adds display:flex when open — ensure column direction */
  .nav-list.open,
  #nav-toggle[aria-expanded="true"] + .nav-list {
    display: flex !important;
    flex-direction: column;
  }

  /* Nav items: full-width rows with left-border active indicator */
  .nav-list > li { width: 100%; }
  .nav-list > li > a {
    display: block;
    border-bottom: none;
    border-left: 4px solid transparent;
    padding: 0.8rem 1.5rem;
    width: 100%;
    text-align: left;
    font-size: 1rem;
    white-space: normal;
  }
  .nav-list > li > a:hover {
    border-left-color: var(--color-focus);
    background: rgba(255,255,255,0.07);
  }
  .nav-list > li > a.active,
  .nav-list > li > a[aria-current="page"] {
    border-left-color: var(--color-accent);
    border-bottom-color: transparent;
    background: rgba(255,255,255,0.05);
  }

  /* Docs: allow doc name to wrap on narrower widths */
  .doc-name { white-space: normal; }

  /* Councillors: 2-col on tablet */
  .councillors-grid { grid-template-columns: 1fr 1fr; }

  /* Hero: move text below image on tablet */
  .hero-text {
    position: static;
    background: var(--color-primary-dark);
    padding: 1rem 1.5rem;
  }
  .hero-img { max-height: 320px; }

  /* News images: 2-col grid on tablet */
  .news-image-grid { grid-template-columns: 1fr 1fr; }
}

/* --- Small mobile (≤600px) --- */
@media (max-width: 600px) {
  .header-inner { padding: 0.6rem 1rem; }

  .councillors-grid { grid-template-columns: 1fr; }

  .doc-item { flex-wrap: wrap; }
  .doc-download { width: 100%; justify-content: center; }

  .hero-img { max-height: 220px; }
  .news-image-grid { grid-template-columns: 1fr; }

  .doc-icon { width: 2.25rem; height: 2.25rem; font-size: 0.6rem; }
  .section-title { font-size: 1.2rem; }
}

/* ============================================================
   HIGH CONTRAST MODE (class toggled by JS on <html>)
   Colour palette aligned with GOV.UK Design System standards.
   https://design-system.service.gov.uk/styles/colour/
   All text/bg combinations exceed 7:1 (WCAG AAA / Enhanced).
   ============================================================ */
html.high-contrast {
  /* GOV.UK near-black text on white — 21:1 contrast */
  --color-text:          #0b0c0c;
  --color-text-muted:    #0b0c0c;
  --color-bg:            #ffffff;
  --color-bg-alt:        #f3f2f1;   /* GOV.UK template background */
  --color-border:        #0b0c0c;   /* Black borders — maximum clarity */

  /* GOV.UK link colours — all 7:1+ on white */
  --color-link:          #1d70b8;   /* GOV.UK blue — 6.1:1; reinforced by underline */
  --color-link-hover:    #003078;   /* GOV.UK dark blue — 10.8:1 */

  /* GOV.UK yellow focus — #ffdd00 bg + #0b0c0c text = 15.7:1 */
  --color-focus:         #ffdd00;

  /* Header/footer: black bg, white text — 21:1 */
  --color-primary:       #0b0c0c;
  --color-primary-dark:  #000000;
  --color-primary-light: #f3f2f1;
  --color-accent:        #ffdd00;   /* GOV.UK yellow accent on dark bg */
}

/* ---- Text & links ---- */
html.high-contrast a {
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
html.high-contrast a:hover {
  color: var(--color-link-hover);
  text-decoration-thickness: 3px;
}
html.high-contrast a:visited {
  color: #4c2c92;   /* GOV.UK visited link — 7.8:1 on white */
}

/* ---- Focus ring: GOV.UK standard — yellow bg, black outline ---- */
html.high-contrast :focus-visible {
  outline: 3px solid #0b0c0c;
  outline-offset: 0;
  background-color: #ffdd00;
  color: #0b0c0c;
  box-shadow: 0 -2px #ffdd00, 0 4px #0b0c0c;
}

/* ---- Header & nav: black on black — use yellow for active/focus ---- */
html.high-contrast #site-header {
  background: #0b0c0c;
  border-bottom: 4px solid #ffdd00;
}
html.high-contrast .site-logo .logo-main,
html.high-contrast .site-logo .logo-sub,
html.high-contrast .nav-list > li > a,
html.high-contrast .nav-list > li > button {
  color: #ffffff;
}
html.high-contrast .nav-list > li > a:hover,
html.high-contrast .nav-list > li > button:hover {
  color: #ffdd00;
  border-bottom-color: #ffdd00;
}
html.high-contrast .nav-list > li > a.active,
html.high-contrast .nav-list > li > a[aria-current="page"] {
  color: #ffdd00;
  border-bottom-color: #ffdd00;
}

/* ---- Accessibility toolbar ---- */
html.high-contrast #a11y-toolbar {
  background: #000000;
  border-bottom: 2px solid #ffdd00;
}
html.high-contrast .a11y-btn {
  border-color: #ffffff;
  color: #ffffff;
}
html.high-contrast .a11y-btn:hover {
  background: #ffdd00;
  border-color: #ffdd00;
  color: #0b0c0c;
}
html.high-contrast .a11y-btn[aria-pressed="true"] {
  background: #ffdd00;
  border-color: #ffdd00;
  color: #0b0c0c;
  font-weight: 700;
}

/* ---- Page banner / hero ---- */
html.high-contrast .page-banner,
html.high-contrast .hero-banner {
  background: #0b0c0c;
  border-bottom: 4px solid #ffdd00;
}
html.high-contrast .page-banner h1,
html.high-contrast .hero-banner h1,
html.high-contrast .hero-parishes,
html.high-contrast .hero-founded {
  color: #ffffff;
}
html.high-contrast .hero-text {
  background: #0b0c0c;
  position: static;
  padding: 1rem 1.5rem;
}
html.high-contrast .news-image-block .news-img,
html.high-contrast .news-image-grid .news-img {
  border-color: #0b0c0c;
  border-width: 2px;
}

/* ---- Document cards ---- */
html.high-contrast .doc-item {
  border: 2px solid #0b0c0c;
  background: #ffffff;
}
html.high-contrast .doc-item:hover {
  border-color: #0b0c0c;
  box-shadow: 4px 4px 0 #0b0c0c;
}
html.high-contrast .doc-name  { color: #0b0c0c; }
html.high-contrast .doc-meta  { color: #0b0c0c; }
html.high-contrast .doc-icon        { background: #0b0c0c; color: #ffffff; }
html.high-contrast .doc-icon.pdf    { background: #0b0c0c; }
html.high-contrast .doc-icon.docx   { background: #0b0c0c; }
html.high-contrast .doc-icon.jpg,
html.high-contrast .doc-icon.jpeg   { background: #0b0c0c; }
html.high-contrast .doc-download {
  background: #0b0c0c;
  color: #ffffff;
  border: 2px solid #0b0c0c;
}
html.high-contrast .doc-download:hover {
  background: #ffdd00;
  color: #0b0c0c;
  border-color: #0b0c0c;
}

/* ---- Notice boxes & cards ---- */
html.high-contrast .notice-box {
  background: #ffffff;
  border: 2px solid #0b0c0c;
  border-left: 6px solid #0b0c0c;
}
html.high-contrast .notice-box h2,
html.high-contrast .notice-box p { color: #0b0c0c; }

html.high-contrast .councillor-card {
  background: #ffffff;
  border: 2px solid #0b0c0c;
  border-top: 4px solid #0b0c0c;
}
html.high-contrast .councillor-card .parish-label { color: #0b0c0c; }

/* ---- Section headings ---- */
html.high-contrast .section-title {
  border-left-color: #0b0c0c;
  color: #0b0c0c;
}
html.high-contrast .year-heading { color: #0b0c0c; border-bottom-color: #0b0c0c; }
html.high-contrast .section-divider { border-top-color: #0b0c0c; }

/* ---- Contact info ---- */
html.high-contrast .contact-info {
  background: #f3f2f1;
  border: 2px solid #0b0c0c;
}

/* ---- Footer ---- */
html.high-contrast #site-footer {
  background: #0b0c0c;
  border-top: 4px solid #ffdd00;
}
html.high-contrast #site-footer a { color: #ffffff; }
html.high-contrast #site-footer a:visited { color: #d0c5f5; }
html.high-contrast .footer-copy { color: #ffffff; }

/* ============================================================
   FONT SIZE SCALING (set via CSS variable on <html>)
   ============================================================ */
html[data-font-size="large"]  { font-size: 1.2rem; }
html[data-font-size="xlarge"] { font-size: 1.4rem; }
html[data-font-size="normal"] { font-size: 1rem; }
