/* =========================================================
   Quequén Casa Editora — Estilos principales
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,300&display=swap');

/* ----- Custom properties ----- */
:root {
  --c-bg:       #FFFFFF;
  --c-bg-alt:   #F8F8F6;
  --c-text:     #1A1A1A;
  --c-muted:    #6B6B6B;
  --c-accent:   #2D5A3D;
  --c-accent2:  #B8935A;
  --c-border:   #DDD9D0;
  --c-white:    #FFFFFF;

  --ff-display: 'Cormorant Garamond', Georgia, serif;
  --ff-body:    'DM Sans', system-ui, sans-serif;

  --radius:     4px;
  --shadow:     0 2px 12px rgba(0,0,0,.07);
  --transition: .2s ease;

  --max-w:      1200px;
  --gutter:     16px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--ff-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--c-text);
  background: var(--c-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }
.site-header, .site-footer { flex-shrink: 0; }

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--c-accent); }
ul { list-style: none; }

/* ----- Typography ----- */
h1, h2, h3, h4 {
  font-family: var(--ff-display);
  font-weight: 400;
  line-height: 1.2;
}
h1 { font-size: clamp(2.2rem, 6vw, 4rem); }
h2 { font-size: clamp(1.6rem, 4vw, 2.6rem); }
h3 { font-size: clamp(1.2rem, 3vw, 1.8rem); }
h4 { font-size: 1.2rem; }

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

/* ----- Layout helpers ----- */
.container {
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: 5rem; }
.section--alt { background: var(--c-bg-alt); }

.section__header {
  text-align: center;
  margin-bottom: 3rem;
}
.section__header h2 { margin-bottom: .5rem; }
.section__header p { color: var(--c-muted); max-width: 50ch; margin-inline: auto; }

/* ----- Buttons ----- */
.btn {
  display: inline-block;
  padding: .6rem 1.5rem;
  border-radius: var(--radius);
  font-family: var(--ff-body);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
}
.btn-primary {
  background: var(--c-accent);
  color: var(--c-white);
  border-color: var(--c-accent);
}
.btn-primary:hover { background: #1e3f2b; border-color: #1e3f2b; color: var(--c-white); }

.btn-outline {
  background: transparent;
  color: var(--c-accent);
  border-color: var(--c-accent);
}
.btn-outline:hover { background: var(--c-accent); color: var(--c-white); }

.btn-gold {
  background: var(--c-accent2);
  color: var(--c-white);
  border-color: var(--c-accent2);
}
.btn-gold:hover { background: #9a7a48; border-color: #9a7a48; color: var(--c-white); }

/* ----- Header / Nav ----- */
.site-header {
  background: var(--c-white);
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 1rem;
}
.site-logo {
  font-family: var(--ff-display);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--c-accent);
  letter-spacing: .03em;
}
.site-logo span { display: block; font-size: .7rem; font-weight: 300; letter-spacing: .12em; text-transform: uppercase; color: var(--c-muted); }

.nav-menu { display: flex; gap: 2rem; align-items: center; }
.nav-menu a { font-size: .9rem; font-weight: 500; transition: var(--transition); }
.nav-menu a:hover, .nav-menu a.active { color: var(--c-accent); }

.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: .25rem; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--c-text); margin-bottom: 5px; transition: var(--transition); }
.nav-toggle span:last-child { margin-bottom: 0; }

/* ----- Hero ----- */
.hero {
  background: var(--c-bg-alt);
  padding: clamp(4rem, 10vw, 8rem) 0 clamp(5rem, 12vw, 10rem);
  text-align: center;
  border-bottom: 1px solid var(--c-border);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('../img/bilbioteca1.jpg') no-repeat center / cover;
  opacity: .35;
  pointer-events: none;
}
.hero .container { position: relative; z-index: 1; }
.hero__eyebrow {
  display: inline-block;
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--c-accent2);
  margin-bottom: 1rem;
}
.hero h1 {
  font-style: italic;
  margin-bottom: 1.25rem;
  color: var(--c-accent);
}
.hero p {
  font-size: 1.1rem;
  color: var(--c-text);
  max-width: 52ch;
  margin-inline: auto;
  margin-bottom: 2rem;
}
.hero__actions { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }

