/* Anvay Ved — site stylesheet */

:root {
  --gold: #B8860B;
  --gold-light: #C8A951;
  --ink: #1F1B16;
  --body-dark: #333333;
  --body-gray: #555555;
  --muted: #888888;
  --cream: #FAF6EE;
  --placeholder-bg: #EFEFEF;
  --placeholder-border: #DDDDDD;
  --disabled-bg: #E0E0E0;
  --white: #FFFFFF;
  --content-width: 620px;
  --wide-width: 1000px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--body-dark);
  background: var(--white);
  line-height: 1.65;
  font-size: 17px;
}

img { max-width: 100%; display: block; }

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 24px;
}

.container-wide {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3 {
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}

h1 { font-size: 2.4rem; margin: 0 0 12px; }
h2 { font-size: 1.7rem; margin: 40px 0 16px; }
h3 { font-size: 1.375rem; color: var(--gold); margin: 0 0 8px; }

.text-center { text-align: center; }

.tagline {
  font-style: italic;
  color: var(--body-gray);
  text-align: center;
  margin: 0 0 28px;
}

.byline {
  font-style: italic;
  color: var(--body-gray);
  margin: 0 0 10px;
}

/* Header */
.site-header {
  border-bottom: 1px solid #eee;
}
.site-header-inner {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.site-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.2px;
}
.site-title:hover { text-decoration: none; }

.main-nav ul {
  list-style: none;
  display: flex;
  gap: 28px;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
.main-nav a {
  color: var(--ink);
  font-size: 1.06rem;
  font-weight: 500;
}
.main-nav a:hover, .main-nav a.active { color: var(--gold); text-decoration: none; }

/* Footer */
.site-footer {
  border-top: 1px solid #eee;
  margin-top: 80px;
  padding: 32px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}
.site-footer .footer-tagline { font-style: italic; margin: 4px 0 8px; }

/* Main content spacing */
main { padding: 56px 0 40px; }

/* Divider */
.divider {
  border: none;
  border-top: 2px solid var(--gold-light);
  margin: 36px 0;
}

/* Buttons */
.btn-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 24px 0;
}
.btn-row.left { justify-content: flex-start; }

.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 2px solid transparent;
  cursor: pointer;
  text-align: center;
}
.btn-filled {
  background: var(--gold-light);
  color: var(--ink);
}
.btn-filled:hover { background: #b89540; text-decoration: none; }

.btn-outline {
  background: transparent;
  border-color: var(--gold);
  color: var(--gold);
}
.btn-outline:hover { background: rgba(184,134,11,0.08); text-decoration: none; }

.btn-disabled {
  background: var(--disabled-bg);
  color: var(--muted);
  border: none;
  cursor: default;
  pointer-events: none;
}

/* Quote block */
.pull-quote {
  border-left: 3px solid var(--gold-light);
  padding: 12px 20px;
  margin: 28px 0;
  font-size: 1.1rem;
  color: var(--gold);
  font-style: normal;
}
.pull-quote.plain { color: var(--ink); }

/* Book row (Books page + Home featured) */
.book-row {
  display: flex;
  gap: 32px;
  padding: 32px 0;
  align-items: flex-start;
}
.book-row .cover {
  flex: 0 0 18%;
  max-width: 180px;
}
.book-row .cover img {
  width: 100%;
  border-radius: 2px;
}
.placeholder-cover {
  width: 100%;
  min-height: 260px;
  background: var(--placeholder-bg);
  border: 1px solid var(--placeholder-border);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  border-radius: 2px;
}
.book-row .details { flex: 1 1 auto; }

.stars { color: var(--gold); margin: 6px 0; }
.stars .rating-note { color: var(--body-gray); font-size: 0.95rem; }

.meta-line { color: var(--body-gray); font-size: 0.9rem; margin: 8px 0; }
.price-line { color: var(--ink); font-size: 1.25rem; margin: 10px 0; }
.status-line { font-style: italic; color: var(--body-gray); margin: 6px 0 16px; }

@media (max-width: 640px) {
  .book-row { flex-direction: column; }
  .book-row .cover { max-width: 220px; }
  h1 { font-size: 1.9rem; }
}

/* CTA callout box */
.cta-box {
  background: var(--cream);
  padding: 40px 32px;
  border-radius: 4px;
  text-align: center;
  margin: 40px 0;
}
.cta-box h3 { color: var(--ink); font-size: 1.3rem; }
.cta-box p { color: var(--body-gray); max-width: 560px; margin: 0 auto 20px; }

.chapter-continue {
  color: var(--muted);
  font-size: 0.9rem;
  font-style: italic;
  margin-top: 8px;
}

.chapter-block { padding: 32px 0; }
.chapter-subtitle { font-style: italic; color: var(--body-gray); margin: 0 0 18px; }

/* Forms */
form.site-form {
  margin-top: 24px;
}
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
  font-size: 0.95rem;
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group textarea,
.form-group input[type="file"] {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: inherit;
  font-size: 1rem;
}
.form-group textarea { min-height: 140px; resize: vertical; }
.form-group input:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--gold);
}
.required { color: var(--gold); }

