/* Confesiones · edición de estudio — web */
:root {
  --paper: #F3F4F1;       /* piedra caliza */
  --paper-2: #E9ECE6;
  --ink: #1E2227;
  --muted: #5A6068;
  --rule: #CDD1CA;
  --lapis: #2C4C8A;       /* acento: lapislázuli de mosaico */
  --lapis-soft: #E1E6EF;
  --ok: #2F6B40;
  --no: #983A3A;
  --serif: "Literata", Georgia, "Times New Roman", serif;
  --inscr: "Cinzel", "Trajan Pro", Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15181D; --paper-2: #1C2026; --ink: #E6E3DB; --muted: #A2A7AE; --rule: #2E333B;
    --lapis: #A7BCEA; --lapis-soft: #1F2A3F; --ok: #8CC79B; --no: #E39B9B;
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 4.5rem; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--serif); font-size: 1.0625rem; line-height: 1.65; font-optical-sizing: auto; }
img, svg { max-width: 100%; }
a { color: var(--lapis); }
:focus-visible { outline: 2px solid var(--lapis); outline-offset: 2px; border-radius: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: .5rem 1rem; z-index: 50; }
.skip:focus { left: 1rem; }

/* ---------- top bar & layout ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem 1.25rem; background: var(--paper); border-bottom: 1px solid var(--rule); }
.topbar .home { font-family: var(--inscr); font-weight: 600; letter-spacing: .14em; color: var(--ink); text-decoration: none; font-size: .95rem; }
.tocbtn { font: inherit; font-size: .95rem; background: none; color: var(--ink); border: 1px solid var(--rule); border-radius: 4px; padding: .3rem .8rem; cursor: pointer; }
.layout { display: grid; grid-template-columns: 17rem minmax(0, 1fr); max-width: 76rem; margin: 0 auto; }
.sidebar { position: sticky; top: 3.4rem; align-self: start; height: calc(100vh - 3.4rem); overflow-y: auto; padding: 1.5rem 1rem 3rem 1.25rem; border-right: 1px solid var(--rule); font-size: .92rem; line-height: 1.45; }
main { padding: 2.5rem clamp(1.25rem, 5vw, 4.5rem) 5rem; max-width: 46rem; width: 100%; }
@media (min-width: 64.01rem) { .tocbtn { display: none; } }
@media (max-width: 64rem) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; top: 3.2rem; left: 0; bottom: 0; height: auto; width: min(20rem, 86vw); background: var(--paper);
    transform: translateX(-102%); transition: transform .25s ease; z-index: 30; box-shadow: 0 0 0 100vmax transparent; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  main { margin: 0 auto; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } html { scroll-behavior: auto; } }

/* ---------- sidebar ---------- */
.sidebar ul, .sidebar ol { list-style: none; margin: 0; padding: 0; }
.sidebar a { color: var(--ink); text-decoration: none; }
.sidebar a:hover { color: var(--lapis); }
.sbt { margin: 0 0 1rem; }
.sbbooks > li { margin-bottom: .55rem; }
.sbn { display: inline-block; min-width: 2.6rem; font-family: var(--inscr); color: var(--lapis); font-weight: 600; }
.sbbooks > li.current > a { font-weight: 600; }
.sbbooks ol { margin: .5rem 0 .8rem 0; padding-left: .2rem; border-left: 1px solid var(--rule); }
.sbbooks ol li a { display: block; padding: .18rem 0 .18rem .8rem; color: var(--muted); border-left: 2px solid transparent; margin-left: -1px; }
.sbbooks ol li a.here { color: var(--ink); border-left-color: var(--lapis); }