/* ----- Blog view toggle ----- */
.blog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.view-toggle { display: flex; gap: .35rem; }
.view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-white);
  cursor: pointer;
  color: var(--c-muted);
  transition: var(--transition);
  padding: 0;
}
.view-btn:hover { border-color: var(--c-accent); color: var(--c-accent); }
.view-btn.active { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }

/* ----- Blog list (row) view ----- */
.blog-list { display: flex; flex-direction: column; gap: 1rem; }
.blog-list .blog-card { display: flex; flex-direction: row; overflow: hidden; }
.blog-list .blog-card__img { flex: 0 0 200px; aspect-ratio: auto; height: 140px; }
.blog-list .blog-card__body { flex: 1; }
@media (max-width: 500px) {
  .blog-list .blog-card { flex-direction: column; }
  .blog-list .blog-card__img { flex: none; height: auto; aspect-ratio: 16/9; }
}

/* ----- Book cards ----- */
.books-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
}
@media (min-width: 1024px) { .books-grid { grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); } }

.book-card {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  background: var(--c-white);
}
.book-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); }

.book-card__cover {
  aspect-ratio: 2/3;
  overflow: hidden;
  background: var(--c-bg-alt);
}
.book-card__cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.book-card:hover .book-card__cover img { transform: scale(1.03); }

.book-card__body { padding: 1rem; }
.book-card__title { font-family: var(--ff-display); font-size: 1.05rem; margin-bottom: .25rem; }
.book-card__author { font-size: .82rem; color: var(--c-muted); }
.book-card__year { font-size: .78rem; color: var(--c-accent2); margin-top: .4rem; }

/* Catálogo list view */
.books-list .book-card {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}
.books-list .book-card__cover { aspect-ratio: unset; width: 80px; flex-shrink: 0; }
.books-list .book-card__cover img { width: 80px; height: 120px; }

/* ----- Blog cards ----- */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
}
.blog-card {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--c-white);
  transition: var(--transition);
}
.blog-card:hover { box-shadow: var(--shadow); }
.blog-card__img { aspect-ratio: 16/9; overflow: hidden; background: var(--c-bg-alt); }
.blog-card__img img { width: 100%; height: 100%; object-fit: cover; }
.blog-card__body { padding: 1.25rem; }
.blog-card__date { font-size: .75rem; color: var(--c-muted); margin-bottom: .4rem; }
.blog-card__title { font-family: var(--ff-display); font-size: 1.2rem; margin-bottom: .5rem; }
.blog-card__excerpt { font-size: .88rem; color: var(--c-muted); margin-bottom: 1rem; }
.blog-card__link { font-size: .85rem; color: var(--c-accent); font-weight: 500; }
.blog-card__link:hover { text-decoration: underline; }

/* ----- Author cards ----- */
.authors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 2rem;
  text-align: center;
}
.author-card { cursor: pointer; transition: var(--transition); }
.author-card:hover { color: var(--c-accent); }
.author-card__photo {
  width: 120px; height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin-inline: auto;
  margin-bottom: .75rem;
  border: 3px solid var(--c-border);
  background: var(--c-bg-alt);
}
.author-card__name { font-family: var(--ff-display); font-size: 1.1rem; }

