:root {
  --tile: #1d2a38;
  --tile-dark: #24364a;
  --page: #ffffff;
  --panel: #ffffff;
  --panel-alt: #f3f3f3;
  --ink: #1f1f1f;
  --muted: #5a5a5a;
  --red: #b3261e;
  --red-deep: #6f1512;
  --link: #c0261d;
  --visited: #8d1c18;
  --brick: #d63a2b;
  --border: #777777;
  --bevel-light: #ffffff;
  --bevel-dark: #adadad;
  /* The greys the chrome is built from: controls, frames and hairlines. Named
     here so every button and border pulls from the same few values. */
  --surface: #e8e8e8;
  --surface-hover: #f3f3f3;
  --chrome: #ededed;
  --frame: #9a9a9a;
  --hairline: #999999;
  --hairline-soft: #dddddd;
  --dashed: #adadad;
  --panel-line: #1f1f1f;
  --thumb-bg: #dddddd;
  --thumb-border: #4f4f4f;
}

* { box-sizing: border-box; }

html { background: var(--tile); }

body {
  margin: 0;
  padding: 16px 10px 28px;
  color: var(--ink);
  font: 13px/1.5 Verdana, Geneva, Arial, sans-serif;
  background-color: var(--tile);
  background-image:
    linear-gradient(45deg, var(--tile-dark) 25%, transparent 25%, transparent 75%, var(--tile-dark) 75%),
    linear-gradient(45deg, var(--tile-dark) 25%, transparent 25%, transparent 75%, var(--tile-dark) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 6px 6px;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--link); }
a:visited { color: var(--visited); }
a:hover { color: var(--brick); }

h1, h2, h3 {
  font-family: "Times New Roman", Times, serif;
  font-weight: bold;
}

.page {
  max-width: 900px;
  margin: 0 auto;
  background: var(--page);
  border: 3px ridge var(--frame);
}

.banner {
  padding: 30px 16px 24px;
  text-align: center;
  color: #f7f3f2;
  background: linear-gradient(180deg, #b22a22 0%, #94201b 55%, #741714 100%);
  border-bottom: 3px double var(--red-deep);
}

.banner h1 {
  margin: 0;
  font-size: clamp(1.9rem, 6vw, 2.7rem);
  letter-spacing: 0.02em;
  text-shadow: 2px 2px 0 #4a0f0d;
}

.banner-sub {
  margin: 6px 0 0;
  font: italic 14px Georgia, "Times New Roman", serif;
  color: #f0d8d4;
}

.navbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 10px;
  font-size: 11px;
  background: var(--chrome);
  border-bottom: 1px solid var(--hairline);
}

.navbar .sep { color: var(--hairline); }

.layout {
  display: grid;
  grid-template-columns: 195px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
}

.box {
  padding: 9px 10px 10px;
  background: var(--panel-alt);
  border: 2px groove var(--bevel-dark);
}

.box h2 {
  margin: 0 0 8px;
  padding-bottom: 4px;
  font-size: 14px;
  border-bottom: 1px solid var(--hairline-soft);
}

.navlist {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
}

.navlist li { padding: 2px 0; }

.site-info p {
  margin: 0 0 7px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
}

.site-info p:last-child { margin-bottom: 0; }

.panel {
  padding: 12px 14px 14px;
  background: var(--panel);
  border: 2px groove var(--bevel-dark);
}

.panel + .panel { margin-top: 14px; }

.panel-title {
  margin: 0 0 10px;
  padding-bottom: 5px;
  font-size: 18px;
  border-bottom: 2px solid var(--red);
}

.intro {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
}

.comic-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.comic {
  display: flex;
  gap: 9px;
  padding: 8px;
  color: var(--ink);
  text-decoration: none;
  background: var(--panel-alt);
  border: 1px solid var(--border);
}

.comic:visited { color: var(--ink); }

.comic:hover {
  color: var(--ink);
  background: var(--panel);
  border-color: var(--red);
}

.thumb {
  position: relative;
  flex: 0 0 104px;
  width: 104px;
  height: 78px;
  background: var(--thumb-bg);
  border: 1px solid var(--thumb-border);
}

.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.9);
}

.thumb-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font: 30px "Times New Roman", serif;
  color: var(--muted);
  background: var(--thumb-bg);
}

.thumb img.is-missing { display: none; }
.thumb img.is-missing + .thumb-fallback { display: flex; }

.comic-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.comic-name {
  font-family: "Times New Roman", Times, serif;
  font-size: 16px;
  font-weight: bold;
  line-height: 1.2;
}

