/* BASIC RESET */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}



:root{
  /* Quiet Courage (balanced twilight): calm + mysterious + human */
  --bg0:#e8eef6;
  --bg1:#d8e2f0;
  --surface:#ffffff;
  --surface2:#f5f7fb;
  --text:#0f172a;
  --muted:#475569;
  --muted2:#64748b;
  --brand:#38bdf8;         /* calm sky */
  --brand2:#22d3ee;        /* aqua */
  --accent:#facc15;        /* warm detective gold */
  --border:rgba(15,23,42,0.14);
  --shadow:0 14px 34px rgba(15,23,42,0.12);
  --shadow2:0 8px 18px rgba(15,23,42,0.10);
  --radius:1.25rem;
}
body{
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:
    radial-gradient(1100px 700px at 15% -10%, rgba(56,189,248,0.18), transparent 55%),
    radial-gradient(900px 650px at 85% 5%, rgba(34,211,238,0.12), transparent 55%),
    radial-gradient(900px 700px at 50% 110%, rgba(250,204,21,0.10), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  color: var(--text);
  line-height: 1.6;
}

/* HEADER */
header{
  width:100%;
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 1.15rem 0;
  text-align:center;
  border-bottom: 1px solid var(--border);
}

.header-center-text {
  font-size: 2.0rem;
  font-weight: 800;
  color: var(--text);
  width: 100%;
  max-width: none;
  display: block;
}

.highlight {
  color: var(--accent);
  text-shadow: 0 0 14px rgba(250,204,21,0.32);
  letter-spacing: 1px;
}

.main-nav{
  width:100%;
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 0;
  display:flex;
  justify-content:center;
  align-items:center;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.main-nav a{
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 650;
  text-decoration:none;
  padding: 0.38rem 0.8rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: transform 0.12s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.main-nav a:hover{
  color: var(--text);
  background: rgba(2,132,199,0.10);
  border-color: rgba(2,132,199,0.20);
  transform: translateY(-1px);
}

/* MAIN PAGE WRAPPER */
.books-page {
  max-width: 1100px;
  margin: 3.5rem auto;
  padding: 2rem 1rem 4rem;
}

.page-title {
  font-size: 2rem;
  color: var(--accent);
  text-align: center;
  margin-bottom: 0.75rem;
}

.page-subtext {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 800px;
  margin: 0 auto 2.5rem;
  text-align: center;
}

/* BOOK PANELS */
.book-panel {
  background: var(--surface);
  border-radius: 1.25rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1.75rem 1.5rem 2rem;
  display: flex;
  gap: 1.75rem;
  margin-bottom: 2.5rem;
}

/* Cover image area */
.book-image {
  flex: 0 0 220px;
  display: flex;
  flex-direction: column; /* stack cover + video */
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
}


.book-cover {
  max-width: 100%;
  max-height: 330px; /* adjust this number if you want it taller/shorter */
  width: auto; /* let the width follow the image */
  height: auto; /* prevent stretching */
  border-radius: 0.9rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
}

/* Right side content */
.book-content {
  flex: 1 1 auto;
}

/* Book header row */
.book-header-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.book-header-row h2 {
  font-size: 1.6rem;
  color: var(--accent);
}

/* Tags */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-badge {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tag-badge.available {
  background: rgba(16, 185, 129, 0.18);
  color: #065f46;
  border: 1px solid rgba(16, 185, 129, 0.55);
}

.tag-badge.coming {
  background: rgba(250, 204, 21, 0.15);
  color: var(--accent);
  border: 1px solid rgba(250, 204, 21, 0.7);
}

/* Summary paragraph */
.book-summary {
  color: var(--muted);
  margin-bottom: 1.25rem;
}

/* Info row: details + what it teaches */
.book-info-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.info-block {
  flex: 1 1 230px;
  background: var(--surface2);
  border-radius: 0.9rem;
  border: 1px solid rgba(148,163,184,0.28);
  padding: 1rem 1rem 1rem;
}

.info-block h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.info-block ul {
  list-style: disc;
  padding-left: 1.25rem;
}

.info-block li {
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

/* Buy button (for Minjae) */
.buy-btn {
  display: inline-block;
  margin-bottom: 1.5rem;
  padding: 0.75rem 1.8rem;
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  text-decoration: none;
  border-radius: 999px;
  border: 2px solid rgba(56,189,248,0.55);
  box-shadow: 0 16px 34px rgba(2,6,23,0.55);
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease,
    border-color 0.2s ease;
}

.buy-btn:hover,
.buy-btn:focus {
  color: #ffffff;
  transform: translateY(-3px);
  border-color: #ffffff;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.8);
  outline: none;
}

/* EXCERPT BLOCK */
.excerpt-block {
  background: var(--surface2);
  border-radius: 0.9rem;
  border: 1px solid rgba(148,163,184,0.30);
  padding: 1rem 1rem 1.1rem;
}

.excerpt-block h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 0.4rem;
}

.excerpt-note {
  font-size: 0.9rem;
  color: var(--muted2);
  margin-bottom: 0.5rem;
}



/* VIDEO PANEL */
.video-panel{
  background: var(--surface);
  border-radius: 1.25rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.5rem 1.75rem;
  margin: 0 auto 2.5rem;
  text-align: center;
}

.video-title{
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.video-subtext{
  font-size: 1rem;
  color: var(--muted2);
  max-width: 42rem;
  margin: 0 auto 1rem;
}

.video-frame{
  width: 220px;              /* match the cover column width */
  max-width: 100%;
  margin: 0 auto;
  border-radius: 0.9rem;
  overflow: hidden;
  border: 1px solid rgba(148,163,184,0.35);
  background: #0b1220;
  box-shadow: var(--shadow2);
}

.video-player{
  display: block;
  width: 100%;
  height: auto;
  max-height: 330px;         /* match cover height cap */
  object-fit: contain;
}

/* If the browser supports it, keep a clean poster-like frame */
@supports (aspect-ratio: 1 / 1) {
  .video-frame{ aspect-ratio: 2 / 3; }
  .video-player{ height: 100%; max-height: none; }
}

/* BACK LINK */
.back-wrap {
  text-align: center;
  margin-top: 1rem;
}

.back-link {
  font-weight: 600;
  color: var(--brand);
  text-decoration: none;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

.back-link:hover {
  color: var(--accent);
  text-shadow: 0 0 8px rgba(250,204,21,0.40);
}

/* FOOTER */
.site-footer {
  background: var(--surface2);
  border-top: 1px solid var(--border);
  padding: 1.5rem 1rem;
  color: var(--muted2);
  font-size: 0.9rem;
  text-align: center;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.footer-links a {
  margin: 0 0.75rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.footer-links a:hover {
  color: var(--accent);
  text-shadow: 0 0 6px rgba(250,204,21,0.32);
}

/* RESPONSIVE */
@media (max-width: 800px) {
  .book-panel {
    flex-direction: column;
  }

  .book-image {
    flex: 0 0 auto;
  }

  .book-cover {
    max-width: 260px;
  }

  /* keep video aligned with cover column instead of expanding */
  .video-frame{
    width: 220px;
  }
}

@media (max-width: 600px) {
  .books-page {
    padding: 1.5rem 0.75rem 3rem;
  }
}

@media (max-width: 480px) {
  /* smaller, book-cover-like size on phones */
  .video-frame{
    width: 180px;
  }

  /* if aspect-ratio isn't supported, prevent a tall giant video */
  .video-player{
    max-height: 270px;
  }
}


/* ===== Video sizing + centering FIX (desktop + mobile) ===== */
.video-section{
  display:flex;
  justify-content:center;
  margin: 2.5rem 0;
}

.video-wrap{
  display:flex;
  justify-content:center;
  width:100%;
}

.video-frame{
  width: 220px;          /* match cover column */
  max-width: 220px;
  margin: 0 auto;
}

.video-player{
  width:100%;
  aspect-ratio: 2 / 3;   /* portrait, like a cover */
  max-height: 330px;
  overflow:hidden;
  border-radius: 14px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.12);
  background: rgba(0,0,0,0.04);
}

.video-player iframe{
  width:100% !important;
  height:100% !important;
  display:block;
  border:0;
}

/* Keep it aligned with cover column on tablets too */
@media (max-width: 800px){
  .video-frame{
    width: 220px;
    max-width: 220px;
  }
}

/* Smaller on phones */
@media (max-width: 480px){
  .video-frame{
    width: 180px;
    max-width: 180px;
  }
  .video-player{
    max-height: 270px;
  }
}


/* ===== FINAL MOBILE VIDEO FIX (prevents off-screen + oversized) ===== */
@media (max-width: 600px){
  /* prevent any horizontal overflow caused by padding/layout */
  html, body{ overflow-x: hidden; }

  /* tighten the panel padding on small screens */
  .video-panel{
    padding: 1.25rem 1rem 1.5rem;
  }

  /* keep wrapper truly centered */
  .video-wrap{
    width: 100%;
    display: flex;
    justify-content: center;
  }

  /* hard cap: never wider than viewport */
  .video-frame{
    width: min(180px, 100%);
    max-width: 180px;
    margin-left: auto;
    margin-right: auto;
  }

  /* lock the visual size so tall source videos don't blow it up */
  .video-player{
    width: 100%;
    height: 270px;     /* explicit height on phones */
    max-height: 270px;
    object-fit: contain;
  }
}

/* Some mobile browsers ignore aspect-ratio on <video>. Keep it sane everywhere. */
.video-frame .video-player{
  max-width: 100%;
}


/* Place the video directly under the book cover (same sizing) */
.book-image .video-frame{
  margin-top: 1rem;
}
