:root {
  --text: #1e2420;
  --muted: #5d655f;
  --bg: #f7f5ef;
  --card: #ffffff;
  --line: #e2ddd0;
  --green: #2f5d3a;
  --green-dark: #1f3f28;
  --warm: #b5562a;
  --link: #1f5a8a;
  --alert: #b3261e;
  --todo: #ffe58a;
  --radius: 0.75rem;
  --page: 64rem;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 2px 8px rgb(0 0 0 / 0.04);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Noto Serif", serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #e7e5de;
    --muted: #a7ada8;
    --bg: #151816;
    --card: #1e221f;
    --line: #333a35;
    --green: #8fc79c;
    --warm: #e08a5c;
    --link: #8cc3f0;
    --alert: #ff8a80;
    --todo: #6b5a00;
    --shadow: none;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 4rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
}

.wrap {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 1.25rem;
}

a {
  color: var(--link);
  text-underline-offset: 0.15em;
}

a:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
}

h1, h2, h3 {
  line-height: 1.2;
  text-wrap: balance;
}

/* No lone word on the last line of running text */
p, li, dd, figcaption {
  text-wrap: pretty;
}

h1, h2 {
  font-family: var(--serif);
  font-weight: 700;
}

h2 {
  margin: 3.5rem 0 1rem;
  font-size: clamp(1.6rem, 3vw, 2rem);
}

main h1 {
  margin: 2rem 0 1rem;
  font-size: clamp(1.9rem, 4vw, 2.5rem);
}

main h1::before,
h2::before {
  content: "";
  display: block;
  width: 2.5rem;
  height: 4px;
  margin-bottom: 0.75rem;
  border-radius: 2px;
  background: var(--warm);
}

h3 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.skip {
  position: absolute;
  left: -999px;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  padding: 0.5rem 1rem;
  background: var(--card);
  z-index: 10;
}

/* Header: photo with the village name over the sky */
.hero {
  position: relative;
  max-width: var(--page);
  margin: 0 auto;
  height: clamp(12rem, 27vw, 18rem);
  overflow: hidden;
  background: #cfd9df;
}

.hero--small {
  height: clamp(7.5rem, 15vw, 11rem);
}

.hero--small img {
  object-position: 55% 55%;
}

.hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 55% 100%;
}

.hero .wrap {
  position: relative;
  padding-top: clamp(1rem, 3vw, 2.25rem);
}

.hero--small .wrap {
  padding-top: clamp(0.6rem, 1.5vw, 1.1rem);
}

.hero .name {
  margin: 0;
  color: #183421;
  font-family: var(--serif);
  font-size: clamp(2.6rem, 7vw, 5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
  text-shadow: 0 0 18px rgb(255 255 255 / 0.85);
}

.hero--small .name {
  font-size: clamp(1.8rem, 4vw, 2.75rem);
}

.hero .name a {
  color: inherit;
  text-decoration: none;
}

.hero .sub {
  margin: 0.4rem 0 0;
  color: #23402c;
  font-size: clamp(0.9rem, 1.6vw, 1.15rem);
  font-weight: 600;
  text-shadow: 0 0 10px rgb(255 255 255 / 0.95);
}

.hero--small .sub {
  margin-top: 0.2rem;
  font-size: clamp(0.8rem, 1.3vw, 0.95rem);
}

/* Navigation */
.topnav {
  position: sticky;
  top: 0;
  z-index: 5;
  max-width: var(--page);
  margin: 0 auto;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* Wider than the page: header, menu and footer become a framed column */
@media (min-width: 66rem) {
  .hero {
    margin-top: 1rem;
    border-radius: var(--radius) var(--radius) 0 0;
  }

  .topnav {
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 var(--radius) var(--radius);
  }
}

.topnav ul {
  display: flex;
  gap: 0.25rem;
  margin: 0;
  padding: 0.5rem 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}

.topnav a {
  display: block;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  white-space: nowrap;
}

.topnav a:hover,
.topnav a:focus-visible {
  background: color-mix(in srgb, var(--green) 14%, transparent);
  color: var(--green);
}

.topnav a[aria-current="page"] {
  background: var(--green-dark);
  color: #fff;
}

/* Phones: all five menu items fit without scrolling */
@media (max-width: 30rem) {
  .topnav .wrap {
    padding: 0 0.75rem;
  }

  .topnav ul {
    justify-content: space-between;
    gap: 0;
  }

  .topnav a {
    padding: 0.4rem 0.5rem;
  }
}

@media (prefers-color-scheme: dark) {
  .topnav a[aria-current="page"] {
    background: #2f5d3a;
  }
}

.draft {
  margin: 1.5rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

mark.todo {
  background: var(--todo);
  color: inherit;
  padding: 0 0.25em;
  border-radius: 0.2em;
}

/* Cards */
.emergency {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 1rem 0;
  padding: 0.5rem 1.1rem 0.5rem 0.5rem;
  border: 1px solid color-mix(in srgb, var(--alert) 25%, transparent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--alert) 7%, var(--card));
  line-height: 1.35;
}

.emergency .tel--sos {
  flex: none;
  align-self: center;
  margin: 0;
  background: #b3261e;
  color: #fff;
}

.emergency .tel--sos:hover {
  background: #8f1d17;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1rem;
  margin: 1rem 0;
  padding: 0;
  list-style: none;
}

.cards > li {
  display: flex;
  flex-direction: column;
  padding: 1rem 1.1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.cards p {
  margin: 0.25rem 0;
}

.tel {
  align-self: flex-start;
  margin-top: auto;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: var(--green-dark);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.cards .tel {
  margin-top: 0.6rem;
}

.tel:hover {
  background: var(--green);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .tel {
    background: #2f5d3a;
  }
}

/* Secondary button in a card: outlined, same shape as .tel */
.more {
  align-self: flex-start;
  margin-top: auto;
  padding: 0.3rem 0.9rem;
  border: 2px solid var(--green);
  border-radius: 999px;
  color: var(--green);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.cards .more {
  margin-top: 0.6rem;
}

/* Several buttons at the bottom of a card */
.cards .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: auto 0 0;
  padding-top: 0.6rem;
}

.cards .actions .more {
  margin-top: 0;
}

.more:hover {
  background: var(--green);
  color: var(--card);
}

.status {
  display: inline-block;
  padding: 0.05rem 0.6rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--warm) 16%, transparent);
  color: var(--warm);
  font-size: 0.9rem;
  font-weight: 700;
}

.updated {
  color: var(--muted);
  font-size: 0.9rem;
}

.contact {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--green) 8%, var(--card));
  border: 1px solid var(--line);
}

