/* =========================================
   BASE Y COMPONENTES DEL REDISEÑO 2026
   Solo la cargan las páginas ya migradas (index.html, books.html y
   libro.html), en lugar de style.css. Todo color, letra y medida sale de tokens.css.
   Reglas: un color plano, líneas de 1 px en vez de sombras, radios 4/6/10/12,
   íconos de icons.svg y movimiento solo si comunica.
   ========================================= */
*, *::before, *::after { box-sizing: border-box; }
html {
    scroll-padding-top: calc(var(--header-h) + 16px);
    -webkit-text-size-adjust: 100%;
}
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 400 var(--fs-body)/var(--lh-body) var(--serif);
    font-optical-sizing: auto;
    -webkit-font-smoothing: antialiased;
    overflow-x: clip;
}
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
ul, ol, dl, dd, figure { margin: 0; padding: 0; }
a { color: var(--brand-text); text-underline-offset: 3px; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.vh {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* BANDAS: el fondo de cada sección sale de un token; nunca dos seguidas iguales */
.band { background: var(--band, var(--bg)); color: var(--text); padding-block: var(--section-y); }
.band--surface { --band: var(--bg-2); }
.band--alt { --band: var(--bg-3); }

/* TIPOGRAFÍA */
.d1 { font-size: var(--fs-d1); line-height: var(--lh-d1); letter-spacing: var(--track-d1); max-width: 17ch; }
.d2 { font-size: var(--fs-d2); line-height: var(--lh-d2); letter-spacing: var(--track-d2); max-width: 22ch; }
.d3 { font-size: var(--fs-d3); line-height: var(--lh-d3); letter-spacing: var(--track-d3); }
.lede { font-size: var(--fs-lede); color: var(--text-2); max-width: 56ch; }
.muted { color: var(--text-2); max-width: 62ch; }
.close { color: var(--brand-text); }
.eyebrow {
    font: 500 var(--fs-label)/1.4 var(--mono);
    text-transform: uppercase;
    letter-spacing: var(--track-label);
    color: var(--text-2);
}
.mono { font-family: var(--mono); font-size: var(--fs-mono); letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }

.section-head { display: grid; gap: 14px; margin-bottom: 40px; }
.section-head .lede { margin-top: 4px; }

/* BOTONES: 48 px, radio 6, un primario por pantalla */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: var(--btn-h);
    padding: 0 20px 1px;
    border: 1px solid transparent;
    border-radius: var(--r-6);
    background: transparent;
    color: var(--text);
    font: 600 1rem/1.1 var(--serif);
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--dur-hover) var(--ease), border-color var(--dur-hover) var(--ease), color var(--dur-hover) var(--ease), transform var(--dur-press) var(--ease);
}
.btn--primary { background: var(--brand); color: var(--on-brand); }
.btn--primary:hover { background: var(--brand-hover); }
.btn--ghost { border-color: var(--line-2); }
.btn--ghost:hover { border-color: var(--text); }
.btn:active { transform: translateY(0.5px) scale(0.99); }
.btn:disabled { cursor: not-allowed; opacity: 1; color: var(--text-3); border-color: var(--line); background: transparent; }
.btn--small { min-height: var(--tap); padding: 0 14px 1px; font-size: 0.9375rem; }
.btn--block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* BOTÓN DE TEXTO: acciones menores con aspecto de enlace (quitar filtros, quitar un libro) */
.link-btn {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    padding: 0;
    border: 0;
    background: none;
    color: var(--brand-text);
    font: 500 0.9375rem/1.2 var(--serif);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

/* CAMPOS */
.field { display: grid; gap: 6px; min-width: 0; }
.field label { font-size: 0.9375rem; font-weight: 500; }
.field .opt { margin-left: 6px; font: 400 0.75rem/1 var(--mono); color: var(--text-3); }
.input {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid var(--line-2);
    border-radius: var(--r-6);
    background: var(--bg-2);
    color: var(--text);
    transition: border-color var(--dur-hover) var(--ease);
}
.input:hover { border-color: var(--text-3); }
.input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
textarea.input { min-height: 96px; padding-block: 12px; resize: vertical; }
.row2 { display: grid; gap: 16px; }
@media (min-width: 640px) { .row2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* LISTA DE DATOS: rótulo en mono a la izquierda, dato a la derecha, líneas de 1 px */
.facts { border-top: 1px solid var(--line); }
.facts > div {
    display: grid;
    grid-template-columns: 7rem minmax(0, 1fr);
    gap: 12px;
    padding-block: 12px 13px;
    border-bottom: 1px solid var(--line);
}
.facts dt {
    padding-top: 3px;
    font: 500 var(--fs-label)/1.4 var(--mono);
    text-transform: uppercase;
    letter-spacing: var(--track-label);
    color: var(--text-3);
}
.facts dd { font-variant-numeric: tabular-nums; }

/* ETIQUETA DE ESTADO (no es píldora: radio 4) */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid var(--line-2);
    border-radius: var(--r-4);
    font: 400 var(--fs-mono)/1 var(--mono);
    color: var(--text-2);
}
.tag::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--seal);
}
.tag:empty { display: none; }

/* TARJETA DE LIBRO
   La portada se asienta sobre --cover-ground (blanco): las del catálogo traen
   fondo blanco y se funden solas, sin mix-blend-mode (con portadas WebP
   transparentes el multiply a veces no se pinta). Los mockups 3D se llenan
   con `--s`, el `scale` de data.js. */
.books { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px 16px; }
@media (min-width: 900px) { .books { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 44px 24px; } }
.book { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.book__cover {
    position: relative;
    display: block;
    aspect-ratio: 4 / 5;
    max-width: 100%;
    margin-bottom: 10px;
    overflow: hidden;
    border-radius: var(--r-6);
    background: var(--cover-ground);
}
.book__cover img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: scale(var(--s, 1));
}
.book__title { font-size: 0.875rem; font-weight: 600; line-height: 1.3; letter-spacing: 0.03em; overflow-wrap: anywhere; }
.book__title a { color: var(--text); text-decoration: none; }
.book__title a:hover { text-decoration: underline; }
.book__author { font-size: 0.9375rem; line-height: 1.35; color: var(--text-2); }
.book__price { margin: 2px 0 12px; font: 400 0.9375rem/1.3 var(--mono); font-variant-numeric: tabular-nums; }
.book__price--out { color: var(--bad); }
.book .btn { margin-top: auto; }

/* SELLO ALKIMIA: única excepción al color único; marca los libros propios */
.seal {
    position: absolute;
    top: 8px;
    left: 8px;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--seal);
    color: var(--on-seal);
}
.seal .icon { width: 16px; height: 16px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
