/* Espai Txema — Libro Proceso. Web edition. */

:root {
  --paper: #faf7f2;
  --paper-2: #f2ede4;
  --ink: #1c1a17;
  --ink-2: #55504a;
  --ink-3: #8a837a;
  --rule: #e0d8cb;
  --accent: #a8553a;
  --accent-2: #7d8a5c;
  --shadow: 0 1px 2px rgba(28,26,23,.06), 0 8px 24px rgba(28,26,23,.06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --measure: 34rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14130f;
    --paper-2: #1c1a16;
    --ink: #ece7de;
    --ink-2: #b3aca1;
    --ink-3: #837c72;
    --rule: #302c25;
    --accent: #d97f5f;
    --accent-2: #a3b37a;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.62;
  overflow-wrap: break-word;
}

/* language switching ------------------------------------------------ */
body[data-lang="es"] .l-en { display: none; }
body[data-lang="en"] .l-es { display: none; }

/* header ------------------------------------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 1rem;
  padding: .6rem clamp(1rem, 4vw, 2.5rem);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans); font-size: .8rem;
}
.topbar a { color: var(--ink-2); text-decoration: none; }
.topbar a:hover { color: var(--accent); }
.topbar .home { font-weight: 600; letter-spacing: .02em; color: var(--ink); }
.topbar .spacer { flex: 1; }

.langtoggle { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; overflow: hidden; }
.langtoggle button {
  font: inherit; font-family: var(--sans); font-size: .74rem; letter-spacing: .06em;
  padding: .25rem .7rem; border: 0; background: transparent; color: var(--ink-3); cursor: pointer;
}
.langtoggle button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* generic layout ----------------------------------------------------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.5rem); }
.prose { max-width: var(--measure); margin-left: auto; margin-right: auto; }
.prose p { margin: 0 0 1.15em; }
.prose ul, .prose ol { margin: 0 0 1.15em; padding-left: 1.3em; }
.prose li { margin: .25em 0; }
strong { font-weight: 650; }

/* chapter head ------------------------------------------------------- */
.chead { padding: clamp(2.5rem, 7vw, 5rem) 0 1.5rem; }
.chead .kicker {
  font-family: var(--sans); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent); margin-bottom: .9rem;
}
.chead h1 {
  font-size: clamp(2rem, 5.2vw, 3.2rem); line-height: 1.08; margin: 0 0 .5rem;
  font-weight: 500; letter-spacing: -.015em;
}
.chead .sub { font-family: var(--sans); font-size: .9rem; color: var(--ink-2); }
.chead .meta {
  font-family: var(--sans); font-size: .76rem; color: var(--ink-3);
  margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--rule);
}

/* galleries ---------------------------------------------------------- */
figure.gal { margin: 2.5rem 0 3rem; }
figure.gal > figcaption, figure.fig > figcaption { max-width: var(--measure); margin: .9rem auto 0; }
.galtitle {
  max-width: var(--measure); margin: 0 auto .9rem;
  font-family: var(--sans); font-size: .78rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent);
}
figcaption { font-size: .92rem; color: var(--ink-2); line-height: 1.5; }

.grid { display: flex; flex-wrap: wrap; gap: 5px; }
.grid a {
  position: relative; display: block; flex-grow: 1; height: 190px;
  background: var(--paper-2); overflow: hidden; border-radius: 2px;
}
.grid a img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid::after { content: ""; flex-grow: 1e4; }
@media (max-width: 640px) { .grid a { height: 130px; } }

figure.fig { margin: 2.5rem auto 3rem; max-width: 900px; }
figure.fig img { width: 100%; height: auto; display: block; border-radius: 2px; }

