/* =====================================================================
   Carlos Jiménez Villarejo — hoja de estilos
   Concepto: expediente de archivo. Papel, tinta y un único rojo lacre.
   ===================================================================== */

:root {
  --paper: #f3efe6;
  --paper-2: #ebe5d8;
  --paper-3: #e1d9c8;
  --ink: #17140f;
  --ink-2: #4b453b;
  --ink-3: #7a7264;
  --rule: #cfc6b3;
  --accent: #8e1c1c;
  --accent-soft: #8e1c1c1a;
  --print: #ece6d8;          /* fondo de las "fotos impresas", fijo en ambos temas */
  --dark: #17140f;           /* bloque oscuro del archivo */
  --dark-2: #221e18;
  --dark-ink: #ede7db;
  --dark-ink-2: #a8a092;
  --dark-rule: #3a342b;
  --dark-accent: #e0675b;

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 2px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14120f;
    --paper-2: #1b1814;
    --paper-3: #24201a;
    --ink: #ece6da;
    --ink-2: #bdb4a5;
    --ink-3: #8c8475;
    --rule: #39332a;
    --accent: #e0675b;
    --accent-soft: #e0675b22;
    --dark: #0d0c0a;
    --dark-2: #191612;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #14120f; --paper-2: #1b1814; --paper-3: #24201a;
  --ink: #ece6da; --ink-2: #bdb4a5; --ink-3: #8c8475; --rule: #39332a;
  --accent: #e0675b; --accent-soft: #e0675b22; --dark: #0d0c0a; --dark-2: #191612;
  color-scheme: dark;
}

/* ------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(17px, 0.35vw + 15.6px, 19px);
  line-height: 1.6;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
[hidden] { display: none !important; }   /* never let a component's display rule override `hidden` */
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: var(--paper); }
h1, h2, h3 { font-weight: 400; line-height: 1.08; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
p { margin: 0 0 1em; text-wrap: pretty; }
em { font-style: italic; }
.mono { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.04em; }
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--ink); color: var(--paper); padding: 10px 14px; z-index: 100; font-family: var(--mono); font-size: 14px; }
.skip:focus { top: 8px; }