.cross-link {
  font-style: italic;
  color: var(--body-gray);
  margin: 16px 0 8px;
  font-size: 0.95rem;
}
.cross-link a { font-weight: 600; }

.form-message {
  padding: 14px 18px;
  border-radius: 4px;
  margin-bottom: 20px;
  font-size: 0.95rem;
}
.form-message.success { background: #eaf6ea; color: #2b6a2b; border: 1px solid #bfe3bf; }
.form-message.error { background: #fbeaea; color: #a33; border: 1px solid #f0c0c0; }

/* honeypot field - hidden from humans */
.hp-field { position: absolute; left: -9999px; top: -9999px; }


/* About page author intro */
.author-intro {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin: 20px 0 8px;
}
.author-photo {
  flex: 0 0 160px;
  width: 160px;
  height: auto;
  border: 2px solid var(--gold-light);
  border-radius: 2px;
}
.author-intro p { margin-top: 0; }
.author-name { color: var(--gold); font-size: 1.15rem; }

/* Home: debut book section */
.section-kicker {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 6px;
}
.debut-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 48px;
  align-items: center;
  margin-top: 24px;
}
.debut-details h3 { font-size: 1.6rem; margin-bottom: 4px; }
.release-subtitle { font-style: italic; color: var(--ink); margin: 0 0 6px; }
.clamp-5 {
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}
.read-more { font-weight: 600; }
.release-question { color: var(--gold); font-weight: 600; }

.upcoming { text-align: center; }
.upcoming ul {
  list-style: none;
  padding: 0;
  margin: 16px 0 8px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.upcoming li {
  border: 1px solid var(--gold-light);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 0.9rem;
  color: var(--ink);
}

/* Book detail page */
.book-hero { text-align: center; }
.book-hero .flip-hint { margin-bottom: 8px; }
.chapter-list { padding-left: 20px; }
.chapter-list li { margin: 6px 0; }
.mini-author { display: flex; gap: 18px; align-items: center; }
.mini-author img { width: 90px; height: auto; border: 2px solid var(--gold-light); border-radius: 2px; }
.mini-author p { margin: 0; }

/* 3D flip-through book */
.book-stage {
  --w: 230px;
  --h: calc(var(--w) * 1.503);
  width: calc(var(--w) * 2);
  height: var(--h);
  margin: 0 auto;
  perspective: 2000px;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.book-stage:focus-visible { outline: 2px solid var(--gold); outline-offset: 8px; }
.book {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform: translateX(calc(var(--w) / -2));
  transition: transform 0.7s ease;
  font-size: max(calc(var(--w) / 16), 10px);
}
.book.open { transform: translateX(0); }
.book.end { transform: translateX(calc(var(--w) / 2)); }

/* page-edge stacks under the leaves */
.book::before, .book::after {
  content: "";
  position: absolute;
  top: 0;
  width: var(--w);
  height: 100%;
  background: #F4ECDA;
  border-radius: 2px;
  transition: opacity 0.4s;
}
.book::before {
  left: var(--w);
  box-shadow: 2px 2px 0 #E9DFC6, 4px 4px 0 #DDD1B4, 10px 14px 28px rgba(0,0,0,0.28);
}
.book::after {
  left: 0;
  opacity: 0;
  box-shadow: -2px 2px 0 #E9DFC6, -4px 4px 0 #DDD1B4, -10px 14px 28px rgba(0,0,0,0.28);
}
.book.open::after { opacity: 1; }
.book.end::before { opacity: 0; }

.leaf {
  position: absolute;
  top: 0;
  left: var(--w);
  width: var(--w);
  height: 100%;
  transform-style: preserve-3d;
  transform-origin: left center;
  transition: transform 0.7s cubic-bezier(0.45, 0.05, 0.3, 1);
}
/* turned state transform is set inline by flipbook.js */

.face {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  overflow: hidden;
  border-radius: 2px;
}
.face.back { transform: rotateY(180deg); }
.cover-face { background: #000; }
.cover-face img { width: 100%; height: 100%; object-fit: cover; }

.page-face {
  background: #FBF7EE;
  color: #2A2118;
  font-family: "EB Garamond", Georgia, "Times New Roman", serif;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 14% 12%;
}
/* gutter shading toward the spine */
.face.front.page-face { background-image: linear-gradient(to right, rgba(0,0,0,0.14), rgba(0,0,0,0) 12%); }
.face.back.page-face  { background-image: linear-gradient(to left,  rgba(0,0,0,0.14), rgba(0,0,0,0) 12%); }
.page-face p { margin: 0.35em 0; line-height: 1.3; }
.pg-kicker { font-size: 0.8em; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); }
.pg-title  { font-size: 1.55em; font-weight: 600; color: #1F1B16; }
.pg-sub    { font-size: 0.95em; font-style: italic; color: #5A4E40; }
.pg-quote  { font-size: 1.15em; font-style: italic; color: #1F1B16; }
.pg-ornament { color: var(--gold-light); font-size: 1.2em; }

.flip-hint { text-align: center; font-size: 0.85rem; color: var(--muted); font-style: italic; margin: 18px 0 0; }
.hint-touch { display: none; }
@media (hover: none) {
  .hint-hover { display: none; }
  .hint-touch { display: inline; }
}
@media (prefers-reduced-motion: reduce) {
  .book, .leaf { transition-duration: 0.01s; }
}

@media (max-width: 860px) {
  .debut-grid { grid-template-columns: 1fr; gap: 24px; }
}
@media (max-width: 520px) {
  .book-stage { --w: calc((100vw - 56px) / 2); }
  .author-intro { flex-direction: column; }
  .author-photo { width: 180px; flex-basis: auto; }
}

/* About page: justified text blocks with straight edges, like the book's back cover */
.about-page p {
  text-align: justify;
  text-justify: inter-word;
  -webkit-hyphens: auto;
  hyphens: auto;
  text-wrap: pretty;
}
.about-page .author-intro { align-items: stretch; }
.about-page .author-intro p { align-self: center; }
.about-page .pull-quote { text-align: left; }
@media (max-width: 520px) {
  .about-page p { text-align: left; -webkit-hyphens: manual; hyphens: manual; }
}

/* Header logo */
.site-logo { display: inline-flex; align-items: center; line-height: 0; }
.site-logo img { height: 72px; width: auto; }
@media (max-width: 520px) { .site-logo img { height: 56px; } }

/* Mobile menu: logo + menu button, links open in a full-width panel */
.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--ink);
  transition: transform 0.25s, opacity 0.2s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

@media (max-width: 900px) {
  .site-header { position: relative; }
  .site-header-inner { flex-wrap: nowrap; padding: 12px 20px; }
  .nav-toggle { display: inline-flex; }
  .main-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 50;
    background: var(--white);
    border-bottom: 1px solid #eee;
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
  }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; gap: 0; padding: 4px 20px 12px; }
  .main-nav li + li { border-top: 1px solid #eee; }
  .main-nav a { display: block; padding: 15px 2px; font-size: 1.1rem; }
}

/* Where to Buy */
.where-to-buy {
  text-align: center;
  padding: 40px 24px;
  margin: 40px auto;
  max-width: 760px;
  border-top: 1px solid var(--gold-light);
  border-bottom: 1px solid var(--gold-light);
}
.wtb-kicker { font-size: 0.78rem; font-weight: 600; letter-spacing: 3px; text-transform: uppercase; color: var(--gold); margin: 0 0 8px; }
.where-to-buy h2 { margin: 0 0 22px; }
.wtb-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.wtb-link {
  display: inline-block;
  padding: 14px 22px;
  background: var(--ink);
  color: #FFFDF8;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid var(--ink);
  transition: background 0.2s, color 0.2s;
}
.wtb-link:hover { background: transparent; color: var(--ink); text-decoration: none; }

.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; margin: 12px 0 14px; font-size: 0.9rem; }
.footer-links a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.footer-links a:hover { color: var(--gold); }
