/* Quastoriva — hoja de estilos única. */

:root {
  --paper: #f3ede2;
  --paper-2: #ebe3d4;
  --card: #fbf8f2;
  --ink: #1d1914;
  --ink-2: #4a4238;
  --muted: #6e6457;
  --line: #d6cbb8;
  --line-2: #c2b49c;
  --accent: #a8321c;
  --accent-ink: #fff8f0;
  --brass: #8a6a24;
  --focus: #1f5fbf;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "URW Palladio L", P052, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --radius: 10px;
  --wrap: 1180px;
  --narrow: 760px;
  --gutter: clamp(16px, 4vw, 40px);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16130f;
    --paper-2: #1e1a15;
    --card: #211c17;
    --ink: #efe7da;
    --ink-2: #cdc2b1;
    --muted: #a39683;
    --line: #3a332a;
    --line-2: #4d4438;
    --accent: #e0745a;
    --accent-ink: #1a0f0b;
    --brass: #d1ad5f;
    --focus: #8ab4ff;
  }
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-decoration-color: var(--line-2); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); text-decoration-color: currentColor; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }

h1, h2, h3 { line-height: 1.15; font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 4.6vw, 3.25rem); margin: 0.2em 0 0.35em; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.wrap.narrow, .narrow { max-width: calc(var(--narrow) + 2 * var(--gutter)); }

.mono { font-family: var(--mono); font-size: 0.92em; letter-spacing: 0.02em; }
.muted { color: var(--muted); }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 10;
  background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 6px;
  font-family: var(--sans); font-size: 0.95rem;
}
.skip:focus { top: 12px; }

/* Cabecera */

.site-header { border-bottom: 1px solid var(--line); background: var(--paper); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 76px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand:hover { color: inherit; }
.brand-mark { width: 38px; height: 38px; color: var(--accent); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-size: 1.45rem; font-weight: 600; letter-spacing: 0.01em; }
.brand-tag { font-family: var(--sans); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin-top: 3px; }

.main-nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.main-nav a {
  display: block; padding: 8px 12px; border-radius: 999px;
  font-family: var(--sans); font-size: 0.95rem; text-decoration: none; color: var(--ink-2);
}
.main-nav a:hover { background: var(--paper-2); color: var(--ink); }
.main-nav a[aria-current="page"] { color: var(--ink); background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--line); }

@media (max-width: 860px) {
  .header-inner { flex-direction: column; align-items: stretch; gap: 6px; padding-block: 14px 8px; }
  .main-nav { margin-inline: calc(-1 * var(--gutter)); overflow-x: auto; scrollbar-width: none; }
  .main-nav::-webkit-scrollbar { display: none; }
  .main-nav ul { padding-inline: calc(var(--gutter) - 12px); width: max-content; }
}

/* Elementos comunes */

.kicker {
  font-family: var(--sans); font-size: 0.78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent); margin: 0;
}
.kicker a { text-decoration: none; }

.lead-summary { font-size: 1.25rem; color: var(--ink-2); max-width: 62ch; margin: 0 0 1em; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.section-title {
  font-size: 1.6rem; margin: 0 0 20px; padding-top: 14px;
  border-top: 2px solid var(--ink);
}
.section-head { border-top: 2px solid var(--ink); padding-top: 14px; margin-bottom: 20px; }
.section-head .section-title { flex: 1; border-top: 0; padding-top: 0; margin: 0; }
.more {
  font-family: var(--sans); font-size: 0.92rem; font-weight: 600; text-decoration: none; color: var(--accent);
}
.more::after { content: " →"; }

.block { margin-block: clamp(48px, 7vw, 88px); }
.page-head { padding-block: 28px 12px; }

.button {
  display: inline-block; padding: 12px 20px; border-radius: 999px;
  background: var(--ink); color: var(--paper); text-decoration: none;
  font-family: var(--sans); font-weight: 600; font-size: 0.98rem;
  border: 1px solid var(--ink);
}
.button:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.button--ghost { background: transparent; color: var(--ink); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

.crumbs ol { display: flex; flex-wrap: wrap; gap: 4px 0; list-style: none; margin: 0 0 18px; padding: 0; font-family: var(--sans); font-size: 0.85rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-inline: 8px; color: var(--line-2); }
.crumbs a { text-decoration: none; }
.crumbs [aria-current] { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 36ch; }
@media (max-width: 600px) {
  .crumbs [aria-current] { display: none; }
  .brand-tag { display: none; }
}

/* Portada */

.home-hero { border-bottom: 1px solid var(--line); background:
  radial-gradient(1200px 400px at 85% 0%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%); }
.home-hero-grid { display: grid; grid-template-columns: 1.25fr 0.75fr; gap: clamp(24px, 5vw, 72px); align-items: center; padding-block: clamp(40px, 7vw, 96px); }
.home-hero h1 { font-size: clamp(2.3rem, 5.4vw, 4rem); max-width: 16ch; }
.hero-art { color: var(--ink-2); max-width: 340px; justify-self: center; width: 100%; }
.hero-art .art-accent { color: var(--accent); }
.hero-art .art-ball { color: var(--brass); }
@media (prefers-reduced-motion: no-preference) {
  .hero-art .art-ball { animation: ball 9s ease-in-out infinite; }
  @keyframes ball {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-60px, -70px); }
    50% { transform: translate(-20px, -150px); }
    75% { transform: translate(-90px, 40px); }
  }
}
@media (max-width: 760px) {
  .home-hero-grid { grid-template-columns: 1fr; }
  .hero-art { max-width: 220px; justify-self: start; order: -1; }
}

