/* África versus América — Spanish–English parallel reader */
:root {
  --bg: #0a0f1e;
  --bg-soft: #101728;
  --ink: #e8e4da;
  --muted: #a7aec2;
  --faint: #6b7387;
  --accent: #e9b45c;
  --line: rgba(255, 255, 255, .09);
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --mono: "Space Mono", ui-monospace, monospace;
  --font-scale: 1;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: calc(1.06rem * var(--font-scale));
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* atmosphere */
.atmos { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.atmos .glow { position: absolute; width: 70vw; height: 70vw; left: -20vw; top: -30vw;
  background: radial-gradient(circle, rgba(233, 180, 92, .08), transparent 60%); }
.atmos .horizon { position: absolute; left: 0; right: 0; bottom: 0; height: 40vh;
  background: linear-gradient(to top, rgba(16, 23, 40, .9), transparent); }
.atmos .contours { position: absolute; right: -12vw; bottom: -14vw; width: 44vw; color: rgba(233, 180, 92, .10); }
.atmos .contours svg { width: 100%; height: auto; }
.grain { position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.9'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* header */
.progress { position: fixed; top: 0; left: 0; height: 2px; width: 0; background: var(--accent); z-index: 60; }
header#hdr { position: sticky; top: 0; z-index: 50; backdrop-filter: blur(10px);
  background: rgba(10, 15, 30, .82); border-bottom: 1px solid var(--line); }
header#hdr nav { max-width: 1200px; margin: 0 auto; padding: .7rem 1.4rem; display: flex; align-items: center; gap: 1.2rem; }
.mark { display: inline-flex; align-items: center; gap: .55rem; font-family: var(--mono); font-size: .82rem;
  letter-spacing: .04em; color: var(--ink); }
.mark svg { width: 26px; height: 26px; }
.mark:hover { text-decoration: none; color: var(--accent); }
.navlinks { display: flex; gap: 1.1rem; margin-left: auto; font-family: var(--mono); font-size: .8rem; }
.navlinks a { color: var(--muted); }
.navlinks a:hover { color: var(--accent); text-decoration: none; }
.toc-toggle { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 8px;
  font-family: var(--mono); font-size: .78rem; padding: .35rem .7rem; cursor: pointer; }
.toc-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* table of contents */
.toc { position: fixed; top: 0; right: 0; bottom: 0; width: min(320px, 85vw); z-index: 55;
  background: rgba(13, 19, 36, .97); border-left: 1px solid var(--line);
  transform: translateX(100%); transition: transform .25s ease; }
.toc.open { transform: translateX(0); }
.toc-inner { padding: 4.2rem 1.6rem 2rem; display: flex; flex-direction: column; gap: .15rem; overflow-y: auto; height: 100%; }
.toc-inner a { color: var(--muted); padding: .45rem .2rem; border-bottom: 1px solid rgba(255,255,255,.05); font-size: .95rem; }
.toc-inner a:hover { color: var(--accent); text-decoration: none; }
.scrim { position: fixed; inset: 0; z-index: 54; background: rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .25s; }
.scrim.on { opacity: 1; pointer-events: auto; }

/* reading toolbar */
.toolbar { position: sticky; top: 52px; z-index: 40; display: flex; justify-content: center; gap: .8rem;
  padding: .5rem 1rem; background: rgba(10, 15, 30, .75); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tb-group { display: flex; gap: .35rem; }
.tb-btn { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 999px;
  font-family: var(--mono); font-size: .74rem; padding: .32rem .85rem; cursor: pointer; transition: all .15s; }
.tb-btn:hover { color: var(--accent); border-color: var(--accent); }
.tb-btn.is-on { background: var(--accent); border-color: var(--accent); color: #14100a; font-weight: 700; }

/* layout */
.wrap, .layout main { max-width: 1200px; margin: 0 auto; padding: 0 1.4rem; }
main { position: relative; z-index: 2; }

/* cover / index */
.cover { position: relative; z-index: 2; text-align: center; padding: 5.5rem 1.5rem 3.5rem; max-width: 900px; margin: 0 auto; }
.eyebrow { font-family: var(--mono); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.cover h1 { font-size: clamp(2.3rem, 6.5vw, 3.9rem); margin: .25em 0 .1em; font-weight: 600; }
.cover-sub { font-size: clamp(1.15rem, 3vw, 1.7rem); color: var(--accent); margin: 0 0 1rem; }
.cover-sub .dot { color: var(--faint); }
.cover-author { color: var(--muted); margin: 0 0 .3rem; }
.cover-note { color: var(--faint); max-width: 40em; margin: .7rem auto 1.6rem; font-size: .98rem; }
.startbtn { display: inline-flex; align-items: center; gap: .5rem; border: 1px solid var(--accent); color: var(--accent);
  border-radius: 999px; padding: .6rem 1.4rem; font-family: var(--mono); font-size: .82rem; }
.startbtn:hover { background: var(--accent); color: #14100a; text-decoration: none; }

article { padding-bottom: 5rem; }
article > h2, .chapter h2 { scroll-margin-top: 120px; }
article h2 { font-size: 1.7rem; margin: 3rem 0 1rem; color: var(--ink); }
article > p { max-width: 46em; color: var(--muted); }
article > p strong { color: var(--ink); }

.parts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin: 1.4rem 0 2rem; }
.pcard { display: block; border: 1px solid var(--line); border-radius: 14px; padding: 1.2rem 1.3rem;
  background: rgba(255,255,255,.02); transition: all .18s; color: var(--ink); }
.pcard:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.pcard.is-soon { opacity: .45; cursor: default; }
.pcard .pn { font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.pcard .ph { font-size: 1.18rem; margin: .35rem 0 .4rem; font-weight: 600; }
.pcard .pd { font-size: .9rem; color: var(--muted); line-height: 1.55; }

/* part banner */
.part-banner { text-align: center; padding: 3.6rem 1rem 2.6rem; border-bottom: 1px solid var(--line); margin-bottom: 2.5rem; }
.part-kicker { font-family: var(--mono); font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.part-title { font-size: clamp(1.9rem, 4.5vw, 2.8rem); font-weight: 600; margin: .3em 0 .2em; }
.part-sub { color: var(--muted); max-width: 44em; margin: 0 auto; font-size: .98rem; }

/* parallel text */
.chapter { margin-bottom: 4rem; }
.chapter h2 { display: flex; flex-direction: column; gap: .15rem; border-bottom: 1px solid var(--line); padding-bottom: .8rem; margin-top: 3.5rem; }
.chapter h2 .h-es { font-size: 1.65rem; color: var(--ink); }
.chapter h2 .h-en { font-size: 1.05rem; color: var(--accent); font-weight: 500; font-style: italic; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 2.2rem; padding: .55rem 0; border-radius: 10px; }
.pair p { margin: 0 0 .9rem; }
.pair .es { color: var(--ink); }
.pair .en { color: var(--muted); font-size: .97em; }
.pair .en:empty::before { content: "—"; color: var(--faint); }
sup.ref { color: var(--accent); font-family: var(--mono); font-size: .68em; }

/* translation display modes */
body.mode-hide .pair { grid-template-columns: minmax(0, 46em); justify-content: center; }
body.mode-hide .pair .en { display: none; }
body.mode-blur .pair .en { filter: blur(5px); opacity: .55; cursor: pointer; transition: filter .2s, opacity .2s; user-select: none; }
body.mode-blur .pair:hover .en, body.mode-blur .pair.revealed .en { filter: none; opacity: 1; user-select: text; }
body.mode-blur .pair .en::after { content: ""; }
body.mode-hide .toolbar [data-mode="hide"],
body.mode-blur .toolbar [data-mode="blur"],
body.mode-both .toolbar [data-mode="both"] { background: var(--accent); border-color: var(--accent); color: #14100a; font-weight: 700; }

/* notes */
.notes-head { margin: 3rem 0 .8rem; border-top: 1px solid var(--line); padding-top: 1.2rem; }
.notes-head span { font-family: var(--mono); font-size: .76rem; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.pair.note p { font-size: .86em; color: var(--faint); margin-bottom: .5rem; }
.pair.note .fn { color: var(--accent); font-family: var(--mono); font-size: .85em; }

/* footer */
footer { position: relative; z-index: 2; border-top: 1px solid var(--line); margin-top: 2rem; }
.foot { display: flex; align-items: center; gap: 1.4rem; padding: 1.3rem 1.4rem; color: var(--faint); font-size: .85rem; flex-wrap: wrap; }
.foot .mono { font-family: var(--mono); font-size: .74rem; }
.foot a { margin-left: auto; }

/* mobile: interleave */
@media (max-width: 800px) {
  .pair { grid-template-columns: 1fr; gap: .1rem; padding: .35rem 0; }
  .pair .es { margin-bottom: .25rem; }
  .pair .en { margin-bottom: 1rem; padding-left: .9rem; border-left: 2px solid rgba(233, 180, 92, .35); }
  body.mode-hide .pair { grid-template-columns: 1fr; }
  .navlinks { display: none; }
  .toolbar { top: 50px; }
}
