:root {
  color-scheme: light;
  --canvas: #faf8f4;
  --paper: #fffdf9;
  --ink: #302329;
  --muted: #68565d;
  --plum: #4d293d;
  --wine: #782c46;
  --rose: #f4e8e9;
  --edge: #e2d6d5;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--canvas); }
body { margin: 0; color: var(--ink); font: 1rem/1.6 var(--sans); }
a { color: var(--wine); text-underline-offset: .22em; }
a:hover { color: var(--plum); }
:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
img { max-width: 100%; height: auto; }
button, input { font: inherit; }
h1, h2, h3 { line-height: 1.16; }
h1, h2 { font-family: var(--serif); font-weight: 600; }
h1 { font-size: clamp(2.35rem, 5vw, 4.5rem); letter-spacing: -.035em; }
h2 { font-size: clamp(1.55rem, 3vw, 2.15rem); letter-spacing: -.02em; }

.site-width { width: min(100% - 3rem, 75rem); margin-inline: auto; }
.reading-width { width: min(100% - 3rem, 48rem); margin-inline: auto; }
.sr-only, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link:focus { position: absolute; z-index: 2; top: .5rem; left: .5rem; padding: .55rem 1rem; background: var(--paper); }

.site-header { background: var(--plum); color: var(--paper); }
.header-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1.4rem; min-height: 4.7rem; padding-block: .65rem; }
.brand { display: inline-flex; align-items: center; gap: .65rem; font: 600 1.43rem/1.25 var(--serif); color: inherit; text-decoration: none; }
.brand img { width: 30px; height: 30px; object-fit: contain; }
.site-nav { display: flex; align-items: center; flex-wrap: wrap; column-gap: .32rem; row-gap: .15rem; font-size: .875rem; }
.site-nav a { display: block; padding: .42rem .61rem; color: #f5eaf0; text-decoration: none; border-radius: .25rem; }
.site-nav a:hover, .site-nav [aria-current] { background: #694155; color: white; }

.library-intro { background: var(--rose); border-bottom: 1px solid var(--edge); }
.library-hero { display: grid; grid-template-columns: minmax(0, 1.57fr) minmax(0, 1fr); align-items: stretch; gap: clamp(1.25rem, 5vw, 5rem); padding-block: 2.65rem; }
.hero-copy { padding-block: .65rem; }
.hero-copy h1 { margin: 0 0 .8rem; color: var(--plum); }
.hero-copy p { max-width: 33rem; margin: 0 0 1.4rem; color: var(--muted); font-size: 1.1rem; }
.hero-image { min-height: 13rem; border-radius: .35rem; background: linear-gradient(110deg, #4d293d54, #4d293d14), url("../../images/headers/pali-0.jpg") center / cover; }
.sutta-search { display: flex; gap: .5rem; max-width: 32rem; }
.sutta-search input { min-width: 0; flex: 1; padding: .6rem .85rem; border: 1px solid #b8a6ad; border-radius: .3rem; background: var(--paper); color: var(--ink); }
.sutta-search button, .button, .entry-content .btn { display: inline-block; padding: .6rem .95rem; background: var(--wine); border: 1px solid var(--wine); border-radius: .3rem; color: white; text-decoration: none; cursor: pointer; }
.sutta-search button:hover, .button:hover, .entry-content .btn:hover { background: var(--plum); color: white; }

.library-layout { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3.5rem); padding-block: 2.6rem 4rem; min-height: 50vh; }
.library-sidebar { min-width: 0; }
.index-nav { display: grid; gap: .28rem; }
.index-nav a, .intro-link { display: block; padding: .62rem .85rem; border-radius: .25rem; text-decoration: none; }
.index-nav a { color: var(--ink); border-inline-start: 3px solid transparent; }
.index-nav a:hover, .index-nav [aria-current] { background: var(--rose); color: var(--wine); }
.index-nav [aria-current] { border-inline-start-color: var(--wine); font-weight: 650; }
.intro-link { margin-top: 1rem; border-top: 1px solid var(--edge); }
.intro-link:hover { text-decoration: underline; }
.index-content > section + section { margin-top: 2rem; }
.index-content > section[hidden] + section { margin-top: 0; }
.index-heading { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem 1rem; flex-wrap: wrap; margin: 0 0 .85rem; }
.index-heading h2 { margin: 0; color: var(--plum); }
.index-heading span { color: var(--muted); font-size: .875rem; }
.sutta-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--edge); }
.sutta-row { display: grid; grid-template-columns: minmax(5.8rem, .22fr) minmax(0, 1fr) auto; align-items: baseline; gap: .7rem 1rem; padding: .88rem .75rem; border-bottom: 1px solid var(--edge); }
.sutta-row:hover { background: var(--paper); }
.sutta-code { color: var(--wine); font-size: .875rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.sutta-title { min-width: 0; overflow-wrap: anywhere; }
.sutta-title > a:first-child { color: var(--ink); font-weight: 600; text-decoration: none; }
.sutta-title > a:first-child:hover { color: var(--wine); text-decoration: underline; }
.sutta-local { display: block; width: fit-content; margin-top: .2rem; font-size: .875rem; }
.sutta-meta { display: flex; align-items: baseline; gap: .65rem; color: var(--muted); font-size: .875rem; white-space: nowrap; }
.sutta-source { color: var(--wine); }
.index-group { border: 1px solid var(--edge); border-radius: .3rem; background: var(--paper); margin-block: .55rem; }
.index-group summary { cursor: pointer; display: flex; align-items: center; gap: .85rem; padding: .85rem 1rem; list-style: none; }
.index-group summary::-webkit-details-marker { display: none; }
.index-group summary::before { content: ""; width: .5rem; height: .5rem; flex: 0 0 .5rem; border-right: 2px solid var(--wine); border-bottom: 2px solid var(--wine); transform: rotate(-45deg); }
.index-group[open] > summary::before { transform: rotate(45deg); }
.index-group summary small { display: block; font-size: .875rem; color: var(--muted); }
.group-code { margin-inline-start: auto; font-size: .875rem; font-weight: 650; color: var(--wine); }
.index-group .sutta-row:last-child { border-bottom: 0; }
.index-subgroups { padding: 0 .85rem .35rem; }

.article-page { padding-block: 2.4rem 4.1rem; min-height: 65vh; }
.article-page h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); margin: 0 0 1.5rem; color: var(--plum); }
.article-preview { padding: 1.5rem 0; border-top: 1px solid var(--edge); }
.article-preview h2 { margin-top: 0; }
.article-image { margin: 0 0 1.5rem; }
.article-image img { display: block; max-height: 21rem; object-fit: cover; border-radius: .25rem; }
.article-image figcaption, .article-meta { color: var(--muted); font-size: .875rem; }
.entry-content { overflow-wrap: anywhere; line-height: 1.75; }
.entry-content blockquote { margin-inline: 0; padding-inline: 1rem; border-left: 3px solid var(--edge); }
.entry-content table { display: block; overflow-x: auto; border-collapse: collapse; }
.entry-content td, .entry-content th { border: 1px solid var(--edge); padding: .3rem .55rem; text-align: left; }
.entry-content pre { overflow-x: auto; }
.entry-content iframe { max-width: 100%; }
.site-footer { border-top: 1px solid var(--edge); background: #f4efeb; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; padding-block: 1.35rem; font-size: .875rem; }
.footer-inner nav { display: flex; flex-wrap: wrap; gap: .5rem 1.3rem; }

@media (max-width: 61rem) {
  .site-nav { flex-basis: 100%; }
  .sutta-meta { display: grid; gap: .05rem; justify-items: end; }
}
@media (max-width: 46rem) {
  .site-width, .reading-width { width: calc(100% - 2rem); }
  .library-hero { grid-template-columns: 1fr; gap: 0; padding-block: 1.25rem; }
  .hero-image { display: none; }
  .library-layout { grid-template-columns: 1fr; gap: 1.2rem; padding-block: 1.2rem 2.75rem; }
  .index-nav { display: flex; flex-wrap: wrap; gap: .25rem; }
  .index-nav a { padding: .45rem .58rem; border-inline-start: 0; border-bottom: 2px solid transparent; font-size: .875rem; }
  .index-nav [aria-current] { border-bottom-color: var(--wine); }
  .intro-link { display: none; }
  .sutta-row { grid-template-columns: 4.8rem minmax(0, 1fr); gap: .2rem .65rem; padding-inline: .15rem; }
  .sutta-meta { grid-column: 2; display: flex; gap: .65rem; }
}
.brand:hover { color: white; }
.annotated { text-decoration: underline dotted; text-underline-offset: .18em; }
