/* ============================================================
   August Pi-Suñer — shared stylesheet
   Scholarly / archival theme. One source of truth for the look;
   retune the whole site from the :root variables below.
   ============================================================ */

/* ---- Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Spectral:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Inter:wght@400;500;600&display=swap');

/* ---- Design tokens ---- */
:root {
  --paper:      #f7f3ea;   /* warm cream page */
  --paper-2:    #efe8d8;   /* raised panels */
  --paper-3:    #e7ddc8;   /* deeper wash */
  --ink:        #211d17;   /* near-black, warm */
  --ink-soft:   #4f4738;   /* muted body */
  --ink-faint:  #8a7f68;   /* captions, meta */
  --accent:     #7a2e2e;   /* oxblood */
  --accent-dk:  #5c2020;
  --gold:       #9a7b3f;   /* aged brass detail */
  --rule:       #ddd2ba;   /* hairlines */
  --rule-soft:  #e8e0cf;

  --font-serif: 'Spectral', Georgia, 'Times New Roman', serif;
  --font-sans:  'Inter', system-ui, -apple-system, Segoe UI, sans-serif;

  --measure: 68ch;
  --wrap: 1120px;
  --radius: 3px;
  --shadow: 0 1px 2px rgba(33,29,23,.06), 0 8px 30px rgba(33,29,23,.08);
  --shadow-lg: 0 4px 12px rgba(33,29,23,.10), 0 24px 60px rgba(33,29,23,.14);
  --step: clamp(1rem, 0.6rem + 1.4vw, 1.35rem);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  font-family: var(--font-serif);
  font-size: var(--step);
  line-height: 1.65;
  color: var(--ink-soft);
  background-color: var(--paper);
  background-image:
    radial-gradient(1200px 600px at 80% -10%, rgba(154,123,63,.06), transparent 60%),
    radial-gradient(900px 500px at 0% 0%, rgba(122,46,46,.045), transparent 55%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(122,46,46,.16); }

/* ---- Typography ---- */
h1, h2, h3, h4 { color: var(--ink); font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.1rem, 1.4rem + 3vw, 3.6rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); }
h3 { font-size: 1.2rem; }
p { margin-bottom: 1.05em; }
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; text-decoration-thickness: 1px; }
strong { color: var(--ink); font-weight: 600; }
em { color: inherit; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

.eyebrow {
  font-family: var(--font-sans);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---- Layout helpers ---- */
.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.prose { max-width: var(--measure); }
.center { text-align: center; }
.stack > * + * { margin-top: 1rem; }

/* ============================================================
   Site header / nav
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(247,243,234,.82);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.site-header .bar {
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 66px;
}
.brand {
  font-family: var(--font-serif);
  font-weight: 600; font-size: 1.06rem; letter-spacing: .01em;
  color: var(--ink); display: inline-flex; align-items: baseline; gap: .5rem;
}
.brand:hover { text-decoration: none; color: var(--accent); }
.brand .mark { color: var(--accent); font-weight: 700; }
.brand .dates { font-family: var(--font-sans); font-size: .68rem; letter-spacing: .12em; color: var(--ink-faint); text-transform: uppercase; }
.site-nav { display: flex; gap: 1.6rem; font-family: var(--font-sans); font-size: .82rem; font-weight: 500; letter-spacing: .04em; }
.site-nav a { color: var(--ink-soft); text-transform: uppercase; letter-spacing: .1em; font-size: .74rem; padding: .4rem 0; position: relative; }
.site-nav a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: -2px;
  height: 2px; background: var(--accent); transition: right .25s ease;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); text-decoration: none; }
.site-nav a:hover::after, .site-nav a[aria-current="page"]::after { right: 0; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-sans); font-size: .82rem; font-weight: 600;
  letter-spacing: .04em; line-height: 1;
  padding: .8rem 1.3rem; border-radius: var(--radius);
  border: 1px solid var(--ink); color: var(--ink); background: transparent;
  cursor: pointer; transition: background .2s, color .2s, border-color .2s, transform .2s;
}
.btn:hover { background: var(--ink); color: var(--paper); text-decoration: none; transform: translateY(-1px); }
.btn-accent { border-color: var(--accent); background: var(--accent); color: #fdf6f0; }
.btn-accent:hover { background: var(--accent-dk); border-color: var(--accent-dk); color: #fff; }
.btn-ghost { border-color: var(--rule); color: var(--ink-soft); }
.btn-ghost:hover { background: var(--paper-2); color: var(--ink); border-color: var(--ink-faint); }

/* ============================================================
   Page hero (interior pages)
   ============================================================ */
.page-hero { padding: clamp(3rem, 2rem + 6vw, 6rem) 0 clamp(2rem, 1.5rem + 2vw, 3rem); border-bottom: 1px solid var(--rule); }
.page-hero h1 { max-width: 22ch; }
.page-hero .lead { font-size: 1.15em; color: var(--ink-soft); max-width: 60ch; margin-top: 1rem; font-weight: 300; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  margin-top: 5rem; border-top: 1px solid var(--rule);
  background: var(--paper-2);
}
.site-footer .bar {
  width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto;
  padding: 2.5rem 0; display: flex; flex-wrap: wrap; gap: 1rem 2rem;
  align-items: center; justify-content: space-between;
  font-family: var(--font-sans); font-size: .8rem; color: var(--ink-faint);
}
.site-footer a { color: var(--ink-soft); }
.site-footer nav { display: flex; gap: 1.4rem; }

/* ============================================================
   Home landing
   ============================================================ */
.home-hero { position: relative; height: 100svh; min-height: 560px; overflow: hidden; }
.home-hero video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.home-hero .veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20,17,13,.28) 0%, rgba(20,17,13,.12) 40%, rgba(20,17,13,.62) 100%);
}
.home-hero .hero-copy {
  position: absolute; left: 0; right: 0; bottom: clamp(2rem, 6vh, 5rem);
  width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; color: #f7f2e8;
}
.home-hero .eyebrow { color: #f0c9a0; }
.home-hero h1 { color: #fbf6ec; text-shadow: 0 2px 24px rgba(0,0,0,.35); max-width: 16ch; }
.home-hero .tagline { font-size: clamp(1.05rem, .9rem + 1vw, 1.4rem); font-weight: 300; color: #eadfce; max-width: 46ch; margin-top: .8rem; text-shadow: 0 1px 12px rgba(0,0,0,.4); }
.home-hero .hero-dates { font-family: var(--font-sans); letter-spacing: .22em; font-size: .8rem; text-transform: uppercase; color: #e7b98f; margin-bottom: .9rem; }
.hero-play {
  position: absolute; top: 1.1rem; right: 1.1rem; z-index: 3;
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
  background: rgba(20,17,13,.5); border: 1px solid rgba(255,255,255,.35);
  color: #fff; font-size: .9rem; display: grid; place-items: center;
  backdrop-filter: blur(4px); transition: background .2s;
}
.hero-play:hover { background: rgba(20,17,13,.8); }

.intro { padding: clamp(3rem, 2rem + 5vw, 5.5rem) 0 1rem; }
.intro .prose { margin-inline: auto; text-align: center; }
.intro .prose p { font-size: 1.15em; color: var(--ink-soft); }

.entry-cards {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.6rem;
  padding: 2.5rem 0 1rem;
}
.entry-card {
  position: relative; display: block; overflow: hidden;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--paper-2); box-shadow: var(--shadow);
  transition: transform .3s ease, box-shadow .3s ease, border-color .3s;
}
.entry-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--ink-faint); text-decoration: none; }
.entry-card .thumb { aspect-ratio: 16 / 10; overflow: hidden; background: var(--paper-3); }
.entry-card .thumb img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.92); transition: transform .5s ease; }
.entry-card:hover .thumb img { transform: scale(1.04); }
.entry-card .label { padding: 1.2rem 1.4rem 1.4rem; }
.entry-card .label .eyebrow { display: block; margin-bottom: .3rem; }
.entry-card .label .title { font-size: 1.35rem; color: var(--ink); font-weight: 600; }
.entry-card .label .arrow { color: var(--accent); font-family: var(--font-sans); font-size: .82rem; font-weight: 600; letter-spacing: .04em; margin-top: .5rem; display: inline-block; }

