/* ══════════════════════════════════════════════════════════════
   Hardgrizz Comics — theme
   White background, primary-color geometry (red/yellow/blue),
   bold black angular type (Baumans).
   ══════════════════════════════════════════════════════════════ */

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

:root {
  --clr-bg:     #ffffff;
  --clr-ink:    #111111;
  --clr-red:    #e8352b;
  --clr-yellow: #f3c318;
  --clr-blue:   #1c4fd6;
  --clr-line:   #111111;
  --radius: 0; /* Hardgrizz: sharp corners everywhere */
}

html, body {
  min-height: 100%;
  background: var(--clr-bg);
  color: var(--clr-ink);
  font-family: "Baumans", system-ui, sans-serif;
  font-weight: 700;
}

img { display: block; max-width: 100%; }

button, input {
  font-family: inherit;
}

a { color: inherit; }

.hidden { display: none !important; }

/* ── type scale ─────────────────────────────────────────────── */
h1, h2, h3, .display {
  font-family: "Baumans", sans-serif;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  line-height: 1.02;
}

/* ── language toggle ────────────────────────────────────────── */
.lang-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  /* Above the 18+ age gate (z-index 1000) so language can be switched
     while the gate is up — its text re-renders live on toggle. */
  z-index: 1100;
  background: var(--clr-bg);
  border: 3px solid var(--clr-ink);
  color: var(--clr-ink);
  font-family: "Baumans", sans-serif;
  font-weight: 900;
  font-weight: 900;
  font-size: 0.78rem;
  padding: 6px 10px;
  cursor: pointer;
  display: flex;
  gap: 4px;
  align-items: center;
}

.lang-toggle .lang-sep { opacity: 0.4; }

.lang-toggle span[data-lang-btn] {
  padding: 2px 4px;
}

.lang-toggle span[data-lang-btn].active {
  background: var(--clr-yellow);
}

/* ── generic building blocks ────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 3px solid var(--clr-ink);
  background: var(--clr-bg);
  color: var(--clr-ink);
  font-family: "Baumans", sans-serif;
  font-weight: 900;
  font-weight: 900;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 14px 28px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  box-shadow: 5px 5px 0 var(--clr-ink);
}

.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 var(--clr-ink);
}

.btn:active {
  transform: translate(1px, 1px);
  box-shadow: 3px 3px 0 var(--clr-ink);
}

.btn-red    { background: var(--clr-red);    color: #fff; }
.btn-yellow { background: var(--clr-yellow); color: var(--clr-ink); }
.btn-blue   { background: var(--clr-blue);   color: #fff; }

.btn-ghost {
  box-shadow: none;
  background: transparent;
}
.btn-ghost:hover { box-shadow: none; transform: none; background: rgba(0,0,0,0.05); }

.shape {
  position: absolute;
  pointer-events: none;
}
.shape-circle  { border-radius: 50%; }
.shape-triangle {
  width: 0; height: 0;
  background: none !important;
}
.shape-tri-up    { border-left: 60px solid transparent; border-right: 60px solid transparent; border-bottom: 100px solid var(--clr-red); }
.shape-diamond   { transform: rotate(45deg); }

/* ── page shell ─────────────────────────────────────────────── */

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.view {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ══════════════════════════════════════════════════════════════
   Landing
   ══════════════════════════════════════════════════════════════ */

.landing {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 40px 24px;
}

.landing-shapes .shape-yellow-bar {
  top: 8%;
  left: -6%;
  width: 46vw;
  height: 90px;
  background: var(--clr-yellow);
  transform: rotate(-8deg);
}
.landing-shapes .shape-red-diamond {
  width: 90px;
  height: 90px;
  background: var(--clr-red);
  top: 12%;
  right: 10%;
}
.landing-shapes .shape-blue-circle {
  width: 140px;
  height: 140px;
  background: var(--clr-blue);
  bottom: 8%;
  left: 8%;
}
.landing-shapes .shape-red-bar {
  bottom: 14%;
  right: -8%;
  width: 40vw;
  height: 22px;
  background: var(--clr-red);
  transform: rotate(-8deg);
}

.landing-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 640px;
}

.landing-title {
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  margin-bottom: 18px;
}

.landing-text {
  font-family: "Baumans", sans-serif;
  font-weight: 500;
  font-size: 1.05rem;
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.5;
  margin-bottom: 36px;
}

.landing-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.landing-buttons .btn {
  font-size: 1.15rem;
  padding: 18px 40px;
}

/* ══════════════════════════════════════════════════════════════
   Section header (used on comics/arts list pages)
   ══════════════════════════════════════════════════════════════ */

