:root {
  --ink: #14171a;
  --ink-2: #3b4148;
  --muted: #6b737c;
  --line: #e4e2dc;
  --paper: #ffffff;
  --paper-2: #f7f5f0;
  --verde: #0b8a4b;
  --verde-ink: #076b39;
  --rosso: #cf2b37;
  --rosso-ink: #a81f2a;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --wrap: 1180px;
  --radius: 10px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.6 var(--sans); }
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
:focus-visible { outline: 3px solid var(--verde); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 0; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 720px; }
.muted { color: var(--muted); font-weight: 400; }

/* Banda tricolor (solo arriba) */
.tricolore { display: flex; height: 4px; }
.tricolore span { flex: 1; }
.tricolore span:nth-child(1) { background: var(--verde); }
.tricolore span:nth-child(2) { background: #fff; box-shadow: inset 0 -1px 0 var(--line); }
.tricolore span:nth-child(3) { background: var(--rosso); }

/* Cabecera */
.masthead { border-bottom: 1px solid var(--line); background: var(--paper); }
.masthead-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding-top: 22px; padding-bottom: 18px; }
.dateline { margin: 0; font-size: .82rem; color: var(--muted); }
.dateline-spacer { display: block; }
.brand { text-decoration: none; text-align: center; display: grid; gap: 2px; }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1; letter-spacing: -0.02em; }
.brand-tag { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.admin-chip { justify-self: end; font-size: .8rem; font-weight: 600; text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; }
.sections { border-top: 1px solid var(--line); }
.sections-row { display: flex; justify-content: center; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.sections-row::-webkit-scrollbar { display: none; }
.sections a { white-space: nowrap; text-decoration: none; font-size: .9rem; font-weight: 500; padding: 12px 14px; color: var(--ink-2); border-bottom: 3px solid transparent; }
.sections a:hover { color: var(--ink); }
.sections a[aria-current='page'] { color: var(--ink); border-bottom-color: var(--verde); }

/* Elementos comunes */
.kicker { display: inline-block; font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--verde-ink); text-decoration: none; margin-bottom: 6px; }
a.kicker:hover { color: var(--rosso-ink); }
.meta { margin: 8px 0 0; font-size: .8rem; color: var(--muted); }
.meta strong { color: var(--ink-2); font-weight: 600; }

/* Portada */
main { min-height: 50vh; }
.front { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; padding: 32px 0 8px; }
.lead-media { display: block; overflow: hidden; border-radius: var(--radius); aspect-ratio: 16 / 9; background: var(--paper-2); }
.lead-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.lead:hover .lead-media img { transform: scale(1.02); }
.lead-body { padding-top: 18px; }
.lead-title { font-size: clamp(1.8rem, 3.6vw, 2.7rem); }
.lead-title a, .card-title a { text-decoration: none; }
.lead-title a:hover, .card-title a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; text-decoration-color: var(--rosso); }
.lead-excerpt { font-size: 1.1rem; color: var(--ink-2); margin: 12px 0 0; max-width: 62ch; }
.lead-noimg { border-left: 4px solid var(--verde); padding-left: 24px; }
.lead-noimg .lead-title { font-size: clamp(2.2rem, 4.4vw, 3.4rem); }