/* ============================================================
   Biography
   ============================================================ */
.bio-layout { display: grid; grid-template-columns: 1fr; gap: 2rem; padding-top: 2.5rem; }
.bio-section { padding: 1.5rem 0 2.5rem; border-bottom: 1px solid var(--rule-soft); scroll-margin-top: 90px; }
.bio-section:last-of-type { border-bottom: 0; }
.bio-section > .eyebrow { display: block; margin-bottom: .4rem; }
.bio-section h2 { margin-bottom: 1rem; }
.bio-section .prose { color: var(--ink-soft); }
.bio-section .subhead { color: var(--ink); font-weight: 600; display: block; margin-top: 1.4rem; }
figure.bio-figure { margin: 2rem 0 0; }
figure.bio-figure img { width: 100%; border-radius: var(--radius); border: 1px solid var(--rule); box-shadow: var(--shadow); filter: sepia(.06) saturate(.94); }
figure.bio-figure figcaption { font-family: var(--font-sans); font-size: .78rem; color: var(--ink-faint); margin-top: .6rem; text-align: center; }

/* Timeline */
.timeline { border-left: 2px solid var(--rule); margin: 1rem 0 0; padding-left: 1.6rem; }
.timeline li { position: relative; list-style: none; padding: 0 0 1.4rem; }
.timeline li::before {
  content: ""; position: absolute; left: calc(-1.6rem - 6px); top: .55rem;
  width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 4px var(--paper);
}
.timeline .yr { font-family: var(--font-sans); font-weight: 700; color: var(--accent); font-size: .92rem; letter-spacing: .02em; }
.timeline .ev { color: var(--ink-soft); font-size: .98em; }

