/*
Theme Name: NOSVALE
Theme URI: https://nosvale.com/
Author: NOSVALE / IANJAMBRE
Description: Tema editorial accesible para las guías públicas de NOSVALE.
Version: 1.2.5
Requires at least: 7.1
Requires PHP: 8.3
Text Domain: nosvale
*/

:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #5b6472;
  --gold: #f2b705;
  --gold-dark: #9a6d00;
  --paper: #ffffff;
  --wash: #f6f7f9;
  --line: #dfe3e8;
  --max: 1140px;
  --reading: 760px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}
a { color: #725000; text-decoration-thickness: .08em; text-underline-offset: .16em; }
a:hover { color: var(--ink); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
img { max-width: 100%; height: auto; }

.skip-link {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 1000;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
}
.skip-link:focus { top: 16px; }

.site-header { border-bottom: 1px solid var(--line); background: rgba(255,255,255,.97); }
.site-header__inner {
  width: min(calc(100% - 32px), var(--max));
  min-height: 82px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand img { width: 48px; height: 48px; }
.brand span { font-size: .98rem; font-weight: 800; letter-spacing: .24em; }
.primary-menu { display: flex; gap: 22px; margin: 0; padding: 0; list-style: none; }
.primary-menu a { color: var(--ink); font-weight: 700; text-decoration: none; }
.primary-menu a:hover { text-decoration: underline; text-decoration-color: var(--gold); }

.site-main { min-height: calc(100vh - 170px); }
.hero {
  width: min(calc(100% - 32px), var(--max));
  margin: 0 auto;
  padding: clamp(56px, 9vw, 108px) 0 clamp(38px, 6vw, 70px);
}
.hero h1, .article-header h1 {
  max-width: 850px;
  margin: 0;
  font-size: clamp(2.35rem, 7vw, 5.25rem);
  line-height: 1.01;
  letter-spacing: -.055em;
}
.hero > p:not(.eyebrow) { max-width: 680px; margin: 24px 0 0; color: var(--muted); font-size: 1.22rem; }
.eyebrow { margin: 0 0 15px; color: var(--gold-dark); font-size: .78rem; font-weight: 850; letter-spacing: .18em; text-transform: uppercase; }
.eyebrow a { color: inherit; text-decoration: none; }

.content-grid {
  width: min(calc(100% - 32px), var(--max));
  margin: 0 auto;
  padding: 0 0 90px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
.card { padding: clamp(24px, 4vw, 38px); border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: 0 14px 40px rgba(17,24,39,.055); }
.card h2 { margin: 5px 0 12px; font-size: clamp(1.45rem, 3vw, 2rem); line-height: 1.14; letter-spacing: -.03em; }
.card h2 a { color: var(--ink); text-decoration: none; }
.card h2 a:hover { text-decoration: underline; text-decoration-color: var(--gold); }
.card__meta { margin: 0; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.read-more { display: inline-block; margin-top: 7px; font-weight: 800; }

.article-shell { width: min(calc(100% - 32px), var(--max)); margin: 0 auto; padding: clamp(42px, 6vw, 72px) 0 74px; }
.page-shell { width: min(calc(100% - 32px), var(--reading)); }
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: 0 0 42px;
  color: var(--muted);
  font-size: .83rem;
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs [aria-current="page"] { max-width: 48ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, var(--reading)) minmax(250px, 310px);
  align-items: start;
  justify-content: space-between;
  gap: clamp(36px, 6vw, 70px);
}
.article-main { min-width: 0; }
.article-header { margin-bottom: 48px; }
.article-header h1 { font-size: clamp(2.25rem, 6vw, 4.4rem); }
.article-date { margin: 22px 0 0; color: var(--muted); font-size: .92rem; }
.article-content { font-family: Georgia, "Times New Roman", serif; font-size: 1.08rem; }
.article-content .article-lead { margin: 0 0 42px; color: #313846; font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: clamp(1.18rem, 3vw, 1.45rem); line-height: 1.52; }
.article-content h2, .article-content h3 { margin: 2.4em 0 .75em; color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, sans-serif; line-height: 1.18; letter-spacing: -.025em; }
.article-content h2 { font-size: 1.8rem; }
.article-content h3 { font-size: 1.42rem; }
.article-content p, .article-content ul, .article-content ol { margin: 0 0 1.25em; }
.article-content li + li { margin-top: .42em; }
.article-content table { width: 100%; margin: 28px 0 36px; border-collapse: collapse; font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: .92rem; }
.article-content th, .article-content td { padding: 12px 13px; border: 1px solid #cfd5dc; text-align: left; vertical-align: top; }
.article-content th { background: #fff8dc; }
.article-content tbody tr:nth-child(even) { background: var(--wash); }
.diagram-description { margin: 28px 0; padding: 18px 20px; border-left: 5px solid var(--gold); background: #fffbeb; font-family: Inter, ui-sans-serif, system-ui, sans-serif; }
.article-content code { padding: .1em .32em; border-radius: 4px; background: var(--wash); font-size: .9em; }
.article-content pre { overflow-x: auto; padding: 18px; border-radius: 10px; background: #111827; color: #fff; }
.article-back { margin-top: 58px; padding-top: 24px; border-top: 1px solid var(--line); font-weight: 800; }
.article-sidebar { display: grid; gap: 26px; position: sticky; top: 28px; }
.section-panel, .ad-slot {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--wash);
}
.section-panel__label, .ad-slot__label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.section-panel h2 { margin: 0 0 10px; font-size: 1.45rem; line-height: 1.1; letter-spacing: -.025em; }
.section-panel h2 a { color: var(--ink); text-decoration: none; }
.section-panel p:not(.section-panel__label) { margin: 0 0 16px; color: var(--muted); font-size: .92rem; line-height: 1.5; }
.section-panel__link { font-weight: 800; }
.ad-slot { background: var(--paper); }
.ad-slot__label { text-align: center; }
.ad-widget { overflow: hidden; max-width: 100%; }
.ad-widget__title { font-size: 1rem; }

.related-shell {
  width: min(calc(100% - 32px), var(--max));
  margin: 0 auto;
  padding: 0 0 96px;
}
.related-heading { margin: 0 0 25px; padding-top: 44px; border-top: 1px solid var(--line); }
.related-heading h2 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.7rem); line-height: 1.08; letter-spacing: -.035em; }
.related-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.related-card { padding: 25px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.related-card h3 { margin: 7px 0 12px; font-size: 1.3rem; line-height: 1.18; letter-spacing: -.02em; }
.related-card h3 a { color: var(--ink); text-decoration: none; }
.related-card h3 a:hover { text-decoration: underline; text-decoration-color: var(--gold); }
.related-card > p:not(.card__meta) { color: var(--muted); font-size: .94rem; line-height: 1.55; }
.page-shell .article-content > ul:first-child { padding: 0; list-style: none; }
.page-shell .article-content > ul:first-child li { margin: 0 0 18px; padding: 22px; border: 1px solid var(--line); border-radius: 14px; }
.page-shell .article-content > ul:first-child a { color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: 1.25rem; font-weight: 800; }

.button { display: inline-block; padding: 12px 18px; border-radius: 9px; background: var(--ink); color: #fff; font-weight: 800; text-decoration: none; }
.site-footer { border-top: 1px solid var(--line); background: var(--wash); color: var(--muted); }
.site-footer__inner { width: min(calc(100% - 32px), var(--max)); margin: 0 auto; padding: 28px 0; display: flex; justify-content: space-between; gap: 20px; font-size: .9rem; }

@media (max-width: 760px) {
  .site-header__inner { min-height: 72px; }
  .brand img { width: 42px; height: 42px; }
  .brand span { font-size: .86rem; letter-spacing: .17em; }
  .primary-menu { gap: 14px; font-size: .94rem; }
  .content-grid { grid-template-columns: 1fr; }
  .article-layout { grid-template-columns: 1fr; }
  .article-sidebar { position: static; }
  .related-grid { grid-template-columns: 1fr; }
  .article-content { font-size: 1rem; }
  .article-content table { display: block; overflow-x: auto; white-space: normal; }
  .site-footer__inner { flex-direction: column; }
}

@media print {
  .site-header, .site-footer, .article-back, .article-sidebar, .breadcrumbs, .related-shell { display: none; }
  body { font-size: 11pt; color: #000; }
  .article-shell, .article-layout { width: 100%; padding: 0; display: block; }
  a { color: #000; }
  .article-content table { break-inside: avoid; }
}

/* NOSVALE_PATCH_07 */
.card__media { display: block; aspect-ratio: 16/9; overflow: hidden; border-radius: 10px; margin-bottom: 16px; }
.card__thumbnail { display: block; width: 100%; height: 100%; object-fit: cover; }
.card__media:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.site-main > .pagination { max-width: 1140px; width: calc(100% - 32px); margin: 0 auto; padding-bottom: 48px; display: flex; justify-content: center; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pagination .page-numbers { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.pagination .current { font-weight: bold; }
.screen-reader-text { clip: rect(1px, 1px, 1px, 1px); position: absolute !important; height: 1px; width: 1px; overflow: hidden; }

/* NOSVALE_PATCH_08 */
.article-index { padding: 16px; margin: 20px 0; background: var(--wash); border: 1px solid var(--line); border-radius: 8px; }
.article-index h2 { margin-top: 0; }
.article-content a { overflow-wrap: anywhere; }
.nosvale-table-scroll { max-width: 100%; overflow-x: auto; }
.nosvale-table-scroll:focus-visible { outline: 3px solid var(--gold-dark); outline-offset: 3px; }
.print-controls .button { border: 0; font: inherit; cursor: pointer; }
.article-content figure { margin: 28px 0; }
.article-content figcaption { font: .82rem/1.5 Inter,ui-sans-serif,system-ui,sans-serif; color: var(--muted); margin-top: 6px; }
@page { size: A4 portrait; margin: 15mm; }
@media print {
  .print-controls, .article-index { display: none !important; }
  body.nosvale-print-checklist .article-header { display: none !important; }
  body.nosvale-print-checklist .article-content > :not(#print-checklist) { display: none !important; }
  body.nosvale-print-checklist .article-shell { margin: 0; width: 100%; padding: 0; }
  body.nosvale-print-checklist .article-content { font-size: 10pt; }
  body.nosvale-print-checklist #print-checklist h2 { font-size: 16pt; margin: 0 0 10mm; }
  .nosvale-table-scroll { overflow: visible; }
  .nosvale-table-scroll table { display: table; overflow: visible; white-space: normal; font-size: 9pt; margin: 0 0 5mm; }
  .nosvale-table-scroll th, .nosvale-table-scroll td { padding: 2mm; }
}

/* NOSVALE_PATCH_10: accessible search, navigation and wide comparison tables. */
.site-header nav { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:16px; }
.primary-menu { flex-wrap:wrap; }
.nosvale-search { display:flex; gap:8px; align-items:center; max-width:100%; }
.nosvale-search input { min-width:0; width:190px; max-width:100%; padding:10px; border:1px solid var(--muted); border-radius:5px; font:inherit; }
.nosvale-search button { padding:10px 13px; border:1px solid var(--ink); border-radius:5px; background:var(--ink); color:#fff; font:inherit; cursor:pointer; }
input:focus-visible { outline:3px solid var(--gold-dark); outline-offset:3px; }
.error-page__links { display:flex; gap:12px; flex-wrap:wrap; margin-top:24px; }
.wp-block-table.nosvale-table-scroll > table { display:table; overflow:visible; min-width:52rem; }
@media(max-width:760px) {
 .site-header__inner { flex-wrap:wrap; padding:16px 0; gap:16px; }
 .site-header nav { width:100%; justify-content:flex-start; }
 .nosvale-search { width:100%; }
 .nosvale-search input { flex:1; width:0; }
}
@media print { .wp-block-table.nosvale-table-scroll > table { min-width:0; } }

/* Expansion: visible labels, single-focus cards and 320px layouts. */
.nosvale-search { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:4px 8px; width:300px; }
.nosvale-search label { grid-column:1/-1; font-size:.82rem; font-weight:700; }
.nosvale-search input { width:100%; }
.card__link { display:block; color:var(--ink); text-decoration:none; }
.card__link:hover h2 { text-decoration:underline; text-decoration-color:var(--gold); }
.card__link:focus-visible { outline:3px solid var(--gold-dark); outline-offset:5px; }
.site-footer nav { display:flex; flex-wrap:wrap; gap:12px; }
.article-content .nosvale-long-table > table { display:table; overflow:visible; min-width:52rem; }
.article-content .nosvale-malaga-table > table { min-width:40rem; }
@media(max-width:760px) { .nosvale-search { width:100%; } .nosvale-search input { width:100%; } }
@media print { .article-content .nosvale-long-table > table { min-width:0; } }