.grid { display: grid; gap: 28px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.secondary { margin-top: 32px; padding-top: 28px; border-top: 1px solid var(--line); }

.card-media { display: block; overflow: hidden; border-radius: var(--radius); aspect-ratio: 3 / 2; background: var(--paper-2); margin-bottom: 12px; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .card-media img { transform: scale(1.03); }
.card-title { font-size: 1.25rem; }
.card-excerpt { margin: 8px 0 0; color: var(--ink-2); font-size: .95rem; }

.front-aside { border-left: 1px solid var(--line); padding-left: 28px; }
.aside-title { font-family: var(--sans); font-size: .78rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; padding-bottom: 10px; border-bottom: 2px solid var(--ink); }
.latest { list-style: none; margin: 0; padding: 0; counter-reset: n; }
.latest li { counter-increment: n; border-bottom: 1px solid var(--line); }
.latest a { display: grid; grid-template-columns: 28px 1fr; column-gap: 8px; padding: 14px 0; text-decoration: none; }
.latest a::before { content: counter(n); grid-row: span 3; font-family: var(--serif); font-size: 1.4rem; font-weight: 700; color: var(--rosso); line-height: 1; }
.latest-sec { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--verde-ink); font-weight: 600; }
.latest-title { font-family: var(--serif); font-weight: 500; font-size: 1.02rem; line-height: 1.3; }
.latest a:hover .latest-title { text-decoration: underline; text-decoration-color: var(--rosso); }
.latest time { font-size: .75rem; color: var(--muted); margin-top: 2px; }

.section-block { padding: 40px 0 8px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; border-top: 2px solid var(--ink); padding-top: 12px; margin-bottom: 22px; }
.block-head h2 { font-size: 1.5rem; }
.block-head h2 a { text-decoration: none; }
.more { font-size: .85rem; font-weight: 600; text-decoration: none; color: var(--verde-ink); }
.more:hover { text-decoration: underline; }

/* Sección */
.page-head { padding: 40px 0 28px; border-bottom: 1px solid var(--line); margin-bottom: 32px; }
.page-head h1 { font-size: clamp(2rem, 4vw, 3rem); }
.page-blurb { color: var(--ink-2); margin: 8px 0 0; font-size: 1.05rem; }
.pager { display: flex; justify-content: space-between; align-items: center; margin: 40px 0 0; padding-top: 20px; border-top: 1px solid var(--line); font-size: .9rem; color: var(--muted); }
.pager a { color: var(--ink); font-weight: 600; text-decoration: none; }

/* Artículo */
.article { padding: 40px 0 16px; }
.article-title { font-size: clamp(2rem, 4.6vw, 3.2rem); margin-top: 4px; }
.article-summary { font-size: 1.22rem; line-height: 1.5; color: var(--ink-2); margin: 16px 0 0; }
.article-meta { padding-bottom: 20px; border-bottom: 1px solid var(--line); margin-top: 18px; }
.article-figure { margin: 28px auto 8px; max-width: 980px; }
.article-figure img { width: 100%; border-radius: var(--radius); }
.article-figure figcaption { font-size: .82rem; color: var(--muted); margin-top: 8px; }
.prose { font-size: 1.12rem; line-height: 1.75; padding-top: 16px; }
.prose p { margin: 0 0 1.2em; }
.prose h2 { font-size: 1.6rem; margin: 1.6em 0 .6em; }
.prose h3 { font-size: 1.3rem; margin: 1.4em 0 .5em; }
.prose a { color: var(--verde-ink); text-underline-offset: 3px; }
.prose ul { padding-left: 1.2em; margin: 0 0 1.2em; }
.prose li { margin-bottom: .4em; }
.prose blockquote { margin: 1.6em 0; padding: 4px 0 4px 22px; border-left: 4px solid var(--rosso); font-family: var(--serif); font-size: 1.35rem; line-height: 1.45; color: var(--ink); }
.prose blockquote p { margin: 0; }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 20px 0; border-top: 1px solid var(--line); margin-top: 16px; font-size: .85rem; }
.share span { color: var(--muted); margin-right: 4px; }
.share a { text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-weight: 500; }
.share a:hover { border-color: var(--ink); }
.related { padding: 24px 20px 16px; }
.draft-banner { background: #fff6dd; border: 1px solid #f0d58a; border-radius: 8px; padding: 10px 14px; font-size: .9rem; }

.empty { text-align: center; padding: 96px 20px; color: var(--ink-2); font-family: var(--serif); font-size: 1.4rem; }
.empty-mark { color: var(--rosso); font-size: 1.6rem; margin: 0 0 8px; }
.empty a { color: var(--verde-ink); }

/* Pie */
.site-footer { margin-top: 64px; background: var(--ink); color: #d9dde1; }
.footer-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; padding-top: 40px; padding-bottom: 28px; }
.footer-row p { margin: 0; max-width: 52ch; font-size: .92rem; }
.footer-brand { font-family: var(--serif); font-weight: 700; font-size: 1.6rem; color: #fff; margin-bottom: 8px !important; }
.footer-row nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 20px; align-content: start; }
.footer-row nav a { text-decoration: none; font-size: .9rem; }
.footer-row nav a:hover { color: #fff; text-decoration: underline; }
.footer-legal { border-top: 1px solid #2c3136; padding-top: 16px; padding-bottom: 24px; font-size: .78rem; color: #9aa2aa; }
.footer-legal p { margin: 0; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 .95rem/1 var(--sans); background: var(--verde); color: #fff; border: 1px solid var(--verde); border-radius: 8px; padding: 12px 18px; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--verde-ink); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--paper-2); }
.btn-sm { padding: 8px 12px; font-size: .85rem; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline; }
.danger { color: var(--rosso-ink); }

/* Panel */
body.admin { background: var(--paper-2); }
.admin-bar { background: var(--paper); border-bottom: 1px solid var(--line); }
.admin-bar-row { display: flex; justify-content: space-between; align-items: center; padding-top: 14px; padding-bottom: 14px; }
.brand-sm { font-family: var(--serif); font-weight: 600; font-size: 1.2rem; text-decoration: none; }
.admin-bar nav { display: flex; gap: 18px; align-items: center; font-size: .9rem; }
.admin-bar nav form { margin: 0; }
.admin-main { padding-top: 28px; padding-bottom: 64px; }
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.admin-head h1 { font-size: 1.8rem; }
.notice { background: #e5f4ec; border: 1px solid #b6dec7; color: var(--verde-ink); border-radius: 8px; padding: 10px 14px; font-weight: 500; }
.posts-table { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.posts-table th, .posts-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: .92rem; vertical-align: middle; }
.posts-table th { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; background: #fbfaf7; }
.row-title { font-weight: 600; text-decoration: none; }
.row-title:hover { text-decoration: underline; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions a { margin-left: 12px; color: var(--verde-ink); font-weight: 500; }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; border-radius: 999px; padding: 2px 10px; }
.tag-pub { background: #e5f4ec; color: var(--verde-ink); }
.tag-draft { background: #f1efe9; color: var(--ink-2); }
.tag-feat { background: #fde8ea; color: var(--rosso-ink); }

.editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
.editor-main, .editor-side { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.editor-side { position: sticky; top: 16px; }
.editor label, .editor legend, .login-box label { display: block; font-size: .85rem; font-weight: 600; margin: 16px 0 6px; }
.editor label:first-child { margin-top: 0; }
.editor input:not([type='checkbox']):not([type='file']), .editor textarea, .editor select, .login-box input {
  width: 100%; font: 400 1rem/1.5 var(--sans); color: var(--ink); background: #fff; border: 1px solid #d4d1c8; border-radius: 8px; padding: 10px 12px;
}
.editor #title { font-family: var(--serif); font-size: 1.4rem; font-weight: 600; }
.editor textarea { resize: vertical; }
.editor #body { font-size: 1.02rem; line-height: 1.7; min-height: 360px; }
.editor input:focus, .editor textarea:focus, .editor select:focus, .login-box input:focus { outline: none; border-color: var(--verde); box-shadow: 0 0 0 3px rgb(11 138 75 / .18); }
.image-field { border: 0; padding: 0; margin: 16px 0 0; }
.image-preview { aspect-ratio: 3 / 2; border-radius: 8px; overflow: hidden; background: var(--paper-2); border: 1px dashed #cfccc3; margin-bottom: 10px; display: grid; place-items: center; color: var(--muted); font-size: .85rem; }
.image-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-preview:not(.is-empty) { border-style: solid; }
.editor input[type='file'] { font-size: .85rem; width: 100%; }
.check { display: flex !important; align-items: center; gap: 8px; font-weight: 500 !important; }
.status-line { font-size: .85rem; color: var(--muted); margin: 18px 0 10px; }
.editor-actions { display: grid; gap: 8px; }
.form-msg { min-height: 1.4em; font-size: .88rem; margin: 10px 0; }
.form-msg.error { color: var(--rosso-ink); font-weight: 500; }
.help { margin-top: 12px; font-size: .88rem; color: var(--ink-2); }
.help summary { cursor: pointer; font-weight: 500; }
.help code { background: var(--paper-2); padding: 1px 5px; border-radius: 4px; }

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-box { width: 100%; max-width: 380px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; padding: 0 28px 28px; }
.login-box .tricolore { margin: 0 -28px 24px; }
.login-box h1 { font-size: 2rem; }
.login-box p { margin: 4px 0 0; }
.login-box .btn { width: 100%; margin-top: 16px; }
.alert { background: #fde8ea; color: var(--rosso-ink); border-radius: 8px; padding: 10px 12px; font-size: .9rem; margin-top: 16px !important; }

/* Responsivo */
@media (max-width: 960px) {
  .front { grid-template-columns: 1fr; gap: 32px; }
  .front-aside { border-left: 0; padding-left: 0; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editor { grid-template-columns: 1fr; }
  .editor-side { position: static; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .masthead-row { grid-template-columns: 1fr; text-align: center; padding-top: 16px; padding-bottom: 12px; gap: 6px; }
  .dateline { order: 2; }
  .dateline-spacer { display: none; }
  .admin-chip { justify-self: center; order: 3; }
  .sections-row { justify-content: flex-start; padding: 0 8px; }
  .sections a { padding: 11px 10px; }
  .front { padding-top: 20px; }
  .lead-media { border-radius: 0; margin: 0 -20px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; gap: 24px; }
  .secondary .card, .section-block .card, .related .card, .page-head + .grid .card { display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 14px; align-items: start; }
  .secondary .card-media, .section-block .card-media, .related .card-media, .page-head + .grid .card-media { order: 2; aspect-ratio: 1; margin: 0; border-radius: 8px; }
  .secondary .card-excerpt, .section-block .card-excerpt, .related .card-excerpt { display: none; }
  .card-title { font-size: 1.1rem; }
  .article { padding-top: 24px; }
  .article-figure { padding: 0; }
  .article-figure img { border-radius: 0; }
  .article-figure figcaption { padding: 0 20px; }
  .prose { font-size: 1.05rem; }
  .footer-row { grid-template-columns: 1fr; gap: 24px; }
  .posts-table thead { display: none; }
  .posts-table, .posts-table tbody, .posts-table tr, .posts-table td { display: block; width: 100%; }
  .posts-table tr { border-bottom: 1px solid var(--line); padding: 10px 0; }
  .posts-table td { border: 0; padding: 4px 14px; }
  .posts-table td[data-label]::before { content: attr(data-label) ': '; color: var(--muted); font-size: .8rem; }
  .row-actions { text-align: left; }
  .row-actions a { margin: 0 14px 0 0; }
  .admin-head h1 { font-size: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
@media (max-width: 640px) {
  .brand-tag { letter-spacing: .08em; font-size: .68rem; }
}
@media (max-width: 640px) {
  .editor #body { min-height: 260px; }
}
main.login-box { min-height: 0; }

/* Aviso de medio no oficial (todas las páginas públicas) */
.aviso-oficial { margin: 0; background: var(--paper-2); border-bottom: 1px solid var(--line); color: var(--ink-2); font-size: .82rem; line-height: 1.45; text-align: center; padding: 8px 0; }
.aviso-oficial .wrap { display: block; }
.footer-legal p + p { margin-top: 6px !important; }
