/* =====================================================================
   Your Townland: design system
   ---------------------------------------------------------------------
   Everything visual is set once here as "tokens" (named values), so the
   whole site stays consistent. To change the look, change a token:
     colours  --bg, --surface, --text, --accent ...
     shape    --radius-*, --shadow-*
     type     --font, --text-*
   Dark mode is automatic (it follows the visitor's phone/computer setting).
   ===================================================================== */

:root {
  /* Surfaces */
  --bg: #f5f5f7;                 /* page background, Apple light grey */
  --surface: #ffffff;            /* cards */
  --surface-2: #f5f5f7;          /* inputs, tracks, table headers */
  --surface-glass: rgba(255, 255, 255, 0.72);
  --hairline: rgba(0, 0, 0, 0.08);
  --hairline-strong: rgba(0, 0, 0, 0.14);

  /* Text */
  --text: #1d1d1f;
  --text-2: #6e6e73;             /* secondary */
  --text-3: #86868b;             /* tertiary / hints */

  /* Brand: an Irish green, used sparingly */
  --accent: #0b7a53;
  --accent-hover: #096a48;
  --accent-soft: rgba(11, 122, 83, 0.10);
  --accent-ring: rgba(11, 122, 83, 0.28);
  --link: #0b6e4b;
  --on-accent: #ffffff;           /* text on green buttons */

  /* The two census years (also used on the map) */
  --y1901: #b4541f;
  --y1901-soft: rgba(196, 92, 34, 0.12);
  --y1911: #0b7a53;
  --y1911-soft: rgba(11, 122, 83, 0.11);

  /* Status */
  --warn: #8a6100;
  --warn-soft: rgba(230, 170, 20, 0.16);
  --theme-ink: #a8421a;          /* map-theme orange (matches the class ramp) */
  --theme-soft: rgba(168, 66, 26, 0.11);

  /* Shape */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 980px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 20px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.05), 0 20px 48px rgba(0, 0, 0, 0.08);

  /* Type */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", system-ui, sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-md: 0.9375rem;
  --text-base: 1.0625rem;

  /* Motion */
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --fast: 160ms;

  --header-h: 52px;
  color-scheme: light;
}

/* dark: when the device asks for it (unless the switch says light), or when the switch says dark */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --surface-glass: rgba(28, 28, 30, 0.72);
    --hairline: rgba(255, 255, 255, 0.10);
    --hairline-strong: rgba(255, 255, 255, 0.18);
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #8e8e93;
    --accent: #30c48d;
    --accent-hover: #3fd69c;
    --accent-soft: rgba(48, 196, 141, 0.16);
    --accent-ring: rgba(48, 196, 141, 0.35);
    --link: #4cd6a2;
    --on-accent: #04291b;
    --y1901: #ff9f5a;
    --y1901-soft: rgba(255, 159, 90, 0.16);
    --y1911: #4cd6a2;
    --y1911-soft: rgba(76, 214, 162, 0.15);
    --warn: #ffd60a;
    --warn-soft: rgba(255, 214, 10, 0.14);
    --theme-ink: #ff9f5a;
    --theme-soft: rgba(255, 159, 90, 0.16);
    --shadow-sm: none;
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
    --shadow-lg: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 20px 48px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --surface-glass: rgba(28, 28, 30, 0.72);
    --hairline: rgba(255, 255, 255, 0.10);
    --hairline-strong: rgba(255, 255, 255, 0.18);
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #8e8e93;
    --accent: #30c48d;
    --accent-hover: #3fd69c;
    --accent-soft: rgba(48, 196, 141, 0.16);
    --accent-ring: rgba(48, 196, 141, 0.35);
    --link: #4cd6a2;
    --on-accent: #04291b;
    --y1901: #ff9f5a;
    --y1901-soft: rgba(255, 159, 90, 0.16);
    --y1911: #4cd6a2;
    --y1911-soft: rgba(76, 214, 162, 0.15);
    --warn: #ffd60a;
    --warn-soft: rgba(255, 214, 10, 0.14);
    --theme-ink: #ff9f5a;
    --theme-soft: rgba(255, 159, 90, 0.16);
    --shadow-sm: none;
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
    --shadow-lg: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 20px 48px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }

/* ---------- Basics ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--text-base)/1.47 var(--font);
  letter-spacing: -0.012em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex; flex-direction: column;
  overflow-x: clip;       /* full-width picture bands must not cause sideways scrolling */
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.12;
  color: var(--text);
}

a { color: var(--link); text-decoration: none; transition: color var(--fast) var(--ease); }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }

main { width: 100%; max-width: 1240px; margin: 0 auto; padding: 32px 22px 72px; flex: 1; }

