/* ==========================================================================
   The Bus Abides - stylesheet
   Plain CSS, no framework, no build step. Edit and redeploy.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --paper: #faf6ef;
  --paper-2: #fffdf9;
  --ink: #1b1814;
  --ink-soft: #443e35;
  --muted: #7d7469;
  --line: #e6ddcf;
  --line-strong: #d2c6b3;

  --maroon: #7c3f4e;
  --maroon-deep: #63313d;
  --blue: #26528e;
  --amber: #c98a24;

  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1140px;
  --narrow: 42rem;
  --gutter: clamp(1.15rem, 4.5vw, 2.5rem);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
    Georgia, serif;
  --sans: "Segoe UI Variable Text", "Segoe UI", -apple-system,
    BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg,
iframe {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

button {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
h4,
p,
figure,
blockquote,
ul,
ol {
  margin: 0;
}

ul,
ol {
  padding-left: 1.15em;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 0.75rem 1.25rem;
  z-index: 100;
  border-radius: 0 0 8px 0;
}

.skip-link:focus {
  left: 0;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ---------- Layout ---------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.narrow {
  max-width: var(--narrow);
  margin-inline: auto;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}

.site-header.is-stuck {
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--paper) 96%, transparent);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 4.75rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  flex: 0 0 auto;
}

.brand img {
  width: clamp(196px, 24vw, 262px);
  height: auto;
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(0.85rem, 2vw, 1.75rem);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.nav a {
  text-decoration: none;
  color: var(--ink-soft);
  padding-block: 0.35rem;
  border-bottom: 2px solid transparent;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.nav a:hover {
  color: var(--maroon);
}

.nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--amber);
}

.nav a.is-external::after {
  content: "\2197";
  font-size: 0.75em;
  margin-left: 0.2em;
  color: var(--muted);
}

/* ---------- Home hero ---------- */
.hero {
  padding-block: clamp(2.75rem, 6vw, 4.5rem) clamp(2rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line);
}

/* No max-width here: the hero has to share the grid's left edge with the
   sections below it. The text is constrained individually instead. */

.eyebrow {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--maroon);
  margin-bottom: 1rem;
}

.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.4rem, 6.5vw, 4.1rem);
  line-height: 1.02;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

.hero h1 em {
  font-style: italic;
  color: var(--maroon);
}

.hero__lede {
  margin-top: 1.25rem;
  max-width: 34rem;
  font-family: var(--serif);
  font-size: clamp(1.0625rem, 1.6vw, 1.25rem);
  line-height: 1.6;
  color: var(--ink-soft);
}

.hero__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.75rem;
  margin-top: 1.75rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Section headings ---------- */
.section {
  padding-block: clamp(2.5rem, 5vw, 4rem);
}

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.section__title {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2.6vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.012em;
}

.section__more {
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.section__more:hover {
  color: var(--maroon);
}

/* ---------- Featured ---------- */
.featured {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1rem, 2.5vw, 1.75rem);
}

.feature {
  display: grid;
  gap: 1rem;
  text-decoration: none;
  align-content: start;
}

.feature__media {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--line);
  aspect-ratio: 21 / 9;
}

.feature__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}

.feature:hover .feature__media img {
  transform: scale(1.035);
}

.feature__title {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 2.9vw, 2.05rem);
  font-weight: 600;
  line-height: 1.17;
  letter-spacing: -0.018em;
  text-wrap: balance;
}

.feature__excerpt {
  font-family: var(--serif);
  color: var(--ink-soft);
  font-size: clamp(1rem, 1.25vw, 1.125rem);
  line-height: 1.58;
  max-width: 46rem;
}