.toc {
  position: sticky; top: 90px; align-self: start;
  font-family: var(--font-sans); font-size: .82rem;
}
.toc .eyebrow { display: block; margin-bottom: .8rem; }
.toc a { display: block; color: var(--ink-faint); padding: .35rem 0; border-left: 2px solid transparent; padding-left: .9rem; margin-left: -.9rem; }
.toc a:hover, .toc a.active { color: var(--ink); border-color: var(--accent); text-decoration: none; }

@media (min-width: 940px) {
  .bio-layout { grid-template-columns: 200px minmax(0, 1fr); gap: 3.5rem; }
}

/* ============================================================
   Bibliography
   ============================================================ */
.biblio-toolbar {
  position: sticky; top: 66px; z-index: 50;
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between;
  padding: 1.1rem 0; margin-bottom: 1rem;
  background: rgba(247,243,234,.9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.search-box { position: relative; flex: 1 1 320px; max-width: 460px; }
.search-box input {
  width: 100%; font-family: var(--font-sans); font-size: .95rem; color: var(--ink);
  padding: .7rem .9rem .7rem 2.4rem; border: 1px solid var(--rule);
  border-radius: var(--radius); background: var(--paper); transition: border-color .2s, box-shadow .2s;
}
.search-box input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(122,46,46,.12); }
.search-box .icon { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--ink-faint); pointer-events: none; }
.biblio-count { font-family: var(--font-sans); font-size: .82rem; color: var(--ink-faint); white-space: nowrap; }

.decade { margin-top: 2.4rem; }
.decade > h2 {
  display: flex; align-items: baseline; gap: .8rem;
  font-size: 1.05rem; font-family: var(--font-sans); font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--accent);
  padding-bottom: .6rem; border-bottom: 1px solid var(--rule); margin-bottom: .4rem;
}
.decade > h2 .n { color: var(--ink-faint); font-weight: 500; letter-spacing: 0; }