.comic-tag {
  margin-top: 2px;
  font-size: 9px;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--brick);
}

.comic-link {
  margin-top: auto;
  padding-top: 5px;
  font-size: 11px;
  color: var(--link);
  text-decoration: underline;
}

.comic:hover .comic-link { color: var(--brick); }

.comic-meta {
  margin-top: 3px;
  font-size: 10px;
  line-height: 1.45;
  color: var(--muted);
}

.comic-note {
  margin: 12px 0 0;
  padding-top: 8px;
  font-size: 10px;
  line-height: 1.5;
  color: var(--muted);
  border-top: 1px dotted var(--hairline-soft);
}

.news {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 11px;
}

.news li {
  padding: 4px 0;
  border-bottom: 1px dotted var(--hairline-soft);
}

.news li:last-child { border-bottom: 0; }

.news-date {
  display: block;
  font-size: 9px;
  font-weight: bold;
  color: var(--brick);
}

.news-text {
  display: block;
  line-height: 1.45;
  color: var(--muted);
}

.credits {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}

.credits dt {
  margin-top: 8px;
  font-weight: bold;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--red-deep);
}

.credits dt:first-child { margin-top: 0; }

.credits dd {
  margin: 2px 0 0;
  padding-left: 10px;
  border-left: 2px solid var(--hairline-soft);
  color: var(--muted);
}

.site-footer {
  padding: 12px 16px 16px;
  text-align: center;
  font-size: 11px;
  background: var(--panel-alt);
  border-top: 1px solid var(--hairline);
}

.site-footer .sep {
  margin: 0 6px;
  color: var(--hairline);
}

.fineprint {
  margin: 8px 0 0;
  font-size: 9px;
  color: var(--muted);
}

.links {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
}

.links li {
  padding: 4px 0;
  border-bottom: 1px dotted var(--hairline-soft);
}

.links li:last-child { border-bottom: 0; }

section.panel:focus { outline: none; }

section.panel:focus-visible {
  outline: 2px dotted var(--brick);
  outline-offset: 2px;
}

a:focus-visible {
  outline: 2px dotted var(--brick);
  outline-offset: 2px;
}

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

@media (max-width: 720px) {
  body { padding: 8px 6px 52px; }
  .layout { grid-template-columns: 1fr; padding: 10px; }
  .sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .banner { padding: 24px 12px 20px; }
}

@media (max-width: 560px) {
  .sidebar { grid-template-columns: 1fr; }
  .comic-list { grid-template-columns: 1fr; }
  .navbar { font-size: 10px; gap: 5px; }
}

/* The mode switch floats in the corner so it stays reachable while scrolling
   and never pushes the layout around. */
.theme-toggle {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 30;
  padding: 4px 12px;
  font: bold 11px Verdana, Geneva, Arial, sans-serif;
  color: var(--ink);
  background: var(--surface);
  border: 2px outset var(--bevel-light);
  box-shadow: 0 0 0 1px var(--hairline);
  cursor: pointer;
}

.theme-toggle:hover { color: var(--brick); background: var(--surface-hover); }
.theme-toggle:active { border-style: inset; }

/* Dark mode: the same layout with the palette flipped to a warm near-black, so
   the red banner and the ink stay comfortable to read at night. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --tile: #14120f;
  --tile-dark: #1a1714;
  --page: #1e1b18;
  --panel: #1e1b18;
  --panel-alt: #262220;
  --ink: #eae5dd;
  --muted: #a9a29a;
  --red: #ff7f6e;
  --red-deep: #ffa79b;
  --link: #ff8d7d;
  --visited: #d8948a;
  --brick: #ea5b4a;
  --border: #4a453f;
  --bevel-light: #45403a;
  --bevel-dark: #100e0c;
  --surface: #2a2622;
  --surface-hover: #34302b;
  --chrome: #221f1b;
  --frame: #3a352f;
  --hairline: #393430;
  --hairline-soft: #2c2823;
  --dashed: #3d3833;
  --panel-line: #6b645c;
  --thumb-bg: #262220;
  --thumb-border: #4a453f;
}

:root[data-theme="dark"] .banner {
  background: linear-gradient(180deg, #8f2219 0%, #741a14 55%, #52100c 100%);
  border-bottom-color: #3d0b08;
}

/* A card lifts towards white in light mode; at night it lifts the other way. */
:root[data-theme="dark"] .comic:hover { background: #2b2622; }

@media (max-width: 720px) {
  .theme-toggle { right: 6px; bottom: 6px; padding: 2px 8px; font-size: 10px; }
}
