/* ── Google Fonts ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Dancing+Script:wght@600;700&family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400&display=swap');

/* ── Custom Properties ───────────────────────────────────────────────────── */
:root {
  /* ── Paleta del logo ─────────────────────────────────────── */
  --color-primary:       #CC0000;
  --color-primary-dark:  #990000;
  --color-primary-light: #FF3333;
  --color-dark:          #1A1A1A;
  --color-light:         #FFFFFF;

  /* ── Tokens semánticos ───────────────────────────────────── */
  --bg:          #F7F5F0;
  --surface:     var(--color-light);
  --text:        var(--color-dark);
  --text-muted:  #6B6459;
  --accent:      var(--color-primary);
  --accent-dark: var(--color-primary-dark);
  --accent2:     var(--color-primary-dark);
  --border:      #E0DBD1;
  --shadow:      0 2px 12px rgba(26,26,26,.08);
  --shadow-hover:0 6px 24px rgba(26,26,26,.14);
  --radius:      6px;

  --font-display:'Playfair Display', Georgia, serif;
  --font-script: 'Dancing Script', cursive;
  --font-body:   'Inter', system-ui, sans-serif;
  --font-mono:   'JetBrains Mono', monospace;

  --container:   1200px;
  --gap:         clamp(1rem, 4vw, 2rem);
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }
button { cursor: pointer; font: inherit; border: none; background: none; }

/* ── Typography ──────────────────────────────────────────────────────────── */
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.25; }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: clamp(1.15rem, 2vw, 1.5rem); }
h4 { font-size: 1.1rem; }
p  { max-width: 70ch; }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.container {
  width: min(var(--container), 100%);
  padding-inline: 1rem;
  margin-inline: auto;
}
@media (min-width: 640px)  { .container { padding-inline: 1.5rem; } }
@media (min-width: 1024px) { .container { padding-inline: 2rem; } }

/* ── Site Header / Navigation ────────────────────────────────────────────── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 1rem;
}
.site-logo {
  font-family: var(--font-script);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}
.site-logo:hover { text-decoration: none; color: var(--accent-dark); }

.site-nav { display: flex; align-items: center; gap: 1.5rem; }
.site-nav a {
  font-size: .9rem;
  font-weight: 500;
  color: var(--text);
  transition: color .2s;
}
.site-nav a:hover, .site-nav a.active {
  color: var(--accent);
  text-decoration: none;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  transition: .3s;
}

@media (max-width: 639px) {
  .nav-toggle { display: flex; }
  .site-nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 1rem 1.5rem;
    gap: 1rem;
  }
  .site-nav.open { display: flex; }
}

/* ── Site Footer ─────────────────────────────────────────────────────────── */
.site-footer {
  margin-top: 5rem;
  background: var(--text);
  color: #ccc;
  padding: 3rem 0 1.5rem;
  font-size: .875rem;
}
.site-footer .container {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .site-footer .container { grid-template-columns: repeat(3, 1fr); }
}
.footer-brand { font-family: var(--font-display); font-size: 1.2rem; color: #fff; }
.footer-links { display: flex; flex-direction: column; gap: .5rem; }
.footer-links a { color: #ccc; }
.footer-links a:hover { color: #fff; }
.footer-bottom {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,.1);
  text-align: center;
  font-size: .8rem;
  color: #999;
}

/* ── Hero ────────────────────────────────────────────────────────────────── */
.hero {
  padding: clamp(3rem, 8vw, 7rem) 0;
  text-align: center;
}
.hero__eyebrow {
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent2);
  margin-bottom: .75rem;
}
.hero__title { color: var(--accent); margin-bottom: 1rem; }
.hero__subtitle {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-muted);
  max-width: 55ch;
  margin-inline: auto;
  margin-bottom: 2rem;
}
.hero__actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4em;
  padding: .6em 1.4em;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  transition: background .2s, transform .15s, box-shadow .2s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-outline {
  border: 2px solid var(--accent);
  color: var(--accent);
  background: transparent;
}
.btn-outline:hover { background: var(--accent); color: #fff; }
.btn-secondary {
  background: var(--accent2);
  color: #fff;
}
.btn-secondary:hover { background: var(--color-primary); }

/* ── Section ─────────────────────────────────────────────────────────────── */
.section { padding: clamp(2.5rem, 6vw, 5rem) 0; }
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.section-title { font-family: var(--font-display); }
.section-link { font-size: .9rem; color: var(--accent); }

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

.book-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow .25s, transform .25s;
  display: flex;
  flex-direction: column;
}
.book-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}
.book-card__cover {
  aspect-ratio: 2/3;
  overflow: hidden;
  background: var(--border);
}
.book-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s;
}
.book-card:hover .book-card__cover img { transform: scale(1.04); }
.book-card__body { padding: 1rem; flex: 1; display: flex; flex-direction: column; gap: .25rem; }
.book-card__title {
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.3;
  color: var(--text);
}
.book-card__author { font-size: .8rem; color: var(--text-muted); }
.book-card__sello {
  margin-top: auto;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent2);
}

