:root {
  --sky: #dcecfb;
  --sky-deep: #99ccff;
  --ink: #1b2430;
  --muted: #4a5868;
  --navy: #1f4e79;
  --accent: #e8590c;
  --card: #ffffff;
  --line: #c9dbee;
  --radius: 10px;
  --wrap: 68rem;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: linear-gradient(var(--sky-deep), var(--sky) 22rem) no-repeat, var(--sky);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; }

a { color: var(--navy); text-underline-offset: 0.15em; }
a:hover { color: var(--accent); }
a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 1rem; }

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

/* Header and navigation */
.site-header { background: var(--navy); color: #fff; }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 2rem; padding-top: 0.75rem; padding-bottom: 0.75rem; }
.brand { display: flex; align-items: center; gap: 0.75rem; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand img { background: #fff; border-radius: 50%; padding: 3px; }
.brand strong { display: block; font-size: 1.4rem; letter-spacing: 0.06em; line-height: 1.1; }
.brand small { display: block; font-size: 0.85rem; opacity: 0.9; }

.site-header nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; }
.site-header nav a {
  display: block; padding: 0.35rem 0.6rem; border-radius: 6px;
  color: #fff; text-decoration: none; font-weight: 600; font-size: 0.95rem;
}
.site-header nav a:hover { background: rgba(255, 255, 255, 0.15); color: #fff; }
.site-header nav a[aria-current="page"], .site-header nav a[aria-current="true"] { background: #fff; color: var(--navy); }

/* Main content */
main.wrap { flex: 1; padding-top: 2rem; padding-bottom: 2.5rem; }
main > .card, main > article {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(1.25rem, 4vw, 2.5rem);
}
h1, h2, h3 { line-height: 1.2; color: var(--navy); }
h1 { font-size: clamp(1.7rem, 4.5vw, 2.6rem); margin-top: 0; }
.lede { font-size: 1.2rem; color: var(--muted); }
.notice {
  border-left: 4px solid var(--accent); background: #fff4ec;
  padding: 0.75rem 1rem; border-radius: 0 6px 6px 0;
}

/* Footer */
.site-footer { background: #fff; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; padding: 1.25rem 0; }
.site-footer p { margin: 0.4rem 0; max-width: 48rem; }

@media (max-width: 40rem) {
  .header-inner { gap: 0.5rem; }
  .site-header nav ul { gap: 0.15rem; }
  .site-header nav a { padding: 0.3rem 0.5rem; font-size: 0.9rem; }
}

/* Ported content */
.prose { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.25rem, 4vw, 2.5rem); min-width: 0; }
.prose > :first-child { margin-top: 0; }
.prose h2, .prose h3 { margin-top: 1.8em; }
.prose img { border-radius: 4px; }
.prose pre { overflow-x: auto; background: #f4f7fb; border: 1px solid var(--line); border-radius: 6px; padding: 0.75rem 1rem; font-size: 0.85rem; line-height: 1.45; }
.prose li + li { margin-top: 0.3em; }
.prose small { color: var(--muted); line-height: 1.4; display: inline-block; }
.center { text-align: center; }
.center img { display: inline-block; }
.table-wrap, .prose table.data { display: block; max-width: 100%; overflow-x: auto; }
table.data { border-collapse: collapse; margin: 1.25rem 0; }
table.data td, table.data th { border: 1px solid var(--line); padding: 0.4rem 0.6rem; vertical-align: middle; }
table.data tr:nth-child(even) td { background: #f7fafd; }

/* Section sub-navigation */
.has-subnav { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.subnav { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; position: sticky; top: 1rem; }
.subnav-title { margin: 0 0 0.5rem; font-weight: 700; }
.subnav-title a { text-decoration: none; }
.subnav ul { list-style: none; margin: 0; padding: 0; }
.subnav a { display: block; padding: 0.25rem 0.5rem; border-radius: 5px; text-decoration: none; }
.subnav a[aria-current="page"] { background: var(--navy); color: #fff; }
@media (max-width: 52rem) {
  .has-subnav { grid-template-columns: 1fr; gap: 1rem; }
  .subnav { position: static; }
  .subnav ul { display: flex; flex-wrap: wrap; gap: 0.25rem; }
}
.section-notice { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--line); font-size: 0.875rem; color: var(--muted); }

/* Photo galleries */
.thumbs, .gallery-index { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: 0.6rem; }
.thumbs { grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); }
.thumbs a, .gallery-index a, .prose .thumbs a, .prose .gallery-index a { display: block; }
.thumbs img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.gallery-index { grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 1rem; }
.gallery-index a { text-decoration: none; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #f7fafd; }
.gallery-index img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.gallery-index span { display: block; padding: 0.5rem 0.75rem; color: var(--muted); }
.gallery-index strong { display: block; color: var(--navy); }
.prose a > img { vertical-align: middle; }
.prose .thumbs li, .prose .gallery-index li { margin: 0; }
.prose a:has(> img) { text-decoration: none; display: inline-block; }

/* Home page */
.hero { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
/* Two photos stacked, each at the aerial's native 500px width, centered. */
.hero-photos { display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: clamp(1.25rem, 4vw, 2rem) 1rem; }
.hero-photos figure { margin: 0; width: 100%; max-width: 500px; }
.hero-photos img { display: block; width: 100%; height: auto; border-radius: 6px; }
.hero-photos figcaption { padding: 0.35rem 0 0; font-size: 0.8rem; color: var(--muted); line-height: 1.35; }
.home-section { margin-top: 2rem; }
.home-section > h2 { margin: 0 0 0.75rem; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.card-item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.card-item h3 { margin: 0 0 0.4rem; font-size: 1.15rem; }
.card-item h3 a { text-decoration: none; }
.card-item h3 a:hover { text-decoration: underline; }
.card-item p { margin: 0.3rem 0 0; color: var(--muted); }
.event-card { border-top: 4px solid var(--accent); }
.event-when { font-weight: 700; color: var(--ink) !important; }

/* Events page */
.prose figure { margin: 0 0 1.5rem; }
.prose figcaption { color: var(--muted); font-size: 0.95rem; }
.event { border-top: 1px solid var(--line); padding-top: 0.5rem; margin-top: 1.5rem; scroll-margin-top: 1rem; }
.event h3 { margin-top: 0.75rem; }
.event-facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; margin: 0.75rem 0 1rem; }
.event-facts dt { font-weight: 700; color: var(--navy); }
.event-facts dd { margin: 0; }
.event-note { margin-bottom: 0.25rem; font-style: italic; color: var(--muted); }
.event-quote { margin: 0; padding: 0 0 0 1rem; border-left: 3px solid var(--line); }
.home-section .cards { display: flex; flex-wrap: wrap; justify-content: center; }
.home-section .cards > li { flex: 0 1 19rem; }
.section-list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin: 0; padding: 1.1rem 1.25rem 1.1rem 2.5rem; }
.section-list li + li { margin-top: 0.5em; }
.section-list a { font-weight: 700; }
.intro { margin-bottom: 1.5rem; }
.intro h1 { margin-bottom: 0.5rem; }
.intro .lede { color: var(--ink); margin: 0 0 0.5rem; }
.intro p:last-child { margin: 0; font-weight: 600; }

/* One Builder's Saga */
.post-date { color: var(--muted); font-size: 0.95rem; margin-top: -0.5rem; }
.saga-photo { margin: 1rem 0 1.5rem; }
.saga-photo img { display: block; border-radius: 6px; }
.saga-contents li { margin-top: 0.25em; }
.saga-date { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.post-nav a { display: block; text-decoration: none; padding: 0.6rem 0.8rem; border: 1px solid var(--line); border-radius: 8px; }
.post-nav a:hover { border-color: var(--accent); }
.post-nav span { display: block; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.post-next { grid-column: 2; text-align: right; }
@media (max-width: 40rem) { .post-nav { grid-template-columns: 1fr; } .post-next { grid-column: 1; } }
.comments { margin-top: 2rem; }
.comment { border-left: 3px solid var(--line); padding: 0.1rem 0 0.1rem 1rem; margin: 1rem 0; }
.comment p { margin: 0.4rem 0; }
.comment-meta { font-size: 0.9rem; color: var(--muted); }
.comment-meta strong { color: var(--ink); }
.fn-ref { font-size: 0.75em; line-height: 0; }
.fn-ref a { text-decoration: none; padding: 0 0.1em; }
.footnotes { margin-top: 2rem; padding-top: 0.75rem; border-top: 1px solid var(--line); font-size: 0.9rem; color: var(--muted); }
.footnotes ol { margin: 0; padding-left: 1.25rem; }
.footnotes li:target { background: #fff4ec; }

/* Page title and lead photo above the content box */
.page-lead { text-align: center; margin-bottom: 1.5rem; }
.page-lead figure { margin: 0; }
.page-lead img { display: inline-block; border-radius: 6px; }
.page-lead figcaption { color: var(--muted); font-size: 0.95rem; margin-top: 0.4rem; line-height: 1.45; }
.page-lead small { font-size: 0.85rem; }
.link-status { color: #a8331c; font-size: 0.85em; font-weight: 600; white-space: nowrap; }
.links-note { font-size: 0.9rem; color: var(--muted); }
.link-gone { text-decoration: line-through; text-decoration-color: rgba(168, 51, 28, 0.5); }
