/* ============================================================
   AND THEN...BOOKS — Global Stylesheet
   Dark Americana. No softness. No gradients. No rounded corners.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Arvo:ital,wght@0,400;0,700;1,400&family=Oswald:wght@300;400;700&display=swap');

/* ── Variables ── */
:root {
  --black:  #0a0a0a;
  --dark:   #111111;
  --panel:  #1a1a1a;
  --red:    #cc0000;
  --red-dim:#8a0000;
  --cream:  #f0ede6;
  --muted:  #888888;
  --gold:   #c8a951;
  --border: #2a2a2a;
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--black);
  color: var(--cream);
  font-family: 'Arvo', serif;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* ── Grain texture overlay ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

/* ── Links ── */
a { color: inherit; text-decoration: none; }
a:hover { color: var(--red); }

/* ── Site Nav ── */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,10,10,0.97);
  backdrop-filter: blur(4px);
}

.nav-logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.4rem;
  letter-spacing: 4px;
  color: var(--cream);
}

.nav-logo span { color: var(--red); }

.nav-links {
  display: flex;
  gap: 32px;
  list-style: none;
}

.nav-links a {
  font-family: 'Oswald', sans-serif;
  font-size: 0.65rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--cream); }

/* ── Site Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 40px;
  text-align: center;
  margin-top: 80px;
}

.site-footer p {
  font-family: 'Oswald', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 4px;
  color: #333;
  text-transform: uppercase;
}

/* ── Section label ── */
.section-label {
  font-family: 'Oswald', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 5px;
  color: var(--red);
  text-transform: uppercase;
  margin-bottom: 12px;
}

/* ── Buttons ── */
.btn {
  display: inline-block;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1rem;
  letter-spacing: 3px;
  padding: 10px 28px;
  border: 2px solid currentColor;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  clip-path: polygon(8px 0%, 100% 0%, calc(100% - 8px) 100%, 0% 100%);
}

.btn-red {
  color: var(--cream);
  background: var(--red);
  border-color: var(--red);
}

.btn-red:hover { background: #a00000; border-color: #a00000; color: var(--cream); }

.btn-outline {
  color: var(--red);
  background: transparent;
  border-color: var(--red);
}

.btn-outline:hover { background: var(--red); color: var(--cream); }

.btn-ghost {
  color: var(--muted);
  background: transparent;
  border-color: #333;
}

.btn-ghost:hover { color: var(--cream); border-color: var(--muted); }

/* ── Hero (landing) ── */
.hero {
  text-align: center;
  padding: 100px 40px 80px;
  position: relative;
}

.hero-eyebrow {
  font-family: 'Oswald', sans-serif;
  font-size: 0.65rem;
  letter-spacing: 6px;
  color: var(--red);
  text-transform: uppercase;
  margin-bottom: 20px;
  border: 1px solid var(--red-dim);
  display: inline-block;
  padding: 3px 14px;
}

.hero-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(4rem, 10vw, 9rem);
  letter-spacing: 6px;
  line-height: 0.9;
  color: var(--cream);
  margin-bottom: 28px;
}

.hero-title .red { color: var(--red); }

.hero-tagline {
  font-family: 'Arvo', serif;
  font-size: 1rem;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 40px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

.hero-divider {
  width: 60px;
  height: 2px;
  background: var(--red);
  margin: 40px auto;
}

/* ── Series grid (landing) ── */
.series-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 40px 80px;
}

.series-card {
  background: var(--panel);
  padding: 40px 36px;
  border: 1px solid var(--border);
  position: relative;
  transition: border-color 0.2s;
  display: block;
}

.series-card:hover { border-color: var(--red-dim); }

.series-card-tag {
  font-family: 'Oswald', sans-serif;
  font-size: 0.55rem;
  letter-spacing: 4px;
  color: var(--red);
  text-transform: uppercase;
  margin-bottom: 16px;
}

.series-card-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.4rem;
  letter-spacing: 3px;
  color: var(--cream);
  line-height: 1;
  margin-bottom: 12px;
}

.series-card-desc {
  font-family: 'Arvo', serif;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 28px;
}

.series-card-count {
  font-family: 'Oswald', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 3px;
  color: #444;
  text-transform: uppercase;
  margin-top: 20px;
}

/* ── Book grid (series page) ── */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 2px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 40px 80px;
}

.book-card {
  background: var(--panel);
  border: 1px solid var(--border);
  transition: border-color 0.2s;
  display: flex;
  flex-direction: column;
}

.book-card:hover { border-color: var(--red-dim); }

.book-card-cover {
  width: 100%;
  aspect-ratio: 6/9;
  background: var(--black);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.book-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}

.book-card-cover-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.book-card-num {
  font-family: 'Oswald', sans-serif;
  font-size: 0.55rem;
  letter-spacing: 4px;
  color: var(--red);
  text-transform: uppercase;
}