.section-header {
  border-bottom: 4px solid var(--clr-ink);
  padding: 22px 0 18px;
  margin-bottom: 28px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.section-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
}

.back-link {
  font-family: "Baumans", sans-serif;
  font-weight: 900;
  font-size: 0.85rem;
  text-transform: uppercase;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--clr-ink);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.back-link:hover { color: var(--clr-red); }

/* ══════════════════════════════════════════════════════════════
   Grid (comics list / arts list)
   ══════════════════════════════════════════════════════════════ */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 22px;
  padding-bottom: 48px;
}

.card {
  position: relative;
  border: 3px solid var(--clr-ink);
  background: var(--clr-bg);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
  box-shadow: 5px 5px 0 var(--clr-ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  overflow: hidden;
}

.card:hover {
  transform: translate(-3px, -3px);
  box-shadow: 8px 8px 0 var(--clr-ink);
}

.card-accent {
  height: 8px;
  width: 100%;
}
.card:nth-child(3n+1) .card-accent { background: var(--clr-red); }
.card:nth-child(3n+2) .card-accent { background: var(--clr-yellow); }
.card:nth-child(3n+3) .card-accent { background: var(--clr-blue); }

.card-cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-bottom: 3px solid var(--clr-ink);
  background: #eee;
}

.card-title {
  font-family: "Baumans", sans-serif;
  font-weight: 900;
  font-size: 0.95rem;
  padding: 12px 14px;
  text-transform: uppercase;
  line-height: 1.2;
}

/* ── "new / unread" star badge ─────────────────────────────── */
/* Yellow spiky starburst with a black "!", flagging unread comics/pages
   and unvisited art. Rendered inline (SVG) by newBadge() in app.js. */
.new-badge {
  display: inline-flex;
  width: 2.2rem;
  height: 2.2rem;
  pointer-events: none;
  filter: drop-shadow(2px 2px 0 var(--clr-ink));
}
.new-badge svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* On a card: pinned to the top-right over the cover. The card clips its
   overflow, so keep the badge inside the box (positive offsets). */
.card .new-badge {
  position: absolute;
  top: 14px;
  right: 12px;
  z-index: 3;
}

/* On the landing buttons: overhang the top-right corner. */
.landing-buttons .btn {
  position: relative;
  overflow: visible;
}
.landing-buttons .btn .new-badge {
  position: absolute;
  top: -1rem;
  right: -1rem;
  width: 2.4rem;
  height: 2.4rem;
  z-index: 3;
}

/* On the comic-detail title: inline next to the heading text. */
.comic-title .new-badge {
  width: 1.8rem;
  height: 1.8rem;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* reading-progress indicator, shown when localStorage has saved a position */
.card-progress {
  height: 5px;
  width: 100%;
  background: #eee;
}
.card-progress-fill {
  height: 100%;
  background: var(--clr-red);
}

.placeholder {
  font-family: "Baumans", sans-serif;
  font-weight: 500;
  text-transform: none;
  color: #555;
  padding: 40px 0;
  text-align: center;
  width: 100%;
}

/* ══════════════════════════════════════════════════════════════
   Comic detail
   ══════════════════════════════════════════════════════════════ */

.comic-detail {
  padding: 36px 0 60px;
}

.comic-top {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 40px;
  align-items: start;
}

@media (max-width: 760px) {
  .comic-top { grid-template-columns: 1fr; }
}

/* carousel */
.carousel {
  position: relative;
  border: 3px solid var(--clr-ink);
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #eee;
}

.carousel-track {
  height: 100%;
  width: 100%;
}

.carousel-track img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: 3px solid var(--clr-ink);
  background: var(--clr-bg);
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-family: "Baumans", sans-serif;
  font-weight: 900;
  font-size: 1rem;
}
.carousel-nav:hover { background: var(--clr-yellow); }
.carousel-prev { left: 8px; }
.carousel-next { right: 8px; }

.carousel-dots {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.carousel-dot {
  width: 10px;
  height: 10px;
  background: var(--clr-bg);
  border: 2px solid var(--clr-ink);
  cursor: pointer;
}
.carousel-dot.active { background: var(--clr-red); }

/* right column */
.comic-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin-bottom: 16px;
}

.comic-description {
  font-family: "Baumans", sans-serif;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.6;
  margin-bottom: 24px;
  white-space: pre-wrap;
}

.comic-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.progress-bar {
  height: 10px;
  width: 100%;
  max-width: 320px;
  background: #eee;
  border: 2px solid var(--clr-ink);
  margin-bottom: 20px;
}
.progress-fill {
  height: 100%;
  background: var(--clr-red);
}