.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.room {
  display: flex; flex-direction: column; gap: 6px; padding: 20px 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none;
}
.room svg { width: 46px; height: 46px; color: var(--accent); margin-bottom: 8px; }
.room-name { font-size: 1.15rem; font-weight: 600; line-height: 1.2; }
.room-count { font-family: var(--sans); font-size: 0.85rem; color: var(--muted); }
.room:hover { border-color: var(--ink); color: inherit; }

.feature {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
.feature-media { background: var(--paper-2); min-height: 260px; max-height: 460px; display: grid; place-items: center; color: var(--accent); overflow: hidden; }
.feature-media img { width: 100%; height: 100%; object-fit: cover; }
.feature-media svg { width: 120px; }
.feature-body { padding: clamp(24px, 4vw, 48px); }
.feature-body h2 { font-size: 2rem; margin: 10px 0 4px; }
.feature-body h2 a { text-decoration: none; }
@media (max-width: 760px) { .feature { grid-template-columns: 1fr; } }

.tl-strip { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.tl-strip li { border-top: 3px solid var(--accent); padding-top: 12px; display: flex; flex-direction: column; gap: 4px; font-size: 1rem; }
.tl-strip-year { font-family: var(--mono); font-size: 1.1rem; color: var(--ink); }
@media (max-width: 860px) { .tl-strip { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .tl-strip { grid-template-columns: 1fr; } }

.callout { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(24px, 4vw, 44px); max-width: calc(var(--wrap) - 2 * var(--gutter)); }
.callout h2 { margin-top: 0; font-size: 1.6rem; }
.method { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.method h3 { font-size: 1.15rem; margin: 0 0 6px; }
.method p { margin: 0; color: var(--ink-2); font-size: 1rem; }
@media (max-width: 760px) { .method { grid-template-columns: 1fr; } }
@media (max-width: 1240px) { .callout { margin-inline: var(--gutter); width: auto; } }

/* Tarjetas */

.grid { display: grid; gap: 22px; }
.grid--cards { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.grid--placards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.card { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; position: relative; }
.card:hover { border-color: var(--line-2); }
.card-media { aspect-ratio: 16 / 9; background: var(--paper-2); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-media--plain { display: grid; place-items: center; background:
  repeating-linear-gradient(135deg, transparent 0 14px, color-mix(in srgb, var(--line) 55%, transparent) 14px 15px), var(--paper-2); }
.card-media--plain span { font-family: var(--sans); font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); background: var(--card); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); }
.card-body { padding: 18px 20px 22px; }
.card-title { font-size: 1.3rem; margin: 8px 0 8px; }
.card-title a { text-decoration: none; }
.card-title a::after { content: ""; position: absolute; inset: 0; }
.card-text { margin: 0; color: var(--ink-2); font-size: 1rem; line-height: 1.5; }

.placard { position: relative; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.placard:hover { border-color: var(--line-2); }
.placard-media { aspect-ratio: 4 / 3; background: var(--paper-2); overflow: hidden; }
.placard-media img { width: 100%; height: 100%; object-fit: cover; }
.placard-media--plain { display: grid; place-items: center; color: var(--accent); }
.placard-media--plain svg { width: 72px; }
.placard-body { padding: 14px 16px 18px; border-top: 1px solid var(--line); }
.placard-number { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); margin: 0; letter-spacing: 0.06em; }
.placard-title { font-size: 1.2rem; margin: 4px 0 2px; }
.placard-title a { text-decoration: none; }
.placard-title a::after { content: ""; position: absolute; inset: 0; }
.placard-meta { font-family: var(--sans); font-size: 0.88rem; color: var(--ink-2); margin: 0; }
.placard-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.placard-tags span { font-family: var(--sans); font-size: 0.74rem; padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }

/* Filtros */

.filters { margin-bottom: 26px; display: grid; gap: 12px; }
.filter-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filter-label { font-family: var(--sans); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); min-width: 56px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: 500 0.9rem var(--sans); padding: 7px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-2); background: transparent; color: var(--ink-2);
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.filter-count, .empty { font-family: var(--sans); font-size: 0.9rem; color: var(--muted); margin: 0; }
[hidden] { display: none !important; }

/* Artículo */

.article-head { padding-top: 28px; }
.article-head h1 { max-width: 22ch; }
.byline { font-family: var(--sans); font-size: 0.92rem; color: var(--muted); margin: 0 0 28px; }

.hero-figure { margin: 0 0 36px; }
.hero-figure img { width: auto; max-width: 100%; max-height: min(72vh, 640px); margin-inline: auto; border-radius: var(--radius); background: var(--paper-2); }
figcaption { font-family: var(--sans); font-size: 0.86rem; color: var(--muted); margin-top: 10px; line-height: 1.45; }
figcaption .credit { display: block; font-size: 0.78rem; opacity: 0.9; margin-top: 2px; }

.article-grid { display: grid; grid-template-columns: 220px minmax(0, var(--narrow)); gap: 56px; justify-content: center; }
.article-aside { position: relative; }
.toc { position: sticky; top: 24px; font-family: var(--sans); font-size: 0.88rem; }
.toc-title { text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.74rem; color: var(--muted); margin: 0 0 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc li a { display: block; padding: 5px 0 5px 14px; text-decoration: none; color: var(--ink-2); line-height: 1.35; }
.toc li a:hover { color: var(--accent); }
@media (max-width: 1000px) {
  .article-grid { grid-template-columns: minmax(0, 1fr); gap: 0; max-width: calc(var(--narrow) + 2 * var(--gutter)); }
  .toc { position: static; margin-bottom: 28px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
  .toc ol { border: 0; }
  .toc li a { padding-left: 0; }
}

.prose { font-size: 1.15rem; line-height: 1.7; }
.prose > * + * { margin-top: 1.1em; }
.prose p { margin-block: 0; }
.prose p + p { margin-top: 1em; }
.prose .lead { font-size: 1.32rem; line-height: 1.55; color: var(--ink-2); }
.prose h2 { font-size: 1.75rem; margin-top: 2.1em; margin-bottom: 0.2em; scroll-margin-top: 20px; }
.prose h3 { font-size: 1.3rem; margin-top: 1.6em; margin-bottom: 0.1em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.35em; }
.prose a { text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.prose blockquote { margin-inline: 0; padding: 4px 0 4px 22px; border-left: 3px solid var(--accent); font-style: italic; color: var(--ink-2); }
.prose figure { margin-block: 2em; margin-inline: 0; }
.prose figure img { border-radius: var(--radius); background: var(--paper-2); width: auto; max-width: 100%; max-height: 80vh; margin-inline: auto; }
.prose figure.diagram { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); }
.prose figure.diagram svg { width: 100%; max-width: 620px; margin-inline: auto; }
.prose figure.diagram svg text { fill: currentColor; stroke: none; font-family: var(--sans); }
.prose aside.note { padding: 18px 22px; background: var(--paper-2); border-radius: var(--radius); border-left: 4px solid var(--brass); font-size: 1.02rem; }
.prose aside.note p + p { margin-top: 0.6em; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius); }
.prose table, table.credits { border-collapse: collapse; width: 100%; font-family: var(--sans); font-size: 0.92rem; line-height: 1.45; }
.prose th, .prose td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose thead th { background: var(--paper-2); font-weight: 600; }
.prose tr:last-child td { border-bottom: 0; }
table.credits td:last-child { white-space: nowrap; }

.sources { margin-top: 3em !important; padding-top: 6px; border-top: 2px solid var(--ink); font-family: var(--sans); font-size: 0.95rem; line-height: 1.5; }
.sources h2 { font-family: var(--serif); font-size: 1.35rem; margin-top: 0.8em; }
.sources ul { padding-left: 1.1em; }
.sources a { word-break: break-word; }

.related { margin-block: 64px; }

/* Ficha */

.exhibit-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 56px; align-items: start; }
.exhibit-main { max-width: var(--narrow); }
.exhibit-aside { position: sticky; top: 24px; }
.facts { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; font-family: var(--sans); }
.facts-title { text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.74rem; color: var(--muted); margin: 0 0 8px; }
.facts dl { margin: 0; }
.facts dl > div { padding: 10px 0; border-top: 1px solid var(--line); }
.facts dl > div:first-child { border-top: 0; }
.facts dt { font-size: 0.78rem; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-size: 0.98rem; }
@media (max-width: 1000px) {
  .exhibit-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; max-width: calc(var(--narrow) + 2 * var(--gutter)); }
  .exhibit-aside { position: static; order: -1; }
}

/* Fabricantes */

.maker-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0 32px; }
.maker { padding: 18px 0 20px; border-bottom: 1px solid var(--line); }
.maker h3 { font-size: 1.35rem; margin: 0 0 2px; }
.maker h3 a { text-decoration: none; }
.maker-meta { font-family: var(--sans); font-size: 0.86rem; color: var(--muted); margin: 0 0 8px; }
.maker p:last-child { margin: 0; color: var(--ink-2); font-size: 1rem; }

.topic-links { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 4px 0 28px; }
.topic-links a { display: block; font-family: var(--sans); font-size: 0.9rem; padding: 7px 14px; border: 1px solid var(--line-2); border-radius: 999px; text-decoration: none; }
.topic-links a:hover { border-color: var(--ink); }

/* Cronología */

.timeline { list-style: none; margin: 8px 0 64px; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 104px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { display: grid; grid-template-columns: 88px 1fr; gap: 32px; padding: 14px 0 22px; position: relative; }
.tl-item::before { content: ""; position: absolute; left: 99px; top: 22px; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 2px solid var(--accent); }
.tl-item[data-region="espana"]::before { background: var(--accent); }
.tl-year { font-family: var(--mono); font-size: 1.05rem; text-align: right; margin: 12px 0 0; color: var(--ink); }
.tl-region { font-family: var(--sans); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin: 0; }
.tl-title { font-size: 1.3rem; margin: 2px 0 6px; }
.tl-title a { text-decoration: none; }
.tl-body > p { margin: 0; color: var(--ink-2); font-size: 1.05rem; }
.tl-body .tl-source { font-family: var(--sans); font-size: 0.84rem; color: var(--muted); margin-top: 8px; }
@media (max-width: 600px) {
  .timeline::before { left: 5px; }
  .tl-item { grid-template-columns: 1fr; gap: 0; padding-left: 28px; }
  .tl-item::before { left: 0; top: 20px; }
  .tl-year { text-align: left; margin-top: 14px; }
}

/* Página */

.page .prose h2 { font-size: 1.45rem; }
.not-found { padding-block: 80px; }

/* Pie */

.site-footer { margin-top: 96px; border-top: 1px solid var(--line); background: var(--paper-2); font-family: var(--sans); font-size: 0.92rem; color: var(--ink-2); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; padding-block: 48px 32px; }
.footer-brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 1.3rem; font-weight: 600; color: var(--ink); margin: 0 0 10px; }
.footer-brand svg { width: 28px; color: var(--accent); }
.footer-about p { max-width: 42ch; }
.footer-title { font-family: var(--sans); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin: 6px 0 12px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.linklike { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.linklike:hover { color: var(--accent); text-decoration: underline; }
.footer-base { border-top: 1px solid var(--line); padding-block: 18px 28px; font-size: 0.84rem; color: var(--muted); }
.footer-base p { margin: 0; }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-about { grid-column: 1 / -1; } }
@media (max-width: 420px) { .footer-grid { grid-template-columns: 1fr; } }

@media print {
  .site-header, .site-footer, .article-aside, .related, .toc { display: none; }
  body { background: #fff; color: #000; }
}
