:root {
  --ink: #182620;
  --muted: #5c6b64;
  --paper: #f6f4ee;
  --surface: #fffdf8;
  --line: #d9d8cf;
  --green: #174d3b;
  --green-2: #276b54;
  --gold: #b88b45;
  --red: #8b3a36;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 80% -10%, #e6eee8 0, transparent 34rem), var(--paper); }
a { color: inherit; }
.site-head { min-height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 5vw; border-bottom: 1px solid var(--line); background: rgba(255, 253, 248, .88); backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand > span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; color: white; background: var(--green); font: 700 12px/1 ui-monospace, monospace; letter-spacing: .08em; }
.brand strong { font-size: 15px; letter-spacing: -.01em; }
.site-head nav { display: flex; gap: 8px; }
.site-head nav a { padding: 9px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 14px; }
.site-head nav a:hover { color: var(--green); background: #e8eee9; }
.independence { display: flex; gap: 18px; align-items: baseline; padding: 12px 5vw; color: #fff9ef; background: #714b2d; font-size: 13px; }
.independence strong { flex: 0 0 auto; text-transform: uppercase; letter-spacing: .08em; font-size: 11px; }
.independence span { max-width: 980px; line-height: 1.5; }
.construction { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 14px 5vw; background: #ece7db; color: var(--ink); font-size: 13px; line-height: 1.5; }
.construction a { font-weight: 650; text-underline-offset: 3px; }
main { width: min(1240px, 90vw); margin: 0 auto; padding: 30px 0 72px; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; color: var(--muted); font-size: 13px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--green); text-decoration: underline; }
.hero, .legal-hero { padding: clamp(28px, 5vw, 64px); border: 1px solid var(--line); border-radius: 4px 28px 4px 4px; background: var(--surface); box-shadow: 0 16px 45px rgba(24, 38, 32, .06); }
.hero > span, .section-heading > span, .side-card > span, .source-card > div > span, .versions > .section-heading > span, .eyebrow { color: var(--green-2); text-transform: uppercase; letter-spacing: .11em; font-size: 11px; font-weight: 750; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 1000px; margin: 14px 0 18px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(38px, 6vw, 74px); line-height: 1.01; letter-spacing: -.045em; font-weight: 500; }
.legal-hero h1 { font-size: clamp(34px, 5vw, 60px); }
.hero p, .common-name { max-width: 760px; margin-bottom: 0; color: var(--muted); font-size: 18px; line-height: 1.65; }
.tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tags span { padding: 6px 9px; border: 1px solid #c9d6cd; border-radius: 99px; color: var(--green); background: #f0f6f1; font-size: 11px; font-weight: 680; }
.hero-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 34px 0 0; background: var(--line); border: 1px solid var(--line); }
.hero-facts > div { padding: 18px; background: var(--surface); }
dt { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
dd { margin: 6px 0 0; font-weight: 650; line-height: 1.45; }
.catalog-filters, .version-form { display: grid; grid-template-columns: 1.5fr 1fr 1fr auto; gap: 12px; align-items: end; margin: 22px 0; padding: 18px; border: 1px solid var(--line); background: var(--surface); }
label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
input, select, button { min-height: 43px; border: 1px solid #c6cbc6; border-radius: 6px; background: white; color: var(--ink); font: inherit; }
input, select { width: 100%; padding: 0 12px; font-size: 14px; text-transform: none; letter-spacing: 0; }
button { padding: 0 18px; color: white; background: var(--green); border-color: var(--green); font-size: 13px; font-weight: 700; cursor: pointer; }
.result-count { margin: 32px 0 14px; color: var(--muted); }
.result-count strong { color: var(--ink); font-size: 24px; }
.norm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.norm-grid article { display: flex; flex-direction: column; min-height: 285px; padding: 24px; border: 1px solid var(--line); background: var(--surface); }
.norm-grid h2 { margin: 20px 0 9px; font: 500 24px/1.13 Georgia, serif; }
.norm-grid h2 a { text-decoration: none; }
.norm-grid h2 a:hover { color: var(--green); }
.norm-grid p { color: var(--muted); line-height: 1.5; }
.norm-grid dl { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: auto; }
.norm-grid .arrow { margin-top: 20px; color: var(--green); font-size: 13px; font-weight: 750; text-decoration: none; }
.two-column, .article-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 24px; align-items: start; margin-top: 34px; }
.section-heading { margin-bottom: 18px; }
.section-heading h2, .source-card h2 { margin: 7px 0 8px; font: 500 31px/1.15 Georgia, serif; }
.section-heading p { color: var(--muted); line-height: 1.6; }
.article-list { margin: 0; padding: 0; border-top: 1px solid var(--line); list-style: none; counter-reset: articles; }
.article-list li { border-bottom: 1px solid var(--line); }
.article-list a { display: flex; justify-content: space-between; gap: 20px; padding: 13px 4px; text-decoration: none; }
.article-list a:hover { color: var(--green); padding-left: 10px; }
.article-list small { color: var(--muted); white-space: nowrap; }
.side-card { margin-bottom: 14px; padding: 20px; border: 1px solid var(--line); background: var(--surface); }
.side-card p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.side-card ul { margin: 14px 0 0; padding-left: 18px; }
.side-card li { margin: 8px 0; line-height: 1.45; }
.side-card a { color: var(--green); font-weight: 680; text-decoration: none; }
.versions, .source-card, .comparison { margin-top: 48px; padding-top: 30px; border-top: 2px solid var(--ink); }
.versions > ul { margin: 0; padding: 0; border: 1px solid var(--line); list-style: none; background: var(--surface); }
.versions li { display: grid; grid-template-columns: 1fr 190px auto; gap: 16px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.versions li:last-child { border-bottom: 0; }
.versions li > span { color: var(--muted); }
.versions a { color: var(--green); font-size: 13px; font-weight: 700; text-decoration: none; }
.source-card { display: grid; grid-template-columns: 1.2fr 2fr; gap: 28px; }
.source-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 0; }
.source-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; }
.source-actions a { padding: 12px 16px; border: 1px solid var(--green); color: var(--green); text-decoration: none; font-size: 13px; font-weight: 720; }
.source-actions a.primary { color: white; background: var(--green); }
.version-form { grid-template-columns: 1fr 1fr auto; margin: 24px 0; }
.legal-text { padding: clamp(24px, 4vw, 54px); border: 1px solid var(--line); background: var(--surface); font-family: Georgia, "Times New Roman", serif; font-size: 18px; line-height: 1.85; }
.legal-text > p { margin-bottom: 1.1em; white-space: normal; }
.legal-text > p:last-child { margin-bottom: 0; }
.legal-fractions { display: grid; gap: 1.1em; margin: 1.35em 0; padding: 0; list-style: none; }
.fraccion { display: grid; grid-template-columns: minmax(2.4em, auto) minmax(0, 1fr); gap: .8em; align-items: baseline; break-inside: avoid; scroll-margin-top: 96px; }
.numero-fraccion { display: inline-flex; align-items: baseline; justify-content: flex-end; gap: .35em; color: var(--green); font-weight: 750; white-space: nowrap; }
.numero-fraccion small { color: #8b6952; font: 600 10px/1.2 ui-sans-serif, system-ui, sans-serif; }
.texto-fraccion { margin: 0; min-width: 0; white-space: normal; }
.article-aside { position: sticky; top: 22px; }
.article-toc { max-height: min(70vh, 660px); overflow: auto; border-top: 3px solid var(--green); }
.article-toc > strong { display: block; margin: 6px 0 13px; font: 500 22px/1.2 Georgia, serif; }
.article-toc ol { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.article-toc li { margin: 0; }
.article-toc a { display: grid; grid-template-columns: 2.4em minmax(0, 1fr); gap: 8px; padding: 8px 6px; border-radius: 5px; color: var(--ink); font-weight: 500; }
.article-toc a:hover { background: #e8eee9; text-decoration: none; }
.article-toc b { color: var(--green); }
.article-toc small { overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.article-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 11px; margin: -6px 0 24px; }
.article-tools button { min-height: 39px; padding: 0 14px; color: var(--green); background: var(--surface); border-color: var(--green); }
.article-tools button:hover, .article-tools button.copied { color: white; background: var(--green); }
.article-tools span { color: var(--muted); font-size: 12px; }
.comparison-skeleton { display: none; grid-template-columns: 1fr 1fr; gap: 14px; margin: -6px 0 24px; }
.comparison-skeleton > span { grid-column: 1 / -1; color: var(--green); font-size: 12px; font-weight: 750; }
.comparison-skeleton > div { display: grid; gap: 10px; padding: 20px; border: 1px solid var(--line); background: var(--surface); }
.comparison-skeleton i { height: 13px; border-radius: 99px; background: linear-gradient(90deg, #e6e4dd 20%, #f6f4ef 45%, #e6e4dd 70%); background-size: 240% 100%; animation: legal-loading 1.15s ease-in-out infinite; }
.comparison-skeleton i:nth-child(2) { width: 88%; }
.comparison-skeleton i:nth-child(3) { width: 63%; }
.version-form.is-loading + .comparison-skeleton { display: grid; }
@keyframes legal-loading { to { background-position: -160% 0; } }
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.compare-grid > article { min-width: 0; }
.compare-grid header { display: grid; gap: 5px; padding: 14px 18px; color: white; background: var(--green); }
.compare-grid header span { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.compare-grid .legal-text { max-height: 70vh; overflow: auto; font-size: 16px; }
.compare-grid .version-a { border-top: 4px solid var(--green); }
.compare-grid .version-a .legal-text { background: #f4faf6; border-color: #cbdcd1; }
.compare-grid .version-b { border-top: 4px solid #7b6f64; }
.compare-grid .version-b header { background: #675e56; }
.compare-grid .version-b .legal-text { background: #f6f1eb; border-color: #ded5cb; }
.empty, .not-found { padding: 40px; border: 1px dashed #b8bdb8; background: var(--surface); text-align: center; }
.not-found { max-width: 720px; margin: 8vh auto; }
.not-found h1 { margin-inline: auto; }
.not-found a { display: inline-block; margin-top: 14px; padding: 12px 16px; color: white; background: var(--green); text-decoration: none; }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 28px 5vw; border-top: 1px solid var(--line); color: var(--muted); background: var(--surface); font-size: 12px; }
footer p { margin: 0; }
footer a { color: var(--green); }

@media (max-width: 900px) {
  .norm-grid { grid-template-columns: 1fr 1fr; }
  .catalog-filters { grid-template-columns: 1fr 1fr; }
  .catalog-filters label:first-child { grid-column: 1 / -1; }
  .two-column, .article-layout, .source-card { grid-template-columns: 1fr; }
  .article-aside { position: static; }
  .compare-grid { grid-template-columns: 1fr; }
  .comparison-skeleton { grid-template-columns: 1fr; }
  .comparison-skeleton > span { grid-column: auto; }
}

@media (max-width: 620px) {
  .site-head { padding: 0 4vw; }
  .site-head nav a:first-child { display: none; }
  .independence { align-items: flex-start; flex-direction: column; gap: 4px; padding-inline: 4vw; }
  main { width: 92vw; padding-top: 20px; }
  .hero, .legal-hero { padding: 25px 20px; border-radius: 3px 18px 3px 3px; }
  h1 { font-size: 37px; }
  .hero-facts, .norm-grid, .catalog-filters, .version-form, .source-card dl { grid-template-columns: 1fr; }
  .catalog-filters label:first-child { grid-column: auto; }
  .versions li { grid-template-columns: 1fr; gap: 5px; }
  .legal-text { padding: 22px 18px; font-size: 16px; line-height: 1.75; }
  .fraccion { grid-template-columns: minmax(2em, auto) minmax(0, 1fr); gap: .65em; }
  footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .comparison-skeleton i { animation: none; }
}
