/* AIEncyclo · web pública. Tipografía DM Sans alojada aquí mismo (licencia OFL, ver /fonts/DM-Sans-OFL.txt). */
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url("/fonts/dm-sans-latin-wght-normal.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --paper: #f8f7f2;
  --surface: #fffefa;
  --band: #eeeee2;
  --ink: #21241f;
  --muted: #5f6259;
  --rule: #dcdcd0;
  --accent: #b94c31;
  --accent-dark: #943820;
  --good: #4f6130;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --sans: "DM Sans", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { min-width: 290px; scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button, a { -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid #c55938; outline-offset: 3px; }
[hidden] { display: none !important; }
.container { width: min(100% - 112px, 1320px); margin-inline: auto; }
.skip-link { position: absolute; left: 12px; top: -100px; z-index: 100; background: #fff; color: var(--ink); padding: 10px 16px; }
.skip-link:focus { top: 10px; }
section[id], div[id="atlas"] { scroll-margin-top: 14px; }

/* Cabecera */
.topbar { position: relative; z-index: 2; background: var(--paper); border-bottom: 1px solid #e6e3d9; }
.topbar-inner { min-height: 75px; display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; white-space: nowrap; color: #23251f; font-size: 29px; font-weight: 650; letter-spacing: -1.9px; line-height: 1; }
.brand-mark { position: relative; display: inline-block; width: 31px; height: 31px; flex: 0 0 auto; color: #bf5736; }
.brand-mark i { position: absolute; left: calc(50% - 2.5px); top: 0; width: 5px; height: 100%; background: currentColor; }
.brand-mark i:nth-child(2) { transform: rotate(45deg); }
.brand-mark i:nth-child(3) { transform: rotate(90deg); }
.brand-mark i:nth-child(4) { transform: rotate(135deg); }
.site-nav { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 30px); font-size: 14px; font-weight: 600; }
.site-nav a { text-decoration: none; padding-block: 6px; border-bottom: 1px solid transparent; }
.site-nav a:hover { color: var(--accent-dark); border-bottom-color: currentColor; }

/* Portada */
.hero { position: relative; isolation: isolate; overflow: hidden; background: #191c19; color: #f9f8ec; }
.hero-art { position: absolute; z-index: -2; inset: 0; background: #191c19 url("/img/atlas.webp") no-repeat center center / cover; }
.hero::after { content: ""; position: absolute; z-index: -1; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(22,25,22,.3), rgba(22,25,22,.13) 39%, transparent 59%); }
.hero-inner { min-height: 388px; display: flex; align-items: center; padding-block: 40px 42px; }
.hero-copy { width: 49%; max-width: 570px; }
.eyebrow { display: flex; align-items: center; gap: 10px; margin: 0 0 15px; color: #e6a489; font-size: 10px; letter-spacing: .18em; font-weight: 650; line-height: 1.45; text-transform: uppercase; }
.eyebrow > span { width: 23px; height: 1px; background: currentColor; }
.hero h1 { margin: 0; font: 400 clamp(58px, 5.25vw, 80px)/.93 var(--serif); letter-spacing: -.058em; }
.hero h1 em { font-weight: 400; }
.hero-description { max-width: 455px; margin: 19px 0 21px; color: #dbdccf; font-size: 15px; line-height: 1.55; }
.search { width: min(100%, 440px); height: 47px; display: flex; align-items: center; gap: 11px; padding: 0 7px 0 15px; background: #f7f6f0; border: 1px solid #f4f3ec; border-radius: 6px; color: #66695f; }
.search:focus-within { box-shadow: 0 0 0 3px rgba(225,145,114,.8); }
.search > svg { flex: none; }
.search input { flex: 1; min-width: 0; width: 100%; outline: none; border: 0; border-radius: 0; background: transparent; color: var(--ink); font-size: 14px; padding: 9px 0; }
.search input::placeholder { color: #6c6c61; opacity: 1; }
.search input:focus-visible { outline: none; }
.search button { display: grid; place-items: center; width: 31px; height: 30px; padding: 0; border: 1px solid #d7d8cc; background: #eeeee6; color: #55594f; border-radius: 4px; }
.search button:hover { border-color: #aaa99a; color: var(--accent); }

/* Banda de trabajo: práctica y comprobador */
.workbench { background: var(--band); border-bottom: 1px solid var(--rule); }
.lab { padding: 33px 0 30px; }
.lab + .lab { border-top: 1px solid #d9d9c9; }
.lab-inner { display: grid; grid-template-columns: minmax(235px, .75fr) minmax(0, 1.5fr); gap: clamp(24px, 4vw, 72px); }
.lab-intro h2 { font-family: var(--serif); font-weight: normal; font-size: clamp(32px, 3.8vw, 52px); line-height: 1.06; letter-spacing: -.045em; margin: 8px 0 12px; }
.lab-overline { text-transform: uppercase; letter-spacing: .13em; color: var(--accent-dark); font-size: 11px; font-weight: 750; margin: 0; }
.lab-intro p { color: #565b51; max-width: 39ch; margin: 0 0 .8em; }
.lab-intro p.lab-note { font-size: 13px; color: var(--muted); }
.exercise { background: var(--surface); border: 1px solid #d6d8ca; border-radius: 8px; padding: clamp(18px, 2.15vw, 30px); min-width: 0; }
.lab-choose { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 0 0 17px; }
.lab label { font-size: 13px; font-weight: 650; }
.lab select, .lab input { max-width: 100%; min-height: 38px; padding: 7px 10px; background: #fff; border: 1px solid #acb09f; border-radius: 4px; color: var(--ink); }
.lab select:disabled { background: #f1f0e8; color: var(--muted); opacity: 1; }
.lab h3 { font: normal clamp(22px, 2.15vw, 32px)/1.25 var(--serif); letter-spacing: -.023em; margin: 0 0 18px; }
.lab-answer { display: flex; align-items: flex-end; gap: 9px; flex-wrap: wrap; }
.lab-answer label { display: flex; flex-direction: column; gap: 5px; }
.lab-answer input { width: 122px; }
.lab button { min-height: 40px; border-radius: 4px; font-size: 14px; font-weight: 650; padding: 6px 15px; }
.lab-check { color: #fff; background: var(--accent-dark); border: 1px solid var(--accent-dark); }
.lab-check:hover { background: #7d2e19; border-color: #7d2e19; }
.lab-next { background: transparent; border: 1px solid #b8b8a9; color: var(--ink); }
.lab-next:hover { background: #f1f0e8; }
.lab-result { margin: 15px 0 0; padding: 14px 15px; background: #f0f2e7; border-left: 3px solid #626f45; }
.lab-result[data-ok="false"] { background: #fbf2e8; border-left-color: #b8552f; }
.lab-result p { margin: .4em 0 0; }

/* Comprobador de familias propias */
.jev-hint { color: var(--muted); font-size: 13px; margin: 0 0 16px; max-width: 70ch; }
.case-list { display: grid; gap: 12px; }
.case-row { min-width: 0; margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px 10px; padding: 12px 14px 14px; border: 1px solid var(--rule); border-radius: 6px; background: #fff; align-items: end; }
.case-row legend { padding-inline: 5px; font-size: 13px; font-weight: 650; }
.case-row .field { display: grid; gap: 4px; min-width: 0; }
.case-row .field input, .case-row .field select { width: 100%; }
.case-row .field-wide { grid-column: span 2; }
.case-remove { grid-column: 1 / -1; justify-self: start; background: none; border: 0; padding: 0; min-height: 0; color: var(--accent-dark); font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.lab button.case-remove { min-height: 0; padding: 0; }
.jev-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 15px; }
.jev-actions .lab-check { margin-left: auto; }
.verdict { margin-top: 20px; border-top: 2px solid var(--ink); padding-top: 16px; }
.verdict:focus { outline: none; }
.verdict-status { margin: 0; font: normal clamp(22px, 2.1vw, 30px)/1.2 var(--serif); letter-spacing: -.023em; }
.verdict[data-status="revision"] .verdict-status, .verdict[data-status="pending"] .verdict-status { color: var(--accent-dark); }
.verdict[data-status="accepted"] .verdict-status, .verdict[data-status="practice"] .verdict-status { color: var(--good); }
.verdict-reason { margin: 6px 0 14px; max-width: 72ch; }
.ledger-wrap { overflow-x: auto; }
.ledger { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
.ledger caption { text-align: left; font-size: 13px; color: var(--muted); padding-bottom: 6px; }
.ledger th { font-size: 12px; font-weight: 650; color: var(--muted); padding: 7px 10px 7px 0; border-bottom: 1px solid var(--ink); vertical-align: bottom; }
.ledger td { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
.ledger .num { font: normal 24px/1.1 var(--serif); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger .situation { color: #4b4f45; }
.ledger .mark { font-weight: 650; white-space: nowrap; }
.ledger tr[data-ok="true"] .mark { color: var(--good); }
.ledger tr[data-ok="false"] .mark, .ledger tr[data-ok="false"] .num-answer { color: var(--accent-dark); }
.verdict-coverage { margin: 14px 0 0; }
.verdict-coverage p { margin: 0 0 .5em; max-width: 72ch; }
.verdict-coverage ul { margin: 0 0 .8em; padding-left: 1.15em; }
.verdict-note { font-size: 13px; color: var(--muted); margin: 10px 0 0; max-width: 72ch; }

/* Atlas */
.catalog { padding-block: 41px 56px; }
.section-heading { display: flex; align-items: center; gap: 21px; margin: 0 0 20px; }
.section-heading h2 { margin: 0; font: 400 clamp(29px, 2.5vw, 39px)/1.17 var(--serif); letter-spacing: -.051em; }
.section-rule { flex: 1; height: 1px; background: var(--rule); }
.collection-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px 15px; }
.collection-card, .article-row { --tone: #595d4d; --tone-bg: #eeefe6; }
[data-tone="coral"] { --tone: #a34c35; --tone-bg: #f3e4d9; }
[data-tone="teal"] { --tone: #2d716b; --tone-bg: #dfece4; }
[data-tone="violet"] { --tone: #706487; --tone-bg: #eae5ef; }
[data-tone="ochre"] { --tone: #876221; --tone-bg: #f3ead3; }
[data-tone="blue"] { --tone: #4e6d83; --tone-bg: #e1eaf0; }
[data-tone="olive"] { --tone: #626b3b; --tone-bg: #e9eddc; }
.collection-card { width: 100%; min-height: 83px; display: flex; gap: 14px; align-items: center; padding: 13px 17px; text-align: left; color: var(--ink); background: var(--surface); border: 1px solid #dcdcd1; border-radius: 8px; transition: border-color .15s, background .15s; }
.collection-card:hover, .collection-card[aria-pressed="true"] { border-color: var(--tone); background: color-mix(in srgb, var(--tone-bg) 30%, var(--surface)); }
.collection-icon, .article-icon { display: inline-grid; place-items: center; background: var(--tone-bg); color: var(--tone); width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto; }
.collection-icon svg { width: 24px; height: 24px; }
.collection-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.collection-text strong { font-size: 15px; line-height: 1.3; font-weight: 630; letter-spacing: -.018em; }
.collection-text small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.collection-arrow, .article-arrow { margin-left: auto; display: inline-flex; align-items: center; align-self: center; justify-content: center; color: #85867a; }
.collection-arrow svg, .article-arrow svg { width: 17px; height: 17px; }
.collection-card:hover .collection-arrow, .article-row:hover .article-arrow { color: var(--accent); }

.articles-section { margin-top: 36px; scroll-margin-top: 26px; }
.atlas-note { margin: -8px 0 16px; max-width: 86ch; color: var(--muted); font-size: 13px; }
.clear-filters { display: inline-flex; align-items: center; gap: 7px; background: none; border: 0; color: var(--accent-dark); font-weight: 600; font-size: 12px; white-space: nowrap; }
.clear-filters:hover { text-decoration: underline; }
.filter-tools { display: flex; gap: 13px; align-items: center; justify-content: space-between; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.filter-tools label { display: inline-flex; gap: 7px; align-items: center; }
input[type="checkbox"] { accent-color: var(--accent); }
.catalog-status { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.article-list { border-top: 1px solid var(--rule); }
.entry { border-bottom: 1px solid var(--rule); }
.entry summary { list-style: none; cursor: pointer; }
.entry summary::-webkit-details-marker { display: none; }
.article-row { display: flex; align-items: center; text-align: left; gap: 15px; width: 100%; min-height: 83px; padding: 13px 5px; background: transparent; color: var(--ink); }
.article-row:hover { background: #f1f0e8; }
.article-icon { width: 38px; height: 43px; border-radius: 5px; }
.article-icon svg { width: 20px; height: 20px; }
.article-copy { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.article-category { color: var(--tone); font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.article-copy strong { font-size: 18px; line-height: 1.37; font-weight: 560; letter-spacing: -.025em; }
.article-summary { display: block; color: var(--muted); font-size: 13px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.article-access { flex: none; color: #5b6154; border: 1px solid #d5d8ca; border-radius: 20px; padding: 2px 8px; font-size: 10px; }
.article-arrow { margin-inline: 6px 4px; transition: transform .15s; }
.entry[open] summary .article-arrow { transform: rotate(180deg); }
.reading { max-width: 78ch; margin: 0 0 24px 58px; line-height: 1.65; }
.reading p { margin: 0 0 1em; }
.article-meta { margin: 9px 0 15px; color: var(--muted); font-size: 12px; }
.article-source-line { border-top: 1px solid var(--rule); padding-top: 13px; font-size: 13px; }
.article-source-line a { color: var(--accent-dark); }
.reading .notice, .article-source-line small { color: var(--muted); }

/* El proyecto */
.project { background: var(--band); border-top: 1px solid var(--rule); padding: 44px 0 50px; }
.project-inner { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(250px, .85fr); gap: clamp(28px, 5vw, 84px); align-items: start; }
.project h2 { margin: 0 0 22px; font: 400 clamp(32px, 3.8vw, 52px)/1.06 var(--serif); letter-spacing: -.045em; }
.project h3 { margin: 26px 0 6px; font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.project h3:first-of-type { margin-top: 0; }
.project p { margin: 0 0 .7em; max-width: 68ch; color: #3d4138; }
.project a { color: var(--accent-dark); text-underline-offset: 2px; }
.notebook { border-left: 1px solid #cfcfbf; padding-left: clamp(18px, 2.4vw, 32px); }
.notebook h3 { margin: 4px 0 14px; font: 400 26px/1.15 var(--serif); letter-spacing: -.03em; }
.notebook ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.notebook time { display: block; font-size: 12px; font-weight: 650; color: var(--accent-dark); margin-bottom: 2px; }
.notebook li p { margin: 0; font-size: 14px; color: #3d4138; }

/* Pie */
footer { border-top: 1px solid var(--rule); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px 28px; padding-block: 22px; }
.footer-brand { font-size: 21px; gap: 8px; letter-spacing: -1.3px; }
.footer-brand .brand-mark { width: 22px; height: 22px; }
.footer-brand .brand-mark i { width: 3px; left: calc(50% - 1.5px); }
.footer-inner p { color: var(--muted); font-size: 13px; margin: 0; }
.footer-inner p a { color: var(--ink); text-underline-offset: 2px; }
.footer-inner p a:hover { color: var(--accent-dark); }
.noscript { padding: 10px 18px; background: #fff3d8; margin: 0; }

/* Página de error */
.plain-page { min-height: 62vh; display: grid; align-content: center; padding-block: 60px; }
.plain-page h1 { margin: 0 0 12px; font: 400 clamp(40px, 6vw, 68px)/1 var(--serif); letter-spacing: -.05em; }
.plain-page p { max-width: 52ch; color: #3d4138; }
.plain-page a { color: var(--accent-dark); }

@media (min-width: 1450px) {
  .hero-inner { min-height: 430px; }
}
@media (max-width: 950px) {
  .container { width: calc(100% - 64px); }
  .topbar-inner { min-height: 67px; }
  .hero-copy { width: 53%; }
  .hero-inner { min-height: 365px; }
  .collection-card { gap: 10px; padding-inline: 12px; }
  .collection-grid { gap: 9px; }
  .collection-icon { width: 37px; height: 37px; }
  .collection-icon svg { width: 21px; height: 21px; }
  .project-inner { grid-template-columns: 1fr; }
  .notebook { border-left: 0; padding-left: 0; border-top: 1px solid #cfcfbf; padding-top: 22px; }
}
@media (max-width: 740px) {
  .lab-inner { grid-template-columns: 1fr; gap: 15px; }
  .lab-intro p { max-width: none; }
}
@media (max-width: 720px) {
  .container { width: calc(100% - 40px); }
  .topbar-inner { min-height: 0; flex-wrap: wrap; gap: 4px 16px; padding-block: 13px 8px; }
  .brand { font-size: 25px; }
  .brand-mark { width: 26px; height: 26px; }
  .site-nav { flex-basis: 100%; gap: 20px; font-size: 13px; overflow-x: auto; padding-bottom: 2px; }
  .site-nav a { white-space: nowrap; }
  .hero-inner { min-height: 328px; padding-block: 34px; }
  .hero-copy { width: 65%; }
  .hero h1 { font-size: clamp(52px, 8.7vw, 61px); }
  .hero-description { font-size: 14px; margin-block: 14px 18px; }
  .hero::after { background: linear-gradient(90deg, #171a17d9 0%, #171a17a6 41%, #171a1722 70%, transparent); }
  .hero-art { background-position: 55% center; }
  .catalog { padding-block: 29px 36px; }
  .section-heading { margin-bottom: 15px; gap: 15px; }
  .collection-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .collection-card { min-height: 73px; }
  .collection-text strong { font-size: 14px; }
  .collection-text small { font-size: 11px; }
  .articles-section { margin-top: 29px; }
  .article-copy strong { font-size: 16px; }
  .reading { margin-left: 4px; }
  .case-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ledger thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .ledger, .ledger tbody, .ledger caption { display: block; }
  .ledger tbody tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 3px 12px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
  .ledger tbody tr:first-child { border-top: 1px solid var(--ink); }
  .ledger td { display: block; padding: 0; border: 0; }
  .ledger td.case { grid-column: 1 / -1; font-size: 13px; font-weight: 650; }
  .ledger td.case::before { content: "Caso "; }
  .ledger td.situation { grid-column: 1 / -1; margin-bottom: 5px; }
  .ledger td.num::before { content: attr(data-label); display: block; margin-bottom: 2px; font: 600 11px/1.3 var(--sans); color: var(--muted); white-space: normal; }
  .ledger td.mark { grid-column: 1 / -1; margin-top: 3px; }
}
@media (max-width: 480px) {
  .hero-inner { min-height: 330px; }
  .hero-copy { width: 95%; }
  .hero-description { max-width: 300px; }
  .hero-art { background-size: auto 105%; background-position: 76% center; opacity: .7; }
  .hero::after { background: linear-gradient(90deg, #171a17f0 0%, #171a17b3 46%, #171a1720 100%); }
  .search { width: min(100%, 335px); }
  .collection-card { padding-inline: 9px; gap: 7px; }
  .collection-icon { width: 32px; height: 32px; }
  .collection-icon svg { width: 19px; height: 19px; }
  .collection-arrow { display: none; }
  .article-row { gap: 10px; padding-inline: 0; }
  .article-access { white-space: normal; text-align: center; max-width: 64px; }
  .article-summary { display: none; }
  .article-arrow { margin: 0; }
  .lab-answer label { width: 100%; }
  .lab-answer input { width: 100%; }
  .jev-actions .lab-check { margin-left: 0; width: 100%; }
}
@media (max-width: 370px) {
  .container { width: calc(100% - 28px); }
  .site-nav { gap: 14px; }
  .collection-grid { grid-template-columns: 1fr; }
  .collection-card { padding-inline: 12px; min-height: 62px; }
  .collection-arrow { display: inline-flex; }
  .section-heading { gap: 10px; }
  .section-heading h2 { font-size: 26px; }
  .brand { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}
@media print {
  .topbar, .hero-art, .search, .workbench, footer { display: none; }
  .hero { background: none; color: var(--ink); }
  .entry .reading { display: block; }
}
