:root {
  color-scheme: light;
  --page: #ffffff;
  --paper: #ffffff;
  --ink: #171717;
  --muted: #66615a;
  --line: #d8d2c8;
  --accent: #b3222a;
  --accent-2: #145c64;
  --shadow: 0 18px 60px rgba(23, 23, 23, 0.08);
  --max: 920px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  letter-spacing: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: var(--footer-space, 7.5rem);
}

body.no-scroll {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

button,
input {
  font: inherit;
}

.skip-link {
  background: var(--ink);
  color: var(--paper);
  left: 1rem;
  padding: 0.6rem 0.8rem;
  position: fixed;
  top: 1rem;
  transform: translateY(-140%);
  z-index: 10;
}

.skip-link:focus {
  transform: translateY(0);
}

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

.site-header {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.65rem 1rem 0.45rem;
}

.logo-link {
  display: inline-flex;
}

.site-logo {
  display: block;
  height: auto;
  max-width: min(430px, 86vw);
  user-select: none;
  width: min(430px, 86vw);
}

.site-nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.76rem;
  gap: 0.75rem;
  justify-content: center;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a[aria-current="page"],
.site-nav a:hover {
  color: var(--ink);
}

.page-shell {
  margin: 0 auto;
  max-width: var(--max);
  padding: 0 clamp(1rem, 5vw, 2rem) 4rem;
}

.intro {
  border-bottom: 1px solid var(--line);
  margin: 0 auto 1.1rem;
  padding: 0.5rem 0 0.65rem;
  text-align: center;
}

.kicker,
.counter-row,
.share-strip,
.comic-meta,
.comic-actions,
.site-footer,
.about-actions {
  font-family: Arial, Helvetica, sans-serif;
}

.kicker {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 auto;
  max-width: 580px;
}

h1 {
  font-size: clamp(2.2rem, 7vw, 4.8rem);
  font-weight: 400;
  line-height: 0.95;
  margin: 0;
}

.counter-row {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.82rem;
  gap: 0.8rem;
  justify-content: center;
  margin-top: 0.65rem;
  text-transform: uppercase;
}

.counter-row span + span::before {
  color: var(--line);
  content: "/";
  margin-right: 0.8rem;
}

.share-strip {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  font-size: 0.85rem;
  gap: 0.45rem;
  justify-content: center;
  margin-top: 0.75rem;
}

.share-strip a,
.share-button,
.comic-action,
.primary-link {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  min-height: 2rem;
  padding: 0.42rem 0.68rem;
  text-decoration: none;
}

.share-strip a:hover,
.share-button:hover,
.comic-action:hover,
.primary-link:hover {
  border-color: var(--ink);
}

.comic-feed {
  display: grid;
  gap: 3rem;
}

.comic-card {
  display: grid;
  gap: 0.65rem;
}

.comic-heading {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  justify-content: space-between;
}

.comic-card h2 {
  font-size: clamp(1.35rem, 3.2vw, 2rem);
  font-weight: 400;
  line-height: 1.08;
  margin: 0;
}

.comic-meta {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.comic-frame {
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: var(--shadow);
  padding: clamp(0.45rem, 2vw, 0.7rem);
}

.comic-image,
.zoom-image {
  background-color: var(--paper);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  display: block;
  user-select: none;
  -webkit-touch-callout: none;
}

.comic-image {
  aspect-ratio: 724 / 543;
  cursor: zoom-in;
  width: 100%;
}

.comic-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: space-between;
}

.comic-action {
  font-size: 0.84rem;
}

.comic-note {
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.8rem;
  margin: 0;
}

.feed-sentinel {
  height: 1px;
}

.zoom-dialog {
  background: rgba(247, 245, 240, 0.98);
  border: 0;
  height: 100%;
  margin: 0;
  max-height: none;
  max-width: none;
  padding: 0;
  width: 100%;
}

.zoom-dialog::backdrop {
  background: rgba(23, 23, 23, 0.32);
}

.zoom-toolbar {
  align-items: center;
  background: rgba(247, 245, 240, 0.94);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  min-height: 4rem;
  padding: 0.8rem;
  position: sticky;
  top: 0;
  z-index: 2;
}

.zoom-control,
.zoom-close {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  min-height: 2.3rem;
  min-width: 2.3rem;
  padding: 0.45rem 0.7rem;
}

[data-zoom-range] {
  accent-color: var(--accent);
  max-width: 38vw;
}

.zoom-stage {
  height: calc(100vh - 4rem);
  overflow: auto;
  padding: clamp(1rem, 4vw, 2.5rem);
}

.zoom-image {
  aspect-ratio: 724 / 543;
  margin: 0 auto;
  max-width: none;
  min-width: 320px;
  transform-origin: top center;
  width: min(980px, 92vw);
}

.about-page {
  max-width: 1040px;
}

.about-copy {
  border-top: 1px solid var(--line);
  display: grid;
  gap: clamp(1.5rem, 4vw, 3rem);
  grid-template-columns: minmax(260px, 0.95fr) minmax(300px, 1fr);
  align-items: start;
  padding-top: 2rem;
}

.about-portrait {
  margin: 0;
}

.about-portrait img {
  border: 1px solid var(--ink);
  box-shadow: var(--shadow);
  display: block;
  height: auto;
  width: 100%;
  user-select: none;
}

.about-copy h1 {
  font-size: clamp(2rem, 4vw, 3.35rem);
  margin-bottom: 1.2rem;
}

.about-copy p:not(.kicker) {
  color: #272421;
  font-size: clamp(1.08rem, 2vw, 1.24rem);
  line-height: 1.55;
}

.about-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.8rem;
}

