
/* ============================================================
   Da Good Life — Styles v3
   Ocean Palette + Responsive Two-Column Layout + PDF Reader
   ============================================================ */

@font-face {
  font-family: 'pbc1';
  src: url('../assets/pbc1.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Roboto';
  src: url('../assets/roboto.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg:               #0d1b2a;
  --surface:          #162236;
  --panel:            #1e3050;
  --text:             #deeaf4;
  --muted:            #7fa8c2;
  --link:             #48BF91;
  --accent:           #48BF91;
  --radius:           16px;
  --shadow:           0 10px 30px rgba(0,0,0,.4);
  --sidebar:          230px;
  --flip-perspective: 1400px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font: 18px/1.6 'pbc1','Roboto',system-ui,-apple-system,Segoe UI,Ubuntu,'Helvetica Neue',Arial;
}

img { max-width: 100%; height: auto; display: block; }
a   { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); font-size: .9rem; }

/* ── Banners ──────────────────────────────────────────────── */
.top-banner,
.bottom-banner { background: var(--panel); }

.top-banner .wrap,
.bottom-banner .wrap { max-width: 1200px; margin: 0 auto; padding: 0; }

.top-banner img,
.bottom-banner img { width: 100%; height: auto; display: block; }

/* ── Site Header ──────────────────────────────────────────── */
header.site-header {
  background: linear-gradient(90deg, #0a2744, #0076BE);
  border-bottom: 2px solid rgba(0,0,0,.3);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  max-width: 1200px; margin: 0 auto; padding: .75rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
}
.header-inner > img { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.header-inner h1  { font-size: 1.25rem; margin: 0; flex: 1; }

nav.main-nav { display: flex; gap: .4rem; flex-wrap: wrap; }
nav.main-nav a {
  padding: .4rem .85rem; border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12); background: var(--panel);
  color: var(--text); font-weight: 600; font-size: .9rem;
}
nav.main-nav a:hover,
nav.main-nav a[aria-current="page"] {
  background: var(--accent); border-color: transparent; text-decoration: none;
}

/* ── Site Layout (sidebar + main) ────────────────────────── */
.site-layout {
  max-width: 1200px; margin: 0 auto; padding: 1.25rem;
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  gap: 1.25rem;
  align-items: start;
}

/* ── PDF Sidebar ──────────────────────────────────────────── */
.pdf-sidebar {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  position: sticky; top: 72px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
}
.sidebar-title {
  font-size: 1rem; margin: 0 0 .75rem;
  border-bottom: 2px solid var(--panel); padding-bottom: .4rem;
}
.pdf-library-grid { display: flex; flex-direction: column; gap: .75rem; }
.loading-msg { text-align: center; }

/* PDF card */
.pdf-card-btn {
  all: unset;
  cursor: pointer;
  display: flex; flex-direction: column; gap: .4rem;
  width: 100%; text-align: center;
  background: var(--bg); border-radius: 10px; padding: .6rem;
  border: 2px solid transparent;
  transition: border-color .2s, transform .15s;
}
.pdf-card-btn:hover  { border-color: var(--link); transform: translateY(-2px); }
.pdf-card-btn:focus-visible { outline: 3px solid var(--link); }

.pdf-cover-img {
  width: 100%; border-radius: 6px;
  border: 2px solid var(--panel);
  aspect-ratio: 3/4; object-fit: cover;
}
.pdf-cover-placeholder {
  font-size: 3rem; text-align: center; padding: 1rem 0;
  background: var(--panel); border-radius: 6px;
}
.pdf-card-title {
  font-size: .8rem; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}

/* ── Main content ─────────────────────────────────────────── */
.main-content {
  min-width: 0;
  display: flex; flex-direction: column; gap: 1.5rem;
}
.section-heading {
  font-size: 1.1rem; margin: 0 0 .6rem;
  color: var(--muted); text-transform: uppercase;
  letter-spacing: .06em; font-weight: 700;
}

/* ── Comic frame ──────────────────────────────────────────── */
.comic-frame {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius);
  padding: 1rem; box-shadow: var(--shadow);
}
.comic-title  { margin: .25rem 0 .2rem; font-size: 1.35rem; }
.comic-date   { color: var(--muted); margin: 0 0 .5rem; }
.comic-figure img {
  border-radius: 12px; border: 4px solid var(--panel); cursor: pointer;
}
.comic-caption { color: var(--muted); font-size: .95rem; margin-top: .5rem; white-space: pre-wrap; }

/* ── Comic / Video navigation ─────────────────────────────── */
nav.comic-nav {
  display: flex; gap: .5rem; flex-wrap: wrap; margin: 1rem 0 0;
}
nav.comic-nav a, .btn-nav {
  padding: .55rem .85rem; border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12); background: var(--panel);
  color: var(--text); font-weight: 600; cursor: pointer;
  font-size: .9rem; display: inline-block; text-decoration: none;
}
nav.comic-nav a:hover, .btn-nav:hover { filter: brightness(1.15); text-decoration: none; }
nav.comic-nav a[aria-disabled="true"]  { opacity: .5; pointer-events: none; }
nav.comic-nav a.home { background: var(--accent); color: #0a2a1a; border-color: transparent; }
.btn-nav:disabled { opacity: .5; cursor: default; }

/* ── Video frame ──────────────────────────────────────────── */
.video-frame {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius);
  padding: 1rem; box-shadow: var(--shadow);
}
.video-title       { margin: .25rem 0 .2rem; font-size: 1.25rem; }
.video-date        { color: var(--muted); margin: 0 0 .75rem; }
.video-description { color: var(--muted); margin: .5rem 0 0; font-size: .95rem; }

