/* =========================================================
   DESIGN TOKENS
========================================================= */

/* Light theme */
:root {
  /* Backgrounds */
  --bg: #fafafa;
  --bg-soft: #f3f0ff;
  --bg-warm: #fff6eb;

  /* Text */
  --primary: #111;
  --secondary: #555;

  /* Brand colors */
  --accent: #7c3aed;        /* emotional purple */
  --accent-soft: #ede9fe;
  --accent-warm: #f59e0b;   /* warmth */
  --accent-cool: #0ea5e9;   /* trust */

  /* Surfaces */
  --card-bg: #ffffff;
  --modal-bg: #ffffff;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Shadows */
  --shadow-sm: 0 6px 18px rgba(0,0,0,0.06);
  --shadow-md: 0 12px 32px rgba(0,0,0,0.1);
}

/* Explicit dark theme */
[data-theme="dark"] {
  --bg: #0f0f12;
  --bg-soft: #18181d;
  --bg-warm: #1f1f16;

  --primary: #eaeaea;
  --secondary: #b3b3b3;

  --accent: #a78bfa;
  --accent-soft: #2a2445;
  --accent-warm: #fbbf24;
  --accent-cool: #38bdf8;

  --card-bg: #18181d;
  --modal-bg: #1c1c22;
}

/* =========================================================
   RESET & BASE
========================================================= */

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

html, body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--primary);
  line-height: 1.7;
}

h1, h2, h3 {
  font-family: 'Playfair Display', serif;
}

h1 { font-size: 2.4rem; }
h2 { font-size: 1.6rem; margin-bottom: 16px; }
h3 { font-size: 1.2rem; }

p + p {
  margin-top: 1rem;
}

a {
  color: var(--accent);
  text-decoration: underline;
  transition: opacity 0.2s ease;
}

a:hover {
  opacity: 0.8;
}

/* =========================================================
   LAYOUT
========================================================= */

section {
  max-width: 900px;
  margin: 60px auto;
  padding: 40px 24px;
  border-radius: var(--radius-lg);
}

/* =========================================================
   HERO
========================================================= */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 50px 20px;
}

.author-photo {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
}

.tagline {
  max-width: 620px;
  margin: 16px 0 32px;
  color: var(--secondary);
}

/* =========================================================
   SECTION THEMING
========================================================= */

.about {
  background: var(--bg-soft);
}

.shortfilms-section {
  background: linear-gradient(
    135deg,
    var(--accent-soft),
    transparent
  );
}

.books {
  background: var(--bg-warm);
}

.quotes-section {
  background: #0f0f12;
  color: #eaeaea;
}

.quotes-section h2 {
  color: #c4b5fd;
}

.poems-section {
  background: var(--bg-soft);
}

.social-proof {
  background: linear-gradient(
    135deg,
    var(--accent),
    var(--accent-warm)
  );
  color: #fff;
  text-align: center;
}

/* =========================================================
   BUTTONS
========================================================= */

.cta-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-content: center;
}

.btn {
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: all 0.25s ease;
}

.btn.secondary {
  border: 2px solid var(--accent);
  color: var(--accent);
  background: transparent;
}

.btn.secondary:hover {
  background: linear-gradient(
    to right,
    var(--accent),
    var(--accent-warm)
  );
  color: #fff;
  transform: translateY(-2px);
}

/* =========================================================
   CARDS
========================================================= */

.book-card,
.poem-card,
.quote-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.book-card:hover,
.poem-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

/* =========================================================
   BOOKS
========================================================= */

.book-card {
  padding: 24px;
  margin-bottom: 24px;
}

.buy-links {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

/* =========================================================
   BOOK POSTERS
========================================================= */

.book-poster {
  width: 100%;
  max-width: 260px;        /* desktop size */
  margin: 0 auto 20px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: var(--card-bg);
}

/* maintain 2:3 poster ratio */
.book-poster img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 2 / 3;
  object-fit: cover;
}

.book-card:hover .book-poster {
  transform: translateY(-4px);
  transition: transform 0.3s ease;
}

/* =========================================================
   POEMS GRID
========================================================= */

.poem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 32px;
}

.poem-card {
  padding: 24px;
  text-decoration: none;
  color: var(--primary);
  border-left: 4px solid var(--accent);
}

.poem-card p {
  color: var(--secondary);
  margin: 10px 0 16px;
}

.poem-meta {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
}

/* =========================================================
   POEM MODAL
========================================================= */

.poem-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.poem-content {
  background: var(--modal-bg);
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  border-radius: var(--radius-md);
  position: relative;
}

.poem-content .sticky-bar {
  position: sticky;
  top: 0;
  height: 0;            /* 👈 no layout space */
  z-index: 10;
}
.poem-content .close {
  position: absolute;
  top: 16px;
  right: 16px;
  float: right;
  font-size: 28px;
  cursor: pointer;
  background: var(--bg);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  z-index: 10;
}

.poem-image {
  position: relative;
  margin-bottom: 16px;
  min-height: 120px;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
}

.img-loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.img-loader::after {
  content: "";
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--secondary);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.poem-img {
  width: 100%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.poem-image.loaded .img-loader { display: none; }
.poem-image.loaded .poem-img { opacity: 1; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =========================================================
   QUOTES
========================================================= */

.quotes-marquee {
  overflow: hidden;
}

.quotes-track {
  display: flex;
  gap: 16px;
}

.quote-card {
  height: 360px;
  padding: 18px;
  border-left: 5px solid var(--accent);
}

.quote-card:nth-child(3n) {
  border-left-color: var(--accent-warm);
}

.quote-card img {
  height: 100%;
  width: auto;
  object-fit: cover;
  border-radius: 12px;
}

/* =========================================================
   FOOTER
========================================================= */

footer {
  text-align: center;
  padding: 40px 20px;
  font-size: 0.9rem;
  color: var(--secondary);
}

.footer-title {
  font-weight: 600;
  color: var(--primary);
}

/* =========================================================
   THEME TOGGLE
========================================================= */

.theme-toggle-wrapper {
  position: absolute;
  right: 0;
  text-align: right;
  padding: 16px;
}

#theme-toggle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--secondary);
  background: var(--card-bg);
  cursor: pointer;
}

/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 768px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.3rem; }

  .author-photo {
    width: 120px;
    height: 120px;
  }

  .cta-buttons {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .quote-card {
    height: 300px;
  }

  .poem-content {
    max-height: 100vh;
    border-radius: 0;
  }
}

@media (min-width: 768px) {
  .book-card {
    display: grid;
    grid-template-columns: 260px 1fr; /* poster fixed, text flexible */
    gap: 28px;
    align-items: start;
  }

  .book-info {
    min-width: 0;  /* important so text wraps inside the column */
  }

  .book-poster img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-md);
  }
}