/* ----- Ficha de libro ----- */
.book-detail {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 3rem;
  align-items: start;
}
.book-detail__cover img {
  border-radius: var(--radius);
  cursor: zoom-in;
  box-shadow: var(--shadow);
}
.book-detail__meta { display: flex; flex-direction: column; gap: 1.5rem; }
.book-detail__tags { display: flex; flex-wrap: wrap; gap: .5rem; }
.tag {
  display: inline-block;
  padding: .25rem .75rem;
  border: 1px solid var(--c-border);
  border-radius: 20px;
  font-size: .78rem;
  color: var(--c-muted);
}
.book-detail__actions { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ----- Catalogue filters ----- */
.catalogue-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 2.5rem;
}
.catalogue-controls input,
.catalogue-controls select {
  padding: .5rem .9rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-family: var(--ff-body);
  font-size: .9rem;
  background: var(--c-white);
  color: var(--c-text);
}
.catalogue-controls input { flex: 1; min-width: 200px; }
.view-toggle { display: flex; gap: .25rem; margin-left: auto; }
.view-toggle button {
  padding: .4rem .6rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  transition: var(--transition);
}
.view-toggle button.active { background: var(--c-accent); color: #fff; border-color: var(--c-accent); }

/* ----- Pagination ----- */
.pagination { display: flex; justify-content: center; gap: .5rem; margin-top: 3rem; }
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding-inline: .6rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: .88rem;
}
.pagination a:hover { background: var(--c-bg-alt); }
.pagination .current { background: var(--c-accent); color: #fff; border-color: var(--c-accent); }

/* ----- Lightbox ----- */
.lightbox-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 999; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.lightbox-overlay.open { opacity: 1; pointer-events: all; }
.lightbox-overlay img { max-width: 90vw; max-height: 90vh; border-radius: var(--radius); }
.lightbox-close {
  position: absolute; top: 1rem; right: 1.5rem;
  color: #fff; font-size: 2rem; cursor: pointer; line-height: 1;
}

/* ----- Contact ----- */
.contact-grid { display: grid; grid-template-columns: 1fr 1.5fr; gap: 3rem; }
.contact-info dt { font-weight: 500; }
.contact-info dd { color: var(--c-muted); margin-bottom: 1rem; }
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: .88rem; font-weight: 500; margin-bottom: .4rem; }
.form-group input,
.form-group textarea {
  width: 100%; padding: .6rem .9rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-family: var(--ff-body);
  font-size: .95rem;
  color: var(--c-text);
  background: var(--c-white);
  transition: border-color var(--transition);
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--c-accent);
}
.form-group textarea { resize: vertical; min-height: 130px; }

/* ----- Alerts ----- */
.alert {
  padding: .85rem 1.1rem;
  border-radius: var(--radius);
  font-size: .9rem;
  margin-bottom: 1.5rem;
}
.alert-info { background: #e8f4ec; color: #1e4029; border: 1px solid #b2d8bc; }
.alert-error { background: #fdecea; color: #7b1d18; border: 1px solid #f2b4b0; }
.alert-success { background: #e8f4ec; color: #1e4029; border: 1px solid #b2d8bc; }

/* ----- Nosotros ----- */
.nosotros-content { max-width: 68ch; margin-inline: auto; font-size: 1.05rem; line-height: 1.8; }
.nosotros-content img.logo { display: block; max-width: 200px; margin: 0 auto 2.5rem; }

/* ----- Footer ----- */
.site-footer {
  margin-top: 0;
  background: var(--c-text);
  padding: 1.5rem 1rem;
  font-size: .8rem;
  color: #999;
  text-align: center;
}
.footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
}
.footer__social {
  display: flex;
  gap: 1.1rem;
  align-items: center;
}
.footer__social a {
  color: #999;
  transition: color .2s;
  display: flex;
  align-items: center;
}
.footer__social a:hover { color: #fff; text-decoration: none; }
.footer__copy { margin: 0; }

/* ----- Page header ----- */
.page-header {
  background: var(--c-bg-alt);
  border-bottom: 1px solid var(--c-border);
  padding-block: 3rem;
  text-align: center;
}
.page-header h1 { font-style: italic; color: var(--c-accent); }
.page-header p { color: var(--c-muted); margin-top: .5rem; }

/* ----- No results ----- */
.no-results {
  text-align: center; padding-block: 4rem;
  color: var(--c-muted);
}
.no-results p { font-size: 1.1rem; }

/* ----- Responsive ----- */
@media (max-width: 1024px) {
  .book-detail { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .nav-menu { display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--c-white); flex-direction: column; padding: 1.5rem;
    border-bottom: 1px solid var(--c-border); gap: 1.25rem; }
  .nav-menu.open { display: flex; }
  .nav-toggle { display: flex; flex-direction: column; }
  .site-header .container { position: relative; flex-wrap: wrap; }
  .books-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
  .blog-grid { grid-template-columns: 1fr; }
  .authors-grid { grid-template-columns: repeat(3, 1fr); }
  .section { padding-block: 3rem; }
  .hero { padding-block: 4rem 3rem; }
}