.muted { color: var(--text-2); }
.small { font-size: var(--text-sm); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Header: frosted glass bar that stays at the top ---------- */
.site-header {
  position: sticky; top: 0; z-index: 1000;
  height: var(--header-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 max(22px, calc((100vw - 1240px) / 2 + 22px));
  background: var(--surface-glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); font-weight: 600; font-size: var(--text-md); letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand:hover { text-decoration: none; opacity: 0.8; }
.brand-mark {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, #12a06e, #0b6e4b);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 1px 2px rgba(0,0,0,0.15);
}
.brand-mark svg { width: 16px; height: 16px; }
.brand-name { font-weight: 700; letter-spacing: -0.02em; }
.brand-years { color: var(--text-2); font-weight: 400; letter-spacing: -0.01em; margin-left: 6px; font-size: var(--text-sm); }

.nav { margin-left: auto; display: flex; gap: 4px; }

/* The menu (three bars) beside the logo */
.menu { position: relative; flex: 0 0 auto; }
.menu summary {
  list-style: none; cursor: pointer; width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; color: var(--text);
  transition: background var(--fast) var(--ease);
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover, .menu[open] summary { background: var(--hairline); }
.menu summary svg { width: 20px; height: 20px; }
.menu-panel {
  position: absolute; top: calc(100% + 8px); left: 0; min-width: 240px; padding: 8px;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.14);
}
.menu-panel a {
  color: var(--text); padding: 9px 12px; border-radius: 9px; font-size: var(--text-sm);
}
.menu-panel a:hover { background: var(--hairline); text-decoration: none; }
.menu-panel a[aria-current="page"] { font-weight: 600; }
.menu-heading {
  margin: 8px 12px 2px; padding-top: 8px; border-top: 1px solid var(--hairline);
  font-size: var(--text-xs, 0.75rem); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2);
}
.nav a {
  color: var(--text); font-size: var(--text-sm); padding: 6px 12px; border-radius: var(--radius-pill);
  opacity: 0.8; transition: background var(--fast) var(--ease), opacity var(--fast) var(--ease);
}
.nav a:hover { opacity: 1; text-decoration: none; background: var(--hairline); }
.nav a[aria-current="page"] { opacity: 1; font-weight: 600; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--hairline);
  color: var(--text-3); font-size: var(--text-xs); line-height: 1.6;
  padding: 22px max(22px, calc((100vw - 1240px) / 2 + 22px)) 32px;
  display: flex; flex-wrap: wrap; gap: 4px 24px; justify-content: space-between;
}
.site-footer strong { color: var(--text-2); font-weight: 600; }
.site-footer .tip-link { color: var(--text-2); font-weight: 600; white-space: nowrap; }
.results .tip-row { list-style: none; margin: 8px 0; padding: 12px 16px; background: var(--accent-soft);
  border-radius: var(--radius); font-size: var(--text-sm); color: var(--text-2); }
.results .tip-row p { margin: 0; }
/* the tip jar on household pages and the About page */
.tip-line { margin: 14px 0 0; color: var(--text-2); }
.tip-line a, .tip-ask a { font-weight: 600; }
.tip-ask { padding-top: 12px; border-top: 1px solid var(--hairline); }

/* ---------- Home page ---------- */
.hero { text-align: center; max-width: 820px; margin: 0 auto; }
.eyebrow {
  display: inline-block; margin: 0 0 14px; padding: 5px 12px;
  font-size: var(--text-sm); font-weight: 600; color: var(--accent);
  background: var(--accent-soft); border-radius: var(--radius-pill); letter-spacing: 0;
}
.hero h1 {
  font-size: clamp(2.4rem, 6.4vw, 4.5rem); line-height: 1.04; letter-spacing: -0.035em;
  margin: 0 0 18px;
}
.hero h1 .gradient, .about-tag .gradient {
  background: linear-gradient(100deg, #0b7a53 10%, #1aa37a 45%, #b4541f 95%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--text-2); font-size: clamp(1.1rem, 2vw, 1.3rem); line-height: 1.45; margin: 0 auto; max-width: 640px; }
.hero p + p { margin-top: 0.8em; }

.home-search { max-width: 1000px; margin: 0 auto; }

/* The big map picture behind the headline: full width, fading out at the
   centre (so the words stay readable) and at the bottom edge. */
.hero-band {
  position: relative; isolation: isolate;
  margin: -32px calc(50% - 50vw) 0; padding: 72px 22px 96px;
}
.hero-band::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: url("img/hero-dublin.webp") center / cover no-repeat;
  opacity: 0.75;
  -webkit-mask-image: radial-gradient(ellipse 52% 60% at 50% 46%, transparent 0%, rgba(0,0,0,0.35) 55%, #000 100%),
                      linear-gradient(to bottom, #000 55%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: radial-gradient(ellipse 52% 60% at 50% 46%, transparent 0%, rgba(0,0,0,0.35) 55%, #000 100%),
              linear-gradient(to bottom, #000 55%, transparent 100%);
  mask-composite: intersect;
}
.hero-band .hero { margin: 0 auto; }
.search-card { position: relative; margin-top: -48px; box-shadow: var(--shadow-lg); }

/* Page sections */
.section { max-width: 1000px; margin: 72px auto 0; }
.section-head { margin-bottom: 20px; }
.section-head h2 { font-size: clamp(1.6rem, 3.2vw, 2.25rem); letter-spacing: -0.03em; margin: 0 0 6px; }
.section-head p { margin: 0; color: var(--text-2); }
/* "Free here" on the home page */
.free-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .free-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .free-grid { grid-template-columns: 1fr; } }
.free-grid .card { margin: 0; padding: 20px; }
.free-grid h3 { margin: 0 0 6px; font-size: 1.05rem; letter-spacing: -0.01em; color: var(--accent); }
.free-grid p { margin: 0; color: var(--text-2); font-size: var(--text-md, 0.9375rem); }
.free-note { margin-top: 14px; }

/* Picture cards: a crop of the 1900s map for each city */
.place-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.place-card {
  position: relative; display: block; aspect-ratio: 3 / 2; overflow: hidden;
  border-radius: var(--radius-lg); box-shadow: var(--shadow); color: #fff;
  background: #efe8d8;
}
.place-card img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 600ms var(--ease);
}
.place-card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.62) 0%, rgba(0,0,0,0.18) 38%, transparent 60%);
}
.place-card-text {
  position: absolute; left: 20px; right: 20px; bottom: 16px; z-index: 1;
  display: flex; flex-direction: column;
}
.place-card-text strong { font-family: var(--font-display); font-size: 1.6rem; letter-spacing: -0.025em; line-height: 1.1; }
.place-card-text span { font-size: var(--text-sm); opacity: 0.85; }
.place-card:hover { text-decoration: none; }
.place-card:hover img { transform: scale(1.04); }
/* dark: when the device asks for it (unless the switch says light), or when the switch says dark */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero-band::before { filter: invert(1) hue-rotate(180deg) brightness(0.8); opacity: 0.45; }
  :root:not([data-theme="light"]) .place-card img { filter: brightness(0.85); }
}
:root[data-theme="dark"] .hero-band::before { filter: invert(1) hue-rotate(180deg) brightness(0.8); opacity: 0.45; }
:root[data-theme="dark"] .place-card img { filter: brightness(0.85); }

.how {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px;
  max-width: 1000px; margin: 48px auto 0;
}
.how > div {
  background: var(--surface); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow);
}
.how h3 { margin: 0 0 6px; font-size: 1.125rem; display: flex; align-items: center; gap: 10px; }
.how h3 .step { width: 26px; height: 26px; font-size: var(--text-sm); margin: 0; }
.how p { margin: 0; color: var(--text-2); font-size: var(--text-md); }