/* ------------------------------------------------------------- botones */
.btn {
  display: inline-flex; align-items: center; gap: 0.5em;
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 0.85em 1.25em; border: 1px solid currentColor; border-radius: var(--radius);
  background: transparent; color: var(--ink); text-decoration: none; cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn--solid { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn--solid:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ------------------------------------------------------------- barra superior */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.topbar__inner { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand__mark {
  display: grid; place-items: center; width: 30px; height: 30px;
  background: var(--accent); color: #fff; font-size: 19px; line-height: 1; border-radius: var(--radius);
}
.brand__text { font-size: 1.05rem; letter-spacing: 0.01em; }
.nav { display: flex; gap: clamp(14px, 2.2vw, 30px); }
.nav a { font-family: var(--mono); font-size: 0.74rem; text-decoration: none; letter-spacing: 0.04em; color: var(--ink-2); padding-block: 6px; }
.nav a:hover, .nav a[aria-current="true"] { color: var(--ink); }
.nav a[aria-current="true"] .nav__n { color: var(--accent); }
.nav__n { color: var(--ink-3); margin-right: 6px; }
.navtoggle { display: none; }

@media (max-width: 860px) {
  .navtoggle {
    display: block; font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase;
    background: none; color: var(--ink); border: 1px solid var(--rule); border-radius: var(--radius); padding: 8px 12px; cursor: pointer;
  }
  .nav {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0; padding: 8px var(--gutter) 16px;
    background: var(--paper); border-bottom: 1px solid var(--rule);
    display: none;
  }
  .nav.is-open { display: flex; }
  .nav a { padding-block: 12px; border-bottom: 1px solid var(--rule); font-size: 0.85rem; }
  .nav a:last-child { border-bottom: 0; }
}

/* ------------------------------------------------------------- portada */
.hero { padding-block: clamp(48px, 8vw, 110px) clamp(32px, 5vw, 64px); position: relative; }
/* two equal halves: the portrait fills the right half, its left edge on the page's centre line */
.hero__text { padding-right: clamp(16px, 3vw, 40px); }
.hero__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 0; align-items: center; }
.kicker { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin-bottom: 1.4rem; }
.hero__name {
  font-size: clamp(3.1rem, 9.4vw, 7.6rem); font-weight: 300; line-height: 0.92; letter-spacing: -0.035em;
  font-variation-settings: "opsz" 72;
}
.hero__lede { font-size: clamp(1.15rem, 1vw + 0.9rem, 1.5rem); line-height: 1.45; color: var(--ink-2); max-width: 34ch; margin-top: 2rem; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 2.2rem; }

/* barra de censura que se retira */
.redact { position: relative; color: var(--ink); white-space: nowrap; }
.redact::after {
  content: ""; position: absolute; left: -0.08em; right: -0.08em; top: 0.12em; bottom: 0.02em;
  background: var(--ink); transform-origin: right center;
  animation: unredact .9s cubic-bezier(.7,0,.2,1) forwards;
  animation-delay: calc(.6s + var(--d, 0) * .35s);
}
@keyframes unredact { to { transform: scaleX(0); } }
@media (max-width: 520px) { .redact { white-space: normal; } }

.portrait { margin: 0; justify-self: end; width: 100%; }
/* the photo is a cut-out cropped at the right and bottom: dissolve those two edges */
.portrait img {
  width: 100%;
  -webkit-mask-image: linear-gradient(to right, #000 88%, transparent), linear-gradient(to bottom, #000 82%, transparent);
  -webkit-mask-composite: source-in;
          mask-image: linear-gradient(to right, #000 88%, transparent), linear-gradient(to bottom, #000 82%, transparent);
          mask-composite: intersect;
}
.portrait figcaption { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--rule); color: var(--ink-3); text-align: right; }

.facts {
  display: grid; grid-template-columns: repeat(4, 1fr); margin: clamp(48px, 7vw, 88px) 0 0;
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule);
}
.facts > div { padding: 22px 20px 22px 0; }
.facts > div + div { padding-left: 20px; border-left: 1px solid var(--rule); }
.facts dt { font-size: clamp(1.5rem, 2.2vw, 2.1rem); line-height: 1.1; font-weight: 400; }
.facts dd { margin: 6px 0 0; font-family: var(--mono); font-size: 0.72rem; color: var(--ink-2); letter-spacing: 0.03em; }

@media (max-width: 860px) {
  .hero__grid { grid-template-columns: 1fr; }
  .portrait { width: min(92%, 400px); justify-self: center; margin-top: 8px; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .facts > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .facts > div:nth-child(n+3) { border-top: 1px solid var(--rule); }
}

/* ------------------------------------------------------------- secciones */
.section { padding-block: clamp(64px, 10vw, 130px); }
.section--tint { background: var(--paper-2); border-block: 1px solid var(--rule); }
.section__head { margin-bottom: clamp(36px, 5vw, 64px); max-width: 52rem; }
.folio {
  font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2);
  display: flex; align-items: center; gap: 12px; margin-bottom: 1.1rem;
}
.folio span { color: var(--accent); }
.folio::after { content: ""; flex: 0 0 56px; height: 1px; background: currentColor; opacity: .5; }
.section__head h2 { font-size: clamp(2.1rem, 4.6vw, 3.9rem); font-weight: 300; letter-spacing: -0.025em; }
.section__head h2 em { color: var(--ink-3); }
.section__intro { margin-top: 1.4rem; font-size: 1.1rem; color: var(--ink-2); max-width: 44rem; }

.prose p { hyphens: auto; }
.prose strong { font-weight: 600; }

/* ------------------------------------------------------------- biografía */
.bio { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: clamp(32px, 6vw, 88px); align-items: start; }
.bio__body { max-width: 40rem; }
.dropcap::first-letter {
  float: left; font-size: 4.6em; line-height: 0.82; padding: 0.06em 0.1em 0 0; color: var(--accent); font-weight: 400;
}
.bio__notes { position: sticky; top: 96px; border-top: 1px solid var(--ink); padding-top: 16px; }
.notes__label { text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); margin-bottom: 14px; }
.notes { list-style: none; margin: 0; padding: 0; counter-reset: n; }
.notes li { counter-increment: n; padding: 14px 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 44px 1fr; column-gap: 8px; }
.notes li > span { color: var(--accent); padding-top: 3px; }
.notes a { font-size: 1rem; line-height: 1.3; text-decoration-color: var(--rule); }
.notes small { grid-column: 2; display: block; margin-top: 4px; color: var(--ink-3); font-size: 0.85rem; line-height: 1.4; }
@media (max-width: 920px) {
  .bio { grid-template-columns: 1fr; }
  .bio__notes { position: static; }
}

/* ------------------------------------------------------------- trayectoria */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: clamp(24px, 4vw, 56px); }
.timeline li { display: grid; grid-template-columns: 5.2rem 1fr; gap: 12px; padding: 18px 0; border-top: 1px solid var(--rule); }
.timeline time { font-family: var(--mono); font-size: 0.95rem; color: var(--ink-2); padding-top: 2px; }
.timeline p { margin: 0; font-size: 1rem; line-height: 1.45; }
.timeline .is-key { border-top-color: var(--ink); }
.timeline .is-key time { color: var(--accent); font-weight: 500; }
@media (max-width: 1000px) { .timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .timeline { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------- carpetas (líneas de trabajo) */
.dossier {
  position: relative; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: clamp(28px, 5vw, 72px); align-items: start;
  padding: clamp(28px, 4vw, 52px); margin-top: 64px;
  background: var(--paper-2); border: 1px solid var(--rule);
}
.dossier:first-of-type { margin-top: 28px; }
.dossier__tab {
  position: absolute; top: -30px; left: -1px; height: 30px; padding: 0 18px;
  display: flex; align-items: center; background: var(--paper-2);
  border: 1px solid var(--rule); border-bottom: 0; border-radius: 6px 6px 0 0;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent);
}
.dossier--flip { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); }
.dossier--flip .dossier__tab { left: auto; right: -1px; }
.dossier--flip .dossier__fig { order: -1; }
.dossier h3 { font-size: clamp(1.9rem, 3.4vw, 2.9rem); font-weight: 300; margin-bottom: 1.3rem; letter-spacing: -0.02em; }
.dossier__meta { color: var(--ink-3); margin: 1.6rem 0 1.4rem; border-top: 1px dashed var(--rule); padding-top: 1rem; }
.dossier__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.dossier__fig { margin: 0; max-width: 400px; justify-self: center; }
.dossier__fig img { width: 100%; filter: grayscale(.15) sepia(.12); box-shadow: 0 14px 30px -18px rgba(20,10,0,.5); }
.dossier__fig--doc img { transform: rotate(1deg); }
.dossier__fig figcaption { margin-top: 12px; color: var(--ink-3); }
.quote { margin: 0; }
.quote p { font-size: clamp(1.2rem, 1.2vw + 0.9rem, 1.55rem); line-height: 1.38; font-style: italic; }
.quote footer { font-size: 0.92rem; color: var(--ink-2); }
@media (max-width: 860px) {
  .dossier { grid-template-columns: 1fr; }
  .dossier--flip .dossier__fig { order: 0; }
  .dossier__fig { max-width: 420px; }
}