/* ---------- Post cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.25rem, 3vw, 2rem) clamp(1rem, 2.5vw, 1.75rem);
  list-style: none;
  padding: 0;
  margin: 0;
}

.card {
  display: grid;
  gap: 0.8rem;
  text-decoration: none;
  align-content: start;
}

.card__media {
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--line);
  aspect-ratio: 21 / 9;
}

.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}

.card:hover .card__media img {
  transform: scale(1.045);
}

.card__meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.card__meta .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--line-strong);
}

.card__title {
  font-family: var(--serif);
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.card:hover .card__title {
  color: var(--maroon);
}

.card__excerpt {
  font-family: var(--serif);
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Pagination ---------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
  font-size: 0.9375rem;
}

.pager a,
.pager span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding-inline: 0.85rem;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid var(--line);
  color: var(--ink-soft);
}

.pager a:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.pager .is-current {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
  font-weight: 600;
}

.pager .is-gap {
  border: 0;
  color: var(--muted);
}

/* ---------- Page head (archives, about) ---------- */
.page-head {
  padding-block: clamp(2.5rem, 5vw, 4rem) clamp(1.5rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--line);
}

.page-head h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.page-head__lede {
  margin-top: 0.9rem;
  max-width: 38rem;
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

/* ---------- Article ---------- */
.article-head {
  padding-block: clamp(2.25rem, 5vw, 3.5rem) 0;
}

.article-head__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}

.article-head__meta a {
  color: var(--maroon);
  text-decoration: none;
}

.article-head h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 5.2vw, 3.4rem);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

.article-head__sub {
  display: block;
  margin-top: 0.85rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.0625rem, 2vw, 1.3rem);
  line-height: 1.45;
  color: var(--blue);
}

.article-cover {
  margin: clamp(1.75rem, 4vw, 2.75rem) 0 0;
}

.article-cover img {
  width: 100%;
  border-radius: var(--radius);
  aspect-ratio: 21 / 9;
  object-fit: cover;
}

.article-body {
  padding-block: clamp(1.75rem, 4vw, 2.75rem) clamp(3rem, 6vw, 4.5rem);
}

.article-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.9375rem;
  color: var(--muted);
}

.article-foot a {
  color: var(--maroon);
  text-decoration: none;
  font-weight: 500;
}

.byline {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.1rem;
  font-size: 0.9375rem;
  color: var(--muted);
}

.byline strong {
  color: var(--ink-soft);
  font-weight: 600;
}

/* ---------- Prose ---------- */
.prose {
  font-family: var(--serif);
  font-size: clamp(1.0625rem, 1.35vw, 1.1875rem);
  line-height: 1.72;
  color: var(--ink-soft);
}

.prose > * + * {
  margin-top: 1.35em;
}

.prose p {
  margin: 0;
}

.prose > * + p {
  margin-top: 1.35em;
}

.prose h2 {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 2.4vw, 1.75rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.014em;
  color: var(--ink);
  margin-top: 2.25em;
  margin-bottom: 0;
}

.prose h2 + * {
  margin-top: 0.75em;
}

.prose h3 {
  font-size: 1.15em;
  color: var(--ink);
}

.prose strong {
  color: var(--ink);
  font-weight: 700;
}

.prose a {
  color: var(--blue);
  text-decoration-color: color-mix(in srgb, var(--blue) 35%, transparent);
}

.prose a:hover {
  text-decoration-color: var(--blue);
}

.prose img {
  border-radius: var(--radius-sm);
  margin-inline: auto;
}

.prose .photo {
  text-align: center;
}

.prose .photo img {
  display: inline-block;
  cursor: zoom-in;
}

.prose .photo br {
  display: none;
}

.prose ul,
.prose ol {
  padding-left: 1.3em;
}

.prose li + li {
  margin-top: 0.5em;
}

.prose blockquote {
  margin: 1.75em 0;
  padding: 0.15em 0 0.15em 1.25rem;
  border-left: 3px solid var(--amber);
  color: var(--ink-soft);
  font-style: italic;
}

.prose blockquote p + p {
  margin-top: 0.9em;
}

.prose iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border-radius: var(--radius-sm);
  border: 0;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.9375rem;
}

.prose th,
.prose td {
  border: 1px solid var(--line);
  padding: 0.6rem 0.8rem;
  text-align: left;
}

.prose th {
  background: var(--paper-2);
  font-weight: 600;
  color: var(--ink);
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin-block: 2.25em;
}

.prose code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.12em 0.35em;
}

