/* When is half term? Paper, ink and a landscape that turns with the seasons. */
:root {
  color-scheme: light;
  --paper: #f5f1e8;
  --card: #fbf9f4;
  --ink: #2f3b35;
  --ink-mid: #4d5952;
  --muted: #6c776f;
  --rule: #dcd9cc;
  --rule-soft: rgba(47, 59, 53, 0.1);
  --glass: rgba(251, 249, 244, 0.78);
  --accent: #a4606b;
  --gold: #d99a3e;

  --shadow-sm: 0 1px 2px rgba(47, 40, 30, 0.05), 0 2px 8px rgba(47, 40, 30, 0.04);
  --shadow-md: 0 2px 8px rgba(47, 40, 30, 0.07), 0 12px 32px rgba(47, 40, 30, 0.1);

  --display: "Lora", Georgia, "Times New Roman", serif;
  --ui: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  /* scene, set per season below */
  --sky: #f3dcc2;
  --sun: #f4c47a;
  --far: #dcbca4;
  --mid: #c88c66;
  --near: #94603f;
  --tree: #b4683e;
  --wall: #f1e3d1;
  --roof: #a4606b;
  --window: #8e7a70;
}

/* ---------- seasons (light) ---------- */
[data-season="winter"] {
  --sky: #e4e3ea; --sun: #fbf1dc; --far: #d3d8dc; --mid: #b2bec4; --near: #8395a0;
  --tree: #6f8580; --wall: #f6f1ea; --roof: #8b6c78; --window: #8a8a93;
}
[data-season="spring"] {
  --sky: #f2e1e3; --sun: #fff0c9; --far: #d4dcc1; --mid: #abc195; --near: #7c9b6b;
  --tree: #e7b7c0; --wall: #f6efe2; --roof: #a4606b; --window: #8c8279;
}
[data-season="summer"] {
  --sky: #f5e0b4; --sun: #ffd277; --far: #ced6a6; --mid: #a3bb7c; --near: #6f9058;
  --tree: #5e7e48; --wall: #f7eedb; --roof: #b56a4f; --window: #8f7f6c;
}

/* ---------- dark: the same hills at night, school lights on ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #1a2428;
    --card: #1f2b30;
    --ink: #ece9dd;
    --ink-mid: #cfd2c8;
    --muted: #9ba7a1;
    --rule: #33444a;
    --rule-soft: rgba(236, 233, 221, 0.1);
    --glass: rgba(31, 43, 48, 0.78);
    --accent: #cf95a1;
    --gold: #e8b25c;
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.35);

    --sky: #2b2b4e; --sun: #efe6d6; --far: #2f3456; --mid: #252a47; --near: #171d33;
    --tree: #1f2540; --wall: #3b384f; --roof: #2a2740; --window: #ffd98a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1a2428; --card: #1f2b30; --ink: #ece9dd; --ink-mid: #cfd2c8; --muted: #9ba7a1;
  --rule: #33444a; --rule-soft: rgba(236, 233, 221, 0.1); --glass: rgba(31, 43, 48, 0.78);
  --accent: #cf95a1; --gold: #e8b25c;
  --sky: #2b2b4e; --sun: #efe6d6; --far: #2f3456; --mid: #252a47; --near: #171d33;
  --tree: #1f2540; --wall: #3b384f; --roof: #2a2740; --window: #ffd98a;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font: 400 1rem/1.6 var(--ui);
  -webkit-font-smoothing: antialiased;
  background-color: var(--paper);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .3 0 0 0 0 .22 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(to bottom, var(--paper) 35%, var(--sky) 100%);
  background-attachment: fixed;
  transition: background-color 0.6s ease;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--ink) 45%, transparent); outline-offset: 3px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.glass {
  background: var(--glass);
  backdrop-filter: blur(12px) saturate(1.3);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
}

/* ---------- top bar ---------- */
.top {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 16px 0;
}
.wordmark {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 500;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.top-tools { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.theme-toggle {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--rule-soft);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.theme-toggle:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: var(--ink-mid); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .icon-moon { fill: var(--ink-mid); stroke: none; }
/* show the moon in light mode (tap for dark), the sun in dark mode */
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}
.area-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 7px 8px 7px 14px;
  border: 1px solid var(--rule-soft);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  font-size: 0.88rem;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.area-pill:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.area-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--accent); }