/* ------------------------------------------------------------- archivo (bloque oscuro) */
.section--ink {
  background: var(--dark); color: var(--dark-ink);
  --ink: var(--dark-ink); --ink-2: var(--dark-ink-2); --ink-3: #7f786c; --rule: var(--dark-rule);
  --paper: var(--dark); --accent: var(--dark-accent);
}
.section--ink .btn--solid { background: var(--dark-ink); color: var(--dark); border-color: var(--dark-ink); }

.archive__controls { display: grid; gap: 16px; margin-bottom: 28px; }
.search { position: relative; display: block; }
.search svg { position: absolute; left: 0; top: 50%; width: 22px; height: 22px; transform: translateY(-50%); fill: none; stroke: var(--ink-2); stroke-width: 1.6; }
.search input {
  width: 100%; font: inherit; font-size: clamp(1.2rem, 1.6vw + .8rem, 1.75rem); color: var(--ink);
  background: transparent; border: 0; border-bottom: 1px solid var(--ink-2); border-radius: 0;
  padding: 14px 8px 14px 36px; outline: none;
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { border-bottom-color: var(--accent); }
.search input::-webkit-search-cancel-button { filter: invert(.6); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.03em;
  padding: 8px 12px; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--ink-2); border: 1px solid var(--rule);
  transition: border-color .15s, color .15s, background-color .15s;
}
.chip:hover { color: var(--ink); border-color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip .c { opacity: .6; margin-left: 6px; }
.chips--sub { padding-left: 14px; border-left: 2px solid var(--accent); }
.chips--small .chip { padding: 6px 10px; font-size: 0.7rem; }
.archive__row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.sort { background: none; border: 0; color: var(--ink-2); cursor: pointer; padding: 6px 0; }
.sort:hover { color: var(--ink); }

.archive__status { color: var(--ink-3); margin-bottom: 8px; min-height: 1.2em; }
.doclist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.doclist li { border-bottom: 1px solid var(--rule); }
.doclist a {
  display: grid; grid-template-columns: 5.5rem minmax(0, 1fr) auto; gap: 16px; align-items: baseline;
  padding: 15px 4px; text-decoration: none; color: var(--ink);
  transition: background-color .15s, padding .15s;
}
.doclist a:hover { background: var(--dark-2); color: var(--ink); padding-left: 12px; }
.doclist .yr { font-family: var(--mono); font-size: 0.85rem; color: var(--accent); white-space: nowrap; }
.doclist .yr--none { color: var(--ink-3); }
.doclist .t { font-size: 1.05rem; line-height: 1.35; }
.doclist .m { font-family: var(--mono); font-size: 0.68rem; color: var(--ink-3); letter-spacing: 0.03em; text-align: right; white-space: nowrap; }
.doclist .m::after { content: " ↗"; color: var(--ink-2); }
.doclist mark { background: var(--accent-soft); color: inherit; box-shadow: 0 -0.1em 0 0 var(--accent) inset; }
@media (max-width: 640px) {
  .doclist a { grid-template-columns: 4.1rem minmax(0, 1fr); column-gap: 12px; row-gap: 4px; }
  .doclist .yr { font-size: 0.74rem; padding-top: 3px; }
  .doclist .m { grid-column: 2; text-align: left; white-space: normal; }
}
.more { margin: 24px auto 0; display: flex; }
.btn--ghost { color: var(--ink); }
.btn--ghost:hover { background: var(--ink); color: var(--paper); }
.archive__fallback { margin-top: 16px; color: var(--ink-2); }
.archive[data-state="error"] .archive__fallback { display: block; }

.press { margin-top: clamp(64px, 8vw, 110px); padding-top: 36px; border-top: 1px solid var(--ink-2); }
.press__title { font-size: clamp(1.7rem, 2.6vw, 2.4rem); font-weight: 300; }
.press__intro { color: var(--ink-2); margin-top: .6rem; }
.mastheads { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.mastheads button {
  width: 100%; height: 100%; min-height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: var(--dark); color: var(--ink); border: 0; cursor: pointer; padding: 24px 16px; transition: background-color .15s;
}
.mastheads button:hover { background: var(--dark-2); }
.mastheads small { color: var(--ink-3); }
.mh { font-size: 1.45rem; line-height: 1; }
.mh--pais { font-family: var(--serif); font-weight: 700; letter-spacing: 0.02em; }
.mh--lv { font-family: var(--serif); font-weight: 600; letter-spacing: 0.08em; font-size: 1.1rem; }
.mh--ed { font-family: var(--mono); font-weight: 500; font-size: 1.15rem; letter-spacing: -0.02em; }
.mh--cg { font-family: var(--serif); font-style: italic; font-weight: 500; }
.mh--ad { font-family: var(--serif); font-size: 1.15rem; }
.press__note { margin-top: 22px; color: var(--ink-2); font-size: 0.95rem; }

/* ------------------------------------------------------------- publicaciones */
.works { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.work { background: var(--paper); padding: clamp(24px, 3.5vw, 44px); display: grid; grid-template-columns: 120px 1fr; gap: 28px; align-items: start; }
.work--wide { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
.work--article { grid-template-columns: 1fr; background: var(--paper-2); }
.work h3 { font-size: 1.6rem; font-weight: 400; margin-bottom: .6rem; }
.work--wide h3 { font-size: clamp(2rem, 3.4vw, 2.8rem); font-weight: 300; }
.work p { color: var(--ink-2); }
.work__year { color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: .8rem; }
.cover img { box-shadow: 0 16px 30px -18px rgba(20,10,0,.55), 0 1px 0 rgba(0,0,0,.08); }
.covers { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(10px, 2vw, 20px); align-items: end; }
.tomes { list-style: none; margin: 1rem 0 0; padding: 0; }
.tomes li { padding: 12px 0; border-top: 1px solid var(--rule); color: var(--ink-2); }
.tomes li .mono { display: inline-block; width: 2.2em; color: var(--accent); font-size: 0.8rem; }
.tomes em { color: var(--ink); }
.links { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 1rem; font-family: var(--mono); font-size: 0.78rem; }
@media (max-width: 860px) {
  .works { grid-template-columns: 1fr; }
  .work--wide { grid-template-columns: 1fr; }
}
@media (max-width: 460px) { .work { grid-template-columns: 90px 1fr; gap: 18px; } }

/* ------------------------------------------------------------- pie */
.footer { background: var(--paper-2); border-top: 1px solid var(--rule); padding-block: 56px 40px; }
.footer__inner { display: grid; gap: 8px; }
.footer__name { font-size: 1.8rem; font-weight: 300; margin: 0; }
.footer .mono { color: var(--ink-2); margin: 0; }
.footer__small { color: var(--ink-3); font-size: 0.88rem; max-width: 46rem; margin-top: 14px; }
.footer__top { justify-self: start; margin-top: 10px; text-decoration: none; }

/* ------------------------------------------------------------- aparición al hacer scroll */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s ease, transform .7s ease; }
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .redact::after { animation: none; transform: scaleX(0); }
  .reveal { opacity: 1; transform: none; transition: none; }
  * { transition: none !important; }
}

@media print {
  .topbar, .hero__actions, .archive__controls, .more, .stamp, .dossier__actions { display: none !important; }
  .section--ink { background: #fff; color: #000; }
  body { background: #fff; }
}