/* ---------- index ---------- */
.hero { padding: 2.5rem 0 3rem; border-bottom: 1px solid var(--rule); margin-bottom: 2.5rem; }
.heroby { margin: 0; color: var(--muted); font-style: italic; }
.herot { font-family: var(--inscr); font-weight: 500; font-size: clamp(2.6rem, 9vw, 4.6rem); letter-spacing: .12em; line-height: 1.05; margin: .3rem 0 1.2rem; }
.herol { font-size: 1.3rem; line-height: 1.45; font-style: italic; max-width: 32rem; margin: 0 0 1rem; }
.herosub { color: var(--muted); max-width: 34rem; }
.cta { display: inline-block; margin-top: .5rem; padding: .55rem 1.1rem; border: 1.5px solid var(--lapis); border-radius: 4px; text-decoration: none; font-weight: 600; }
.cta:hover { background: var(--lapis); color: var(--paper); }
.bookcard { padding: 1.2rem 0; border-bottom: 1px solid var(--rule); }
.bookcard h2 { margin: 0; font-size: 1.35rem; }
.bookcard h2 a { color: var(--ink); text-decoration: none; display: flex; align-items: baseline; gap: .9rem; }
.bookcard .numeral { font-family: var(--inscr); color: var(--lapis); font-size: 1.6rem; min-width: 2.8rem; }
.bookcard .years { margin: .1rem 0 .4rem 3.7rem; color: var(--muted); font-style: italic; font-size: .95rem; }
.bookcard p { margin-left: 3.7rem; }

/* ---------- headings ---------- */
section.front { margin: 3.5rem 0; }
section.front > h1, h1.booktitle { font-weight: 600; font-size: 1.85rem; line-height: 1.2; margin: 0 0 1.2rem; }
h1.booktitle { font-size: 2.3rem; margin-top: .5rem; }
h1.booktitle .bnum { display: block; font-family: var(--inscr); font-weight: 600; color: var(--lapis); font-size: 1.05rem; letter-spacing: .16em; margin-bottom: .3rem; }
h1.booktitle .years { display: block; font-weight: 400; font-style: italic; color: var(--muted); font-size: 1.05rem; margin-top: .3rem; }
p.arg { font-style: italic; color: var(--muted); }
h3 { font-size: 1.02rem; font-weight: 600; margin: 2rem 0 .6rem; }
ol.bt { padding-left: 0; list-style: none; columns: 2 15rem; column-gap: 2rem; }
ol.bt li { break-inside: avoid; margin-bottom: .3rem; }
.parthead { margin: 4.5rem 0 1rem; padding-top: 1rem; border-top: 3px double var(--rule); }
.parthead .pt { font-weight: 600; font-size: 1.15rem; }
.parthead .ps { color: var(--muted); font-style: italic; }

