:root {
  --bg:            #1a1a1a;
  --bg-alt:        #141414;
  --surface:       #242424;
  --surface-raise: #2c2c2c;
  --border:        #333333;
  --text:          #e2e2e2;
  --text-muted:    #888888;
  --text-subtle:   #555555;
  --accent:        #6b9bd2;
  --tag-bg:        #1a3a5c;
  --tag-text:      #7ab3e8;
  --tag-pill-bg:   #1e2e3d;
  --tag-pill-text: #6699bb;
  --radius:        8px;
  --radius-sm:     4px;
  --shadow:        0 4px 24px rgba(0, 0, 0, 0.45);
  --trans:         0.2s ease;
  --max-width:     1100px;
  --font:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Container ─────────────────────────────────────── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Header ────────────────────────────────────────── */
.site-header {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.site-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.site-tagline {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.site-nav {
  display: flex;
  gap: 24px;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color var(--trans);
}

.site-nav a:hover,
.site-nav a:focus-visible { color: var(--text); outline: none; }

/* ── Hero ──────────────────────────────────────────── */
.hero {
  padding: 48px 0 36px;
  border-bottom: 1px solid var(--border);
}

.hero-text {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 560px;
  line-height: 1.55;
}

/* ── Comics Section ────────────────────────────────── */
.comics-section {
  padding: 56px 0 72px;
}

.comics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
}

/* ── Comic Card ────────────────────────────────────── */
.comic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--trans), box-shadow var(--trans), transform var(--trans);
}

.comic-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.comic-image-wrap {
  position: relative;
  cursor: zoom-in;
  background: var(--bg-alt);
  overflow: hidden;
}

.comic-image-wrap img {
  width: 100%;
  height: auto;
  display: block;
  transition: opacity var(--trans);
}

.comic-image-wrap:hover img { opacity: 0.9; }

.zoom-hint {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.65);
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 100px;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--trans);
}

.comic-image-wrap:hover .zoom-hint { opacity: 1; }

.comic-meta {
  padding: 20px 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

/* ── Topic tag (primary label) ─────────────────────── */
.topic-tag {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 100px;
  width: fit-content;
}

.comic-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-top: 2px;
}

.comic-date {
  font-size: 12px;
  color: var(--text-subtle);
  display: block;
}

.comic-description {
  font-size: 13px;
  color: var(--text-subtle);
  line-height: 1.55;
  margin-top: 2px;
}

/* ── Behind the Deviation (lightbox only, collapsible) */
.btd-details {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 4px;
}

.btd-summary {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-subtle);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btd-summary::-webkit-details-marker { display: none; }

.btd-summary::before {
  content: '+';
  color: var(--accent);
  font-size: 15px;
  font-weight: 300;
  line-height: 1;
}

.btd-details[open] .btd-summary::before { content: '−'; }

.btd-text {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.75;
  padding-top: 12px;
}

/* ── Tag pills ─────────────────────────────────────── */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 14px;
}

.tag-pill {
  background: var(--tag-pill-bg);
  color: var(--tag-pill-text);
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 100px;
  opacity: 0.75;
}

/* ── Loading state ─────────────────────────────────── */
.loading {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-subtle);
  padding: 80px 0;
  font-size: 14px;
}

/* ── About Section ─────────────────────────────────── */
.about-section {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 64px 0;
}

.about-inner { max-width: 640px; }

.about-inner h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
}

.about-inner p {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.75;
  margin-bottom: 12px;
}

.about-inner p:last-child { margin-bottom: 0; }

/* ── Footer ────────────────────────────────────────── */
.site-footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding: 24px 0;
}

.site-footer p {
  font-size: 13px;
  color: var(--text-subtle);
}

.footer-contact { margin-top: 4px; }

.footer-contact a {
  color: var(--text-subtle);
  text-decoration: none;
  transition: color var(--trans);
}

.footer-contact a:hover { color: var(--accent); }

.footer-disclaimer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-subtle);
  line-height: 1.6;
}

/* ── Lightbox ──────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 3vw 32px;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.lightbox.is-open {
  opacity: 1;
  pointer-events: all;
}

.lightbox-close {
  position: fixed;
  top: 14px;
  right: 18px;
  background: var(--surface-raise);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--trans), border-color var(--trans);
  z-index: 201;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  background: var(--border);
  border-color: var(--accent);
  outline: none;
}

.lightbox-inner {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 28px;
  max-width: min(94vw, 1440px);
  width: 100%;
  align-items: start;
  margin: auto;
}

.lightbox-image-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

#lightbox-img {
  width: auto;
  height: auto;
  max-width: min(100%, 90vw);
  max-height: 88vh;
  object-fit: contain;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.open-tab-link {
  display: inline-block;
  font-size: 12px;
  color: var(--text-subtle);
  text-decoration: none;
  transition: color var(--trans);
}

.open-tab-link:hover,
.open-tab-link:focus-visible { color: var(--accent); }

.lightbox-meta {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 40px;
}

.lightbox-meta h2 {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.3;
}

.lightbox-description {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.lightbox-meta .tag-list { padding-top: 4px; }

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 900px) {
  .lightbox-inner {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .lightbox-meta { position: static; }
  .lightbox { padding: 56px 16px 32px; }
}

@media (max-width: 640px) {
  .comics-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .header-inner { height: 56px; }
  .site-tagline { display: none; }
  .site-nav { display: none; }

  .hero { padding: 28px 0 24px; }
  .hero-text { font-size: 16px; }

  .comics-section { padding: 36px 0 56px; }
  .comic-meta { padding: 16px 18px 22px; }
  .comic-title { font-size: 18px; }
}

/* ── Focus visible ─────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