.chapters-label, .characters-label {
  font-family: "Baumans", sans-serif;
  font-weight: 900;
  font-size: 0.9rem;
  text-transform: uppercase;
  margin-bottom: 10px;
  display: block;
}

.chapters-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
}

.chapter-btn {
  border: 2px solid var(--clr-ink);
  background: var(--clr-bg);
  font-family: "Baumans", sans-serif;
  font-weight: 700;
  padding: 8px 14px;
  cursor: pointer;
}
.chapter-btn:hover { background: var(--clr-blue); color: #fff; }

/* characters */
.characters {
  margin-top: 40px;
  border-top: 3px solid var(--clr-ink);
  padding-top: 24px;
}

.characters-list {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.character-card {
  border: 2px solid var(--clr-ink);
  padding: 10px 16px;
  min-width: 140px;
}

.character-name {
  font-family: "Baumans", sans-serif;
  font-weight: 900;
  font-size: 0.85rem;
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* Clickable character name (button element) — links to its gallery page
   when a matching arts/characters/ entry exists. Strip button chrome and
   present it as an underlined red link. */
.character-link {
  display: inline-block;
  padding: 0;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  color: var(--clr-red);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}
.character-link:hover {
  color: var(--clr-ink);
  background: var(--clr-yellow);
}

.character-about {
  font-family: "Baumans", sans-serif;
  font-weight: 500;
  font-size: 0.85rem;
  color: #444;
}

/* ══════════════════════════════════════════════════════════════
   Reader
   ══════════════════════════════════════════════════════════════ */

.reader {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.reader-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 20px;
  border-bottom: 3px solid var(--clr-ink);
}

.reader-header-top {
  display: flex;
  align-items: center;
  gap: 16px;
}

.reader-titles {
  flex: 1;
  overflow: hidden;
}

.reader-comic-title {
  font-family: "Baumans", sans-serif;
  font-weight: 900;
  font-size: 1rem;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reader-chapter-title {
  font-family: "Baumans", sans-serif;
  font-size: 0.8rem;
  color: #555;
}

.fullscreen-btn {
  align-self: center;
  font-size: 0.75rem;
  padding: 8px 12px;
  border: 2px solid var(--clr-ink);
}

/* Fullscreen mode targets #app (not .reader/.art-detail directly) — those
   views get fully torn down and rebuilt on every page turn or language
   switch (full innerHTML re-render), and a browser auto-exits fullscreen
   the instant its fullscreen element is removed from the document. #app
   itself is never replaced, only its contents, so fullscreen survives
   navigation within the reader. */
#app:fullscreen,
#app:-webkit-full-screen {
  background: #000;
}
/* Size the fullscreen page to the space actually left between the header
   and footer (which vary in height with the fullscreen button / page
   comment), not a fixed vh — 88vh overflowed and collided with both. The
   flex viewport already resolves to the leftover height, so 100% of it
   plus overflow:hidden keeps the page fully inside. */
#app:fullscreen .reader-viewport,
#app:-webkit-full-screen .reader-viewport {
  overflow: hidden;
}
#app:fullscreen .reader-viewport img,
#app:-webkit-full-screen .reader-viewport img {
  max-height: 100%;
}
#app:fullscreen .reader-header,
#app:-webkit-full-screen .reader-header,
#app:fullscreen .reader-footer,
#app:-webkit-full-screen .reader-footer {
  background: #000;
  color: #fff;
  border-color: #444;
}
#app:fullscreen .reader-comic-title,
#app:-webkit-full-screen .reader-comic-title,
#app:fullscreen .back-link,
#app:-webkit-full-screen .back-link,
#app:fullscreen .fullscreen-btn,
#app:-webkit-full-screen .fullscreen-btn {
  color: #fff;
  border-color: #fff;
}

#app:fullscreen .art-detail img,
#app:-webkit-full-screen .art-detail img {
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
  background: #000;
}

.reader-viewport {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 16px;
  min-height: 0;
}

.reader-viewport img {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border: 3px solid var(--clr-ink);
}

