/*
Theme Name: Comic PDF Reader
Theme URI: https://example.com/comic-pdf-reader
Author: ChatGPT
Description: A comic-book themed WordPress theme with a dedicated PDF comic reader custom post type and PDF.js-powered single page viewer.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 7.4
License: GPLv2 or later
Text Domain: comic-pdf-reader
*/

:root {
  --ink: #111;
  --paper: #fff8dc;
  --yellow: #ffd23f;
  --red: #e63946;
  --blue: #1d70b8;
  --cyan: #8ecae6;
  --panel: #ffffff;
  --shadow: rgba(0,0,0,.22);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(0,0,0,.20) 1px, transparent 0),
    linear-gradient(135deg, rgba(255,210,63,.45), rgba(142,202,230,.35));
  background-size: 12px 12px, cover;
}

a { color: #004aad; font-weight: 800; }
a:hover { color: var(--red); }

.site-header {
  border-bottom: 6px solid var(--ink);
  background: linear-gradient(120deg, var(--yellow), #ff8f00 55%, var(--red));
  padding: 1.25rem 1rem;
  box-shadow: 0 8px 0 rgba(0,0,0,.13);
}
.site-header-inner,
.site-main,
.site-footer-inner {
  max-width: 1180px;
  margin: 0 auto;
}
.site-title {
  display: inline-block;
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: .9;
  text-transform: uppercase;
  letter-spacing: -0.04em;
  color: #fff;
  text-shadow: 4px 4px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink);
  transform: rotate(-2deg);
}
.site-description {
  display: inline-block;
  margin: .75rem 0 0;
  padding: .35rem .7rem;
  background: #fff;
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  font-weight: 900;
}
.nav-menu { margin-top: 1rem; }
.nav-menu ul { list-style: none; display: flex; flex-wrap: wrap; gap: .75rem; padding: 0; margin: 0; }
.nav-menu a {
  display: block;
  padding: .5rem .8rem;
  background: #fff;
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  text-decoration: none;
  text-transform: uppercase;
}
.site-main { padding: 2rem 1rem 3rem; }
.comic-panel, .post-card, .comic-card {
  background: var(--panel);
  border: 5px solid var(--ink);
  box-shadow: 8px 8px 0 var(--shadow);
  padding: 1rem;
  position: relative;
}
.comic-panel::before,
.post-card::before,
.comic-card::before {
  content: "";
  position: absolute;
  inset: 8px;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(0,0,0,.08) 1px, transparent 1px);
  background-size: 6px 6px;
  opacity: .45;
}
.entry-title, .page-title {
  position: relative;
  margin-top: 0;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: -0.03em;
}
.entry-content { position: relative; font-size: 1.1rem; line-height: 1.65; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}
.comic-card { min-height: 260px; display: flex; flex-direction: column; justify-content: space-between; }
.comic-cover {
  aspect-ratio: 3 / 4;
  border: 4px solid var(--ink);
  background: linear-gradient(135deg, #fff, var(--cyan));
  overflow: hidden;
  margin-bottom: .75rem;
}
.comic-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.button, button, input[type="submit"] {
  display: inline-block;
  background: var(--red);
  color: #fff !important;
  border: 4px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  padding: .65rem 1rem;
  text-transform: uppercase;
  text-decoration: none;
  font-weight: 950;
  cursor: pointer;
}
.button:hover, button:hover, input[type="submit"]:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }

.reader-shell {
  background: #111;
  color: #fff;
  border: 6px solid #000;
  box-shadow: 10px 10px 0 rgba(0,0,0,.3);
  min-height: 80vh;
}
.reader-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  padding: .75rem;
  background: linear-gradient(90deg, #f9c80e, #f86624, #ea3546);
  border-bottom: 5px solid #000;
}
.reader-toolbar .reader-title { margin-right: auto; color: #fff; text-shadow: 2px 2px 0 #000; font-weight: 950; text-transform: uppercase; }
.reader-toolbar button { padding: .45rem .75rem; background: #fff; color: #000 !important; }
#comic-pdf-canvas-wrap { text-align: center; padding: 1rem; overflow: auto; }
#comic-pdf-canvas {
  max-width: 100%;
  height: auto;
  background: #fff;
  box-shadow: 0 0 30px rgba(255,255,255,.16);
}
.reader-status { padding: 1rem; text-align: center; color: #fff; }
.reader-page-count { color: #000; font-weight: 950; background:#fff; border:3px solid #000; padding:.35rem .65rem; }
.site-footer { padding: 2rem 1rem; background: #111; color: #fff; border-top: 6px solid #000; }
.site-footer a { color: var(--yellow); }

.admin-note {
  padding: 1rem;
  background: #fff3cd;
  border: 4px solid #111;
  box-shadow: 4px 4px 0 #111;
}

@media (max-width: 760px) {
  .reader-toolbar { position: relative; }
  .reader-toolbar .reader-title { flex-basis: 100%; }
}
