@font-face {
  font-family: "c4ed hand";
  src: url("/fonts/hand.ttf") format("truetype");
  font-display: swap;
}
:root {
  --paper: #fffdf8;
  --ink: #1a1a1a;
  --muted: #6b6760;
  --rule: #e8e2d6;
  --accent: #ff5a1f;
  --hand: "c4ed hand", "Patrick Hand", "Comic Neue", "Chalkboard SE", "Comic Sans MS", "Bradley Hand", cursive;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); }
body {
  margin: 0 auto;
  max-width: 1040px;
  padding: 0 20px 40px;
  font: 17px/1.55 var(--body);
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
h1, h2, .logo, .comic-nav, summary { font-family: var(--hand); font-weight: normal; }

header.site {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px;
  padding: 22px 0 14px; border-bottom: 2px solid var(--ink); margin-bottom: 26px;
}
.logo { font-size: 2.1rem; line-height: 1; text-decoration: none; letter-spacing: 0.02em; }
.tagline { color: var(--muted); font-size: 0.95rem; }
.site-nav { margin-left: auto; display: flex; gap: 16px; font-family: var(--hand); font-size: 1.2rem; }
.site-nav a { text-decoration: none; }
.site-nav a[aria-current] { text-decoration: underline; }

main { text-align: center; }
.comic-title { font-size: 2.3rem; line-height: 1.15; margin: 4px 0 2px; }
.comic-date { color: var(--muted); margin: 0 0 14px; font-size: 0.95rem; }

.comic-nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 14px 0; font-size: 1.15rem; }
.comic-nav a, .comic-nav > span {
  display: inline-block; min-width: 4.6em; padding: 3px 12px;
  border: 2px solid var(--ink); border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  text-decoration: none; background: var(--paper);
}
.comic-nav a:hover { border-color: var(--accent); }
.comic-nav > span { color: #b9b3a8; border-color: #d8d2c6; }

.comic { margin: 0 auto; max-width: 100%; }
.comic svg { display: block; width: 100%; height: auto; margin: 0 auto; }
.comic[data-panels="1"] { max-width: 420px; }
.comic[data-panels="2"] { max-width: 760px; }
.comic .stack { display: none; }

details { margin: 10px auto; max-width: 680px; }
summary { cursor: pointer; font-size: 1.15rem; color: var(--muted); display: inline-block; }
summary:hover { color: var(--accent); }
details p { text-align: left; margin: 8px 0; }
details.alt p { text-align: center; font-style: italic; }

.meta { max-width: 680px; margin: 22px auto 0; padding-top: 14px; border-top: 1px dashed var(--rule); }
.meta p { margin: 6px 0; }
.hn { color: var(--muted); font-size: 0.92rem; }
.share { font-size: 0.92rem; color: var(--muted); word-break: break-all; }

.archive, .about, .empty { text-align: left; max-width: 680px; margin: 0 auto; }
.archive h1, .about h1 { font-size: 2.3rem; margin: 0 0 12px; }
.about h2 { font-size: 1.6rem; margin: 26px 0 6px; }
.archive ol { list-style: none; padding: 0; margin: 0; }
.archive li { padding: 7px 0; border-bottom: 1px dashed var(--rule); display: flex; gap: 16px; }
.archive time { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.archive a { font-family: var(--hand); font-size: 1.25rem; line-height: 1.2; }
.cast li { margin: 4px 0; }
.empty { text-align: center; padding: 40px 0; }

footer.site { margin-top: 44px; padding-top: 12px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.85rem; text-align: center; }

@media (max-width: 700px) {
  body { padding: 0 12px 32px; font-size: 16px; }
  header.site { margin-bottom: 18px; }
  .site-nav { margin-left: 0; width: 100%; }
  .comic-title { font-size: 1.9rem; }
  .comic-nav { gap: 6px; font-size: 1.05rem; flex-wrap: nowrap; }
  .comic-nav a, .comic-nav > span { min-width: 0; padding: 2px 10px; }
  .comic-nav .w { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  /* 1–2 panels: keep the strip, scroll sideways when it gets too small to read. */
  .comic:not(.has-stack) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .comic[data-panels="2"]:not(.has-stack) svg { min-width: 560px; }
  /* 3–4 panels: stack the panels vertically; the full strip stays for screen readers. */
  .comic.has-stack .strip {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
  }
  .comic.has-stack .stack { display: block; max-width: 420px; margin: 0 auto; }
  .comic.has-stack .stack svg + svg { margin-top: 10px; }
}
