/* Daisy & Rosie — Bright Paw Comics
   One simple, mobile-first stylesheet. */

:root {
  --paper: #f3e8d0;
  --paper-deep: #e9dbbb;
  --ink: #1e1a16;
  --ink-soft: #4a4238;
  --red: #c8322a;
  --blue: #1f5fa8;
  --gold: #f2c230;
  --night: #15181f;
  --radius: 10px;
  --display: "Archivo Black", "Arial Black", Impact, sans-serif;
  --label: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Source Serif 4", Georgia, serif;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  /* subtle halftone dots, like old newsprint */
  background-image: radial-gradient(rgba(30, 26, 22, .07) 1px, transparent 1.2px);
  background-size: 6px 6px;
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--body);
}

img { display: block; max-width: 100%; height: auto; }
a { color: var(--blue); }

/* ---------- Masthead ---------- */
.masthead {
  text-align: center;
  padding: 2rem 1.25rem 1.5rem;
  max-width: 52rem;
  margin: 0 auto;
}
.masthead__crest { width: 120px; margin: 0 auto .75rem; }
.masthead__title { margin: 0; }
.masthead__title img { width: min(100%, 640px); margin: 0 auto; }
.masthead__lede {
  margin: 1.25rem auto 0;
  max-width: 36rem;
  font-size: 1.125rem;
  color: var(--ink-soft);
}

.toc {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem;
  margin-top: 1.5rem;
}
.toc a {
  font: 700 .95rem/1 var(--label);
  text-transform: uppercase;
  letter-spacing: .06em;
  text-decoration: none;
  color: var(--ink);
  background: #fff8e8;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: .55rem .9rem;
  box-shadow: 2px 2px 0 var(--ink);
}
.toc a:hover, .toc a:focus-visible { background: var(--gold); }

/* ---------- Section headings ---------- */
.section-title {
  font: 400 clamp(1.75rem, 6vw, 2.6rem)/1.05 var(--display);
  text-transform: uppercase;
  margin: 0;
  color: var(--red);
  text-shadow: 2px 2px 0 var(--ink);
  -webkit-text-stroke: 1px var(--ink);
}

/* ---------- Cast ---------- */
.cast {
  max-width: 68rem;
  margin: 1rem auto 0;
  padding: 2rem 1.25rem;
  text-align: center;
}
.cast__grid {
  display: grid;
  gap: 1.25rem;
  margin-top: 1.5rem;
}
.hero {
  background: #fffaf0;
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 5px 5px 0 var(--ink);
  padding: 1.25rem;
}
.hero img { height: 190px; width: auto; margin: 0 auto .75rem; }
.hero h3 { font: 400 1.5rem/1.1 var(--display); margin: 0 0 .5rem; }
.hero h3 span {
  display: block;
  font: 700 1rem/1.3 var(--label);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-top: .25rem;
}
.hero p { margin: 0; color: var(--ink-soft); }
.hero--daisy h3 span { color: var(--red); }
.hero--rosie h3 span { color: var(--blue); }
.hero--villain h3 span { color: var(--ink-soft); }

@media (min-width: 720px) {
  .cast__grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Story arcs ---------- */
.arc {
  max-width: 68rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem;
}
.arc__header {
  text-align: center;
  max-width: 38rem;
  margin: 0 auto 2rem;
  padding-top: 2rem;
  border-top: 3px double rgba(30, 26, 22, .35);
}
.arc__header > p:last-child { color: var(--ink-soft); margin: .75rem 0 0; }
.arc__range {
  font: 700 .95rem/1 var(--label);
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--blue);
  margin: 0 0 .5rem;
}