.contact h3 {
  margin-top: 0;
}

.contact ul {
  margin: 0.25rem 0 0.5rem;
  padding-left: 1.2rem;
}

.members {
  columns: 2 14rem;
  padding-left: 1.2rem;
}

/* History page */
.lead {
  font-size: 1.15rem;
}

.map {
  margin: 2rem 0;
}

.map img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.map figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.timeline {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 0.9rem 1.25rem;
  margin: 0;
}

.timeline dt {
  color: var(--warm);
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 700;
  text-align: right;
}

.timeline dd {
  margin: 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--line);
}

.src {
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 34rem) {
  .timeline {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .timeline dt {
    margin-top: 1rem;
    text-align: left;
  }

  .timeline dd {
    padding-left: 0;
    border: 0;
  }
}

.bars {
  margin: 0;
  padding: 0;
  list-style: none;
}

.bars li {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  align-items: center;
  gap: 0.75rem;
  margin: 0.35rem 0;
}

.bars span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.bars b {
  width: calc(var(--n) / 731 * 100%);
  min-width: 3rem;
  padding: 0.1rem 0.6rem;
  border-radius: 0.3rem;
  background: color-mix(in srgb, var(--green) 22%, var(--card));
  font-variant-numeric: tabular-nums;
}

.site-footer {
  max-width: var(--page);
  margin: 4rem auto 0;
  padding: 2rem 0;
  background: var(--green-dark);
  color: #e3ebe5;
  font-size: 0.95rem;
}

.site-footer a {
  color: #fff;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 0.5rem 3rem;
}

.site-footer h2 {
  margin: 0 0 0.5rem;
  font-family: inherit;
  font-size: 1.05rem;
}

.site-footer h2::before {
  display: none;
}

.site-footer ul {
  margin: 0;
  padding-left: 1.1rem;
}

@media (min-width: 66rem) {
  .site-footer {
    margin-bottom: 1rem;
    border-radius: var(--radius);
  }
}

@media print {
  :root {
    --text: #000;
    --muted: #333;
    --bg: #fff;
    --card: #fff;
    --link: #000;
    --shadow: none;
  }

  body {
    font-size: 11pt;
  }

  .skip,
  .topnav,
  .draft,
  .hero img {
    display: none;
  }

  .hero {
    height: auto;
    background: none;
  }

  .hero .name,
  .hero .sub {
    color: #000;
    text-shadow: none;
  }

  .site-footer {
    background: none;
    color: #000;
  }

  .tel,
  .more {
    background: none;
    border: 0;
    color: #000;
    padding: 0;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    word-break: break-all;
  }

  .cards {
    display: block;
  }

  .cards > li {
    break-inside: avoid;
    margin-bottom: 0.5rem;
  }
}
