@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Inter:wght@300;400;500;600&display=swap');

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

:root {
  --gold: #c9a84c;
  --gold-dark: #a8873a;
  --black: #1a1a1a;
  --gray: #666;
  --light-gray: #e8e8e8;
  --bg: #fafafa;
  --white: #ffffff;
}

html { scroll-behavior: smooth; }

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

/* ===== HEADER ===== */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(250, 250, 250, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--light-gray);
  padding: 1.2rem 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--black);
  text-decoration: none;
  letter-spacing: -0.5px;
}
.site-logo span { color: var(--gold); }

nav ul { list-style: none; display: flex; gap: 2.5rem; }
nav a {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--black);
  text-decoration: none;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.2s;
}
nav a:hover { color: var(--gold); }

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 5px;
}
.menu-toggle span {
  display: block;
  width: 24px; height: 2px;
  background: var(--black);
  transition: all 0.3s;
}

/* ===== LANGUAGE TOGGLE ===== */
.lang-toggle {
  background: none;
  border: 1px solid var(--light-gray);
  color: var(--black);
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.lang-toggle:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* ===== PAGE CONTENT ===== */
.page-content { padding-top: 72px; }

/* ===== HERO (index) ===== */
.hero {
  padding: 8rem 2.5rem 5rem;
  max-width: 860px;
  margin: 0 auto;
}
.hero-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.8rem;
}
.hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.6rem, 5vw, 4.2rem);
  font-weight: 700;
  line-height: 1.12;
  color: var(--black);
  margin-bottom: 1.8rem;
}
.hero p {
  font-size: 1.05rem;
  color: var(--gray);
  max-width: 580px;
  line-height: 1.85;
}

/* ===== SECTION ===== */
.books-section {
  padding: 3rem 2.5rem 6rem;
  max-width: 1200px;
  margin: 0 auto;
}
.section-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.5rem;
}
.section-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.9rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--black);
}
.section-subtitle {
  font-size: 0.85rem;
  color: var(--gray);
  margin-bottom: 3.5rem;
}

/* ===== BOOKS GRID ===== */
.books-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem 2rem;
}

/* last two items centered when there are 5 */
.books-grid .book-card:nth-child(4) { grid-column: 1; }
.books-grid .book-card:nth-child(5) { grid-column: 2; }

/* ===== BOOK CARD ===== */
.book-card {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform 0.3s ease;
}
.book-card:hover { transform: translateY(-5px); }
.book-card:hover .book-card-overlay { opacity: 1; }
.book-card:hover .book-cover img { transform: scale(1.04); }

.book-cover {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3/4;
  background: var(--light-gray);
  margin-bottom: 1.2rem;
}
.book-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
  display: block;
}
.book-card-overlay {
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 26, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.book-card-overlay span {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: white;
  border: 1px solid rgba(255,255,255,0.7);
  padding: 0.6rem 1.5rem;
}

.book-year {
  font-size: 0.72rem;
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}
.book-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
  color: var(--black);
}
.book-excerpt {
  font-size: 0.83rem;
  color: var(--gray);
  line-height: 1.75;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.badge-novo {
  font-family: 'Inter', sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid var(--gold);
  padding: 0.15rem 0.45rem;
  vertical-align: middle;
  margin-left: 0.5rem;
  position: relative;
  top: -2px;
}

/* ===== DIVIDER ===== */
.divider {
  width: 50px;
  height: 1px;
  background: var(--gold);
  margin: 4rem auto;
}

/* ===== FOOTER ===== */
.site-footer {
  border-top: 1px solid var(--light-gray);
  padding: 3rem 2rem;
  text-align: center;
}
.footer-logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 1.2rem;
}
.footer-logo span { color: var(--gold); }
.footer-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1.2rem;
}
.footer-links a {
  font-size: 0.75rem;
  color: var(--gray);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--gold); }
.footer-copy { font-size: 0.72rem; color: #aaa; }

/* ===== BIO PAGE ===== */
.bio-text {
  margin-top: 2.5rem;
  max-width: 650px;
}
.bio-text p {
  font-size: 1.05rem;
  line-height: 1.85;
  color: #333;
  margin-bottom: 1.6rem;
}
.bio-text em {
  font-style: italic;
  color: var(--black);
}

/* ===== BOOK PAGE ===== */

/* Sticky bar */
.sticky-bar {
  position: fixed;
  top: 72px;
  right: 2.5rem;
  z-index: 99;
}
.btn-buy {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--gold);
  color: white;
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.85rem 1.6rem;
  transition: background 0.2s, transform 0.2s;
  box-shadow: 0 4px 20px rgba(201,168,76,0.3);
}
.btn-buy:hover {
  background: var(--gold-dark);
  transform: translateY(-1px);
}
.btn-buy.em-breve {
  background: #999;
  cursor: default;
  box-shadow: none;
  pointer-events: none;
}

/* Book hero */
.book-hero {
  padding: 7rem 2.5rem 3.5rem;
  max-width: 780px;
  margin: 0 auto;
}
.book-hero .book-year { font-size: 0.8rem; margin-bottom: 0.8rem; }
.book-hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.5rem, 5vw, 3.8rem);
  font-weight: 700;
  line-height: 1.12;
  margin-bottom: 1.8rem;
  color: var(--black);
}
.book-hero .description {
  font-size: 1rem;
  color: var(--gray);
  line-height: 1.95;
  max-width: 680px;
}