/* Black Feather gets a moody night panel */
.arc--dark {
  max-width: none;
  background: var(--night);
  color: #efe6d2;
}
.arc--dark > * { max-width: 68rem; margin-left: auto; margin-right: auto; }
.arc--dark .arc__header { border-top: 0; padding-top: 0; }
.arc--dark .arc__header > p:last-child,
.arc--dark .issue__text p { color: #d8cdb6; }
.arc--dark .arc__range { color: var(--gold); }
.arc--dark .issue { background: #1f232c; border-color: #000; box-shadow: 5px 5px 0 #000; }
.arc--dark .issue__tagline { color: var(--gold) !important; }
.arc--dark .issue__setting { border-color: rgba(255,255,255,.2); }

/* ---------- Issue ---------- */
.issue {
  display: grid;
  background: #fffaf0;
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 5px 5px 0 var(--ink);
  overflow: hidden;
  scroll-margin-top: 1rem;
}
.issue + .issue { margin-top: 1.75rem; }

/* The cover sits inset on the card like a printed comic on a table.
   .plate is the physical "sheet" that tilts; covers.js draws the shader canvas inside it. */
.issue__cover {
  display: block;
  margin: 14px 14px 0;
  perspective: 900px;
  -webkit-tap-highlight-color: transparent;
}
.plate {
  position: relative;
  display: block;
  border-radius: 4px;
  overflow: hidden;
  outline: 1px solid rgba(30, 26, 22, .55);
  box-shadow: 0 2px 4px rgba(30, 26, 22, .25), 0 8px 18px rgba(30, 26, 22, .18);
  transform: rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
  transform-style: preserve-3d;
  will-change: transform;
}
.plate img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.plate canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity .4s ease;
}
.plate.is-live canvas { opacity: 1; }

.issue__text { padding: 1.1rem 1.25rem 1.35rem; }
.issue__text p { margin: 0 0 .75rem; }

.issue__num {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  font: 700 1rem/1 var(--label);
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--red);
}
.issue h3 {
  font: 400 clamp(1.35rem, 4.5vw, 1.75rem)/1.1 var(--display);
  margin: 0 0 .5rem;
}
.issue__tagline {
  font-style: italic;
  color: var(--blue);
}
.issue__setting {
  font: 600 .95rem/1.3 var(--label);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-soft);
  border-top: 1px dashed rgba(30, 26, 22, .3);
  padding-top: .6rem;
  margin: 1rem 0 0 !important;
}
.issue__setting::before { content: "📍 "; }

.badge {
  font: 700 .75rem/1 var(--label);
  letter-spacing: .08em;
  padding: .3rem .5rem;
  border-radius: 4px;
  background: linear-gradient(135deg, #f7dc7a, #c99a1e 50%, #f7dc7a);
  color: var(--ink);
}
.badge--new { background: var(--red); color: #fff; }

/* Desktop: cover beside text, alternating sides */
@media (min-width: 900px) {
  .issue {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    align-items: center;
    gap: 1.75rem;
    padding: 18px;
  }
  .issue:nth-of-type(even) { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
  .issue:nth-of-type(even) .issue__cover { order: 2; }
  .issue__cover { margin: 0; }
  .issue__text { padding: .5rem .25rem; }
}

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 3rem 1.25rem 4rem;
  color: var(--ink-soft);
  border-top: 3px double rgba(30, 26, 22, .35);
  max-width: 68rem;
  margin: 0 auto;
}
.footer img { width: 96px; margin: 0 auto .75rem; }
.footer p { margin: .25rem 0; }

/* ---------- Lightbox ---------- */
.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  /* pin to the viewport edges (100vw would include the scrollbar width on Windows)
     and clip, so a tilted cover can never create scrollbars */
  position: fixed;
  inset: 0;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  overflow: hidden;
}
/* keep the page behind the viewer from scrolling */
html:has(.lightbox[open]) { overflow: hidden; }
.lightbox[open] {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .75rem;
}
.lightbox::backdrop { background: rgba(10, 10, 14, .92); }
.lightbox .plate {
  width: min(92vw, calc(80vh * 16 / 9));   /* headroom so the corners stay visible at full tilt */
  border-radius: 6px;
  outline: 0;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .6);
  touch-action: none;            /* drag a finger to tilt */
}
.lightbox__stage { perspective: 1200px; }
.lightbox p {
  color: #efe6d2;
  font: 700 1.1rem/1.2 var(--label);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 0;
  padding: 0 1rem;
  text-align: center;
}
.lightbox form { position: absolute; top: .5rem; right: .5rem; margin: 0; }
.lightbox__close {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}
.lightbox__close:hover { background: rgba(255, 255, 255, .25); }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