.video-wrapper {
  position: relative; padding-top: 56.25%;   /* 16:9 */
  border-radius: 12px; overflow: hidden;
  background: #000; border: 4px solid var(--panel);
}
.video-wrapper iframe {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%; border: none;
}

/* ── Archive grid ─────────────────────────────────────────── */
.archive {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: .5rem;
}
.chapter-section {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.chapter-heading {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 0;
  padding-bottom: .4rem;
  border-bottom: 2px solid var(--panel);
}
.chapter-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.card {
  background: var(--surface); border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px; padding: 10px;
}
.card img  { border-radius: 8px; border: 3px solid var(--panel); }
.card-title { font-size: 1rem; margin: .45rem 0 0; }

/* ── PDF Modal ────────────────────────────────────────────── */
.pdf-modal { position: fixed; inset: 0; z-index: 1000; }
.pdf-modal[hidden] { display: none; }

.pdf-modal-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.72); backdrop-filter: blur(4px);
}
.pdf-modal-inner {
  position: relative; z-index: 1;
  margin: 2vh auto;
  max-width: 880px; width: calc(100% - 2rem);
  background: var(--bg); border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
  display: flex; flex-direction: column;
  height: 96vh; overflow: hidden;
}
.pdf-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem;
  background: linear-gradient(90deg, #0a2744, #0076BE);
  border-radius: var(--radius) var(--radius) 0 0;
  flex-shrink: 0;
}
.pdf-modal-title { margin: 0; font-size: 1.05rem; color: var(--text); }
.pdf-modal-close {
  all: unset; cursor: pointer; font-size: 1.3rem;
  padding: .2rem .55rem; border-radius: 8px; line-height: 1;
}
.pdf-modal-close:hover { background: rgba(0,0,0,.12); }

.pdf-reader-area {
  flex: 1; overflow: auto; padding: 1rem;
  background: #0076BE;
  display: flex; justify-content: center; align-items: flex-start;
  min-height: 220px;
  perspective: var(--flip-perspective);
}

/* ── Flip-book container (holds behind + front canvases) ── */
.flip-book {
  position: relative;
  display: inline-block;
  line-height: 0;
}

/* Behind canvas — always underneath, revealed as front page rotates */
.pdf-canvas-behind {
  position: absolute;
  top: 0; left: 0;
  max-width: 100%; height: auto;
  display: block;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0,0,0,.55);
  pointer-events: none;
}

/* Flip-page wrapper — the element that rotates during page turns */
.flip-page {
  position: relative;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}
.flip-page:active { cursor: grabbing; }

/* Front canvas */
.pdf-canvas {
  max-width: 100%; height: auto;
  border-radius: 4px; box-shadow: 0 4px 20px rgba(0,0,0,.55);
  display: block;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* ── Button-click flip is handled entirely in JS (no CSS keyframes needed) ── */

.pdf-loading { color: #ccc; text-align: center; padding: 2rem; font-size: 1rem; margin: 0; }

.pdf-modal-nav {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .75rem 1rem;
  background: var(--surface);
  border-radius: 0 0 var(--radius) var(--radius);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.pdf-page-info { color: var(--muted); font-size: .9rem; }
.pdf-nav-sep   { color: var(--panel); font-size: 1.1rem; margin: 0 .1rem; }
.btn-zoom      { min-width: 2.2rem; text-align: center; font-size: 1.1rem; line-height: 1; }

/* ── Footer ───────────────────────────────────────────────── */
.footer {
  padding: 2rem 1.25rem; background: var(--surface);
  border-top: 2px solid rgba(255,255,255,.06); margin-top: 2rem;
  text-align: center;
}
.tiny { color: var(--muted); font-size: .9rem; }

/* ── Responsive ──────────────────────────────────────────── */

/* Tablet: stack sidebar below main */
@media (max-width: 820px) {
  .site-layout {
    grid-template-columns: 1fr;
  }
  .pdf-sidebar {
    position: static;
    max-height: none;
    order: 2;               /* sidebar after main content on mobile */
  }
  .main-content { order: 1; }
}

/* Mobile: tighten spacing */
@media (max-width: 500px) {
  .header-inner { padding: .5rem .75rem; }
  .header-inner h1 { font-size: 1.05rem; }
  nav.main-nav a { padding: .35rem .6rem; font-size: .82rem; }
  .section-heading { font-size: .95rem; }
  .comic-title, .video-title { font-size: 1.1rem; }
  nav.comic-nav a, .btn-nav { padding: .45rem .65rem; font-size: .82rem; }
  .pdf-modal-inner { margin: 0; width: 100%; border-radius: 0; height: 100vh; }
  .pdf-modal-header { border-radius: 0; }
}

