/* Sitewide prspct-inspired line-art frame + vertical centering
   Tokens match home-lineart: #161512 panel, #c9a36a accents, cream strokes */
:root{
  --la-stroke:#c9a36a;
  --la-stroke-soft:#ece7dc;
  --la-panel:#161512;
  --la-outer:#0a0a08;
  --la-frame-green:#1a2218;
  --la-outline:#3a3630;
  --la-rule:#2c2a24;
}

/* ——— Vertical centering ———
   Short pages: main content sits mid-viewport.
   Long chapters: safe center → start when overflowing (no huge top gap). */
.site{
  display:flex;
  flex-direction:column;
  min-height:100dvh;
}
header.mast,
footer.colophon{
  flex-shrink:0;
}
main#text{
  flex:1 1 auto;
  display:flex;
  flex-direction:column;
  /* center when content fits; safe keyword avoids top gap on overflow */
  justify-content:center;
  justify-content:safe center;
  min-height:0;
}

/* ——— Outer panel / double outline on content well ——— */
main#text > .wrap,
main#text > article.wrap{
  position:relative;
  width:min(var(--wide), 100%);
  /* double-line frame via border + outline */
  border:1px solid var(--la-rule);
  outline:1px solid #3a363066;
  outline-offset:4px;
  background:
    linear-gradient(180deg, #161512cc 0%, #0e0d0bf0 48%, #0e0d0b 100%);
  box-shadow:
    0 0 0 1px #0005,
    inset 0 0 0 1px #c9a36a10,
    inset 0 1px 0 #ffffff06;
  padding-block:clamp(1.25rem, 3.5vw, 2rem);
  padding-inline:var(--gutter);
  margin-inline:auto;
}

/* Home hero already has its own frame — avoid double boxing */
main#text > .wrap.home-hero{
  border:none;
  outline:none;
  background:transparent;
  box-shadow:none;
  /* home-lineart owns padding/frame; keep centering parent happy */
  padding-block:unset;
}

/* Chapter pages: keep readable measure; light frame only */
main#text > article.wrap.chapter-page{
  max-width:44rem;
  width:min(44rem, 100%);
  background:
    linear-gradient(180deg, #14120ecc 0%, #0e0d0bf8 40%, #0e0d0b 100%);
  /* softer ornament so paper chapter-body stays primary */
  outline-offset:3px;
}

/* ——— Corner L-brackets (CSS only) ——— */
main#text > .wrap:not(.home-hero):before,
main#text > .wrap:not(.home-hero):after,
main#text > article.wrap:before,
main#text > article.wrap:after{
  content:"";
  position:absolute;
  width:14px;
  height:14px;
  pointer-events:none;
  z-index:2;
  border-color:var(--la-stroke);
  opacity:.5;
}
main#text > .wrap:not(.home-hero):before,
main#text > article.wrap:before{
  top:6px;left:6px;
  border-top:1px solid;
  border-left:1px solid;
  box-shadow:inset 2px 2px 0 -1px var(--la-stroke);
}
main#text > .wrap:not(.home-hero):after,
main#text > article.wrap:after{
  bottom:6px;right:6px;
  border-bottom:1px solid;
  border-right:1px solid;
  box-shadow:inset -2px -2px 0 -1px var(--la-stroke);
}

/* ——— Double-line cards / sections ——— */
.book-card,
.lead,
section.aeo,
.home-seo-answer,
.excerpt{
  border:1px solid var(--la-rule);
  outline:1px solid #3a363066;
  outline-offset:3px;
  background:linear-gradient(180deg, #181610 0%, var(--la-panel) 100%);
  box-shadow:inset 0 0 0 1px #c9a36a0e;
  position:relative;
}
.book-card{
  padding:1.1rem 1.15rem 1.2rem;
  margin:0 0 .85rem;
  border-top:1px solid var(--la-rule);
}
.book-list .book-card:first-child{border-top:1px solid var(--la-rule);padding-top:1.1rem}
.lead{
  padding:.85rem 1rem;
  margin:0 0 1.25rem;
  max-width:var(--measure);
}
.lead p{margin:0}
section.aeo{
  padding:1rem 1.1rem;
  margin:0 0 1.5rem;
  max-width:var(--measure);
}
/* Lore / about prose sections — thin divider treatment */
main#text .wrap > section:not(.aeo):not(.toc){
  margin:0 0 1.5rem;
  padding-top:.15rem;
  border-top:1px solid transparent;
}
main#text .wrap > section:not(.aeo):not(.toc) h2{
  padding-bottom:.45rem;
  border-bottom:1px solid var(--la-rule);
  box-shadow:0 1px 0 #1a1814;
  position:relative;
}
main#text .wrap > section:not(.aeo):not(.toc) h2:after{
  content:"";
  position:absolute;
  left:0;bottom:-2px;
  width:2.25rem;height:1px;
  background:var(--la-stroke);
  opacity:.5;
}