.reader-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 84px;
  border: 3px solid var(--clr-ink);
  font-family: "Baumans", sans-serif;
  font-weight: 900;
  font-size: 1.3rem;
  cursor: pointer;
}
.reader-nav:disabled { opacity: 0.15; cursor: default; }
.reader-prev { left: 16px; background: var(--clr-yellow); }
.reader-next { right: 16px; background: var(--clr-blue); color: #fff; }
.reader-prev:hover:not(:disabled) { background: var(--clr-red); color: #fff; }
.reader-next:hover:not(:disabled) { background: var(--clr-red); }

.reader-footer {
  border-top: 3px solid var(--clr-ink);
  padding: 14px 20px 26px;
}

.reader-page-jump {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: "Baumans", sans-serif;
  font-weight: 900;
  font-size: 0.95rem;
  margin-bottom: 14px;
}

#reader-page-input {
  width: 3.4em;
  padding: 6px;
  border: 2px solid var(--clr-ink);
  text-align: center;
  font-family: "Baumans", sans-serif;
  font-weight: 900;
  font-size: 0.95rem;
  -moz-appearance: textfield;
  appearance: textfield;
}
#reader-page-input::-webkit-outer-spin-button,
#reader-page-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.reader-meta {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

.reader-comment {
  font-family: "Baumans", sans-serif;
  font-weight: 500;
  font-style: italic;
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.5;
  margin-bottom: 8px;
}

.reader-date {
  font-family: "Baumans", sans-serif;
  font-size: 0.8rem;
  color: #777;
  text-transform: none;
}

/* ══════════════════════════════════════════════════════════════
   Arts
   ══════════════════════════════════════════════════════════════ */

.art-detail {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 24px 60px;
  gap: 24px;
}

.art-detail img {
  max-width: min(90vw, 720px);
  max-height: 70vh;
  object-fit: contain;
  border: 3px solid var(--clr-ink);
}

.art-detail-title {
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  text-align: center;
}

.art-detail-description {
  font-family: "Baumans", sans-serif;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.6;
  max-width: 640px;
  text-align: center;
  white-space: pre-wrap;
}

/* ── character detail: gallery of images + per-picture captions ── */
.character-gallery {
  display: flex;
  flex-direction: column;
  gap: 40px;
  align-items: center;
  padding: 12px 0 40px;
}

.character-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 720px;
  width: 100%;
}

.character-figure-img {
  max-width: min(90vw, 720px);
  max-height: 80vh;
  object-fit: contain;
  border: 3px solid var(--clr-ink);
  box-shadow: 6px 6px 0 var(--clr-ink);
}

.character-figure-caption {
  font-family: "Baumans", sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.6;
  max-width: 640px;
  text-align: center;
  white-space: pre-wrap;
}

/* character detail: "appears in comics" links to related works */
.related-comics {
  margin-top: 8px;
  border-top: 3px solid var(--clr-ink);
  padding-top: 24px;
  /* clear the footer disclaimer — the buttons carry a 5px drop-shadow, so
     without this they butt right up against it */
  padding-bottom: 56px;
}
.related-comics-label {
  font-family: "Baumans", sans-serif;
  font-weight: 900;
  font-size: 0.9rem;
  text-transform: uppercase;
  margin-bottom: 12px;
  display: block;
}
.related-comics-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.related-comic-btn {
  font-size: 0.9rem;
  padding: 10px 18px;
}

/* ── mobile ────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .reader-nav { width: 44px; height: 64px; }
  .reader-viewport img { max-height: 62vh; }
  .carousel-nav { width: 44px; height: 44px; }

  /* Keep the fixed corner language toggle from sitting on top of
     header content on narrow screens. */
  .lang-toggle { top: 8px; right: 8px; padding: 4px 8px; font-size: 0.65rem; }
  .reader-header { padding-right: 92px; flex-wrap: wrap; }
  .section-header { padding-right: 92px; }
  .fullscreen-btn { font-size: 0.68rem; padding: 6px 8px; }
}

/* ══════════════════════════════════════════════════════════════
   18+ disclaimer footer + first-visit age gate
   ══════════════════════════════════════════════════════════════ */

.site-disclaimer {
  border-top: 3px solid var(--clr-ink);
  padding: 20px 24px;
  text-align: center;
  font-family: "Baumans", sans-serif;
  font-weight: 900;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--clr-ink);
}
.site-disclaimer:empty { display: none; }

/* Full-screen gate shown once, before content, on the first visit. */
.age-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(17, 17, 17, 0.88);
}

.age-gate-box {
  background: var(--clr-bg);
  border: 3px solid var(--clr-ink);
  box-shadow: 8px 8px 0 var(--clr-ink);
  padding: 32px 28px;
  max-width: 460px;
  width: 100%;
  text-align: center;
}

.age-gate-badge {
  display: inline-block;
  background: var(--clr-red);
  color: #fff;
  font-family: "Baumans", sans-serif;
  font-weight: 900;
  font-size: 1.6rem;
  line-height: 1;
  padding: 10px 16px;
  border: 3px solid var(--clr-ink);
  box-shadow: 4px 4px 0 var(--clr-ink);
  margin-bottom: 20px;
}

.age-gate-text {
  font-family: "Baumans", sans-serif;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.4;
  margin-bottom: 24px;
}

.age-gate-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  .age-gate-actions { flex-direction: column; }
  .age-gate-actions .btn { width: 100%; }
}