/* Gallery */
.gallery-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 2.5rem 7rem;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.gallery-item {
  cursor: pointer;
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--light-gray);
  position: relative;
}
.gallery-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease, filter 0.3s ease;
  display: block;
}
.gallery-item:hover img {
  transform: scale(1.06);
  filter: brightness(0.82);
}

/* Card horizontal — sem corte, para o livro Ofício na home */
.book-cover--horizontal {
  aspect-ratio: 4/3;
}
.book-cover--horizontal img {
  object-fit: contain;
  background: var(--black);
}

/* Foto de abertura — horizontal, sem corte, fora do grid */
.foto-abertura {
  width: 100%;
  background: var(--black);
  cursor: pointer;
  overflow: hidden;
  margin-bottom: 6px;
}
.foto-abertura img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 88vh;
  object-fit: contain;
  transition: filter 0.3s ease;
}
.foto-abertura:hover img {
  filter: brightness(0.88);
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 8, 0.96);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.lightbox.active { opacity: 1; pointer-events: all; }
.lightbox-img {
  max-width: 86vw;
  max-height: 86vh;
  object-fit: contain;
  transition: opacity 0.2s ease;
  display: block;
}
.lightbox-close {
  position: absolute;
  top: 1.5rem; right: 2rem;
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 2.2rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}
.lightbox-close:hover { color: white; }
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 1px solid rgba(255,255,255,0.25);
  color: white;
  width: 50px; height: 50px;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.lightbox-nav:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.6);
}
.lightbox-prev { left: 1.5rem; }
.lightbox-next { right: 1.5rem; }
.lightbox-counter {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.12em;
}

/* Other books */
.other-books {
  background: #f2f2f2;
  padding: 5rem 2.5rem;
}
.other-books-inner { max-width: 1100px; margin: 0 auto; }
.other-books h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  margin-bottom: 2.5rem;
  color: var(--black);
}
.other-books-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}
.other-books .book-title { font-size: 1.05rem; }

/* ===== CONTACT PAGE ===== */
.contact-section {
  max-width: 600px;
  margin: 0 auto;
  padding: 8rem 2.5rem 6rem;
}
.contact-section h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2.8rem;
  margin-bottom: 0.5rem;
}
.contact-section .subtitle {
  color: var(--gray);
  margin-bottom: 3.5rem;
  font-size: 0.95rem;
}
.form-group { margin-bottom: 1.5rem; }
.form-group label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--black);
  margin-bottom: 0.5rem;
}
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid var(--light-gray);
  background: var(--white);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  color: var(--black);
  outline: none;
  transition: border-color 0.2s;
  resize: vertical;
}
.form-group input:focus,
.form-group textarea:focus { border-color: var(--gold); }
.btn-submit {
  background: var(--black);
  color: white;
  border: none;
  padding: 1rem 2.5rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-submit:hover { background: var(--gold); }
.contact-info {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--light-gray);
}
.contact-info p { font-size: 0.88rem; color: var(--gray); margin-bottom: 0.4rem; }
.contact-info a { color: var(--gold); text-decoration: none; }
.social-links { display: flex; gap: 1rem; margin-top: 1.2rem; }
.social-links a {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--black);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border: 1px solid var(--light-gray);
  transition: all 0.2s;
}
.social-links a:hover { border-color: var(--gold); color: var(--gold); }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .books-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .books-grid .book-card:nth-child(4),
  .books-grid .book-card:nth-child(5) { grid-column: auto; }
  .other-books-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Desktop nav: fixed, centred in the header band */
@media (min-width: 769px) {
  #main-nav {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    height: 72px;
    display: flex;
    align-items: center;
    z-index: 101;
  }
}

@media (max-width: 768px) {
  .site-header { padding: 1rem 1.5rem; }

  /* Mobile: nav hidden by default */
  #main-nav { display: none; }

  /* Mobile: dropdown below header when open */
  #main-nav.open {
    display: block;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    z-index: 9999;
    background-color: #fafafa;
    background-color: var(--bg);
    border-bottom: 1px solid var(--light-gray);
    box-shadow: 0 6px 18px rgba(0,0,0,0.07);
  }
  #main-nav.open ul {
    display: flex;
    flex-direction: column;
    list-style: none;
    padding: 0.25rem 1.5rem 0.75rem;
    gap: 0;
  }
  #main-nav.open ul li {
    border-bottom: 1px solid var(--light-gray);
  }
  #main-nav.open ul li:last-child { border-bottom: none; }
  #main-nav.open a {
    display: block;
    padding: 0.9rem 0;
    font-size: 0.9rem;
  }
  .menu-toggle { display: flex; }

  .hero { padding: 5rem 1.5rem 3rem; }
  .books-section { padding: 2rem 1.5rem 4rem; }
  .gallery-section { padding: 1rem 1rem 4rem; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .book-hero { padding: 5.5rem 1.5rem 2.5rem; }

  .sticky-bar {
    position: fixed;
    top: auto; bottom: 0;
    left: 0; right: 0;
    padding: 0;
  }
  .btn-buy {
    width: 100%;
    justify-content: center;
    padding: 1.1rem;
    border-radius: 0;
    box-shadow: none;
    border-top: 1px solid rgba(201,168,76,0.3);
  }
  .btn-buy:hover { transform: none; }

  .lightbox-prev { left: 0.5rem; }
  .lightbox-next { right: 0.5rem; }
  .lightbox-nav { width: 38px; height: 38px; font-size: 1.1rem; }
}

@media (max-width: 500px) {
  .books-grid { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 4px; }
  .other-books-grid { grid-template-columns: repeat(2, 1fr); }
}