.about-actions a {
  align-items: center;
  display: inline-flex;
  min-height: 2.5rem;
  padding: 0.62rem 0.9rem;
}

.site-footer {
  align-items: center;
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--line);
  bottom: 0;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.82rem;
  gap: 0.8rem;
  justify-content: center;
  left: 0;
  margin: 0;
  padding: 0.8rem clamp(1rem, 5vw, 2rem);
  position: fixed;
  right: 0;
  text-align: center;
  z-index: 7;
}

.site-footer p {
  margin: 0;
}

.footer-maddog {
  align-items: center;
  display: inline-flex;
  gap: 0.6rem;
  margin: 0;
}

.footer-maddog img {
  border-radius: 50%;
  height: 2.4rem;
  object-fit: cover;
  object-position: 50% 18%;
  user-select: none;
  width: 2.4rem;
}

.footer-share {
  margin: 0;
}

.site-footer > a {
  white-space: nowrap;
}

.maddog-toast {
  align-items: end;
  bottom: 1rem;
  display: flex;
  gap: 0.6rem;
  max-width: min(24rem, calc(100vw - 2rem));
  opacity: 0;
  pointer-events: none;
  position: fixed;
  right: 1rem;
  transform: translateY(0.75rem);
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 8;
}

.maddog-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.maddog-bubble {
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 0.8rem;
  box-shadow: var(--shadow);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.86rem;
  line-height: 1.2;
  max-width: 13rem;
  padding: 0.65rem 0.75rem;
  position: relative;
}

.maddog-bubble::after {
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
  border-right: 1px solid var(--ink);
  bottom: 0.75rem;
  content: "";
  height: 0.62rem;
  position: absolute;
  right: -0.36rem;
  transform: rotate(-45deg);
  width: 0.62rem;
}

.maddog-toast-image {
  border-radius: 50%;
  height: 4.4rem;
  object-fit: cover;
  object-position: 50% 18%;
  user-select: none;
  width: 4.4rem;
}

.new-comic-marker {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  display: inline-flex;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  min-height: 1.35rem;
  padding: 0.25rem 0.42rem;
  text-transform: uppercase;
  vertical-align: middle;
}

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

@media (max-width: 620px) {
  body {
    --footer-space: 8.5rem;
  }

  .site-header {
    padding-top: 0.55rem;
  }

  .intro {
    margin-bottom: 1rem;
    padding-top: 0.45rem;
  }

  .comic-heading,
  .comic-actions {
    display: grid;
  }

  .share-strip {
    flex-wrap: nowrap;
    gap: 0.4rem;
    justify-content: flex-start;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 0.15rem;
    scrollbar-width: none;
  }

  .share-strip a,
  .share-button {
    justify-content: center;
    min-width: auto;
    white-space: nowrap;
  }

  .share-strip::-webkit-scrollbar {
    display: none;
  }

  .site-footer {
    display: grid;
    gap: 0.55rem;
    grid-template-columns: auto 1fr;
    justify-items: start;
    padding: 0.65rem 0.9rem;
    text-align: left;
  }

  .site-footer p {
    align-self: center;
    font-size: 0.78rem;
    line-height: 1.25;
  }

  .footer-share {
    grid-column: 1 / -1;
    width: 100%;
  }

  .site-footer > a {
    grid-column: 1 / -1;
    justify-self: center;
  }

  .maddog-toast {
    bottom: 0.75rem;
    right: 0.75rem;
  }

  .maddog-toast-image {
    height: 3.6rem;
    width: 3.6rem;
  }

  .maddog-bubble {
    max-width: 11rem;
  }
}

@media (max-width: 820px) {
  .about-copy {
    grid-template-columns: 1fr;
  }

  .about-portrait {
    margin-inline: auto;
    max-width: 520px;
  }
}