.prose{
  position:relative;
  padding:.15rem 0 0;
}
.prose > p:first-child{
  padding-top:.35rem;
  border-top:1px solid var(--la-rule);
  box-shadow:0 -1px 0 #1a1814;
}

/* Book hub TOC — framed list */
.toc{
  border:1px solid var(--la-rule);
  outline:1px solid #3a363044;
  outline-offset:3px;
  padding:1rem 1.15rem 1.15rem;
  background:#16151266;
  box-shadow:inset 0 0 0 1px #c9a36a08;
}
.toc h2{
  margin-top:0;
  padding-bottom:.45rem;
  border-bottom:1px solid var(--la-rule);
}

/* Chapter chrome: keep Base typography; frame nav/actions lightly */
.chapter-page .chapter-nav{
  border-top:1px solid var(--la-rule);
  box-shadow:0 -1px 0 #1a1814;
  padding-top:1rem;
}
.chapter-page .aeo-dek,
.chapter-page .aeo-note{
  border:1px solid var(--la-rule);
  outline:1px solid #3a363044;
  outline-offset:2px;
  background:#16151288;
  padding:.75rem .9rem;
  box-shadow:inset 0 0 0 1px #c9a36a0a;
  max-width:var(--measure);
}
.chapter-page .aeo-note{margin-top:.75rem}
/* Do not recolor or re-measure chapter-body paper block */
.chapter-page .chapter-body{
  /* Base styles preserved; only a soft outer bronze hint */
  box-shadow:
    0 0 0 1px #0006,
    0 0 0 2px #c9a36a14;
}

/* CTAs — thin double frame sitewide */
.cta{
  outline:1px solid #3a363055;
  outline-offset:2px;
  box-shadow:inset 0 0 0 1px #c9a36a14;
}

/* Mast / colophon fine dividers already in Base; bronze hairline accent */
header.mast{
  box-shadow:0 1px 0 #1a1814;
  border-bottom-color:var(--la-rule);
}
footer.colophon{
  box-shadow:0 -1px 0 #1a1814;
  border-top-color:var(--la-rule);
}

/* ——— Mobile: keep frame, reduce ornament ——— */
@media (max-width:719px){
  main#text > .wrap:not(.home-hero),
  main#text > article.wrap{
    outline-offset:2px;
    padding-block:clamp(1rem, 3vw, 1.5rem);
  }
  main#text > .wrap:not(.home-hero):before,
  main#text > .wrap:not(.home-hero):after,
  main#text > article.wrap:before,
  main#text > article.wrap:after{
    width:10px;height:10px;
    opacity:.38;
  }
  .book-card,
  .lead,
  section.aeo,
  .toc,
  .chapter-page .aeo-dek,
  .chapter-page .aeo-note{
    outline-offset:2px;
  }
}

/* ——— Reduced motion ——— */
@media (prefers-reduced-motion:reduce){
  .book-card,
  .cta,
  .series-card,
  main#text > .wrap,
  main#text > article.wrap{
    transition:none!important;
  }
}

/* Extra guard: very long chapter articles pin to start if safe unsupported */
@supports not (justify-content:safe center){
  main#text:has(> article.chapter-page .chapter-body){
    justify-content:flex-start;
  }
}


/* EN-first promo: hide language switcher in top nav */
.nav .lang{
  display:none !important;
}


/* Homepage: lead/SEO boxes match series-grid width */
.home-hero .lead,
.home-hero .home-lead,
.home-hero .home-seo-answer{
  max-width:none !important;
  width:100%;
}
