/* ============================================================
   Shared Evidence — interpretive layer
   Styles the standalone pandoc HTML output.
   Pair with sections.lua (collapsible <details>) and
   controls.html (controls bar + theme/expand/collapse JS).
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Spectral:ital,wght@0,300;0,400;0,500;0,600;1,400;1,500;1,600&display=swap');

:root{
  --paper:#f6f3ec;
  --ink:#1f1c17;
  --muted:#5c564b;
  --rule:#d8d1c2;
  --accent:#7a1f2b;
  --quote-bg:#efeadf;
  --quote-bar:#b89a6a;
  --quote-text:#332f28;
  --link:#7a1f2b;
  --link-underline:rgba(122,31,43,.32);
  --flash:rgba(184,154,106,.32);
  --maxw:46rem;
}

html[data-theme="dark"]{
  --paper:#16140f;
  --ink:#e8e2d4;
  --muted:#9b9384;
  --rule:#322d24;
  --accent:#d98a96;
  --quote-bg:#1f1c15;
  --quote-bar:#8a6f44;
  --quote-text:#ddd6c7;
  --link:#e0a4ae;
  --link-underline:rgba(224,164,174,.3);
  --flash:rgba(138,111,68,.34);
}

/* System-preference fallback for the brief moment before JS sets data-theme */
@media (prefers-color-scheme: dark){
  html:not([data-theme]){
    --paper:#16140f; --ink:#e8e2d4; --muted:#9b9384; --rule:#322d24;
    --accent:#d98a96; --quote-bg:#1f1c15; --quote-bar:#8a6f44;
    --quote-text:#ddd6c7; --link:#e0a4ae; --link-underline:rgba(224,164,174,.3);
    --flash:rgba(138,111,68,.34);
  }
}

*{box-sizing:border-box;}
html{scroll-behavior:smooth;}

body{
  margin:0 auto;
  max-width:var(--maxw);
  background:var(--paper);
  color:var(--ink);
  font-family:"Spectral",Georgia,serif;
  font-weight:400;
  font-size:1.075rem;
  line-height:1.65;
  -webkit-font-smoothing:antialiased;
  padding:0 1.25rem 70vh;
  transition:background .3s ease, color .3s ease;
}

/* ---- Title block (pandoc renders #title-block-header > h1.title) ---- */
#title-block-header{
  padding:3.5rem 0 1.6rem;
  border-bottom:1px solid var(--rule);
  margin-bottom:1.5rem;
}
/* Optional eyebrow — edit or delete the content string to taste */
#title-block-header::before{
  content:"Continuous Interpretive Layer";
  display:block;
  font-family:"Fraunces",serif;
  font-size:.72rem;
  letter-spacing:.22em;
  text-transform:uppercase;
  color:var(--accent);
  margin-bottom:1.1rem;
}
h1.title{
  font-family:"Fraunces",serif;
  font-weight:500;
  font-size:clamp(1.9rem,5vw,2.7rem);
  line-height:1.12;
  letter-spacing:-0.01em;
  margin:0;
  text-wrap:balance;
}
.subtitle{font-family:"Fraunces",serif;font-weight:400;color:var(--muted);}

/* If you keep a body-level "# …" H1 or a "Menu" list, these keep them tidy.
   (You can delete those lines from the markdown for the cleanest look.) */
body > h1:not(.title){
  font-family:"Fraunces",serif;font-weight:500;font-size:1.5rem;margin:1.5rem 0 .5rem;
}

/* ---- Controls bar (injected by controls.html) ---- */
.controls{
  display:flex;
  gap:.6rem;
  flex-wrap:wrap;
  margin:1.5rem 0 .5rem;
}
.controls button{
  font-family:"Fraunces",serif;
  font-size:.74rem;
  letter-spacing:.1em;
  text-transform:uppercase;
  background:transparent;
  color:var(--muted);
  border:1px solid var(--rule);
  border-radius:2px;
  padding:.45rem .85rem;
  cursor:pointer;
  transition:all .18s ease;
}
.controls button:hover{
  color:var(--accent);
  border-color:var(--accent);
}

/* ---- Collapsible sections ---- */
details.section{ border-bottom:1px solid var(--rule); }
details.section > summary{
  list-style:none;
  cursor:pointer;
  display:flex;
  align-items:baseline;
  gap:.85rem;
  padding:1.15rem 0;
  position:relative;
}
details.section > summary::-webkit-details-marker{display:none;}
.sec-num{
  font-family:"Fraunces",serif;
  font-size:.85rem;
  color:var(--accent);
  min-width:1.4rem;
  font-variant-numeric:tabular-nums;
  flex-shrink:0;
  padding-top:.18rem;
}
.sec-title{
  font-family:"Fraunces",serif;
  font-weight:500;
  font-size:1.22rem;
  line-height:1.25;
  flex:1;
  text-wrap:balance;
}
.chev{
  flex-shrink:0;
  width:1rem;height:1rem;
  margin-top:.3rem;
  transition:transform .22s ease;
  color:var(--muted);
}
details.section[open] > summary .chev{transform:rotate(90deg);}
.sec-body{ padding:.2rem 0 2rem 2.25rem; }
@media (max-width:560px){ .sec-body{padding-left:0;} }

/* ---- Prose ---- */
p{margin:0 0 1.1rem;}
a{
  color:var(--link);
  text-decoration:none;
  border-bottom:1px solid var(--link-underline);
  transition:border-color .15s;
}
a:hover{border-color:var(--accent);}
strong{font-weight:600;}
em{font-style:italic;font-weight:600;color:var(--ink);}

ul,ol{margin:0 0 1.1rem;padding-left:1.2rem;}

blockquote{
  margin:1.4rem 0;
  padding:1rem 1.25rem;
  background:var(--quote-bg);
  border-left:3px solid var(--quote-bar);
  border-radius:0 3px 3px 0;
  font-size:.98rem;
  color:var(--quote-text);
}
blockquote p{margin:0 0 .7rem;}
blockquote p:last-child{margin-bottom:0;}
blockquote ul{margin:.4rem 0 0;padding-left:1.1rem;font-size:.9rem;color:var(--muted);}

/* flash highlight when an internal anchor opens a section */
details.section.flash > summary{ animation:flash 1.4s ease; }
@keyframes flash{
  0%{background:transparent;}
  18%{background:var(--flash);}
  100%{background:transparent;}
}

footer{
  margin-top:3rem;
  padding-top:1.4rem;
  border-top:1px solid var(--rule);
  font-size:.82rem;
  color:var(--muted);
}
