@import url('https://fonts.googleapis.com/css2?family=Shippori+Mincho:wght@400;500;600;700&family=Zen+Kaku+Gothic+New:wght@400;500;700;900&family=Space+Mono:wght@400;700&display=swap');

:root {
  --ink: #17130f;
  --ink-soft: #241d16;
  --washi: #f1e6cd;
  --washi-dark: #e2d1a8;
  --red: #a3272c;
  --red-dark: #74191d;
  --gold: #c9a24b;
  --gold-light: #e8cd85;
  --panel-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
  --radius: 2px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  background-color: var(--ink);
  color: var(--washi);
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
}

/* faint brand-mark watermark, low and slow behind everything */
body::before {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-8deg);
  width: 70vw;
  height: 70vw;
  max-width: 900px;
  max-height: 900px;
  background-image: url('/images/logo-watermark.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.05;
  z-index: 0;
  pointer-events: none;
}
/* halftone screentone dots — comic-print texture */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(201, 162, 75, 0.16) 1px, transparent 1px);
  background-size: 14px 14px;
  z-index: 0;
  pointer-events: none;
}

.page-shell, .top-ribbon, .reader-shell { position: relative; z-index: 1; }

h1, h2, h3, .display {
  font-family: 'Shippori Mincho', serif;
  letter-spacing: 0.02em;
  line-height: 1.15;
  color: var(--gold-light);
  margin: 0;
}

.mono { font-family: 'Space Mono', monospace; }
a { color: inherit; }

/* ---------- layout shells ---------- */

.page-shell { max-width: 1180px; margin: 0 auto; padding: 0 24px 64px; }

.top-ribbon {
  background: linear-gradient(180deg, var(--ink-soft), var(--ink));
  color: var(--washi);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--gold);
  box-shadow: 0 2px 0 var(--red);
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }

.brand-logo {
  width: 34px; height: 34px; flex: none;
  display: block;
  filter: drop-shadow(0 0 6px rgba(201, 162, 75, 0.45));
}

.brand .display { font-size: 30px; color: var(--gold-light); letter-spacing: 0.04em; }
.brand .tagline {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: var(--washi-dark);
  opacity: 0.75;
  display: block;
}

.ribbon-nav { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- buttons ---------- */

.btn {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--washi);
  padding: 10px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.btn:hover { background: rgba(201, 162, 75, 0.12); box-shadow: 0 0 12px rgba(201, 162, 75, 0.3); }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--red); border-color: var(--red); color: var(--washi); }