section.chapter { margin: 4rem 0 0; padding-top: 1rem; }
h2.cap { position: relative; font-size: 1.6rem; line-height: 1.25; margin: 0 0 .4rem; font-weight: 600; }
h2.cap .capnum { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h2.cap .numeral { display: block; font-family: var(--inscr); font-weight: 500; color: var(--lapis); font-size: 2.6rem; line-height: 1; letter-spacing: .06em; margin-bottom: .45rem; }
@media (min-width: 92rem) {
  h2.cap .numeral { position: absolute; right: calc(100% + 1.6rem); top: -.15rem; margin: 0; text-align: right; min-width: 5rem; }
}
p.orig { margin: 0 0 1.3rem; font-size: .92rem; font-style: italic; color: var(--muted); }
.sum { font-size: 1.12rem; font-style: italic; line-height: 1.5; margin: 0 0 1.8rem; padding: .2rem 0 .2rem 0; }

/* ---------- Augustine's text ---------- */
.aug { font-size: 1.15rem; line-height: 1.72; border-left: 3px solid var(--lapis); padding: .1rem 0 .1rem 1.2rem; margin: 0 0 2rem; }
.aug p { margin: 0 0 1rem; hyphens: auto; }
.aug .num { font-weight: 600; color: var(--lapis); }
sup.g { font-size: .68em; line-height: 0; }
sup.g a { text-decoration: none; font-weight: 600; padding: 0 .1em; }

/* ---------- notes ---------- */
.gl { font-size: .95rem; line-height: 1.55; }
.gl > div { display: grid; grid-template-columns: 1.8rem 1fr; gap: 0 .2rem; margin-bottom: .6rem; padding: .15rem .3rem; border-radius: 3px; }
.gl .n a { font-weight: 600; text-decoration: none; }
.gl > div:target { background: var(--lapis-soft); }
.comm p { margin: 0 0 1rem; }
a.x { text-decoration-thickness: 1px; text-underline-offset: 3px; }
span.xoff { border-bottom: 1px dotted var(--muted); }

/* ---------- boxes ---------- */
.box, .memo, .pausa { margin: 1.6rem 0; }
.box { background: var(--paper-2); border-radius: 6px; padding: 1rem 1.2rem .3rem; font-size: .97rem; }
.box p { margin: 0 0 .8rem; }
.kick { font-weight: 600; font-size: .9rem; margin-bottom: .35rem; color: var(--lapis); }
.memo { text-align: center; padding: 1.1rem .5rem; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.memo .la { font-style: italic; font-size: 1.25rem; line-height: 1.4; }
.memo .es { color: var(--muted); font-size: .95rem; margin-top: .3rem; }
.latin { font-style: italic; }
.pausa { border: 1px dashed var(--lapis); border-radius: 6px; padding: 1rem 1.2rem; }
.pausa p { margin: 0 0 .6rem; }
.pausa textarea { width: 100%; font: inherit; font-size: 1rem; color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: 4px; padding: .5rem .6rem; resize: vertical; }
.pausa .hint { font-size: .82rem; color: var(--muted); margin: .4rem 0 0; }
.diagram { text-align: center; color: var(--ink); margin: 1.5rem 0 .3rem; }
.caption { text-align: center; font-style: italic; font-size: .9rem; color: var(--muted); }
table.esc, table.voc { width: 100%; border-collapse: collapse; font-size: .97rem; margin: .8rem 0 1.4rem; }
table.esc td, table.voc td { border-bottom: 1px solid var(--rule); padding: .5rem .5rem .5rem 0; vertical-align: top; }
table.esc td:first-child, table.voc td:first-child { font-weight: 600; width: 34%; }
table.vicios tr:first-child td { font-weight: 400; font-style: italic; color: var(--muted); }
.mapa .yr { color: var(--muted); font-style: italic; white-space: nowrap; }
dl.ficha dt { font-weight: 600; margin-top: 1rem; }
dl.ficha dd { margin: .2rem 0 0; }
ol.tight, ul.tight { padding-left: 1.3rem; }
ol.tight li, ul.tight li { margin-bottom: .45rem; }
.small { font-size: .9rem; color: var(--muted); }

/* ---------- end of book ---------- */
section.bookend { margin-top: 5rem; padding-top: 1rem; border-top: 3px double var(--rule); }
h2.endh { font-size: 1.4rem; margin: 2.8rem 0 1rem; }
.q { margin: 0 0 1.6rem; }
.q p { margin: 0 0 .5rem; }
.opts { display: flex; flex-direction: column; gap: .4rem; }
.opts button { font: inherit; font-size: .98rem; text-align: left; color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: 5px; padding: .5rem .8rem; cursor: pointer; }
.opts button:hover:not(:disabled) { border-color: var(--lapis); }
.opts button.ok { border-color: var(--ok); box-shadow: inset 3px 0 0 var(--ok); }
.opts button.no { border-color: var(--no); color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.opts button:disabled { cursor: default; }
.expl { margin: .5rem 0 0; font-size: .95rem; color: var(--muted); }
.gonext a { font-weight: 600; }
.pager { display: flex; gap: 1.5rem; margin-top: 4rem; padding-top: 1rem; border-top: 1px solid var(--rule); }

@media print {
  .topbar, .sidebar, .pager, .tocbtn { display: none; }
  .layout { display: block; }
  body { background: #fff; color: #000; }
}
