:root {
  --bg: #fdfbed;
  --text: #0f1d36;
  --text-muted: #5d6b80;
  --accent: #1e3a6b;
  --accent-neon: #d6ff00;
  --rule: #efe9d4;
  --card-bg: #fffef5;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1d33;
    --text: #f4eed8;
    --text-muted: #a4b0c4;
    --accent: #e8dfb8;
    --accent-neon: #d6ff00;
    --rule: #1f3050;
    --card-bg: #14253f;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--rule); }
a:hover { text-decoration-color: var(--accent-neon); text-decoration-thickness: 2px; }

h1, h2, h3 { font-family: var(--serif); letter-spacing: -0.01em; line-height: 1.2; }
h1 { font-size: 2.4rem; margin-bottom: 0.4em; }
h2 { font-size: 1.4rem; margin: 1.6em 0 0.5em; }
h3 { font-size: 1.1rem; margin: 1.2em 0 0.4em; }
p { margin-bottom: 1em; }

/* Header */
.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 24px 20px;
  border-bottom: 2px solid var(--accent-neon);
}
.brand {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
}
.site-nav { font-family: var(--sans); font-size: 0.95rem; }
.site-nav a {
  margin-left: 14px;
  color: var(--text-muted);
  text-decoration: none;
}
.site-nav a:hover { color: var(--accent); }

/* Main */
.site-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 24px;
}

/* Hero */
.hero { text-align: center; margin-bottom: 56px; }
.hero h1 { font-size: 2.8rem; margin-bottom: 6px; }
.hero .tagline {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 32px;
}
.hero-quotes {
  position: relative;
  max-width: 520px;
  margin: 0 auto;
  /* Reserve space so layout doesn't jump as quotes change */
  min-height: 7.5em;
}
.hero-quote {
  position: absolute;
  inset: 0;
  font-style: italic;
  color: var(--text-muted);
  border-left: 3px solid var(--accent-neon);
  padding: 4px 0 4px 18px;
  text-align: left;
  opacity: 0;
  transition: opacity 0.8s ease;
  pointer-events: none;
}
.hero-quote.is-active {
  opacity: 1;
  pointer-events: auto;
}
.hero-quote cite {
  display: block;
  margin-top: 8px;
  font-size: 0.9rem;
  font-style: normal;
}
@media (prefers-reduced-motion: reduce) {
  .hero-quote { transition: none; }
}

/* Facets */
.facets {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 56px;
}
@media (min-width: 540px) {
  .facets { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 820px) {
  .facets { grid-template-columns: repeat(4, 1fr); }
}
.facet {
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 20px 22px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.facet:hover { border-color: var(--accent); transform: translateY(-1px); }
.facet h2 { font-size: 1.1rem; margin: 0 0 6px; }
.facet p { font-size: 0.95rem; color: var(--text-muted); margin: 0; line-height: 1.5; }

/* Recent / note list */
.recent h2 { font-size: 1.1rem; margin-bottom: 12px; }
.note-list { list-style: none; }
.note-list li {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.95rem;
}
.note-list time { color: var(--text-muted); }
.note-list a { color: var(--text); text-decoration: none; }
.note-list a:hover { color: var(--accent); text-decoration: underline; }
.note-list .empty { color: var(--text-muted); font-style: italic; }
@media (max-width: 540px) {
  .note-list li { grid-template-columns: 1fr; gap: 2px; }
}

/* Colophon hero — bee on a thistle */
.colophon-hero {
  margin: 1.5em auto 2em;
  max-width: 480px;
  text-align: center;
}
.colophon-hero img {
  width: 100%;
  height: auto;
  border-radius: 4px;
}

/* 404 page penny-farthing illustration */
.not-found {
  margin: 2em auto;
  max-width: 480px;
  text-align: center;
}
.not-found img {
  width: 100%;
  height: auto;
  border-radius: 4px;
}

/* Subscribe blurb at the bottom of the notes index */
.subscribe {
  margin-top: 2.5em;
  padding-top: 1em;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.subscribe a { color: var(--text-muted); }
.subscribe a:hover { color: var(--accent); }

/* Page header */
.page-header { margin-bottom: 32px; }
.page-header h1 { margin-bottom: 8px; }
.lede { color: var(--text-muted); font-size: 1.05rem; }

/* Prose / post body */
.prose p, .post-body p { margin-bottom: 1.1em; }
.prose h2, .post-body h2 { margin-top: 1.6em; }
.post-header { margin-bottom: 28px; }
.post-header h1 { margin-bottom: 6px; }
.post-header time {
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--text-muted);
}
.post-back {
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.9rem;
}

/* Gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.gallery figure { margin: 0; }
.gallery img { width: 100%; height: auto; display: block; border-radius: 4px; }
.gallery figcaption {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Rates table — wrap in overflow on narrow viewports */
.rates {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0 2em;
  font-family: var(--sans);
  font-size: 0.95rem;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.rates th, .rates td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
}
.rates th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.rates td:last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* Post body images — fill the column for visual consistency. */
.post-body img {
  width: 100%;
  height: auto;
  display: block;
  margin: 1.5em auto 0.4em;
  border-radius: 4px;
}

/* Figures and captions in post bodies */
.post-body figure {
  margin: 1.5em 0;
}
.post-body figure img {
  width: 100%;
  margin: 0 auto;
}
.post-body figcaption {
  text-align: center;
  font-style: italic;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.5em;
}

/* Lightbox */
.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 100vw;
  max-height: 100vh;
  width: 100%;
  height: 100%;
  margin: 0;
  color: #fff;
}
.lightbox::backdrop {
  background: rgba(0, 0, 0, 0.88);
}
.lightbox-img {
  display: block;
  max-width: 92vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  margin: 0 auto;
  position: absolute;
  inset: 0;
  margin: auto;
  border-radius: 4px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.lightbox-close,
.lightbox-nav {
  position: absolute;
  background: transparent;
  border: 0;
  color: #fff;
  font-family: var(--sans);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}
.lightbox-close:hover,
.lightbox-nav:hover { opacity: 1; }
.lightbox-close {
  top: 16px;
  right: 20px;
  font-size: 2.4rem;
  line-height: 1;
  width: 44px;
  height: 44px;
}
.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  line-height: 1;
  width: 56px;
  height: 56px;
}
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }

@media (max-width: 540px) {
  .lightbox-nav { font-size: 2.2rem; width: 44px; height: 44px; }
}

/* Signature image — pre-colored transparent PNGs (navy for light mode, ivory
   for dark mode), served via <picture> with prefers-color-scheme. */
.signature {
  display: block;
  margin: 1em 0;
  max-width: 200px;
  height: auto;
}

/* Signature in the header, used as the home/brand mark. */
.signature-brand {
  display: inline-block;
  margin: 0;
  width: 250px;
  max-width: none;
  vertical-align: middle;
}
@media (max-width: 760px) {
  .signature-brand { width: 200px; }
}
@media (max-width: 600px) {
  .signature-brand { width: 160px; }
}

/* Embedded video — preserves 16:9 aspect ratio at any width */
.video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 1.5em 0;
}
.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 4px;
}

/* Footer */
.site-footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}
.footer-links {
  margin-top: 6px;
  font-size: 0.8rem;
}
.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}
.footer-links a:hover { color: var(--accent); }