.btn-primary:hover { background: var(--red-dark); box-shadow: 0 0 14px rgba(163, 39, 44, 0.55); }
.btn-blue { background: var(--ink-soft); border-color: var(--gold); color: var(--gold-light); }
.btn-yellow { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.btn-ghost { border-color: rgba(241, 230, 205, 0.35); }
.btn-danger { border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: rgba(163, 39, 44, 0.15); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

/* ---------- comic scroll cards (home grid) ---------- */

.vault-intro { padding: 44px 0 8px; position: relative; }
.vault-intro .display { font-size: 44px; position: relative; }
.vault-intro p { max-width: 60ch; font-size: 14.5px; color: var(--washi-dark); position: relative; }

/* comic "impact burst" behind the hero heading */
.vault-intro .burst {
  position: absolute;
  top: -34px;
  left: -28px;
  width: 200px;
  height: 200px;
  background: var(--red);
  opacity: 0.16;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  z-index: 0;
  pointer-events: none;
}

.comic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 36px;
  margin-top: 30px;
}

.comic-card {
  text-decoration: none;
  color: var(--washi);
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, filter 0.18s ease;
}
.comic-card:nth-child(3n+1) { transform: rotate(-1.1deg); }
.comic-card:nth-child(3n+2) { transform: rotate(0.8deg); }
.comic-card:nth-child(3n)   { transform: rotate(-0.5deg); }
.comic-card:hover { transform: rotate(0deg) translateY(-6px); }

/* hanging-scroll rod above the cover */
.comic-card .rod {
  height: 10px;
  background: linear-gradient(180deg, var(--gold-light), var(--gold) 60%, #96793a);
  border-radius: 5px;
  position: relative;
  margin-bottom: -2px;
}
.comic-card .rod::before, .comic-card .rod::after {
  content: '';
  position: absolute;
  top: -3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--gold-light), var(--gold) 65%, #8a6e33);
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.comic-card .rod::before { left: -6px; }
.comic-card .rod::after { right: -6px; }

.comic-card .cover {
  aspect-ratio: 3 / 4;
  background: var(--washi-dark);
  border: 2px solid var(--ink);
  outline: 1px solid var(--gold);
  outline-offset: -4px;
  border-top: none;
  overflow: hidden;
  position: relative;
  box-shadow: var(--panel-shadow);
}
.comic-card .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.comic-card .cover .placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Shippori Mincho', serif;
  font-size: 22px;
  color: var(--ink);
  opacity: 0.4;
  text-align: center;
  padding: 12px;
  background: var(--washi);
}

.comic-card .info { padding: 12px 4px 0; background: transparent; }
.comic-card .info h3 { font-size: 19px; color: var(--gold-light); }
.comic-card .info .desc {
  font-size: 12.5px;
  color: var(--washi-dark);
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.comic-card .info .pagecount {
  margin-top: 9px;
  display: inline-block;
  font-family: 'Space Mono', monospace;
  font-size: 10.5px;
  color: var(--ink);
  background: var(--gold);
  padding: 2px 9px;
  border-radius: 1px;
}
.comic-card .info .progress-badge {
  margin-top: 9px;
  margin-left: 6px;
  display: inline-block;
  font-family: 'Space Mono', monospace;
  font-size: 10.5px;
  color: var(--washi);
  background: var(--red);
  padding: 2px 9px;
  border-radius: 1px;
  border: 1px solid var(--gold);
}
.comic-card .info .progress-badge.done {
  background: var(--ink-soft);
  color: var(--gold-light);
}

.empty-state {
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  margin-top: 24px;
  background: rgba(241, 230, 205, 0.04);
}
.empty-state .display { font-size: 24px; margin-bottom: 8px; }
.empty-state p { color: var(--washi-dark); margin: 0 0 16px; }

.site-footer {
  position: relative;
  z-index: 1;
  padding: 10px 24px 30px;
  text-align: center;
}

.caption-box {
  display: inline-block;
  background: var(--red);
  color: var(--washi);
  border: 1px solid var(--gold);
  padding: 5px 14px;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  border-radius: 1px;
}

/* ---------- reader ---------- */

.reader-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ink);
  color: var(--washi);
}

.reader-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--gold);
  box-shadow: 0 2px 0 var(--red);
  gap: 16px;
  flex-wrap: wrap;
}
.reader-header h1 { font-size: 20px; color: var(--gold-light); font-weight: 500; }
.reader-header-actions { display: flex; align-items: center; gap: 8px; }
.reader-header .brand { gap: 8px; }
.reader-header .brand .brand-logo { width: 24px; height: 24px; }
.reader-header .brand .display { font-size: 20px; }

