:root {
  color-scheme: light dark;

  --color-bg: #fbfaf8;
  --color-fg: #1a1a1a;
  --color-muted: #55524d;
  --color-accent: #7a3b1e;
  --color-border: #ddd6cc;
  --font-body: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --measure: 68ch;
  --header-h: 5.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #161513;
    --color-fg: #ece9e4;
    --color-muted: #b8b2a7;
    --color-accent: #e2a075;
    --color-border: #3a362f;
  }
}

* {
  box-sizing: border-box;
}

html {
  font-size: 100%;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-fg);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

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

a {
  color: var(--color-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--color-accent);
  color: var(--color-bg);
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
  z-index: 10;
  transition: top 0.15s ease-in-out;
  font-family: var(--font-ui);
}

.skip-link:focus {
  top: 1rem;
}

@media (prefers-reduced-motion: reduce) {
  .skip-link {
    transition: none;
  }
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  padding-block: 1rem;
  font-family: var(--font-ui);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-nav-archive {
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav-archive:hover,
.site-nav-archive:focus-visible {
  text-decoration: underline;
}

.site-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-fg);
  text-decoration: none;
}

.site-tagline {
  margin: 0.25rem 0 0;
  color: var(--color-muted);
  font-size: 1rem;
}

main {
  padding-block: 2.5rem;
  min-height: 60vh;
}

main h1 {
  font-size: 1.9rem;
  line-height: 1.25;
  margin-top: 0;
}

.index-intro {
  color: var(--color-muted);
  font-family: var(--font-ui);
  font-size: 0.95rem;
}

.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 1.75rem;
  font-family: var(--font-ui);
}

.no-js .filter-bar {
  display: none;
}

.filter-bar label {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-fg);
}

.filter-bar input {
  font: inherit;
  font-size: 1rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 0.35rem;
  background: var(--color-bg);
  color: var(--color-fg);
  width: 100%;
}

.filter-status {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--color-muted);
  min-height: 1.2em;
  margin: 0.6rem 0 0;
}

.filter-empty {
  font-family: var(--font-ui);
  color: var(--color-muted);
  margin-top: 1rem;
}

.post-index {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}

.post-index li[hidden] {
  display: none;
}

.post-index li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  padding-block: 0.6rem;
  border-bottom: 1px solid var(--color-border);
}

.post-index a {
  font-size: 1.05rem;
  text-decoration: none;
}

.post-index a:hover,
.post-index a:focus-visible {
  text-decoration: underline;
}

.post-index time {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-left: auto;
  white-space: nowrap;
}

.post-header h1 {
  margin-bottom: 0.4rem;
}

.post-meta {
  font-family: var(--font-ui);
  color: var(--color-muted);
  font-size: 0.9rem;
  margin-top: 0;
}

.post-body p {
  margin: 0 0 1.2em;
}

.post-body blockquote {
  margin: 1.5em 0;
  padding-left: 1.25em;
  border-left: 3px solid var(--color-border);
  color: var(--color-muted);
}

.post-pager {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.post-pager a {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-decoration: none;
}

.post-pager-next {
  grid-column: -2;
  text-align: right;
}

.post-pager-label {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--color-muted);
}

.post-pager-title {
  font-size: 1.05rem;
}

.post-pager a:hover .post-pager-title,
.post-pager a:focus-visible .post-pager-title {
  text-decoration: underline;
}

.post-back {
  margin-top: 2rem;
  font-family: var(--font-ui);
}

.site-footer {
  border-top: 1px solid var(--color-border);
  padding-block: 1.5rem;
  font-family: var(--font-ui);
  color: var(--color-muted);
  font-size: 0.85rem;
}

.footer-sponsor {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.footer-sponsor p {
  margin: 0;
}

.footer-logo-link {
  display: inline-flex;
  align-items: center;
  line-height: 0;
}

.footer-logo {
  display: block;
  height: 1.3rem;
  width: auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.layout-wide .wrap {
  max-width: 72rem;
}

.home-grid {
  display: grid;
  gap: 2.5rem;
}

.home-grid h2 {
  font-size: 1.5rem;
  line-height: 1.25;
  margin-top: 0;
}

.home-about {
  max-width: var(--measure);
}

.home-about p {
  margin: 0 0 1.2em;
}

.home-about,
.home-archive {
  min-width: 0;
}

@media (min-width: 56rem) {
  .home-grid {
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    gap: 4rem;
    align-items: start;
  }
}

@media (min-width: 56rem) {
  /* Both columns are visible side by side, so the header link is redundant. */
  .layout-wide .site-nav-archive {
    display: none;
  }
}

/* Pin the intro below the header; if it is taller than the viewport it scrolls on its own. */
@media (min-width: 56rem) {
  .home-about {
    position: sticky;
    top: calc(var(--header-h) + 1.5rem);
    max-height: calc(100vh - var(--header-h) - 3rem);
    max-height: calc(100dvh - var(--header-h) - 3rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 0.5rem;
  }
}