/* Book card list view */
.books-list .book-card {
  flex-direction: row;
  max-height: 140px;
}
.books-list .book-card__cover {
  aspect-ratio: unset;
  width: 90px;
  min-width: 90px;
  flex-shrink: 0;
}
.books-list .book-card__body { justify-content: center; }

/* ── Author Card ─────────────────────────────────────────────────────────── */
.authors-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.author-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  box-shadow: var(--shadow);
  text-align: center;
  transition: box-shadow .25s, transform .25s;
}
.author-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-3px); }
.author-card__photo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto .75rem;
  background: var(--border);
}
.author-card__photo img { width: 100%; height: 100%; object-fit: cover; }
.author-card__name { font-family: var(--font-display); font-size: .95rem; }

/* ── Blog Card ───────────────────────────────────────────────────────────── */
.blog-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px)  { .blog-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .blog-grid { grid-template-columns: repeat(3, 1fr); } }

.blog-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: box-shadow .25s, transform .25s;
}
.blog-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-3px); }
.blog-card__img {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--border);
}
.blog-card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.blog-card:hover .blog-card__img img { transform: scale(1.04); }
.blog-card__body { padding: 1.25rem; flex: 1; display: flex; flex-direction: column; gap: .5rem; }
.blog-card__date { font-size: .78rem; color: var(--text-muted); }
.blog-card__title { font-family: var(--font-display); font-size: 1.1rem; line-height: 1.35; }
.blog-card__excerpt { font-size: .875rem; color: var(--text-muted); flex: 1; }
.blog-card__link { margin-top: .5rem; font-size: .85rem; font-weight: 600; color: var(--accent); }

/* ── Catalog ─────────────────────────────────────────────────────────────── */
.catalog-controls {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
  margin-bottom: 2rem;
  padding: 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.catalog-controls input[type="search"] {
  flex: 1;
  min-width: 180px;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
  background: var(--bg);
  color: var(--text);
}
.catalog-controls select {
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
.view-toggle { display: flex; gap: .4rem; margin-left: auto; }
.view-btn {
  padding: .4rem .6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .85rem;
  color: var(--text-muted);
  transition: .2s;
}
.view-btn.active, .view-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Pagination ──────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  gap: .5rem;
  margin-top: 3rem;
}
.pagination a, .pagination span {
  padding: .45rem .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
  color: var(--text);
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.pagination .current { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Single Book Page ────────────────────────────────────────────────────── */
.book-detail {
  display: grid;
  gap: var(--gap);
  grid-template-columns: 1fr;
  margin-block: 3rem;
}
@media (min-width: 640px) { .book-detail { grid-template-columns: 280px 1fr; } }
@media (min-width: 1024px) { .book-detail { grid-template-columns: 340px 1fr; } }

.book-detail__cover {
  position: relative;
}
.book-detail__cover-img {
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  cursor: zoom-in;
  width: 100%;
}
.book-detail__back-cover {
  margin-top: .75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  width: 100%;
}
.book-detail__info { display: flex; flex-direction: column; gap: 1rem; }
.book-detail__title { font-family: var(--font-display); font-size: clamp(1.5rem, 3vw, 2rem); }
.book-detail__meta { display: flex; flex-wrap: wrap; gap: .5rem; font-size: .85rem; color: var(--text-muted); }
.book-detail__meta span { display: flex; align-items: center; gap: .3em; }
.book-detail__meta a { color: var(--accent); }
.book-detail__label { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--accent2); }
.book-detail__isbn { font-family: var(--font-mono); font-size: .85rem; color: var(--text-muted); }
.book-detail__sinopsis { line-height: 1.8; }
.book-detail__actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: .5rem; }

/* ── Lightbox ────────────────────────────────────────────────────────────── */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.lightbox.open { display: flex; }
.lightbox__img { max-height: 90vh; max-width: 90vw; border-radius: var(--radius); }
.lightbox__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  padding: .25rem .5rem;
  background: rgba(0,0,0,.5);
  border-radius: var(--radius);
}

