/* Joe the Voter - all site CSS lives here. Colors are variables so a re-skin is a few lines. */
:root {
  --bg: #ffffff;
  --text: #1c2230;
  --muted: #5b6577;
  --navy: #14284b;
  --navy-2: #1d3a6b;
  --red: #b3202a;
  --line: #d9deea;
  --card: #f4f6fb;
  --link: #1a4fa3;
  --max: 1100px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11151f; --text: #e6e9f1; --muted: #a2abbd; --card: #1a2030; --line: #2b3348; --link: #8fb4ff; --navy: #0b1730; --navy-2: #1a3160; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--link); }
img, video, iframe { max-width: 100%; height: auto; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 1.25rem 16px 2.5rem; }
.center { text-align: center; }
.muted { color: var(--muted); font-size: .9em; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--red); color: #fff; padding: .6rem 1rem; z-index: 200; }
.skip-link:focus { left: 0; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

h1 { font-size: 2rem; line-height: 1.2; margin: .3rem 0 .6rem; color: var(--navy); }
@media (prefers-color-scheme: dark) { h1 { color: #fff; } }
h2 { font-size: 1.45rem; margin: 2rem 0 .6rem; border-bottom: 2px solid var(--line); padding-bottom: .25rem; }
h3 { font-size: 1.15rem; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }
.lead.center { margin-left: auto; margin-right: auto; }

/* ---- header + sticky nav ---- */
.site-header { background: var(--navy); text-align: center; }
.banner { display: block; max-width: 1200px; margin: 0 auto; line-height: 0; }
.banner img { width: 100%; height: auto; display: block; }
.banner-text { display: block; line-height: 1.3; color: #fff; font-size: 2.2rem; font-weight: 700; padding: 1.4rem 1rem; }
.banner-text small { display: block; font-size: 1rem; font-weight: 400; opacity: .8; }

.site-nav { position: sticky; top: 0; z-index: 100; background: var(--navy-2); border-bottom: 3px solid var(--red); }
.nav-toggle { display: none; width: 100%; padding: .8rem 1rem; background: none; border: 0; color: #fff; font: inherit; font-weight: 700; text-align: left; cursor: pointer; }
.menu { list-style: none; margin: 0 auto; padding: 0; max-width: var(--max); display: flex; flex-wrap: wrap; justify-content: center; }
.menu > li { position: relative; }
.menu a, .menu .sub-toggle { display: block; color: #fff; text-decoration: none; padding: .7rem .85rem; font: inherit; font-size: .97rem; background: none; border: 0; cursor: pointer; text-align: left; }
.menu > li > a:hover, .menu .sub-toggle:hover, .menu li.current > a, .menu li.current > .sub-toggle { background: rgba(255, 255, 255, .14); }
.menu .sub-link { display: inline-block; padding-right: .2rem; }
.menu .sub-toggle:not(.sub-label) { display: inline-block; padding-left: .2rem; padding-right: .7rem; }
.has-sub > .sub { display: none; list-style: none; margin: 0; padding: .3rem 0; position: absolute; left: 0; top: 100%; min-width: 230px; background: var(--navy); border: 1px solid rgba(255, 255, 255, .2); box-shadow: 0 8px 20px rgba(0, 0, 0, .35); z-index: 110; }
.has-sub > .sub a { padding: .5rem 1rem; white-space: nowrap; }
.has-sub > .sub a:hover { background: var(--red); }
.has-sub.open > .sub { display: block; }
@media (hover: hover) and (min-width: 801px) { .has-sub:hover > .sub, .has-sub:focus-within > .sub { display: block; } }
.menu li:last-child > .sub, .menu li:nth-last-child(2) > .sub { left: auto; right: 0; }

@media (max-width: 800px) {
  .nav-toggle { display: block; }
  .menu { display: none; flex-direction: column; }
  .menu.open { display: flex; }
  .menu > li { border-top: 1px solid rgba(255, 255, 255, .12); }
  .has-sub > .sub { position: static; box-shadow: none; border: 0; background: rgba(0, 0, 0, .18); }
  .has-sub > .sub a { white-space: normal; padding-left: 1.6rem; }
  .menu .sub-link { display: inline-block; width: calc(100% - 3rem); }
  .menu .sub-toggle:not(.sub-label) { width: 2.6rem; text-align: center; padding: .7rem 0; }
  .menu .sub-label { width: 100%; }
}

/* ---- content ---- */
.crumbs { font-size: .9rem; color: var(--muted); margin: 0; }
.meta { color: var(--muted); font-size: .9rem; margin: 0 0 1rem; }
.content .body { overflow-wrap: anywhere; }
.content .body table { max-width: 100%; }
.content .body img { height: auto; }
.content .body iframe { border: 0; }
.more { margin-top: 2.5rem; padding: 1rem 1.25rem; background: var(--card); border-radius: 8px; }
.more h2 { margin-top: 0; font-size: 1.15rem; border: 0; }
.more ul, .link-list { margin: 0; padding-left: 1.2rem; }
.link-list li { margin: .3rem 0; }
.news { margin-bottom: 1.5rem; }
.news h2 { color: var(--red); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.card { display: block; padding: 1rem 1.1rem; background: var(--card); border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--text); }
.card:hover { border-color: var(--red); }
.card strong { display: block; color: var(--navy); }
@media (prefers-color-scheme: dark) { .card strong { color: #fff; } }
.card span { display: block; margin-top: .25rem; font-size: .92rem; color: var(--muted); }

.button, button.btn, .search-form button, .footer-search button, .gal-search button { display: inline-block; padding: .55rem 1.1rem; background: var(--red); color: #fff; border: 0; border-radius: 5px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.button:hover, button.btn:hover { background: #8f1820; }
.notice { padding: .7rem 1rem; background: var(--card); border-left: 4px solid var(--red); font-size: .95rem; }
.featured-author { display: flex; gap: 1.2rem; align-items: center; padding: 1rem 1.25rem; margin: 1.2rem 0; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.featured-author h2 { margin: 0 0 .3rem; border: 0; font-size: 1.2rem; }
.featured-author p { margin: .3rem 0; }

/* ---- books ---- */
.books { list-style: none; padding: 0; margin: 1rem 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1.2rem; }
.books li a { display: block; text-decoration: none; color: var(--text); text-align: center; }
.books img { width: 100%; max-width: 160px; height: 220px; object-fit: contain; background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 4px; }
.books li a:hover img { border-color: var(--red); }
.books span { display: block; font-size: .82rem; line-height: 1.3; margin-top: .35rem; color: var(--muted); }

/* ---- gallery ---- */
.gal-controls { display: flex; flex-wrap: wrap; gap: .8rem 1.5rem; align-items: center; justify-content: space-between; margin: 1rem 0; }
.albums { display: flex; flex-wrap: wrap; gap: .4rem; }
.albums a, .sorts a { padding: .25rem .7rem; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; font-size: .92rem; }
.albums a[aria-current], .sorts a[aria-current] { background: var(--navy-2); color: #fff; border-color: var(--navy-2); }
.gal-search { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .8rem; margin: 1rem 0; }
.gallery-strip { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.toon { display: block; aspect-ratio: 4 / 3; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--card); }
.toon img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.toon:hover img, .toon:focus img { transform: scale(1.04); }
.pager { display: flex; gap: 1.5rem; justify-content: center; align-items: center; margin: 1.5rem 0; }

.lb { position: fixed; inset: 0; z-index: 300; background: rgba(0, 0, 0, .92); display: flex; align-items: center; justify-content: center; }
.lb[hidden] { display: none; }
.lb figure { margin: 0; max-width: 94vw; text-align: center; }
.lb img { max-width: 94vw; max-height: 80vh; display: block; margin: 0 auto; }
.lb figcaption { color: #eee; margin-top: .6rem; font-size: .95rem; }
.lb figcaption a { color: #9bc1ff; margin-left: .8rem; }
.lb button { position: absolute; background: rgba(255, 255, 255, .15); color: #fff; border: 0; font-size: 2rem; line-height: 1; width: 3rem; height: 3rem; border-radius: 50%; cursor: pointer; }
.lb button:hover { background: var(--red); }
.lb .lb-close { top: 1rem; right: 1rem; }
.lb .lb-prev { left: 1rem; top: 50%; }
.lb .lb-next { right: 1rem; top: 50%; }

/* ---- search + forms ---- */
.search-form, .footer-search { display: flex; gap: .5rem; flex-wrap: wrap; }
input[type="search"], .optin-form input, .optin-form textarea { padding: .55rem .7rem; font: inherit; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); color: var(--text); }
.results { list-style: none; padding: 0; }
.results li { margin: 1rem 0; }

#optin-form-section { max-width: 520px; }
.optin-form { display: flex; flex-direction: column; gap: .8rem; }
.optin-form .btn { align-self: flex-start; }
.note-text { margin: 1rem 0; padding: .85rem 1rem; border-radius: 6px; font-weight: 600; }
.note-success { background: #eaf6fb; border: 1px solid #bfe3ee; color: #146a8a; }
.note-error { background: #fdecea; border: 1px solid #f5c2c0; color: #a52a20; }
.note-warn { background: #fff6dd; border: 1px solid #ecd58a; color: #7a5b00; }
.optin-honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.optin-captcha-img { display: block; border: 1px solid var(--line); border-radius: 4px; margin: .4rem 0; }

/* ---- footer ---- */
.site-footer { background: var(--navy); color: #dfe5f3; font-size: .93rem; border-top: 3px solid var(--red); }
.site-footer a { color: #fff; }
.footer-inner { max-width: var(--max); margin: 0 auto; padding: 1.4rem 16px; display: grid; grid-template-columns: 210px 1fr 200px; gap: 1.2rem; align-items: center; }
.footer-mid { text-align: center; }
.footer-mid p { margin: .35rem 0; }
.footer-search { justify-content: center; }
.footer-side { text-align: center; }
.footer-side .wg { max-width: 190px; margin-top: .6rem; }
.counter { display: inline-block; min-width: 60px; padding: 5px 12px; border: 1px solid rgba(255, 255, 255, .5); border-radius: 6px; text-align: center; font-variant-numeric: tabular-nums; }
.credits { font-size: .85rem; opacity: .85; }
@media (max-width: 800px) {
  .footer-inner { grid-template-columns: 1fr; text-align: center; }
  .featured-author { flex-direction: column; align-items: flex-start; }
  h1 { font-size: 1.6rem; }
}