#area-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.area-change {
  flex: none;
  padding: 2px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  color: var(--ink-mid);
  font-size: 0.78rem;
  font-weight: 500;
}

/* ---------- the answer ---------- */
.page {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
  padding: clamp(48px, 12vh, 128px) 16px 24px;
}
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; color: var(--muted); font-size: 0.82rem; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; text-underline-offset: 3px; }
.page-title {
  margin: 0 0 22px;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink-mid);
  letter-spacing: -0.005em;
}
.hero-name {
  margin: 10px 0 0;
  font-family: var(--display);
  font-size: clamp(1.4rem, 3.4vw, 2.2rem);
  font-weight: 400;
  font-style: italic;
  color: var(--ink-mid);
  line-height: 1.2;
}
.hero-date {
  margin: 0.08em 0 0;
  font-family: var(--display);
  font-size: clamp(3rem, 11.5vw, 8.75rem);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.hero-range {
  margin: 18px 0 0;
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  color: var(--ink-mid);
}
.hero-count {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0 0;
}
.chip {
  padding: 5px 13px;
  border: 1px solid var(--rule-soft);
  border-radius: 999px;
  background: var(--glass);
  font-size: 0.88rem;
  font-weight: 500;
}
.chip.strong { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.hero-before { margin: 18px 0 0; color: var(--muted); font-size: 0.95rem; }

.then {
  margin-top: clamp(48px, 9vh, 88px);
  padding-top: 22px;
  border-top: 1px solid var(--rule);
  max-width: 640px;
}
.then-name {
  margin: 8px 0 0;
  font-family: var(--display);
  font-size: clamp(1.5rem, 3.6vw, 2.25rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.015em;
}
.then-date { margin: 6px 0 0; color: var(--ink-mid); }

/* ---------- every date ---------- */
.section-title {
  margin: 0 0 14px;
  font-family: var(--display);
  font-size: clamp(1.25rem, 2.6vw, 1.6rem);
  font-weight: 500;
  letter-spacing: -0.01em;
}
.section-title .count { color: var(--muted); font-family: var(--ui); font-size: 0.85rem; font-weight: 400; margin-left: 4px; }
.dates, .about { margin-top: clamp(48px, 8vh, 80px); max-width: 640px; }
.year-group + .year-group { margin-top: 22px; }
.year-group .eyebrow { margin-bottom: 8px; }
.year-list {
  margin: 0;
  padding: 6px 18px;
  list-style: none;
  border: 1px solid var(--rule-soft);
  border-radius: 14px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.year-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule-soft);
  font-size: 0.92rem;
}
.year-list li:last-child { border-bottom: 0; }
.year-list .y-name { font-weight: 500; }
.year-list .y-when { color: var(--ink-mid); text-align: right; }
.year-list .is-day .y-name { font-weight: 400; color: var(--ink-mid); }
.year-list .is-past { opacity: 0.45; }
.year-list .is-now .y-name::after { content: "now"; margin-left: 8px; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: var(--paper); font-size: 0.7rem; vertical-align: 2px; }
.tag { margin-left: 8px; color: var(--muted); font-size: 0.75rem; font-style: italic; font-weight: 400; }
.tag-diff { color: var(--accent); font-style: normal; }
@media (max-width: 480px) {
  .year-list li { grid-template-columns: 1fr; gap: 0; }
  .year-list .y-when { text-align: left; }
}

.faq { margin-top: clamp(48px, 8vh, 80px); max-width: 640px; }
.faq dl { margin: 0; }
.faq-item { padding: 12px 0; border-bottom: 1px solid var(--rule-soft); }
.faq-item:last-child { border-bottom: 0; }
.faq dt { font-weight: 500; }
.faq dd { margin: 4px 0 0; color: var(--ink-mid); font-size: 0.95rem; }
.pending .faq { opacity: 0; }
.about { color: var(--ink-mid); font-size: 0.95rem; }
.about p { margin: 0 0 12px; }
.about a, .foot a, .hero-range a, .showing a { text-decoration-color: var(--rule); text-underline-offset: 3px; }
.save-button {
  margin-top: 6px;
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.88rem;
  font-weight: 500;
}
.saved { color: var(--accent); font-weight: 500; }
.showing { margin: 0 0 18px; color: var(--muted); font-size: 0.88rem; }
.link-button { padding: 0; border: 0; background: none; color: inherit; font-size: inherit; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }

/* the home page waits for your saved area before showing anything */
.pending .hero, .pending .then, .pending .dates, .pending .about { opacity: 0; }
.hero, .then, .dates, .about { transition: opacity 0.25s ease; }

/* ---------- councils A–Z ---------- */
.hero-small .hero-date { font-size: clamp(2.4rem, 7vw, 4.5rem); }
.hero-small .hero-range { max-width: 560px; }
.council-search {
  width: min(420px, 100%);
  margin-top: 24px;
  padding: 12px 16px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
}
.council-group { margin-top: 48px; }
.council-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 2px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.council-list li { display: flex; flex-direction: column; padding: 8px 0; border-bottom: 1px solid var(--rule-soft); }
.council-list a { font-weight: 500; text-decoration: none; }
.council-list a:hover { text-decoration: underline; text-underline-offset: 3px; }
.c-note { color: var(--muted); font-size: 0.8rem; }
.c-note.diff { color: var(--accent); }

.foot-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 10px; font-weight: 500; color: var(--ink-mid); }
.foot {
  margin-top: 48px;
  max-width: 560px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}
.foot p { margin: 0 0 8px; }

/* ---------- the landscape ---------- */
.scene {
  display: block;
  flex: none;
  width: 100%;
  /* the art is 4:1 and gets trimmed from the top when the window is wider than that;
     growing with the width keeps the trim small enough that the sun stays in view */
  height: max(clamp(180px, 34vh, 340px), 18vw);
  pointer-events: none;
}
.scene * { transition: fill 0.8s ease; }
.sun { fill: var(--sun); }
.hill-far { fill: var(--far); }
.hill-mid { fill: var(--mid); }
.hill-near { fill: var(--near); }
.trees { fill: var(--tree); }
.school-wall { fill: var(--wall); }
.school-roof, .school-door { fill: var(--roof); }
.school-window { fill: var(--window); }
@media (max-width: 640px) {
  .school { transform: translate(120px, 196px); }
}

/* ---------- picker ---------- */
.picker {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 28px 24px 20px;
  border: 1px solid var(--rule-soft);
  border-radius: 20px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-md);
}
.picker::backdrop { background: rgba(26, 36, 40, 0.35); backdrop-filter: blur(3px); }
.picker-close-form { position: absolute; top: 12px; right: 12px; margin: 0; }
.picker-close {
  width: 34px; height: 34px;
  border: 0; border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  font-size: 1.3rem; line-height: 1;
}
.picker-title {
  margin: 6px 0 0;
  font-family: var(--display);
  font-size: 1.7rem;
  font-weight: 500;
  letter-spacing: -0.015em;
}
.picker-lede { margin: 8px 0 18px; color: var(--ink-mid); font-size: 0.93rem; }
.postcode { display: flex; gap: 8px; }
.postcode input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  text-transform: uppercase;
}
.postcode input::placeholder { text-transform: none; color: var(--muted); }
.postcode button {
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 500;
}
.locate {
  margin-top: 10px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-mid);
  font-size: 0.88rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--rule);
}
.picker-status { min-height: 1.4em; margin: 10px 0 4px; font-size: 0.88rem; color: var(--accent); }
.area-groups { max-height: min(46vh, 420px); overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.area-group { margin-top: 14px; }
.picker-empty { color: var(--muted); font-size: 0.9rem; }
.area-group h3 { margin: 0 0 8px; }
.area-options { display: flex; flex-wrap: wrap; gap: 8px; }
.area-option {
  padding: 7px 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  font-size: 0.88rem;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.area-option:hover { border-color: var(--ink-mid); }
.area-option[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.picker-small { margin: 20px 0 0; color: var(--muted); font-size: 0.78rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