.prose pre {
  overflow-x: auto;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.prose pre code {
  border: 0;
  background: 0;
  padding: 0;
}

/* ---------- Prev / next ---------- */
.prevnext {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: clamp(1.5rem, 3vw, 2.5rem);
}

.prevnext a {
  display: grid;
  gap: 0.35rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-decoration: none;
  background: var(--paper-2);
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.prevnext a:hover {
  border-color: var(--line-strong);
}

.prevnext .label {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.prevnext .title {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}

.prevnext .next {
  text-align: right;
}

/* ---------- Category chips ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
}

.chips a {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.8125rem;
  text-decoration: none;
  color: var(--ink-soft);
  background: var(--paper-2);
}

.chips a:hover {
  border-color: var(--maroon);
  color: var(--maroon);
}

/* ---------- Forms ---------- */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr);
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: start;
}

.form {
  display: grid;
  gap: 1.15rem;
  max-width: 34rem;
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field label {
  font-size: 0.875rem;
  font-weight: 550;
  color: var(--ink-soft);
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.72rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper-2);
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--maroon);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--maroon) 14%, transparent);
}

.field textarea {
  min-height: 11rem;
  resize: vertical;
}

.field__hint {
  font-size: 0.8125rem;
  color: var(--muted);
}

.form__submit {
  justify-self: start;
  border: 0;
  cursor: pointer;
}

.aside-stack {
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.25rem);
}

.panel {
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper-2);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

.panel p + p {
  margin-top: 0.85em;
}

/* ---------- Button ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.35rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
}

.btn:hover {
  background: var(--maroon);
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--paper-2);
  border-top: 1px solid var(--line);
  padding-block: clamp(2.5rem, 5vw, 3.5rem) 1.75rem;
  font-size: 0.9375rem;
}

.footer__top {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
}

.footer__logo {
  width: 210px;
  height: auto;
  margin-bottom: 0.9rem;
}

.footer__intro p {
  max-width: 22rem;
  color: var(--muted);
  line-height: 1.6;
}

.footer__col {
  display: grid;
  gap: 0.5rem;
  align-content: start;
}

.footer__head {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
  font-weight: 500;
}

.footer__col a {
  text-decoration: none;
  color: var(--ink-soft);
}

.footer__col a:hover {
  color: var(--maroon);
}

.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-top: clamp(2rem, 4vw, 2.75rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  color: var(--muted);
}

.footer__bottom a {
  color: var(--muted);
  text-decoration: none;
}

.footer__bottom a:hover {
  color: var(--maroon);
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: rgba(20, 17, 14, 0.92);
  backdrop-filter: blur(4px);
}

.lightbox[open],
.lightbox.is-open {
  display: grid;
}

.lightbox img {
  max-width: 100%;
  max-height: 84vh;
  border-radius: 8px;
  object-fit: contain;
}

.lightbox figcaption {
  margin-top: 0.9rem;
  text-align: center;
  color: var(--paper);
  font-size: 0.9375rem;
  opacity: 0.85;
}

.lightbox__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
}

.lightbox__close:hover {
  background: rgba(255, 255, 255, 0.12);
}

body.is-locked {
  overflow: hidden;
}

/* ---------- 404 ---------- */
.notfound {
  padding-block: clamp(4rem, 10vw, 7rem);
  text-align: center;
}

.notfound h1 {
  font-family: var(--serif);
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.notfound p {
  margin-top: 0.9rem;
  color: var(--muted);
}

.notfound .btn {
  margin-top: 1.75rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split {
    grid-template-columns: minmax(0, 1fr);
  }

  .footer__top {
    grid-template-columns: 1fr 1fr;
  }

  .footer__intro {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  .cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .header__inner {
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding-block: 0.75rem;
    min-height: 0;
  }

  .nav {
    gap: 1rem;
    font-size: 0.875rem;
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }

  .prevnext {
    grid-template-columns: minmax(0, 1fr);
  }

  .prevnext .next {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .site-header,
  .site-footer,
  .prevnext {
    display: none;
  }

  body {
    background: #fff;
  }
}