.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px 24px;
  max-width: 1000px; margin: 48px auto 0; text-align: center;
}
@media (max-width: 820px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat strong { display: block; font-family: var(--font-display); font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; }
.stat span { color: var(--text-2); font-size: var(--text-sm); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 24px; box-shadow: var(--shadow);
}
.card.compact { padding: 18px 20px; }

/* ---------- Forms ---------- */
.search-form { display: grid; gap: 18px; }
.form-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.form-row.drill { padding-top: 18px; border-top: 1px solid var(--hairline); }
.more-options > summary { cursor: pointer; font-weight: 600; font-size: var(--text-sm); color: var(--text); width: fit-content; }
.more-options[open] > summary { margin-bottom: 12px; }
.more-options .drill-hint { margin: 10px 0 0; }
.form-row.drill .field { flex: 1 1 200px; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 150px; min-width: 0; }
.field.wide { flex: 2 1 240px; }
.field label, .label-row > label { font-weight: 600; font-size: var(--text-sm); color: var(--text); }
.opt { font-weight: 400; color: var(--text-3); }
.label-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

input, select, textarea {
  font: inherit; font-size: var(--text-base); color: var(--text);
  width: 100%; height: 44px; padding: 0 14px;
  background: var(--surface-2); border: 1px solid transparent; border-radius: var(--radius);
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
  -webkit-appearance: none; appearance: none;
}
input::placeholder { color: var(--text-3); }
input:hover, select:hover { border-color: var(--hairline-strong); }
input:focus, select:focus {
  outline: none; background: var(--surface); border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}
select {
  padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2386868b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
select:disabled { color: var(--text-3); cursor: not-allowed; opacity: 0.7; }
select:disabled:hover { border-color: transparent; }
input[type="radio"], input[type="checkbox"] {
  width: auto; height: auto; padding: 0; -webkit-appearance: auto; appearance: auto;
  accent-color: var(--accent); background: none; border: 0; box-shadow: none;
}

/* Segmented control (Exact / Starts with) */
.radio-row {
  display: inline-flex; padding: 2px; gap: 2px;
  background: var(--surface-2); border-radius: 9px;
}
.radio-row label {
  position: relative; display: inline-flex; align-items: center;
  font-size: var(--text-xs); font-weight: 500; color: var(--text-2);
  padding: 3px 10px; border-radius: 7px; cursor: pointer;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.radio-row input { position: absolute; opacity: 0; pointer-events: none; }
.radio-row label:has(input:checked) { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.radio-row label:has(input:focus-visible) { outline: 2px solid var(--accent-ring); }

/* Buttons */
button, .button {
  font: inherit; font-size: var(--text-base); font-weight: 500; letter-spacing: -0.01em;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 44px; padding: 0 26px; flex: 0 0 auto;
  color: var(--on-accent); background: var(--accent); border: 0; border-radius: var(--radius-pill);
  cursor: pointer; text-decoration: none;
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease);
}
button:hover, .button:hover { background: var(--accent-hover); text-decoration: none; }
button:active, .button:active { transform: scale(0.97); }
.button.secondary { background: var(--surface-2); color: var(--link); }
.button.secondary:hover { background: var(--hairline); }

.step {
  display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 6px;
  border-radius: 50%; background: var(--accent); color: var(--on-accent);
  font-size: 0.6875rem; font-weight: 700; vertical-align: 1px;
}
.drill-hint { margin: 0; font-size: var(--text-sm); color: var(--text-3); }

.notice {
  background: var(--warn-soft); color: var(--text);
  padding: 14px 18px; border-radius: var(--radius); font-size: var(--text-md);
}

/* ---------- Filter chips ---------- */
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 20px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 4px 0 13px;
  background: var(--accent-soft); color: var(--accent); border-radius: var(--radius-pill);
  font-weight: 600; font-size: var(--text-sm);
}
.chip.name { background: var(--text); color: var(--bg); padding-right: 13px; }
.chip a {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  color: inherit; font-size: 1rem; line-height: 1; opacity: 0.7;
}
.chip a:hover { opacity: 1; background: var(--accent); color: #fff; text-decoration: none; }
.chip.theme { background: var(--theme-soft); color: var(--theme-ink); }
.chip.theme a:hover { background: var(--theme-ink); color: #fff; }
.chip-sep { color: var(--text-3); }
.suggestions { margin: 14px 0 0; line-height: 1.9; font-size: var(--text-md); }
.suggestions a { font-weight: 600; }

/* ---------- Results ---------- */
.summary { color: var(--text-2); margin: 22px 0 14px; font-size: var(--text-md); }
.summary strong { color: var(--text); }
.results-layout, .household-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start;
}
.household-layout { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }

.results {
  list-style: none; margin: 0; padding: 0;
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden;
}
.results > li + li { border-top: 1px solid var(--hairline); }
.result {
  display: flex; gap: 14px; align-items: flex-start; color: inherit;
  padding: 14px 18px; position: relative;
  transition: background var(--fast) var(--ease);
}
.result::after {
  content: ""; position: absolute; right: 18px; top: 50%; width: 8px; height: 8px;
  border-right: 2px solid var(--text-3); border-top: 2px solid var(--text-3);
  transform: translateY(-50%) rotate(45deg); opacity: 0.6;
}
.result:hover { background: var(--surface-2); text-decoration: none; }
.result-main { display: flex; flex-direction: column; min-width: 0; padding-right: 22px; }
.result-place { font-weight: 600; color: var(--text); }
.result-sub { font-size: var(--text-sm); color: var(--text-2); }
.result-people { font-size: var(--text-md); color: var(--text-2); margin-top: 2px; }
.result-facts { display: block; font-size: var(--text-sm); color: var(--accent); margin-top: 2px; }

.year-badge {
  flex: 0 0 auto; font-weight: 700; font-size: var(--text-xs); letter-spacing: 0.01em;
  padding: 4px 9px; border-radius: var(--radius-pill); font-variant-numeric: tabular-nums;
}
.y1901 { background: var(--y1901-soft); color: var(--y1901); }
.y1911 { background: var(--y1911-soft); color: var(--y1911); }
.y1926 { background: rgba(88, 86, 214, 0.12); color: #5856d6; }

.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; }
.pager a {
  font-weight: 500; font-size: var(--text-md); padding: 9px 18px;
  background: var(--surface); border-radius: var(--radius-pill); box-shadow: var(--shadow);
}
.pager a:hover { text-decoration: none; background: var(--surface-2); }

/* ---------- Maps ---------- */
.map-panel { position: sticky; top: calc(var(--header-h) + 16px); }
.map {
  height: 480px; border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow); background: var(--surface-2);
  isolation: isolate;
}
.map.tall { height: 560px; }
.map-note { font-size: var(--text-sm); color: var(--text-2); margin-top: 10px; line-height: 1.7; }
.key { display: inline-block; width: 14px; height: 10px; vertical-align: middle; margin-right: 3px; }
.key.townland { border: 2px dashed #8c2d19; border-radius: 2px; }
.key.ded { border: 2px solid var(--text); border-radius: 2px; }
.key.street { height: 6px; border-radius: 3px; background: #c62828; opacity: 0.75; }
.key.house { width: 12px; height: 12px; border: 3px solid #c62828; border-radius: 50%; }

/* Leaflet's buttons, popups and layer menu, restyled to match */
.leaflet-container { font: inherit; font-size: var(--text-sm); background: var(--surface-2); }
.leaflet-bar, .leaflet-control-layers {
  border: 0 !important; border-radius: var(--radius) !important; overflow: hidden;
  box-shadow: var(--shadow-lg) !important;
}
.leaflet-bar a {
  width: 34px !important; height: 34px !important; line-height: 34px !important;
  background: var(--surface-glass) !important; color: var(--text) !important;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-bottom-color: var(--hairline) !important;
}
.leaflet-bar a:hover { background: var(--surface) !important; text-decoration: none; }
.leaflet-control-layers {
  background: var(--surface-glass) !important; color: var(--text);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.leaflet-control-layers-expanded { padding: 10px 14px !important; }
.leaflet-control-layers label { font-size: var(--text-sm); margin: 2px 0; }
.leaflet-control-layers-separator { border-top-color: var(--hairline) !important; }
.leaflet-popup-content-wrapper {
  border-radius: var(--radius) !important; box-shadow: var(--shadow-lg) !important;
  background: var(--surface) !important; color: var(--text) !important;
}
.leaflet-popup-tip { background: var(--surface) !important; }
.leaflet-popup-content { margin: 12px 16px !important; font-size: var(--text-sm); line-height: 1.5; }
.leaflet-tooltip {
  border: 0 !important; border-radius: var(--radius-sm) !important; box-shadow: var(--shadow-lg) !important;
  font-size: var(--text-sm); padding: 6px 10px !important;
}
.leaflet-control-attribution {
  background: var(--surface-glass) !important; color: var(--text-2) !important;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top-left-radius: var(--radius-sm); font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--text-2) !important; }
.faded-tiles { filter: grayscale(1) opacity(0.55); }
/* dark: when the device asks for it (unless the switch says light), or when the switch says dark */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .faded-tiles { filter: grayscale(1) invert(1) brightness(0.9) contrast(0.85) opacity(0.7); }
}
:root[data-theme="dark"] .faded-tiles { filter: grayscale(1) invert(1) brightness(0.9) contrast(0.85) opacity(0.7); }

/* The 1900s six-inch sheets: darker ink and stronger contrast, so the faint
   hand-drawn lines and names stand out (the scans themselves are fixed) */
.historic-tiles { filter: contrast(1.35) saturate(1.15) brightness(0.96); }

/* County names drawn on the map */
.county-label {
  font: 600 11px/1 var(--font); letter-spacing: 0.08em; text-transform: uppercase;
  color: #1d1d1f; white-space: nowrap; transform: translate(-50%, -50%);
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 2px #fff;
  pointer-events: none;
}

/* Townland names on the zoomed-in home map */
.townland-label {
  font: 500 10px/1.1 var(--font); color: #6b2412; white-space: nowrap; transform: translate(-50%, -50%);
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 2px #fff; pointer-events: none;
}

/* ---------- Map themes panel ---------- */
.themes {
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 16px 18px; margin-bottom: 12px;
}
.themes h2 { font-size: var(--text-md); margin: 0 0 10px; letter-spacing: -0.01em; }
.theme-choices {
  display: flex; flex-wrap: wrap; gap: 2px; padding: 2px;
  background: var(--surface-2); border-radius: 10px;
}
.theme-choice {
  flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px 12px; border-radius: 8px; font-weight: 500; font-size: var(--text-sm);
  color: var(--text-2); cursor: pointer; text-align: center;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.theme-choice input { position: absolute; opacity: 0; pointer-events: none; }
.theme-choice:has(input:checked) { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.theme-choice:has(input:focus-visible) { outline: 2px solid var(--accent-ring); }
.theme-choice.disabled { color: var(--text-3); cursor: not-allowed; opacity: 0.6; }
.theme-options:empty { display: none; }
.theme-options { margin-top: 12px; }
.theme-options p { margin: 0 0 10px; }
.chip-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-choice span {
  display: inline-block; padding: 5px 12px; border-radius: var(--radius-pill);
  font-size: var(--text-sm); cursor: pointer; background: var(--surface-2); color: var(--text);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.chip-choice span:hover { background: var(--hairline-strong); }
.chip-choice input:checked + span { background: var(--theme-ink); color: #fff; }
.chip-choice input:focus-visible + span { outline: 2px solid var(--accent-ring); outline-offset: 1px; }
.theme-check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: var(--text-sm); }
.theme-check.disabled { color: var(--text-3); }

/* Map legends */
.legend, .share-legend {
  display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center;
  margin-top: 10px; font-size: var(--text-sm); color: var(--text-2);
}
.legend-title { font-weight: 600; color: var(--text); width: 100%; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; flex: 0 0 auto; }

/* ---------- Household page ---------- */
.crumbs { margin: 0 0 18px; font-size: var(--text-md); }
.crumbs a { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; }
.household-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 24px; }
.household-head .year-badge { margin-top: 10px; }
.household-head h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.75rem); letter-spacing: -0.03em; }
.place-line { margin: 6px 0 0; color: var(--text-2); font-size: var(--text-base); }

.table-wrap {
  overflow-x: auto; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
}
table.people { border-collapse: collapse; width: 100%; font-size: var(--text-md); }
.people th, .people td { padding: 11px 14px; text-align: left; white-space: nowrap; }
.people td { border-top: 1px solid var(--hairline); }
.people th {
  background: var(--surface); color: var(--text-2);
  font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--hairline-strong);
}
.people tbody tr { transition: background var(--fast) var(--ease); }
.people tbody tr:hover { background: var(--surface-2); }
.people td.name { font-weight: 600; }
.people th.num, .people td.num { text-align: right; }
.other-year { margin-top: 18px; }

.records-note { margin: 12px 4px 0; }
.archives-link { margin: 18px 4px 0; display: flex; flex-direction: column; gap: 2px; }
.archives-link a { font-weight: 600; }
.birth-link { white-space: nowrap; }
.birth-link a + a { margin-left: 8px; }

/* Workers and their class (HISCLASS bars) */
.workers { margin-top: 20px; }
.workers h2, .family-link h2 { font-size: 1.1875rem; margin: 0 0 4px; }
.workers > p { margin: 0 0 16px; }
.class-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.class-bars li {
  display: grid; grid-template-columns: minmax(120px, 1.3fr) minmax(80px, 2fr) minmax(140px, 1.4fr);
  gap: 12px; align-items: center; font-size: var(--text-md);
}
.class-bars .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.class-bars .track { height: 8px; background: var(--surface-2); border-radius: var(--radius-pill); overflow: hidden; }
.class-bars .bar { display: block; height: 100%; border-radius: var(--radius-pill); min-width: 4px; }
.class-bars .score { color: var(--text-2); font-size: var(--text-sm); }
.class-bars .score strong { color: var(--text); font-variant-numeric: tabular-nums; margin-right: 3px; }
/* class groups: the same orange as the Class level map theme, darker = higher */
.g1 { background: #73290d; } .g2 { background: #a8421a; } .g3 { background: #d95926; }
.g4 { background: #ed7c46; } .g5 { background: #f29b6c; }
.class-key { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 14px; font-size: var(--text-xs); color: var(--text-2); }
.not-ranked { margin: 12px 0 0; }

/* The same family in the other census */
.family-link { margin-top: 20px; position: relative; overflow: hidden; }
.family-link::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 4px;
  background: linear-gradient(180deg, var(--y1901), var(--y1911));
}
.family-link h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.family-link p { margin: 6px 0; }

/* Counting the family: years married, children born / living (app/family.py) */
.family-count { margin-top: 20px; }
.family-count h2 { font-size: 1.1875rem; margin: 0 0 4px; }
.family-count p { margin: 6px 0; }
.tally { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 10px 0; padding: 0; }
.tally li {
  padding: 6px 14px; border-radius: var(--radius-pill);
  background: var(--accent-soft); color: var(--accent); font-size: var(--text-sm);
}
.tally li strong { font-size: 1.05em; }
.tally li.away { background: var(--warn-soft); color: var(--warn); }
.tally li.died { background: var(--surface-2); color: var(--text-2); }
.confidence {
  font-family: var(--font); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0;
  padding: 3px 10px; border-radius: var(--radius-pill);
}
.confidence.strong { background: var(--accent-soft); color: var(--accent); }
.confidence.possible { background: var(--warn-soft); color: var(--warn); }
.confidence.weak { background: var(--surface-2); color: var(--text-2); }
.link-pairs { margin: 10px 0; padding-left: 20px; font-size: var(--text-md); }
.link-pairs li { margin: 3px 0; }

/* ---------- Skill levels map page ---------- */
.page-intro { max-width: 780px; margin-bottom: 24px; }
.page-intro h1 { margin: 0 0 10px; font-size: clamp(2rem, 4.5vw, 3rem); letter-spacing: -0.03em; }
.page-intro p { margin: 0; color: var(--text-2); font-size: var(--text-base); }

.filters { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 18px; }
.filters .field { flex: 0 1 300px; }

.skills-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.skills-layout .map.tall { height: 620px; }

.detail h3 { margin: 0 0 12px; font-size: 1.25rem; }
.detail h4 { margin: 20px 0 8px; font-size: var(--text-md); }
.big-number { font-family: var(--font-display); font-size: 2.5rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; }
.big-number span { font-family: var(--font); font-size: var(--text-md); font-weight: 400; letter-spacing: 0; color: var(--text-2); margin-left: 6px; }
.stack-bar { display: flex; gap: 2px; height: 10px; margin: 14px 0 12px; border-radius: var(--radius-pill); overflow: hidden; }
.stack-bar span { min-width: 2px; }
.level-list, .top-list { list-style: none; margin: 0; padding: 0; font-size: var(--text-md); }
.level-list li, .top-list li { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.top-list li + li { border-top: 1px solid var(--hairline); }
.level-list li span:nth-child(2), .top-list li span:first-child { flex: 1; }

.table-section { margin-top: 40px; }
.table-section h2 { font-size: 1.5rem; margin: 0 0 12px; }
.table-section .table-wrap { max-height: 440px; overflow-y: auto; }
.sortable th { cursor: pointer; position: sticky; top: 0; z-index: 1; user-select: none; }
.sortable th:hover { color: var(--text); }
.sortable th[aria-sort="ascending"]::after { content: " ▲"; font-size: 0.7em; }
.sortable th[aria-sort="descending"]::after { content: " ▼"; font-size: 0.7em; }

/* ---------- Gentle entrance animation (skipped if the visitor prefers less motion) ---------- */
@media (prefers-reduced-motion: no-preference) {
  main > * { animation: rise 420ms var(--ease) backwards; }   /* "backwards": nothing lingers once finished, so full-screen maps can sit above the menu bar */
  main > *:nth-child(2) { animation-delay: 40ms; }
  main > *:nth-child(3) { animation-delay: 80ms; }
  main > *:nth-child(4) { animation-delay: 120ms; }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  /* the sticky map must not be animated with transform, or it stops sticking */
  .results-layout, .household-layout, .skills-layout { animation-name: fade; }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
}

/* ---------- Phones & small screens ---------- */
@media (max-width: 820px) {
  main { padding: 20px 16px 56px; }
  .site-header { padding: 0 16px; }
  .site-footer { padding: 20px 16px 28px; }
  .brand-years { display: none; }
  .results-layout, .household-layout, .skills-layout { grid-template-columns: minmax(0, 1fr); }
  .map-panel { position: static; order: -1; }
  .map, .map.tall { height: 320px; }
  .skills-layout .map.tall { height: 400px; }
  .form-row > button { width: 100%; }
  .hero-band { margin-top: -20px; padding: 48px 16px 80px; }
  .hero-band::before { opacity: 0.4; }
  .search-card { margin-top: -40px; }
  .section { margin-top: 52px; }
  .card { padding: 18px; }
}
@media (max-width: 600px) {
  .class-bars li { grid-template-columns: 1fr 1fr; }
  .class-bars .who { grid-column: 1 / -1; }
}

/* ---------- Full-screen maps (the ⤢ button on every map) ---------- */
.map-expand a { display: grid !important; place-items: center; }
.map.map-expanded, .leaflet-container.map-expanded {
  /* !important: page-specific map heights (e.g. .household-map .map.tall) mustn't win */
  position: fixed !important; inset: 0; z-index: 2000;
  width: 100vw !important; height: 100vh !important; height: 100dvh !important;
  border-radius: 0; box-shadow: none; margin: 0;
}
html.map-is-expanded, html.map-is-expanded body { overflow: hidden; }   /* the page behind mustn't scroll */
/* a fade-in still running would make it the map's frame instead of the window */
html.map-is-expanded main > * { animation: none !important; transform: none !important; }

/* ---------- "Life in this place" story panel (search page) ---------- */
.life-story { margin: 20px 0 8px; padding: 28px; }
.life-story.loading { padding: 18px 24px; }
.life-story.loading p { margin: 0; animation: pulse 1.4s var(--ease) infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }
.life-head .eyebrow { margin-bottom: 10px; }
.life-head h2 { font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -0.03em; margin: 0 0 18px; }
.life-body { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(240px, 1fr); gap: 32px; align-items: start; }
.life-text p { margin: 0 0 14px; line-height: 1.6; }
.life-more summary {
  cursor: pointer; color: var(--link); font-weight: 600; font-size: var(--text-md);
  list-style: none; display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px;
}
.life-more summary::-webkit-details-marker { display: none; }
.life-more summary::after { content: "›"; font-size: 1.2em; transition: transform var(--fast) var(--ease); }
.life-more[open] summary::after { transform: rotate(90deg); }

.life-compare { margin: 0; padding: 18px; background: var(--surface-2); border-radius: var(--radius); }
.life-compare figcaption { font-weight: 600; font-size: var(--text-md); margin-bottom: 12px; }
.cmp { display: grid; gap: 3px; margin-bottom: 12px; }
.cmp-label { font-size: var(--text-sm); }
.cmp-row { display: flex; align-items: center; gap: 8px; }
.cmp-bar { height: 8px; border-radius: var(--radius-pill); min-width: 3px; }
.cmp-bar.fam, .cmp-dot.fam { background: var(--accent); }
.cmp-bar.area, .cmp-dot.area { background: var(--text-3); opacity: 0.6; }
.cmp-n { font-size: var(--text-xs); color: var(--text-2); font-variant-numeric: tabular-nums; }
.cmp-key { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 4px 0 0; font-size: var(--text-xs); color: var(--text-2); }
.cmp-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: -6px; }

.life-links { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--hairline); }
.life-links h3 { font-size: var(--text-base); margin: 0 0 12px; }
.life-links ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.life-links a {
  display: flex; flex-direction: column; gap: 2px; height: 100%;
  padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); color: var(--text);
  transition: background var(--fast) var(--ease);
}
.life-links a:hover { background: var(--hairline); text-decoration: none; }
.life-links strong { color: var(--link); font-size: var(--text-md); }
.life-links span { font-size: var(--text-sm); color: var(--text-2); line-height: 1.4; }
.life-note { margin: 18px 0 0; }
@media (max-width: 820px) {
  .life-story { padding: 20px; }
  .life-body { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}

/* ---------- No results: back button and wider searches ---------- */
.no-results { margin-top: 4px; }
.back-button { height: 36px; padding: 0 16px; font-size: var(--text-md); margin-bottom: 4px; }
.no-results h2 { font-size: 1.1875rem; margin: 18px 0 10px; }
.widen { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.widen a {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: var(--radius); background: var(--surface-2);
  font-weight: 600; transition: background var(--fast) var(--ease);
}
.widen a:hover { background: var(--hairline); text-decoration: none; }
.widen a span { color: var(--text-2); font-weight: 400; font-size: var(--text-sm); white-space: nowrap; }
.widen a span::after { content: "  ›"; }

/* ---------- Household people table: fits without sideways scrolling ---------- */
.people-section { margin-bottom: 24px; }
.people-section .table-wrap {
  /* if the table is ever wider than the screen, soft shadows at the edges
     show there's more to scroll to (they disappear at each end) */
  background:
    linear-gradient(to right, var(--surface) 30%, transparent) left / 40px 100% no-repeat local,
    linear-gradient(to left, var(--surface) 30%, transparent) right / 40px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(0,0,0,0.14), transparent) left / 14px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,0.14), transparent) right / 14px 100% no-repeat scroll,
    var(--surface);
}
.table-wrap::-webkit-scrollbar { height: 8px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--hairline-strong); border-radius: 4px; }
.people-section .people td, .people-section .people th { white-space: normal; vertical-align: top; }
.people-section .people td { min-width: 6em; }
.people-section .people td.name { white-space: nowrap; min-width: 9em; }
.people-section .people .narrow { min-width: 0; width: 1%; white-space: nowrap; }
.people td.name .relation { display: block; font-weight: 400; font-size: var(--text-sm); color: var(--text-2); }
.people td.birth-link { white-space: nowrap; min-width: 0; }
.people-section .people td.birth-link a + a { display: block; margin: 2px 0 0; }   /* "all Ireland" under "Search" */
.people-section .people td { min-width: 5em; }
.class-cell { font-size: var(--text-sm); }
.class-num {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; margin-right: 4px;
  border-radius: var(--radius-pill); color: #fff; font-size: var(--text-xs); font-weight: 700;
  font-variant-numeric: tabular-nums; vertical-align: 1px;
}