.paper {
  display: grid; grid-template-columns: 4.2rem 1fr auto; gap: 1rem 1.2rem;
  align-items: start; padding: 1.1rem .4rem; border-bottom: 1px solid var(--rule-soft);
  transition: background .15s;
}
.paper:hover { background: var(--paper-2); }
.paper .yr { font-family: var(--font-sans); font-weight: 700; color: var(--ink-faint); font-size: .95rem; padding-top: .15rem; }
.paper .body .title { color: var(--ink); font-weight: 600; font-size: 1.08em; line-height: 1.35; }
.paper a.title:hover { color: var(--accent); }
.paper .meta { color: var(--ink-faint); font-size: .9em; margin-top: .25rem; font-family: var(--font-sans); }
.paper .meta .authors { color: var(--ink-soft); }
.paper .meta .venue { font-style: italic; }
.paper .action { align-self: center; }
.paper .pill {
  font-family: var(--font-sans); font-size: .72rem; font-weight: 600; letter-spacing: .04em;
  padding: .45rem .8rem; border-radius: 100px; white-space: nowrap;
  border: 1px solid var(--accent); color: var(--accent); background: transparent; transition: background .2s, color .2s;
}
a.pill:hover { background: var(--accent); color: #fdf6f0; text-decoration: none; }
.pill.disabled { border-color: var(--rule); color: var(--ink-faint); cursor: default; }
.no-results { padding: 3rem 0; text-align: center; color: var(--ink-faint); font-style: italic; display: none; }

@media (max-width: 640px) {
  .paper { grid-template-columns: 3rem 1fr; }
  .paper .action { grid-column: 2; justify-self: start; margin-top: .3rem; }
}

/* ============================================================
   Single paper (reader) page
   ============================================================ */
.reader { padding-top: 2rem; }
.backlink { font-family: var(--font-sans); font-size: .8rem; font-weight: 500; letter-spacing: .03em; color: var(--ink-faint); display: inline-flex; gap: .4rem; }
.backlink:hover { color: var(--accent); text-decoration: none; }
.citation-block {
  background: var(--paper-2); border: 1px solid var(--rule); border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: 1.4rem 1.6rem; margin: 1.2rem 0 1.6rem;
}
.citation-block .yr { font-family: var(--font-sans); font-size: .78rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.citation-block h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.15rem); margin: .3rem 0 .5rem; }
.citation-block .cite { font-family: var(--font-sans); font-size: .9rem; color: var(--ink-soft); }
.citation-block .cite .venue { font-style: italic; }
.doc-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1rem; }

.pdf-frame {
  width: 100%; height: min(82vh, 1000px);
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--paper-3); box-shadow: var(--shadow); overflow: hidden;
}
.pdf-frame embed, .pdf-frame iframe { width: 100%; height: 100%; border: 0; }
.pdf-missing {
  display: grid; place-content: center; text-align: center; gap: .6rem; padding: 3rem;
  color: var(--ink-faint); font-family: var(--font-sans); height: 40vh;
  border: 1px dashed var(--rule); border-radius: var(--radius); background: var(--paper-2);
}
.pdf-missing strong { color: var(--ink); font-family: var(--font-serif); font-size: 1.2rem; }

.paper-nav {
  display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem;
  padding-top: 1.4rem; border-top: 1px solid var(--rule); font-family: var(--font-sans);
}
.paper-nav a { display: flex; flex-direction: column; gap: .2rem; max-width: 45%; color: var(--ink-soft); font-size: .9rem; }
.paper-nav a.next { text-align: right; margin-left: auto; }
.paper-nav a .dir { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); }
.paper-nav a:hover { color: var(--accent); text-decoration: none; }
.paper-nav a.disabled { visibility: hidden; }

/* ---- focus + a11y ---- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: .6rem 1rem; z-index: 200; font-family: var(--font-sans); font-size: .85rem; }
.skip-link:focus { left: .5rem; top: .5rem; }
