:root {
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* ---------- Theme ---------- */
body {
  --overlay: rgba(22, 18, 10, 0.55);
  --ink: #f4ecda;
  --ink-soft: #d2c4a2;
  --paper: rgba(30, 24, 13, 0.3);
  --paper-deep: rgba(34, 28, 15, 0.62);
  --card: rgba(48, 39, 21, 0.6);
  --accent: #b0832f;
  --accent-dark: #8c6723;
  --gold: #d2a955;
  --line: rgba(230, 212, 165, 0.28);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
/* Per-page full backgrounds */
body.page-home   { --bg-image: url("../images/backgrounds/bg3.png"); }
body.page-books  { --bg-image: url("../images/backgrounds/theme3-books.png"); }
body.page-about  { --bg-image: url("../images/backgrounds/theme3-about.png"); }
body.page-blog   { --bg-image: url("../images/backgrounds/theme3-blog.png"); }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink);
  background:
    linear-gradient(var(--overlay), var(--overlay)),
    var(--bg-image) center top / cover no-repeat,
    #1a160c;
  line-height: 1.6;
  touch-action: pan-y;
}

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper-deep);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand a {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.01em;
}
.brand .tagline {
  display: block;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--ink-soft);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.98rem;
  font-weight: 600;
}
.nav a:hover { color: var(--accent); }
.nav a.active { color: var(--accent); }

.lang-switch {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.lang-switch:hover { background: var(--gold); color: #fff; border-color: var(--gold); }

/* ---------- Layout ---------- */
.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem;
}
.wrap.narrow { max-width: 760px; }

/* ---------- Hero (home) ---------- */
.hero {
  text-align: center;
  padding: 3.5rem 1.25rem 2.5rem;
  background: linear-gradient(180deg, rgba(34, 28, 15, 0.55), rgba(30, 24, 13, 0.15));
  border-bottom: 1px solid var(--line);
}
.hero h1 {
  font-family: var(--serif);
  font-size: 2.4rem;
  margin: 0.4rem 0;
  color: var(--ink);
}
.hero .byline {
  font-size: 1.05rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 1.2rem;
}
.hero .intro {
  max-width: 640px;
  margin: 0 auto;
  color: var(--ink-soft);
}
.portrait {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--gold);
  box-shadow: 0 6px 18px rgba(0,0,0,0.3);
  margin-bottom: 0.5rem;
}

/* ---------- Typography ---------- */
h1, h2, h3 { font-family: var(--serif); line-height: 1.3; }
h2 { font-size: 1.6rem; margin: 0 0 1.25rem; }
h3 { font-size: 1.15rem; margin: 0 0 0.5rem; }
p { margin: 0 0 1rem; }
a { color: var(--accent); }

.section { margin-bottom: 3rem; }

.rule {
  border: 0;
  border-top: 2px solid var(--gold);
  width: 70px;
  margin: 0 0 1.4rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff !important;
  text-decoration: none;
  font-weight: 600;
  padding: 0.65rem 1.5rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.98rem;
  font-family: var(--sans);
}
.btn:hover { background: var(--accent-dark); }
.btn.gold { background: var(--gold); }
.btn.gold:hover { background: var(--accent); }

/* ---------- Books grid ---------- */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1.75rem;
}
.book-card {
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.book-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(0,0,0,0.45);
}
.book-card img {
  width: 100%;
  max-width: 190px;
  margin: 0 auto 0.8rem;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  aspect-ratio: 3 / 4;
  object-fit: contain;
  background: var(--paper-deep);
}
.book-card .title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  flex-grow: 1;
  color: var(--ink);
}
.book-card .buy {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.book-card .buy:hover { text-decoration: underline; }

/* ---------- Home book strip ---------- */
.strip { display: flex; gap: 1rem; flex-wrap: wrap; }
.strip img {
  width: 92px;
  height: 122px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

/* ---------- Newsletter ---------- */
.newsletter {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 2rem;
  text-align: center;
}
.newsletter input[type="email"] {
  padding: 0.65rem 1rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.98rem;
  min-width: 260px;
  max-width: 100%;
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
}
.newsletter form { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }
.note { font-size: 0.85rem; color: var(--ink-soft); margin-top: 0.8rem; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: transparent;
  padding: 1.5rem 1.25rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.site-footer a { color: var(--accent); text-decoration: none; }

/* ---------- Blog ---------- */
.post {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}
.post .date { color: var(--ink-soft); font-size: 0.85rem; }

/* ---------- Language switching ---------- */
html[lang="en"] .te { display: none; }
html:not([lang="en"]) .en { display: none; }

/* ---------- Responsive ---------- */
@media (min-width: 1440px) {
  body { font-size: 17.5px; }
  .hero h1 { font-size: 2.9rem; }
}

@media (max-width: 640px) {
  body.page-home {
    background-size: auto 120%;
    background-position: center 12%;
  }
  .hero h1 { font-size: 1.8rem; }
  .header-inner { justify-content: center; text-align: center; }
  .nav { justify-content: center; }
  .books-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; }
}
