/* ================================
   Marvel Page — dedicated stylesheet
   Deliberately its own design language: comic-book panels, halftone
   texture, ink borders, Bangers lettering. Loaded only on marvel.html
   so nothing here leaks elsewhere, same approach as rosie.css.
   ================================ */

@import url('https://fonts.googleapis.com/css2?family=Bangers&family=Comic+Neue:wght@400;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --comic-ink: #0a0a0a;
  --comic-paper: #f2ede0;
  --comic-red: #ed1d24;
  --comic-red-dark: #a3080c;
  --comic-yellow: #ffe066;
}

/* Calm cream "paper" base instead of a single saturated color
   covering the whole page — easier on the eyes, and gives the
   colored panels below something neutral to sit on, the way an
   actual comic page has white gutters between colored panels. */
body {
  background-color: #f2ecdd;
  background-image: radial-gradient(circle, rgba(10, 10, 10, 0.07) 1px, transparent 1.4px);
  background-size: 14px 14px;
}

/* ---- Page-scoped nav/footer recolor ---- */
.site-nav {
  background: var(--comic-red-dark);
  border-bottom: 3px solid var(--comic-ink);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35);
}

.site-nav-logo {
  font-family: 'Bangers', cursive;
  font-size: 1.4rem;
  letter-spacing: 0.03em;
  color: var(--comic-paper);
  -webkit-text-stroke: 1px var(--comic-ink);
}

.site-nav-link {
  font-family: 'Bangers', cursive;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--comic-paper);
}

.site-nav-link:hover {
  color: #fff;
}

.site-nav-link.active {
  color: var(--comic-yellow);
  border-bottom-color: var(--comic-ink);
}