figure.vid { margin: 2.5rem auto 3rem; max-width: 900px; }
figure.vid video { width: 100%; height: auto; display: block; border-radius: 2px; background: #000; }

/* sidebar (scrolling widget) ----------------------------------------- */
.sidebar {
  max-width: var(--measure); margin: 2.5rem auto; padding: 1.5rem 1.6rem;
  background: var(--paper-2); border-left: 3px solid var(--accent-2); border-radius: 2px;
}
.sidebar h3 {
  margin: 0 0 1rem; font-family: var(--sans); font-size: .78rem;
  letter-spacing: .1em; text-transform: uppercase; color: var(--accent-2);
}
.sidebar p { margin: 0 0 .8em; font-size: .95rem; }

/* pager --------------------------------------------------------------- */
.pager {
  display: flex; gap: 1rem; justify-content: space-between;
  margin: 4rem 0 5rem; padding-top: 1.5rem; border-top: 1px solid var(--rule);
  font-family: var(--sans); font-size: .85rem;
}
.pager a { color: var(--ink-2); text-decoration: none; max-width: 46%; }
.pager a:hover { color: var(--accent); }
.pager .dir { display: block; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.pager .next { text-align: right; margin-left: auto; }

/* home ---------------------------------------------------------------- */
.hero { padding: clamp(3rem, 10vw, 7rem) 0 clamp(2rem, 5vw, 3.5rem); }
.hero h1 {
  font-size: clamp(2.4rem, 7vw, 4.6rem); line-height: 1.02; margin: 0 0 1rem;
  font-weight: 500; letter-spacing: -.02em;
}
.hero .tag { font-family: var(--sans); font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); margin-bottom: 1.2rem; }
.hero .lede { max-width: 38rem; font-size: 1.15rem; color: var(--ink-2); }
.stats { display: flex; flex-wrap: wrap; gap: 2rem; margin-top: 2.5rem; font-family: var(--sans); }
.stats div { font-size: .78rem; color: var(--ink-3); letter-spacing: .04em; }
.stats b { display: block; font-family: var(--serif); font-size: 1.9rem; font-weight: 500; color: var(--ink); letter-spacing: -.02em; }

.phase { margin: 4rem 0 0; }
.phase-head { border-top: 2px solid var(--ink); padding-top: 1rem; margin-bottom: 2rem; }
.phase-head .n { font-family: var(--sans); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.phase-head h2 { font-size: clamp(1.6rem, 4vw, 2.3rem); margin: .3rem 0 .6rem; font-weight: 500; letter-spacing: -.015em; }
.phase-head .range { font-family: var(--sans); font-size: .8rem; color: var(--ink-3); }
.phase-head .intro { max-width: var(--measure); margin-top: 1rem; color: var(--ink-2); font-size: .98rem; }

.tl { position: relative; margin-left: 0; }
.tl::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 1px; background: var(--rule); }
.entry { position: relative; padding: 0 0 1.4rem 2.4rem; }
.entry::before {
  content: ""; position: absolute; left: 3px; top: .55rem; width: 9px; height: 9px;
  border-radius: 50%; background: var(--paper); border: 1.5px solid var(--ink-3);
}
.entry.big::before { background: var(--accent); border-color: var(--accent); }
.entry a { display: flex; gap: 1rem; align-items: flex-start; min-height: 1px; text-decoration: none; color: inherit; }
.entry .thumb {
  flex: 0 0 96px; height: 68px; border-radius: 2px; overflow: hidden; background: var(--paper-2);
}
.entry .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.entry .txt { flex: 1; min-width: 0; }
.entry .date { font-family: var(--sans); font-size: .72rem; letter-spacing: .08em; color: var(--ink-3); }
.entry h3 { margin: .1rem 0 .2rem; font-size: 1.12rem; font-weight: 500; line-height: 1.25; }
.entry a:hover h3 { color: var(--accent); }
.entry .desc { font-family: var(--sans); font-size: .78rem; color: var(--ink-3); }
@media (max-width: 560px) { .entry .thumb { flex-basis: 68px; height: 50px; } }

.glosgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.glosgrid a { display: block; padding: 1rem 1.1rem; background: var(--paper); text-decoration: none; color: inherit; }
.glosgrid a:hover { background: var(--paper-2); color: var(--accent); }
.glosgrid .t { font-size: 1rem; }
.glosgrid .d { font-family: var(--sans); font-size: .72rem; color: var(--ink-3); margin-top: .2rem; }

footer.site {
  margin-top: 5rem; padding: 2.5rem 0 4rem; border-top: 1px solid var(--rule);
  font-family: var(--sans); font-size: .78rem; color: var(--ink-3);
}
footer.site p { margin: .3em 0; max-width: 42rem; }

/* lightbox ------------------------------------------------------------ */
.lb { position: fixed; inset: 0; z-index: 100; display: none; background: rgba(10,9,8,.985); }
.lb.open { display: block; }
.lb img { position: absolute; inset: 0; margin: auto; max-width: 94vw; max-height: 84vh; object-fit: contain; }
.lb .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 1rem 1.2rem 1.4rem;
  color: #e9e4da; font-size: .9rem; text-align: center; background: linear-gradient(transparent, rgba(0,0,0,.65));
}
.lb .cap .count { display: block; font-family: var(--sans); font-size: .72rem; color: #9c948a; margin-top: .35rem; letter-spacing: .08em; }
.lb button {
  position: absolute; background: rgba(255,255,255,.09); color: #fff; border: 0; cursor: pointer;
  width: 44px; height: 44px; border-radius: 50%; font-size: 1.2rem; line-height: 1;
}
.lb button:hover { background: rgba(255,255,255,.2); }
.lb .prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lb .next { right: 14px; top: 50%; transform: translateY(-50%); }
.lb .close { right: 14px; top: 14px; }

@media print {
  .topbar, .pager, .lb { display: none !important; }
  body { background: #fff; color: #000; }
}