/* Phones and tablets: each person becomes a card instead of a table row */
@media (max-width: 900px) {
  .people-section .table-wrap { background: none; box-shadow: none; overflow: visible; }
  .people-section table.people, .people-section .people tbody,
  .people-section .people tr, .people-section .people td { display: block; width: auto; }
  .people-section .people thead { display: none; }
  .people-section .people tr {
    background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow);
    padding: 14px 16px; margin-bottom: 10px;
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px;
  }
  .people-section .people tbody tr:hover { background: var(--surface); }
  .people-section .people td { border: 0; padding: 0; min-width: 0; font-size: var(--text-md); }
  .people-section .people td::before {
    content: attr(data-label); display: block;
    font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3);
  }
  .people-section .people td.name { grid-column: 1 / -1; font-size: 1.0625rem; white-space: normal; }
  .people-section .people td.name::before { display: none; }
  .people-section .people td:empty { display: none; }
  .people-section .people .narrow { width: auto; }
  .people-section .people td.birth-link a + a { display: inline; margin-left: 8px; }
}

/* Household page order: map, then everyone in the house, then the details */
.household-map { margin-bottom: 24px; }
.household-map .map.tall { height: 440px; }
.household-details { display: grid; gap: 0; max-width: 980px; }
@media (max-width: 820px) { .household-map .map.tall { height: 320px; } }