/* ── Related Books ───────────────────────────────────────────────────────── */
.related { margin-top: 4rem; }
.related .books-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

/* ── Author Detail ───────────────────────────────────────────────────────── */
.author-detail {
  display: grid;
  gap: var(--gap);
  grid-template-columns: 1fr;
  margin-block: 3rem;
}
@media (min-width: 640px) { .author-detail { grid-template-columns: 200px 1fr; } }
.author-detail__photo {
  width: 100%;
  max-width: 200px;
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow-hover);
}

/* ── Blog Post ───────────────────────────────────────────────────────────── */
.post-header { margin-bottom: 2rem; }
.post-header__img { border-radius: var(--radius); margin-bottom: 1.5rem; max-height: 460px; width: 100%; object-fit: cover; }
.post-date { font-size: .85rem; color: var(--text-muted); margin-bottom: .5rem; }
.post-title { font-family: var(--font-display); font-size: clamp(1.75rem, 4vw, 2.75rem); }
.post-content { line-height: 1.9; }
.post-content h2, .post-content h3, .post-content h4 { margin-block: 1.5rem .5rem; }
.post-content p { margin-bottom: 1rem; max-width: none; }
.post-content img { border-radius: var(--radius); margin-block: 1rem; max-width: 100%; }
.post-content a { color: var(--accent); }
.post-content ul, .post-content ol { margin-left: 1.5rem; margin-bottom: 1rem; }
.post-content li { margin-bottom: .3rem; }
.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  font-style: italic;
  color: var(--text-muted);
  margin-block: 1rem;
}
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.post-nav a {
  font-size: .875rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  max-width: 45%;
}
.post-nav__label { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; }
.post-nav__title { color: var(--text); font-weight: 500; }

/* ── Quequén Section ─────────────────────────────────────────────────────── */
.quequen-hero {
  background: var(--text);
  color: #fff;
  padding: 4rem 0;
  text-align: center;
}
.quequen-hero img { max-height: 80px; margin-inline: auto; margin-bottom: 1.5rem; }
.quequen-hero h1 { font-family: var(--font-display); color: #fff; margin-bottom: .75rem; }
.quequen-hero p  { color: #ccc; max-width: 60ch; margin-inline: auto; }

/* ── Contact ─────────────────────────────────────────────────────────────── */
.contact-grid {
  display: grid;
  gap: 3rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) { .contact-grid { grid-template-columns: 1fr 1fr; } }

.contact-info { display: flex; flex-direction: column; gap: 1rem; }
.contact-info a { color: var(--accent); word-break: break-all; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1.25rem; }
.form-label { font-size: .875rem; font-weight: 600; }
.form-control {
  padding: .55rem .8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: .9rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color .2s;
}
.form-control:focus { outline: none; border-color: var(--accent); }
textarea.form-control { resize: vertical; min-height: 120px; }
.form-submit { display: flex; justify-content: flex-end; }

/* ── Alert messages ──────────────────────────────────────────────────────── */
.alert {
  padding: .85rem 1.1rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: .9rem;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  gap: .5rem;
  align-items: center;
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb__sep { color: var(--border); }

/* ── Empty State ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}
.empty-state p { font-size: 1.1rem; }

/* ── Fade-in on scroll ───────────────────────────────────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .5s ease, transform .5s ease;
}
.fade-in.visible { opacity: 1; transform: none; }

/* ── Utilities ───────────────────────────────────────────────────────────── */
.text-accent  { color: var(--accent); }
.text-muted   { color: var(--text-muted); }
.text-center  { text-align: center; }
.mt-sm  { margin-top: .5rem; }
.mt-md  { margin-top: 1rem; }
.mt-lg  { margin-top: 2rem; }
.mb-md  { margin-bottom: 1rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