.book-card-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.8rem;
  letter-spacing: 2px;
  color: var(--cream);
  line-height: 1;
}

.book-card-status {
  font-family: 'Oswald', sans-serif;
  font-size: 0.55rem;
  letter-spacing: 3px;
  color: var(--muted);
  text-transform: uppercase;
  border: 1px solid #333;
  padding: 2px 8px;
}

.book-card-status.available { color: var(--red); border-color: var(--red-dim); }
.book-card-status.draft { color: var(--gold); border-color: #6a5010; }

.book-card-body {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.book-card-premise {
  font-family: 'Arvo', serif;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.6;
  flex: 1;
}

.book-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Page header (individual book page) ── */
.page-hero {
  padding: 60px 40px 40px;
  max-width: 1100px;
  margin: 0 auto;
}

.breadcrumb {
  font-family: 'Oswald', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 3px;
  color: #444;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.breadcrumb a:hover { color: var(--muted); }
.breadcrumb span { color: #2a2a2a; margin: 0 8px; }

.page-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(2.4rem, 5vw, 4rem);
  letter-spacing: 4px;
  line-height: 1;
  color: var(--cream);
  margin-bottom: 12px;
}

.page-title .red { color: var(--red); }

.page-premise {
  font-family: 'Arvo', serif;
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.65;
  max-width: 600px;
  margin-bottom: 28px;
}

/* ── Flipbook wrapper ── */
.flipbook-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 40px 20px;
}

.flipbook-label {
  font-family: 'Oswald', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 4px;
  color: var(--red);
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 16px;
  padding: 6px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* ── Buy section ── */
.buy-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px;
  display: flex;
  align-items: center;
  gap: 32px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.buy-price {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2rem;
  letter-spacing: 2px;
  color: var(--cream);
}

.buy-price-label {
  font-family: 'Oswald', sans-serif;
  font-size: 0.55rem;
  letter-spacing: 3px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.buy-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.buy-note {
  font-family: 'Oswald', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 2px;
  color: #333;
  text-transform: uppercase;
  margin-top: 8px;
}

/* ── Status badges ── */
.badge {
  font-family: 'Oswald', sans-serif;
  font-size: 0.55rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  border: 1px solid currentColor;
  padding: 3px 10px;
  display: inline-block;
}

.badge-wip { color: var(--gold); }
.badge-available { color: var(--red); }
.badge-coming { color: #444; }

/* ── Series page header ── */
.series-hero {
  padding: 80px 40px 60px;
  max-width: 1100px;
  margin: 0 auto;
}

.series-hero-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(3rem, 7vw, 6rem);
  letter-spacing: 5px;
  line-height: 0.95;
  color: var(--cream);
  margin-bottom: 16px;
}

.series-hero-desc {
  font-family: 'Arvo', serif;
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
  max-width: 580px;
  line-height: 1.7;
  margin-bottom: 12px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .site-nav { padding: 14px 20px; }
  .nav-links { display: none; }
  .hero { padding: 60px 20px 40px; }
  .series-grid, .book-grid { padding: 0 20px 60px; grid-template-columns: 1fr; }
  .series-hero, .page-hero, .flipbook-section, .buy-section { padding-left: 20px; padding-right: 20px; }
  .buy-section { flex-direction: column; align-items: flex-start; }
}

/* ===== Mobile fullscreen reading mode (And Then...Books) ===== */
#reader-close, #reader-open { display: none; }

body.reader-mobile .keyboard-hint { display: none; }

/* Mobile, browsing (not reading): hide the live flipbook so swipes scroll the page */
body.reader-mobile:not(.reading-active) #flipbook-wrapper,
body.reader-mobile:not(.reading-active) .flipbook-controls { display: none; }
body.reader-mobile:not(.reading-active) #reader-open {
  display: inline-flex; align-items: center; justify-content: center;
  margin: 14px auto 0; font-size: 0.95rem; padding: 13px 28px;
}

/* Reading mode: fullscreen overlay centered on the pages */
body.reading-active { overflow: hidden; }
body.reading-active .flipbook-section {
  position: fixed; inset: 0; z-index: 9999; margin: 0; padding: 6px 6px 4px;
  background: #0b0b0b;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  touch-action: none; overscroll-behavior: none;
}
body.reading-active .flipbook-label { display: none; }
body.reading-active #reader-open { display: none; }
body.reading-active #flipbook-wrapper { display: flex; width: 100%; }
body.reading-active .flipbook-controls { display: flex; margin-top: 2px; }
body.reading-active #reader-close {
  display: flex; position: fixed; top: 12px; right: 12px; z-index: 10001;
  width: 46px; height: 46px; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.65); color: var(--white, #f0ece0);
  border: 2px solid var(--red, #cc0000); border-radius: 50%;
  font-family: 'Bebas Neue', sans-serif; font-size: 1.4rem; line-height: 1; cursor: pointer;
}
body.reading-active #reader-close:active { background: var(--red, #cc0000); }