.fx-toggle { font-family: 'Space Mono', monospace; font-size: 11px; }
.fx-toggle .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: var(--gold); }
.fx-toggle[aria-pressed="false"] .dot { background: #6a6355; }

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

.page-frame {
  position: relative;
  max-width: 100%;
  max-height: 82vh;
  border: 1px solid var(--gold);
  box-shadow: var(--panel-shadow);
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1800px;
  overflow: hidden;
}
.page-frame img { display: block; width: auto; height: auto; max-width: 100%; max-height: 82vh; object-fit: contain; }

.page-frame .corner {
  position: absolute;
  width: 22px; height: 22px;
  border: 2px solid var(--gold);
  z-index: 3;
  pointer-events: none;
}
.page-frame .corner.tl { top: 6px; left: 6px; border-right: none; border-bottom: none; }
.page-frame .corner.tr { top: 6px; right: 6px; border-left: none; border-bottom: none; }
.page-frame .corner.bl { bottom: 6px; left: 6px; border-right: none; border-top: none; }
.page-frame .corner.br { bottom: 6px; right: 6px; border-left: none; border-top: none; }

.stage-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: var(--red);
  color: var(--washi);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px rgba(163, 39, 44, 0.5);
  z-index: 4;
  font-family: 'Shippori Mincho', serif;
}
.stage-nav-btn::before {
  content: '';
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  background: repeating-conic-gradient(rgba(201, 162, 75, 0.4) 0deg 3deg, transparent 3deg 18deg);
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: -1;
  pointer-events: none;
}
.stage-nav-btn:not(:disabled):hover::before { opacity: 1; }
.stage-nav-btn.next-volume {
  background: var(--gold);
  color: var(--ink);
  border-color: var(--gold-light);
  box-shadow: 0 0 16px rgba(201, 162, 75, 0.6);
}
.stage-nav-btn.next-volume:hover { background: var(--gold-light); }
.stage-nav-btn:disabled { opacity: 0.2; cursor: default; box-shadow: none; }
.stage-nav-btn.prev { left: 12px; }
.stage-nav-btn.next { right: 12px; }
.stage-nav-btn:not(:disabled):hover { background: var(--red-dark); }

.reader-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 14px;
  border-top: 1px solid var(--gold);
}

.page-counter {
  font-family: 'Space Mono', monospace;
  background: var(--ink-soft);
  color: var(--gold-light);
  border: 1px solid var(--gold);
  padding: 5px 14px;
  border-radius: 1px;
  font-size: 12.5px;
  font-weight: 700;
  position: relative;
}
.page-counter::before {
  content: '';
  position: absolute;
  left: -1px; top: 50%;
  width: 6px; height: 6px;
  background: var(--ink);
  border-right: 1px solid var(--gold);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.thumb-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 16px 4px;
  border-top: 1px solid rgba(201, 162, 75, 0.2);
}
.thumb-strip button {
  border: 1px solid rgba(201, 162, 75, 0.4);
  background: rgba(255,255,255,0.04);
  padding: 0;
  border-radius: 1px;
  overflow: hidden;
  width: 44px;
  height: 60px;
  flex: none;
  cursor: pointer;
}
.thumb-strip button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-strip button.active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }

.reader-empty { text-align: center; padding: 60px 20px; }
.reader-empty .display { font-size: 28px; color: var(--gold-light); }

.disclaimer {
  text-align: center;
  font-size: 11px;
  color: var(--washi-dark);
  opacity: 0.65;
  padding: 8px 20px 14px;
  margin: 0;
  max-width: 70ch;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- zoom / lightbox ---------- */

#pageImg { cursor: zoom-in; }

.zoom-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 3;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: rgba(23, 19, 15, 0.78);
  color: var(--gold-light);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.zoom-btn:hover { background: var(--red); color: var(--washi); }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 8, 6, 0.94);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lightbox-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.lightbox-controls button {
  border: 1px solid var(--gold);
  background: var(--ink-soft);
  color: var(--gold-light);
  font-size: 14px;
  font-weight: 700;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-controls button#zoomResetBtn {
  width: auto;
  border-radius: 999px;
  padding: 0 14px;
  font-size: 12px;
}
.lightbox-controls button#lightboxClose { background: var(--red); color: var(--washi); border-color: var(--red); }
.lightbox-controls button:hover { background: var(--gold); color: var(--ink); }
#zoomLevel { color: var(--washi-dark); font-size: 12px; min-width: 46px; text-align: center; }

.lightbox-viewport {
  flex: 1;
  width: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  cursor: grab;
}
.lightbox-viewport.dragging { cursor: grabbing; }
.lightbox-viewport img {
  max-width: 92vw;
  max-height: 80vh;
  object-fit: contain;
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
}