/* Records cell: Birth and Marriage searches, one per line */
.people td.birth-link .rec { display: block; white-space: nowrap; }
.people td.birth-link .rec + .rec { margin-top: 4px; }
.people td.birth-link .rec-kind { display: inline-block; min-width: 4.6em; font-size: var(--text-xs); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.03em; }
.people-section .people td.birth-link .rec a + a { display: inline; margin: 0 0 0 6px; }

/* ---------- Her side of the family (household page) ---------- */
.her-family { margin-top: 20px; transition: opacity var(--fast) var(--ease); }
.her-family.loading { opacity: 0.5; pointer-events: none; }
.her-family h2 { font-size: 1.1875rem; margin: 0 0 4px; }
.her-family h3 { font-size: var(--text-base); margin: 20px 0 8px; }
.maiden-clue { margin: 12px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.maiden-form { margin-top: 14px; }
.maiden-form label { display: block; font-weight: 600; font-size: var(--text-sm); margin-bottom: 6px; }
.maiden-row { display: flex; gap: 10px; flex-wrap: wrap; }
.maiden-row input { flex: 1 1 220px; }
.maiden-form .muted { margin: 8px 0 0; }
.kin-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.kin-list li { padding: 10px 14px; background: var(--surface-2); border-radius: var(--radius); font-size: var(--text-md); }
.kin-place { display: block; font-size: var(--text-sm); margin-top: 2px; }
.chip.job { background: var(--y1901-soft); color: var(--y1901); }
.chip.job a:hover { background: var(--y1901); color: #fff; }
.maiden-clue.from-record { display: block; padding: 12px 14px; background: var(--accent-soft); border-radius: var(--radius); }
.maiden-clue.from-record p { margin: 6px 0 0; }
.people td.name .nee { font-weight: 400; color: var(--text-2); }

/* Marriage register entry, read from the handwritten page */
.her-father { margin-top: 16px; }
.her-father.loading p { animation: pulse 1.4s var(--ease) infinite; }
.register-entry { padding: 14px 16px; background: var(--surface-2); border-radius: var(--radius); }
.register-entry p { margin: 0 0 8px; }
table.register { border-collapse: collapse; width: 100%; font-size: var(--text-md); margin: 6px 0 10px; }
.register th, .register td { text-align: left; padding: 6px 10px 6px 0; vertical-align: top; border-bottom: 1px solid var(--hairline); }
.register thead th { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); }
.register tbody th { font-weight: 500; color: var(--text-2); width: 7em; font-size: var(--text-sm); }
.register tr.fathers td { font-weight: 600; }

/* ---------- Partner / affiliate links ---------- */
.partner-card { margin-top: 20px; }
/* County resources page: the framed-artwork card (Census2Art) */
.feature-partner { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 28px; align-items: center; }
.feature-partner h2 { font-size: clamp(1.3rem, 2.6vw, 1.7rem); letter-spacing: -0.03em; margin: 4px 0 8px; }
.feature-partner-text p { color: var(--text-2); line-height: 1.6; }
.feature-partner-text p:last-child { margin-bottom: 0; }
.framed-print {
  padding: 8px; background: #2b2118; border-radius: 3px;
  box-shadow: 0 14px 30px rgba(0,0,0,0.22), inset 0 0 0 2px #4a3a2c;
  transform: rotate(-1.2deg);
}
.framed-print img {
  display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover;
  border: 12px solid #f7f3ea; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}
@media (max-width: 560px) { .feature-partner { grid-template-columns: 1fr; } .framed-print { width: 150px; } }
.partner-card h2 { font-size: 1.1875rem; margin: 0 0 12px; }
.partner-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.partner-list a, .partner-links a {
  display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--accent-soft); color: var(--text); transition: background var(--fast) var(--ease);
}
.partner-list a:hover, .partner-links a:hover { background: var(--hairline); text-decoration: none; }
.partner-list strong, .partner-links strong { color: var(--link); }
.partner-list span, .partner-links span { font-size: var(--text-sm); color: var(--text-2); }
.promo-code { margin-top: 4px; }
.promo-code b { display: inline-block; padding: 1px 8px; border: 1.5px dashed var(--accent); border-radius: 6px; color: var(--accent); letter-spacing: 0.04em; }
.disclosure { margin: 10px 0 0; }
.father-death { margin-top: 10px; }
.father-death.loading p { animation: pulse 1.4s var(--ease) infinite; }
.death-entry { margin-top: 4px; }
.agree { padding: 8px 12px; border-radius: var(--radius-sm); background: var(--accent-soft); }

/* Map themes floating over a full-screen map */
.map-fs-panel {
  position: absolute; left: 12px; bottom: 28px; z-index: 1000;
  width: min(400px, calc(100% - 24px)); max-height: min(60vh, calc(100% - 120px));
  display: flex; flex-direction: column;
  background: var(--surface-glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden;
  font-size: var(--text-md); cursor: auto;
}
.map-fs-body { overflow-y: auto; padding: 4px 16px 14px; }
.map-fs-body .themes { background: none; box-shadow: none; padding: 0; margin: 0; }
.map-fs-body .share-legend { margin-top: 12px; }
.map-fs-toggle {
  align-self: flex-end; height: auto; padding: 8px 14px; margin: 0; border-radius: 0;
  background: none; color: var(--link); font-size: var(--text-sm); font-weight: 600;
}
.map-fs-toggle:hover { background: var(--hairline); }
.map-fs-toggle:active { transform: none; }
.map-fs-panel.collapsed .map-fs-body { display: none; }
.map-fs-panel.collapsed { width: auto; }
/* the search page's map column sticks to the top of the screen, which would
   keep a full-screen map underneath the menu bar: lift it while expanded */
html.map-is-expanded .map-panel { z-index: 2001; }

/* All their children (household page) */
.children .told { margin: .25rem 0 .75rem; }
.child-list { list-style: none; padding: 0; margin: .5rem 0 1rem; display: grid; gap: .5rem; }
.child-list li { border: 1px solid var(--hairline); border-radius: var(--radius); padding: .6rem .8rem;
                 border-left: 4px solid var(--accent); }
.child-list li.away { border-left-color: var(--warn); }
.child-list li.died { border-left-color: var(--hairline-strong); }
.child-main { display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: baseline; }
.child-note { margin-top: .25rem; }
.chip.sad { background: var(--hairline); }

/* "Who's missing" (app/missing.py) */
.missing-period { font-size: 1rem; margin: 18px 0 4px; }
.missing-period:first-of-type { margin-top: 6px; }

/* County resources (/resources and the home page picker) */
.resources-page { max-width: 1000px; margin: 32px auto 0; }
.resources-page > .card { margin-top: 20px; }
.resources-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.resources-picker select { min-width: 220px; flex: 1 1 220px; max-width: 360px; }
.compact-stats { margin: 12px 0 18px; }
.compact-stats .stat strong { font-size: 1.5rem; }
.surname-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.district-table { width: 100%; border-collapse: collapse; }
.district-table th, .district-table td { text-align: left; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.resource-list { list-style: none; padding: 0; margin: 0; }
.resource-list li { padding: 12px 0; border-bottom: 1px solid var(--hairline); }
.resource-list li:last-child { border-bottom: 0; }
.resource-list p { margin: 4px 0 0; color: var(--text-2); }
@media (max-width: 600px) { .district-table td:last-child, .district-table th:last-child { display: none; } }
.resource-sections { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px !important; }

/* ---- Family tree page (/tree, app/tree.py) ---- */
.tree-page.loading { min-height: 200px; opacity: 0.8; }
.tree-gen { font-size: var(--text-lg, 1.1rem); margin: 32px 0 12px; }
.tree-row { display: grid; gap: 14px; }
.tree-row.parents { grid-template-columns: 1fr 1fr; }
.tree-side { display: grid; gap: 14px; align-content: start; }
.tree-row.couple { grid-template-columns: 1fr minmax(160px, 0.6fr) 1fr; align-items: center; }
.tree-row.kids { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.tree-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px; border-top: 3px solid var(--hairline-strong); min-width: 0;
}
.tree-card.sex-M { border-top-color: var(--y1911); }
.tree-card.sex-F { border-top-color: var(--y1901); }
.tree-card.has-died h3::after { content: " †"; color: var(--text-3); font-weight: 400; }
.tree-card h3 { margin: 0 0 8px; font-size: var(--text-md, 1rem); overflow-wrap: anywhere; }
.tree-card .nee { font-weight: 400; color: var(--text-2); }
.tree-role { margin: 0 0 2px; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); }
.tree-facts { list-style: none; margin: 0; padding: 0; font-size: var(--text-sm); }
.tree-facts li { margin: 6px 0; line-height: 1.45; overflow-wrap: anywhere; }
.fact-note { display: block; margin-left: 2px; }
.tree-marriage { text-align: center; font-size: var(--text-sm); padding: 10px; border-top: 2px dashed var(--hairline-strong); }
.proof {
  display: inline-block; font-size: 0.6875rem; font-weight: 600; padding: 1px 7px; margin-right: 2px;
  border-radius: var(--radius-pill); vertical-align: 1px; cursor: help; white-space: nowrap;
}
.proof-record { background: var(--accent-soft); color: var(--accent); }
.proof-census { background: rgba(40, 90, 200, 0.11); color: #2a5bc0; }
.proof-linked { background: var(--warn-soft); color: var(--warn); }
.proof-likely { background: var(--warn-soft); color: var(--warn); border: 1px dashed var(--warn); }
.proof-possible { background: var(--surface-2); color: var(--text-2); border: 1px dashed var(--hairline-strong); }
/* dark: when the device asks for it (unless the switch says light), or when the switch says dark */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .proof-census { background: rgba(110, 150, 255, 0.16); color: #9db8ff; }
}
:root[data-theme="dark"] .proof-census { background: rgba(110, 150, 255, 0.16); color: #9db8ff; }
.proof-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--text-2); }
.right { display: block; margin-top: 3px; font-size: var(--text-xs); color: var(--text-3); }
.right button {
  font-size: var(--text-xs); height: 22px; padding: 0 10px; margin-left: 4px;
  background: var(--surface-2); color: var(--link);
}
.right button:hover { background: var(--accent); color: var(--on-accent); }
.right textarea { display: block; width: 100%; margin: 4px 0; font: inherit; font-size: var(--text-sm); }
.tree-export { margin-top: 32px; }
.household-head > a.button { margin-top: 6px; white-space: nowrap; }
.household-head > a.button:first-of-type { margin-left: auto; }
@media (max-width: 600px) { .household-head { flex-wrap: wrap; } .household-head > a.button:first-of-type { margin-left: 0; } }
@media (max-width: 700px) {
  .tree-row.parents, .tree-row.couple { grid-template-columns: 1fr; }
  .tree-marriage { border-top: 0; border-left: 2px dashed var(--hairline-strong); text-align: left; }
}

/* ---- About page: why the site exists ---- */
.about-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
.about-story h1 { font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -0.03em; margin: 4px 0 12px; }
.about-story p, .about-townland p { color: var(--text-2); line-height: 1.6; }
.about-story p:last-child, .about-townland p:last-child { margin-bottom: 0; }
.about-townland h3 { margin: 0 0 8px; font-size: 1.125rem; }
.about-tag { font-weight: 600; font-size: 1.125rem; color: var(--text) !important; }
@media (max-width: 760px) { .about-grid { grid-template-columns: 1fr; } }
.about-map { margin-top: 16px; }
.family-map { margin: 0; padding: 0; overflow: hidden; }
.family-map-head { padding: 24px 24px 16px; }
.family-map-head h2 { font-size: clamp(1.3rem, 2.6vw, 1.7rem); letter-spacing: -0.03em; margin: 4px 0 8px; }
.family-map-head p:last-child { color: var(--text-2); line-height: 1.6; margin: 0; max-width: 680px; }
.family-map-frame { position: relative; aspect-ratio: 16 / 10; border-block: 1px solid var(--hairline); }
.family-map-frame img, .family-map-frame svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.family-map-frame img { object-fit: cover; }
.tree-lines path {
  fill: none; stroke: #0b7a53; stroke-width: 7; stroke-linecap: round; opacity: 0.85;
}
.tree-lines path.down { stroke-dasharray: 2 16; }
.family-map .pin circle { fill: #0b7a53; stroke: #fff; stroke-width: 6; }
.family-map .pin.home circle { fill: #8a4b1f; }
.family-map .pin text {
  fill: #fff; font: 700 30px var(--font-display, system-ui); text-anchor: middle;
}
.family-map figcaption { padding: 16px 24px 20px; }
.family-map-key {
  list-style: none; counter-reset: key; margin: 0 0 12px; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px 20px;
}
.family-map-key li { counter-increment: key; display: grid; grid-template-columns: 26px 1fr; column-gap: 10px; }
.family-map-key li::before {
  content: counter(key); grid-row: span 2; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; background: #0b7a53; color: #fff; font-weight: 700; font-size: var(--text-sm);
}
.family-map-key li.home::before { background: #8a4b1f; }
.family-map-key span { color: var(--text-2); font-size: var(--text-sm); line-height: 1.45; }
.tree-up { margin: 10px 0 0; font-size: var(--text-sm); font-weight: 600; }
.tree-climb-notes { color: var(--text-2); margin-top: 8px; }
.tree-climb-notes p { margin: 6px 0; }

/* ---- Search by drawing an area (app/area.py) ---- */
.draw-control { display: flex; flex-direction: column; background: var(--surface); }
.draw-control button {
  height: auto; padding: 7px 12px; font-size: var(--text-sm); border-radius: 0; white-space: nowrap;
  background: var(--surface); color: var(--link); border-bottom: 1px solid var(--hairline);
}
.draw-control button:hover { background: var(--accent-soft); }
.draw-control .draw-done { background: var(--accent); color: var(--on-accent); }
.draw-control .draw-done:hover { background: var(--accent-hover); }
.draw-control button:disabled { opacity: 0.45; cursor: default; }
.map.drawing { cursor: crosshair; }
.map.drawing .leaflet-interactive { pointer-events: none; }    /* clicks go to the map, not the outlines */
.results-layout.map-only { grid-template-columns: 1fr; }
.results-layout.map-only .results { display: none; }
.draw-link { margin-top: 6px; }
.map-search-card { padding: 0; overflow: hidden; display: grid; grid-template-columns: 220px 1fr; }
.map-search-fields { padding: 18px; display: flex; flex-direction: column; gap: 6px; border-right: 1px solid var(--hairline); }
.map-search-fields label { font-weight: 600; font-size: var(--text-sm); margin-top: 8px; }
.map-search-fields .opt { font-weight: 400; color: var(--text-3); }
.home-map { height: 460px; border-radius: 0; margin: 0; box-shadow: none; }
@media (max-width: 700px) {
  .map-search-card { grid-template-columns: 1fr; }
  .map-search-fields { border-right: 0; border-bottom: 1px solid var(--hairline); }
  .home-map { height: 380px; }
}
.draw-control button[hidden] { display: none; }
/* the pencil: a square map button like the zoom ones, "Draw an area" on hover */
.draw-control .draw-start { width: 34px; height: 34px; padding: 0; display: grid; place-items: center; border-bottom: 0; }
.draw-control .draw-start svg { display: block; }
/* "Search near an address" box on the maps (static/draw.js): small, top right */
.near-control { background: var(--surface); width: 232px; max-width: calc(100vw - 110px); padding: 4px; }
.near-form { display: flex; gap: 3px; align-items: center; }
.near-form .near-q { flex: 1; min-width: 0; height: 28px; padding: 2px 7px; font-size: 13px; }
.near-km-label { display: flex; align-items: center; gap: 2px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.near-form .near-km { width: 42px; height: 28px; padding: 2px 4px; font-size: 13px; }
.near-form button { height: 28px; padding: 0 8px; font-size: 13px; }
.near-status { color: var(--text-2); margin: 3px 2px 0; font-size: 12px; }
.near-status:empty { display: none; }
.near-choices { list-style: none; margin: 3px 0 0; padding: 0; max-height: 150px; overflow-y: auto; }
.near-choices button, .near-control .near-go {
  display: block; width: 100%; height: auto; text-align: left; padding: 5px 7px; font-size: 12px;
  border-radius: 0; background: var(--surface); color: var(--link); border-top: 1px solid var(--hairline); white-space: normal;
}
.near-choices button:hover { background: var(--accent-soft); }
.near-control .near-go { margin-top: 4px; text-align: center; background: var(--accent); color: var(--on-accent); border-radius: 6px; }
.near-control .near-go:hover { background: var(--accent-hover); }
.near-control [hidden] { display: none; }
/* the one-line "Free here" in the home page hero, linking down to the cards */
.free-line { margin: 14px 0 0; font-size: var(--text-md); }
.free-line a { display: inline-block; padding: 6px 14px; border-radius: var(--radius-pill); background: var(--accent-soft);
  color: var(--text); text-decoration: none; }
.free-line a:hover { background: var(--accent-ring); }
.free-line strong { color: var(--accent); }

/* ---------- Privacy page ---------- */
.legal-card { max-width: 760px; margin: 0 auto; }
.legal-card h1 { font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -0.03em; margin: 4px 0 12px; }
.legal-card h2 { font-size: 1.125rem; margin: 28px 0 8px; }
.legal-card p, .legal-card li { color: var(--text-2); line-height: 1.6; }
.legal-card .lead { color: var(--text); font-size: 1.0625rem; }
.legal-card ul { padding-left: 1.2em; }
.legal-card li + li { margin-top: 6px; }
.accuracy-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); margin: 8px 0 16px; }
.accuracy-table th, .accuracy-table td { text-align: left; vertical-align: top; padding: 8px 10px;
  border-bottom: 1px solid var(--hairline); color: var(--text-2); }
.accuracy-table th { color: var(--text); font-weight: 600; }
.accuracy-table td:first-child { color: var(--text); font-weight: 600; width: 38%; }
.site-footer a { color: inherit; }

/* ---------- Explore the map ---------- */
.explore-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: start; }
.explore-panel { position: sticky; top: 76px; }
.explore-themes { display: grid; gap: 2px; padding: 2px; background: var(--surface-2); border-radius: 10px; }
.explore-themes .theme-choice { justify-content: flex-start; }
.explore-label { margin: 14px 0 6px; font-size: var(--text-sm); font-weight: 600; }
.explore-surname { margin-top: 12px; }
.explore-surname label { font-size: var(--text-sm); font-weight: 600; }
.inline-form { display: flex; gap: 8px; margin-top: 6px; }
.inline-form input { flex: 1; min-width: 0; }
.explore-ranks:empty { display: none; }
.explore-ranks h2 + .explore-rank { margin-bottom: 14px; }
.explore-rank { margin: 0; padding: 0; list-style: none; counter-reset: rank; }
.explore-rank li { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: var(--text-sm);
  border-bottom: 1px solid var(--hairline); }
.explore-rank li:last-child { border-bottom: 0; }
.explore-rank button { all: unset; cursor: pointer; color: var(--accent); }
.explore-rank button:hover { text-decoration: underline; }
.explore-rank span { color: var(--text-2); font-variant-numeric: tabular-nums; }
.explore-crumbs { margin: 0 0 10px; font-size: var(--text-md); display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.explore-crumbs .explore-search { margin-left: auto; font-size: var(--text-sm); font-weight: 600; }
.explore-note:empty { display: none; }
.explore-story { margin-top: 20px; padding: 20px 22px; background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 14px; max-width: 760px; }
.explore-story h2 { font-size: 1.125rem; margin: 0 0 4px; }
.explore-story h3 { font-size: var(--text-md); margin: 18px 0 4px; }
.explore-story p { color: var(--text-2); line-height: 1.6; margin: 0 0 8px; }
.explore-sources a { color: var(--accent); }
@media (max-width: 900px) {
  .explore-layout { grid-template-columns: minmax(0, 1fr); }
  .explore-panel { position: static; }
  .explore-main { order: -1; }
  .explore-main .map.tall { height: 420px; }
}

/* Naming-pattern clue (in the kin section) */
.naming-list { margin: 8px 0; padding: 0; list-style: none; }
.naming-list li { display: flex; gap: 10px; align-items: baseline; padding: 5px 0; border-bottom: 1px solid var(--hairline); font-size: var(--text-sm); }
.naming-list li:last-child { border-bottom: 0; }
.naming-list li > strong { min-width: 90px; }
.naming-list .confidence { margin-left: 6px; }

/* "?" on census column headings that explain the question (hover for the text) */
.col-help { display: inline-grid; place-items: center; width: 14px; height: 14px; margin-left: 2px; border-radius: 50%;
  font-size: 10px; font-weight: 700; color: var(--text-2); border: 1px solid var(--hairline-strong); cursor: help;
  vertical-align: 1px; }

/* Error pages (404 / 500): a search box to get people back on track */
.error-search { display: flex; gap: 10px; margin: 20px 0 16px; flex-wrap: wrap; }
.error-search input { flex: 1 1 220px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Household page: "Take it further" (partner links + books about the county) */
.take-further { margin: 0 0 24px; }
.take-further-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 24px; }
.take-further-grid > :only-child { grid-column: 1 / -1; }
.household-books h3 { font-size: var(--text-sm, 0.8125rem); text-transform: uppercase; letter-spacing: 0.05em;
                      color: var(--text-3); margin: 0 0 8px; }
.tree-next-title { margin: 20px 0 8px; }
@media (max-width: 760px) { .take-further-grid { grid-template-columns: 1fr; } }

/* "Local history groups near here" on family pages (app/societies.py) */
.local-societies { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--hairline); }
.local-societies h3 { margin: 0 0 4px; font-size: var(--text-md); }
.society-list { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.society-list li { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px;
  background: var(--surface-2, var(--accent-soft)); }
.society-contact { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 2px; overflow-wrap: anywhere; }

/* ---------- Light/dark switch in the header (base.html) ---------- */
.theme-switch {
  flex: none; width: 36px; height: 36px; padding: 0; margin-left: 4px; display: grid; place-items: center;
  border-radius: 50%; background: transparent; color: var(--text-2); border: 0; cursor: pointer;
}
.theme-switch:hover { background: var(--surface-2); color: var(--text); }
.theme-switch svg { width: 20px; height: 20px; }
.theme-switch .theme-sun { display: none; }
.theme-switch.is-dark .theme-sun { display: block; }
.theme-switch.is-dark .theme-moon { display: none; }
/* small phones: room for the menu, name, Search, Explore and the light/dark switch */
@media (max-width: 420px) {
  .site-header { gap: 8px; padding: 0 12px; }
  .brand { gap: 8px; }
  .nav { gap: 0; }
  .nav a { padding: 6px 8px; }
  .theme-switch { width: 32px; height: 32px; margin-left: 0; }
}

/* Contact page and "Spot a mistake?" on family pages */
.contact-email { margin: 22px 0 8px; }
.contact-email .button { display: inline-block; }
.contact-card ul { padding-left: 1.2em; }
.contact-card li { margin: 8px 0; }
.report-mistake { text-align: center; margin: 28px 0 0; color: var(--text-2); }