.theme-toggle {
  margin-left: auto;
  flex-shrink: 0;
  font-family: 'Bangers', cursive;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  color: var(--comic-ink);
  background: var(--comic-yellow);
  border: 2px solid var(--comic-ink);
  border-radius: 4px;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.theme-toggle:hover {
  background: #fff;
  transform: scale(1.05);
}

footer {
  background-color: var(--comic-ink);
  color: #999;
  border-top: 3px solid var(--comic-red);
}

/* ---- Hero banner ---- */
.page-hero {
  border-bottom: 4px solid var(--comic-ink);
}

.page-hero::after {
  background-image:
    radial-gradient(circle, rgba(0, 0, 0, 0.5) 1.5px, transparent 1.8px),
    linear-gradient(to top, rgba(0, 0, 0, 0.9) 5%, transparent 65%);
  background-size: 10px 10px, auto;
}

.page-hero .page-hero-title {
  font-family: 'Bangers', cursive;
  font-size: 3rem;
  letter-spacing: 0.04em;
  color: var(--comic-paper);
  -webkit-text-stroke: 2px var(--comic-ink);
  text-shadow: none;
  background: var(--comic-red);
  padding: 0.3rem 1.3rem 0.4rem;
  transform: rotate(-2deg);
  box-shadow: 6px 6px 0 var(--comic-ink);
}

/* ---- Row sections — each one its own colored comic panel,
   cycling through a small palette instead of one color everywhere,
   the way a real comic page mixes panel colors across a spread. ---- */
.mcu-row-section:nth-of-type(4n+1) { --panel-color: #6b3fa0; }
.mcu-row-section:nth-of-type(4n+2) { --panel-color: #0f766e; }
.mcu-row-section:nth-of-type(4n+3) { --panel-color: #b91c1c; }
.mcu-row-section:nth-of-type(4n)   { --panel-color: #c2540b; }

/* Three torn-corner silhouettes, cycled independently of the color
   above (3 shapes x 4 colors = 12 combinations before anything
   repeats). Corners are cut by a fixed pixel amount rather than a
   percentage, so the cut always lands inside the panel's own padding
   and never risks clipping a poster card near the edge, no matter
   how tall or short the row is. */
.mcu-row-section:nth-of-type(3n+1) {
  transform: rotate(-1.3deg);
  clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
  box-shadow: 7px 7px 0 var(--comic-ink);
}

.mcu-row-section:nth-of-type(3n+1):hover {
  transform: rotate(-1.3deg) translateY(-3px);
}

.mcu-row-section:nth-of-type(3n+2) {
  transform: rotate(1.1deg);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
  box-shadow: -7px 7px 0 var(--comic-ink);
}

.mcu-row-section:nth-of-type(3n+2):hover {
  transform: rotate(1.1deg) translateY(-3px);
}

.mcu-row-section:nth-of-type(3n) {
  transform: rotate(-0.6deg);
  clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 14px, 100% calc(100% - 14px), calc(100% - 14px) 100%, 14px 100%, 0 calc(100% - 14px), 0 14px);
  box-shadow: 8px 8px 0 var(--comic-ink);
}

.mcu-row-section:nth-of-type(3n):hover {
  transform: rotate(-0.6deg) translateY(-3px);
}

.mcu-row-section {
  margin: 0 auto 2.5rem;
  padding: 1.4rem 1.5rem 1.2rem;
  background-color: var(--panel-color);
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.16) 1px, transparent 1.6px);
  background-size: 12px 12px;
  border: 3px solid var(--comic-ink);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* ---- Row headings — torn banner, with a faint radiating burst
   behind it for depth ---- */
.mcu-row-heading {
  position: relative;
  display: inline-block;
  font-family: 'Bangers', cursive;
  font-size: 1.6rem;
  letter-spacing: 0.03em;
  color: var(--comic-ink);
  background: var(--comic-yellow);
  padding: 0.3rem 1.1rem;
  transform: rotate(-1deg);
  clip-path: polygon(0% 8%, 3% 0%, 97% 4%, 100% 15%, 98% 92%, 95% 100%, 2% 96%, 0% 85%);
  box-shadow: 4px 4px 0 var(--comic-ink);
}

.mcu-row-heading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 160px;
  height: 160px;
  transform: translate(-50%, -50%);
  background-image: repeating-conic-gradient(rgba(255, 255, 255, 0.35) 0deg 4deg, transparent 4deg 16deg);
  border-radius: 50%;
  opacity: 0.4;
  z-index: -1;
  pointer-events: none;
}

/* The base stylesheet's right-edge scroll fade hardcodes #000. It
   now fades into whichever panel color the row belongs to, via the
   inherited --panel-color custom property set above. Hidden by
   default; marvel.html adds .has-overflow only to rows that actually
   scroll, so short rows show no fade. */
.poster-row-wrap::after {
  background: linear-gradient(to right, transparent, var(--panel-color, #6b3fa0) 88%);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.poster-row-wrap.has-overflow::after {
  opacity: 0.85;
}

/* .poster-row sets overflow-x:auto in the base stylesheet, which
   forces the browser to also clip the y-axis (a CSS quirk: setting
   only one overflow axis makes the other compute to 'auto' too).
   The hover pop needs room to rise above the row and, for the first
   and last cards in a row, to grow sideways too — both need padding
   inside the scrollable box, since anything past the padding edge
   gets clipped by that same overflow-x. */
.poster-row {
  padding-top: 4rem;
  padding-left: 50px;
  padding-right: 50px;
}

/* ---- Poster cards — inked comic panels ---- */
.poster-card {
  border: 3px solid var(--comic-ink);
  outline: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0;
  background-color: #1a1a1a;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s ease;
}

.poster-card:nth-child(3n+1) {
  transform: rotate(-1.6deg);
}

.poster-card:nth-child(3n+2) {
  transform: rotate(1.2deg);
}

.poster-card:nth-child(3n) {
  transform: rotate(-0.4deg);
}

/* Keeping each card's own tilt on hover instead of snapping flat to
   0deg reads livelier — it looks like the card is leaning toward the
   viewer, not just growing in place. The brightness/saturation bump
   makes the art itself feel like it's lighting up, and the glow
   pulses gently while hovered rather than sitting static. */
.poster-card:nth-child(3n+1):hover {
  transform: scale(1.32) translateY(-16px) rotate(-3deg);
}

.poster-card:nth-child(3n+2):hover {
  transform: scale(1.32) translateY(-16px) rotate(2.5deg);
}

.poster-card:nth-child(3n):hover {
  transform: scale(1.32) translateY(-16px) rotate(-1.5deg);
}

.poster-card:hover {
  filter: brightness(1.1) saturate(1.25);
  animation: posterPopGlow 1.1s ease-in-out infinite;
}

@keyframes posterPopGlow {
  0%, 100% {
    box-shadow:
      0 0 0 4px var(--comic-yellow),
      0 0 0 7px var(--comic-ink),
      0 20px 32px rgba(0, 0, 0, 0.55);
  }
  50% {
    box-shadow:
      0 0 0 5px var(--comic-yellow),
      0 0 0 8px var(--comic-ink),
      0 24px 38px rgba(0, 0, 0, 0.6);
  }
}

/* Full-card dot overlay replaced with a caption strip that only
   covers the bottom of the poster, so the art stays fully visible.
   Solid ink background behind the title keeps it legible instead of
   fighting a busy poster image underneath. */
.poster-card::before {
  top: auto;
  left: 0;
  right: 0;
  bottom: 0;
  display: block;
  font-family: 'Bangers', cursive;
  font-size: 1rem;
  letter-spacing: 0.02em;
  color: var(--comic-yellow);
  padding: 0.5rem 60px 0.4rem 0.5rem;
  text-align: left;
  background-color: var(--comic-ink);
  background-image: none;
  border-top: 3px solid var(--comic-red);
  opacity: 0;
  transform: translateY(100%);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.poster-card:hover::before {
  opacity: 1;
  transform: translateY(0);
}

.poster-fallback {
  font-family: 'Bangers', cursive;
  letter-spacing: 0.02em;
  border-radius: 0;
}

/* Signature element: starburst rating stamp, replaces the flat
   gradient rating bar. */
.poster-rating-badge {
  position: absolute;
  bottom: -20px;
  right: -20px;
  left: auto;
  z-index: 3;
  width: 84px;
  height: 84px;
  padding: 0;
  background: var(--comic-yellow);
  background-image: none;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  border: 3px solid var(--comic-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-8deg);
  font-family: 'Bangers', cursive;
  font-size: 1.05rem;
  color: var(--comic-ink);
  text-align: center;
  line-height: 1.1;
}

/* ---- Review modal — two comic panels side by side: info panel on
   the left, review "speech bubble" filling the right. Built entirely
   with CSS grid-area on the existing elements — modal-poster-row,
   modal-rating, etc. are already separate children of modal-box, so
   nothing in marvel.html or the render script needs to change. */
.modal-overlay {
  background: rgba(0, 0, 0, 0.85);
}

.modal-box {
  display: grid;
  grid-template-columns: 200px 1fr;
  grid-template-areas:
    "info review"
    "seasonlabel review"
    "episodes review"
    "rating review"
    "lastwatched review";
  column-gap: 2rem;
  row-gap: 0.85rem;
  align-items: start;
  max-width: 820px;
  background-color: #170505;
  background-image:
    radial-gradient(circle, rgba(255, 224, 102, 0.3) 1px, transparent 1.6px),
    linear-gradient(100deg, #170505 0%, #170505 26%, var(--poster-accent, #7a1e22) 30%, var(--poster-accent, #7a1e22) 100%);
  background-size: 12px 12px, auto;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 4px solid var(--comic-ink);
  outline: 3px solid var(--poster-accent, #7a1e22);
  outline-offset: -11px;
  border-radius: 0;
  box-shadow: 10px 10px 0 color-mix(in srgb, var(--poster-accent, #7a1e22) 55%, transparent);
}

/* Kept inside the box bounds — modal-box has overflow-y:auto and
   overflow-x:hidden in the base stylesheet (so long reviews scroll
   instead of overflowing the screen), which clips anything hanging
   outside via a negative offset. */
.modal-close {
  top: 0.6rem;
  right: 0.6rem;
  width: 32px;
  height: 32px;
  background: var(--comic-yellow);
  border: 2px solid var(--comic-ink);
  border-radius: 50%;
  color: var(--comic-ink);
  font-family: 'Bangers', cursive;
  z-index: 1;
}

.modal-close:hover {
  background: #fff;
  color: var(--comic-ink);
}

/* ---- Left panel: poster, title, meta, rating, last watched ---- */
.modal-poster-row {
  grid-area: info;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 0;
}

.modal-poster-thumb {
  flex: 0 0 auto;
  width: 100%;
  max-width: 160px;
  height: auto;
  aspect-ratio: 2 / 3;
  border: 3px solid var(--comic-ink);
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--comic-ink);
}

.modal-header-info {
  width: 100%;
}

.modal-title {
  font-family: 'Bangers', cursive;
  font-size: 1.6rem;
  line-height: 1.15;
  letter-spacing: 0.02em;
  color: var(--comic-paper);
}

.modal-meta {
  color: #999;
}

.modal-season-label {
  grid-area: seasonlabel;
  color: var(--comic-yellow);
}

.modal-episodes {
  grid-area: episodes;
  border-top: 2px solid var(--comic-yellow);
  border-bottom: 2px solid var(--comic-yellow);
}

.modal-episode-row .ep-rating {
  color: var(--comic-yellow);
}

.modal-rating {
  grid-area: rating;
  font-family: 'Bangers', cursive;
  font-size: 1.3rem;
  letter-spacing: 0.02em;
  color: var(--comic-yellow);
  margin-bottom: 0;
}

.modal-rating-empty {
  color: #555;
}

.modal-last-watched {
  grid-area: lastwatched;
  border-top: 2px dashed #555;
  color: #999;
  margin-top: 0;
}

/* ---- Right panel: review, styled as a real comic speech bubble —
   generous rounding, a thick ink outline, and a bold pointed tail
   instead of a subtle sliver. ---- */
.modal-review {
  grid-area: review;
  position: relative;
  align-self: start;
  margin-top: 0.5rem;
  background-color: #ece3cf;
  background-image:
    radial-gradient(circle, rgba(120, 100, 70, 0.07) 0.6px, transparent 1px),
    radial-gradient(ellipse at 30% 15%, #f8f3e6 0%, #ece3cf 70%);
  background-size: 5px 5px, auto;
  box-shadow: inset 0 0 32px rgba(60, 40, 20, 0.1);
  color: #1a1a1a;
  font-family: 'Comic Neue', cursive;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.5;
  padding: 1.4rem 1.6rem;
  border: 4px solid var(--comic-ink);
  border-radius: 32px;
}

.modal-review::before,
.modal-review::after {
  content: "";
  position: absolute;
  top: 32px;
  width: 0;
  height: 0;
  border-style: solid;
}

/* Ink-outlined wedge behind... */
.modal-review::before {
  left: -26px;
  border-width: 16px 26px 16px 0;
  border-color: transparent var(--comic-ink) transparent transparent;
}

/* ...paper-colored wedge on top, inset so the outline shows through
   as a consistent border around the tail. */
.modal-review::after {
  left: -19px;
  top: 36px;
  border-width: 12px 20px 12px 0;
  border-color: transparent #f6f0e2 transparent transparent;
}

.modal-review.pending {
  background: #2c2c2c;
  color: #999;
  font-family: 'Inter', sans-serif;
  font-weight: 400;
}

.modal-review.pending::after {
  border-color: transparent #2c2c2c transparent transparent;
}

/* ---- Dark mode — toggled via .theme-toggle in the nav, persisted
   in localStorage. The nav, footer, and hero ribbon just get dimmed
   with a filter since they're plain color blocks with no photos
   inside. The row panels and modal box are handled differently on
   purpose: filter cascades to every descendant, and both of those
   contain actual poster art (poster-card images / the modal's poster
   thumbnail) — filtering them would dim the posters too. So instead,
   the panel colors are redefined directly via --panel-color, which
   only touches the section's own background, leaving the posters
   inside completely untouched. */
body.dark-mode {
  background-color: #14100a;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.05) 1px, transparent 1.4px);
}

body.dark-mode .site-nav {
  background: #2a2a2a;
}

body.dark-mode footer,
body.dark-mode .page-hero .page-hero-title,
body.dark-mode .mcu-row-heading {
  filter: grayscale(0.55) brightness(0.55);
}

/* Muted, darker equivalents of the same four panel colors — posters
   sitting on top are unaffected since this only changes the section's
   own background-color. */
body.dark-mode .mcu-row-section:nth-of-type(4n+1) { --panel-color: #34204a; }
body.dark-mode .mcu-row-section:nth-of-type(4n+2) { --panel-color: #0b3a35; }
body.dark-mode .mcu-row-section:nth-of-type(4n+3) { --panel-color: #5c1414; }
body.dark-mode .mcu-row-section:nth-of-type(4n)   { --panel-color: #5c2a0a; }

body.dark-mode .poster-rating-badge {
  filter: grayscale(0.4) brightness(0.75);
}

body.dark-mode .theme-toggle {
  background: #444;
  color: #eee;
  border-color: #888;
}

body.dark-mode .theme-toggle:hover {
  background: #666;
}

@media (max-width: 700px) {
  .page-hero .page-hero-title {
    font-size: 2.1rem;
  }
  .poster-rating-badge {
    width: 64px;
    height: 64px;
    font-size: 0.85rem;
    bottom: -14px;
    right: -14px;
  }
  .modal-box {
    grid-template-columns: 1fr;
    grid-template-areas:
      "info"
      "seasonlabel"
      "episodes"
      "rating"
      "review"
      "lastwatched";
    max-width: 92vw;
    background-image: radial-gradient(circle, rgba(255, 224, 102, 0.3) 1px, transparent 1.6px);
    background-size: 12px 12px;
  }
  .modal-poster-row {
    flex-direction: row;
    align-items: center;
  }
  .modal-poster-thumb {
    max-width: 90px;
  }
  .modal-title {
    font-size: 1.6rem;
  }
  .modal-review::before,
  .modal-review::after {
    display: none;
  }
}