/* ---------- page-turn effect ---------- */
/* A page flips over like a leaf hinged at the spine when you turn it.
   When disabled, navigation just swaps the image instantly (also respected
   automatically for prefers-reduced-motion). */

.page-flip-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  background: #000;
  will-change: transform;
}
.page-flip-layer img { width: 100%; height: 100%; object-fit: contain; display: block; }

.page-flip-layer.turning-next {
  transform-origin: right center;
  animation: flip-next 460ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.page-flip-layer.turning-prev {
  transform-origin: left center;
  animation: flip-prev 460ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes flip-next {
  0%   { transform: rotateY(0deg); box-shadow: 0 0 0 rgba(0,0,0,0); }
  100% { transform: rotateY(-150deg); opacity: 0.15; box-shadow: -40px 0 60px rgba(0,0,0,0.5); }
}
@keyframes flip-prev {
  0%   { transform: rotateY(0deg); box-shadow: 0 0 0 rgba(0,0,0,0); }
  100% { transform: rotateY(150deg); opacity: 0.15; box-shadow: 40px 0 60px rgba(0,0,0,0.5); }
}

@media (prefers-reduced-motion: reduce) {
  .page-flip-layer.turning-next, .page-flip-layer.turning-prev {
    animation: none;
    display: none;
  }
}

/* ---------- subscribe bell + toast ---------- */

.bell-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: rgba(23, 19, 15, 0.78);
  color: var(--gold-light);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.bell-btn.subscribed { background: var(--red); border-color: var(--gold-light); color: var(--washi); }
.bell-btn:disabled { opacity: 0.5; cursor: wait; }

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: var(--ink-soft);
  color: var(--gold-light);
  border: 1px solid var(--gold);
  padding: 9px 16px;
  border-radius: 1px;
  font-size: 12.5px;
  font-family: 'Space Mono', monospace;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 50;
  max-width: 86vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--red); background: var(--red-dark); color: var(--washi); }

/* ---------- mobile ---------- */

@media (max-width: 640px) {
  .top-ribbon { padding: 12px 14px; gap: 8px; }
  .brand-logo { width: 28px; height: 28px; }
  .brand .display { font-size: 22px; }
  .brand .tagline { font-size: 10px; }
  .ribbon-nav .btn { padding: 8px 12px; font-size: 12px; }

  .page-shell { padding: 0 14px 40px; }
  .vault-intro { padding: 26px 0 4px; }
  .vault-intro .display { font-size: 30px; }
  .vault-intro .burst { width: 130px; height: 130px; top: -20px; left: -16px; }
  .comic-grid { gap: 22px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

  .reader-header { padding: 10px 12px; gap: 8px; }
  .reader-header .brand .brand-logo { width: 20px; height: 20px; }
  .reader-header .brand .display { font-size: 15px; }
  .reader-header h1 { font-size: 14px; width: 100%; order: 3; text-align: center; }
  .reader-header-actions { width: 100%; order: 4; justify-content: center; flex-wrap: wrap; gap: 6px; }
  .reader-header-actions .btn { padding: 7px 10px; font-size: 11.5px; }

  .stage-nav-btn { width: 40px; height: 40px; font-size: 17px; }
  .stage-nav-btn.prev { left: 4px; }
  .stage-nav-btn.next { right: 4px; }
  .reader-stage { padding: 12px; }

  .thumb-strip button { width: 36px; height: 50px; }
  .page-counter { font-size: 11px; padding: 4px 10px; }

  .lightbox-controls { padding: 8px; gap: 6px; }
  .lightbox-controls button { width: 30px; height: 30px; font-size: 12px; }
  .lightbox-controls button#zoomResetBtn { padding: 0 10px; }

  .disclaimer { font-size: 10px; padding: 6px 14px 10px; }

  .comic-card .info h3 { font-size: 17px; }
}

