/* Guide To Buddhism A To Z — keeps the warm saffron look of the original site,
   rebuilt mobile-first. */
:root {
  --bg: #f4b65c;
  --bg-deep: #d98f2b;
  --paper: #fff8ec;
  --ink: #1f1a14;
  --muted: #6b5a45;
  --link: #2f2f8f;
  --link-hover: #1b1b5e;
  --accent: #8a4b08;
  --line: #ecd9b8;
  --radius: 12px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  --display: "Cormorant Garamond", "Iowan Old Style", Palatino, Georgia, serif;
}

@font-face { font-family: "Cormorant Garamond"; font-weight: 500; font-display: swap;
  src: url("/assets/fonts/cormorant-garamond-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Cormorant Garamond"; font-weight: 500; font-display: swap;
  src: url("/assets/fonts/cormorant-garamond-latin-ext-500-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+1E00-1EFF; }
@font-face { font-family: "Cormorant Garamond"; font-weight: 600; font-display: swap;
  src: url("/assets/fonts/cormorant-garamond-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Cormorant Garamond"; font-weight: 600; font-display: swap;
  src: url("/assets/fonts/cormorant-garamond-latin-ext-600-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+1E00-1EFF; }
@font-face { font-family: "Cormorant Garamond"; font-weight: 700; font-display: swap;
  src: url("/assets/fonts/cormorant-garamond-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Cormorant Garamond"; font-weight: 700; font-display: swap;
  src: url("/assets/fonts/cormorant-garamond-latin-ext-700-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+1E00-1EFF; }
@font-face { font-family: "Cormorant Garamond"; font-weight: 600; font-style: italic; font-display: swap;
  src: url("/assets/fonts/cormorant-garamond-latin-600-italic.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Cormorant Garamond"; font-weight: 600; font-style: italic; font-display: swap;
  src: url("/assets/fonts/cormorant-garamond-latin-ext-600-italic.woff2") format("woff2"); unicode-range: U+0100-02AF, U+1E00-1EFF; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 4.5rem; }
body {
  margin: 0;
  font: 18px/1.7 var(--serif);
  color: var(--ink);
  background: var(--bg);
  background-image: radial-gradient(ellipse at center, #f8c574 0%, var(--bg) 55%, var(--bg-deep) 100%);
  background-attachment: fixed;
  overflow-wrap: break-word;
}
.wrap { width: 100%; max-width: 940px; margin: 0 auto; padding: 0 16px; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover, a:focus-visible { color: var(--link-hover); }
img { max-width: 100%; height: auto; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- header ---------- */
.site-header { padding: 18px 0 8px; }
.site-header .wrap { display: grid; gap: 10px; grid-template-columns: 1fr; }
.brand { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; justify-content: start; }
.brand-home { display: contents; color: var(--ink); text-decoration: none; }
.brand-home .mark { grid-row: 1 / span 2; }
.brand-title { grid-column: 2; align-self: end; }
a.brand-tag { grid-column: 2; align-self: start; justify-self: start; text-decoration: none; }
a.brand-tag:hover { text-decoration: underline; text-underline-offset: 3px; }
.brand .mark { width: clamp(40px, 9vw, 52px); height: clamp(40px, 9vw, 52px); flex: none; color: #8a4b08;
  transition: transform 1.2s cubic-bezier(.2,.7,.2,1); }
.stupa .lines path { fill: none; stroke: currentColor; stroke-width: 2.8; stroke-linejoin: round; stroke-linecap: round; }
.stupa .sun { fill: #ffe1a1; animation: sunrise 2.2s cubic-bezier(.2,.7,.2,1) .3s both; }
.brand-home:hover .stupa .sun { animation: sunrise-again 2.2s cubic-bezier(.2,.7,.2,1) both; }
@keyframes sunrise { from { transform: translateY(22px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sunrise-again { from { transform: translateY(22px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .stupa .sun { animation: none !important; } }
.brand-title { font: 600 clamp(1.75rem, 6.4vw, 2.5rem)/1 var(--display); color: #2a1604; letter-spacing: -.005em; white-space: nowrap; }
.brand-title i, .hero h1 i { color: #8a4b08; font-style: italic; }
.az { display: inline-block; font: 600 .38em/1 var(--sans); letter-spacing: .08em; vertical-align: middle;
  margin-left: .45em; padding: .45em .75em; border-radius: 999px; background: #2a1604; color: #f8c574; transform: translateY(-.15em); }
.brand-tag { font: italic 600 clamp(.95rem, 3.4vw, 1.05rem)/1.2 var(--display); color: #6b3a07; margin-top: 4px; }
.site-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.site-nav a {
  font: 600 .9rem/1.2 var(--sans); color: var(--ink); text-decoration: none;
  padding: 7px 13px; border-radius: 999px; background: rgba(255,248,236,.7);
}
.site-nav a:hover { background: var(--paper); }
.search { position: relative; }
.search input, .hero-search input {
  width: 100%; font: 16px var(--sans); padding: 10px 14px; border: 1px solid var(--line);
  border-radius: 999px; background: #fff; color: var(--ink);
}
.search input:focus, .hero-search input:focus { outline: 3px solid rgba(47,47,143,.35); border-color: var(--link); }
.suggest {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 6px 0;
  list-style: none; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,.15); max-height: 60vh; overflow: auto; font-family: var(--sans);
}
.suggest a { display: block; padding: 8px 14px; text-decoration: none; color: var(--ink); }
.suggest a:hover, .suggest a[aria-selected="true"] { background: #fdf0d8; }
.suggest .all { color: var(--link); border-top: 1px solid var(--line); }

@media (max-width: 480px) {
  .site-nav { gap: 6px; }
  .site-nav a { font-size: .84rem; padding: 6px 10px; }
}
@media (min-width: 820px) {
  .site-header .wrap { grid-template-columns: 1fr minmax(240px, 320px); align-items: center; gap: 8px 24px; }
  .site-nav { grid-column: 1 / -1; grid-row: 2; }
}

/* ---------- main card ---------- */
main.wrap {
  background: var(--paper); border-radius: var(--radius); padding: 22px 18px 28px; margin-top: 10px;
  box-shadow: 0 8px 30px rgba(90,50,0,.18);
}
@media (min-width: 820px) { main.wrap { padding: 36px 48px 44px; } }

h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.15; color: var(--ink); }
h1 { font-size: clamp(2rem, 7vw, 2.8rem); margin: 0 0 .35em; }
h2 { font-size: 1.65rem; margin: 1.4em 0 .5em; }
.crumbs { margin: 0; font: 14px var(--sans); }
.crumbs a { text-decoration: none; color: var(--muted); }

/* ---------- entry ---------- */
.entry { max-width: 74ch; }
.entry-body p { margin: 0 0 1em; }
.entry-body b, .entry-body strong { font-weight: 600; }
.entry-body a.xref { text-decoration: none; border-bottom: 1px solid rgba(47,47,143,.35); }
.entry-body a.xref:hover { border-bottom-color: currentColor; }
.entry-img { margin: 4px auto 18px; text-align: center; }
.entry-img img { border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.18); max-height: 420px; width: auto; }
@media (min-width: 640px) {
  .entry-img { float: right; margin: 6px 0 14px 22px; max-width: 42%; }
}
.entry-body img:not(.entry-img img) { display: block; margin: 12px auto; border-radius: 6px; }
.source { clear: both; font-size: .92em; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; margin-top: 22px; }
.source span { font-family: var(--sans); font-size: .8em; text-transform: uppercase; letter-spacing: .06em; display: block; }
.subjects-line { font: 14px/1.8 var(--sans); color: var(--muted); }
.subjects-line a { display: inline-block; margin: 2px 6px 2px 0; padding: 1px 10px; border-radius: 999px; background: #fbe8c8; text-decoration: none; color: var(--ink); }
.backlinks { clear: both; margin-top: 18px; }
.backlinks h2 { font-size: 1.15rem; }
.backlinks ul { columns: 2; column-gap: 24px; padding-left: 18px; font-size: .95em; margin: 0; }
@media (min-width: 640px) { .backlinks ul { columns: 3; } }

.dyk {
  clear: both; margin: 28px 0 0; padding: 16px 18px; border-left: 4px solid var(--bg-deep);
  background: #fdf0d8; border-radius: 0 var(--radius) var(--radius) 0;
}
.dyk h2 { margin: 0 0 4px; font-size: 1.15rem; color: var(--accent); }
.dyk p { margin: 0; }

.prevnext { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; font: 15px/1.4 var(--sans); }
.prevnext a { text-decoration: none; padding: 8px 0; }
.prevnext .next { text-align: right; margin-left: auto; }

/* ---------- index pages ---------- */
.letters {
  position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; gap: 4px;
  margin: 0 -6px 12px; padding: 8px 6px; background: var(--paper); border-bottom: 1px solid var(--line);
}
.letters a, .letters span {
  min-width: 2.1em; padding: 4px 0; text-align: center; font: 600 16px var(--sans);
  border-radius: 6px; text-decoration: none;
}
.letters a:hover { background: #fbe8c8; }
.letters span { color: #c9b89c; }
.az-group h2 { border-bottom: 1px solid var(--line); padding-bottom: 4px; }
ul.index { list-style: none; padding: 0; margin: 0; }
ul.index li a { display: block; padding: 7px 0; font-size: 1.02em; text-decoration: none; border-bottom: 1px dotted var(--line); }
@media (min-width: 640px) {
  ul.index { columns: 2; column-gap: 32px; }
  ul.index li { break-inside: avoid; }
}
@media (min-width: 980px) { ul.index { columns: 3; } }
.toc { padding-left: 20px; columns: 2; column-gap: 24px; }
@media (max-width: 480px) { .toc { columns: 1; } }

/* ---------- home + search ---------- */
.hero { display: grid; gap: 8px 36px; align-items: center; }
.hero-art { margin: 0 auto 6px; max-width: 300px; width: 82%; }
.hero-art img { display: block; width: 100%; height: auto; filter: drop-shadow(0 6px 14px rgba(90,50,0,.25)); }
@media (min-width: 760px) {
  .hero { grid-template-columns: minmax(260px, 40%) 1fr; }
  .hero-art { max-width: none; width: 100%; margin: 0; }
}
.hero h1 { margin-bottom: .3em; }
.hero p { max-width: 70ch; }
.hero-search { display: flex; gap: 8px; margin: 18px 0 22px; max-width: 560px; }
.hero-search button {
  font: 600 16px var(--sans); padding: 10px 18px; border: 0; border-radius: 999px;
  background: var(--accent); color: #fff; cursor: pointer;
}
.home-cols { display: grid; gap: 8px 32px; }
@media (min-width: 760px) { .home-cols { grid-template-columns: 1fr 1fr; align-items: start; } }
.results { padding-left: 22px; }
.results li { margin: 0 0 14px; }
.results a { font-weight: 600; }
.results p { margin: 2px 0 0; font-size: .95em; color: var(--muted); }
.results mark { background: #fbe0a6; color: inherit; }

/* ---------- footer ---------- */
.site-footer { padding: 20px 0 36px; font: 14px/1.6 var(--sans); color: #3b2a12; text-align: center; }
.site-footer a { color: #3b2a12; }

/* ---------- old content oddities ---------- */
.entry-body table { max-width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.entry-body big { font-size: 1em; }

@media (prefers-color-scheme: dark) {
  :root { --paper: #1d1913; --ink: #eee5d6; --muted: #b9a88f; --link: #f0b45e; --link-hover: #ffd18f;
          --line: #3a3124; --accent: #f0b45e; }
  body { background: #120f0b; background-image: none; }
  .brand, .brand-title, .site-nav a, h1, h2, h3, .site-footer, .site-footer a { color: #eee5d6; }
  .brand .mark, .brand-title i, .hero h1 i, .brand-tag { color: #f0b45e; }
  .stupa .sun { fill: rgba(240,180,94,.28); }
  .az { background: #f0b45e; color: #1d1913; }
  .site-nav a { background: #2a231a; }
  .search input, .hero-search input, .suggest { background: #2a231a; color: var(--ink); border-color: var(--line); }
  .suggest a { color: var(--ink); } .suggest a:hover { background: #3a3124; }
  .dyk, .subjects-line a, .letters a:hover { background: #2a231a; }
  .letters span { color: #5a4c38; }
  .hero-search button { color: #1d1913; }
  .entry-body a.xref { border-bottom-color: rgba(240,180,94,.4); }
}
@media print {
  body { background: #fff; } .site-header nav, .search, .dyk, .prevnext, .site-footer, .letters { display: none; }
  main.wrap { box-shadow: none; }
}

/* ---------- about / abbreviations ---------- */
.author { margin: 0 0 18px; }
.author img { border-radius: 10px; box-shadow: 0 4px 14px rgba(0,0,0,.2); width: 100%; max-width: 600px; }
dl.abbr { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; }
dl.abbr dt { font-weight: 700; font-family: var(--sans); }
dl.abbr dd { margin: 0; }
.hero h1 { font-size: clamp(2rem, 4.2vw, 2.7rem); }
.hero h1 .az { font-size: .4em; }

/* ---------- Tipiṭaka chart (text version of the old image) ---------- */
.tipitaka-chart { margin: 1.6em 0; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: #fffdf8; }
.tipitaka-chart figcaption { text-align: center; font: 600 1.45rem/1.2 var(--display); margin-bottom: 16px; }
.tipitaka-chart .baskets { display: grid; gap: 14px; position: relative; }
.tipitaka-chart .basket { padding: 12px 14px; border-radius: 10px; background: #fdf0d8; }
.tipitaka-chart h3 { font-size: 1.15rem; margin: 0 0 8px; font-weight: 500; }
.tipitaka-chart h3 b { font-weight: 700; }
.tipitaka-chart ol { margin: 0; padding-left: 1.4em; font-size: .95em; line-height: 1.5; }
.tipitaka-chart li { margin: 0 0 6px; }
.tipitaka-chart li b { font-weight: 700; white-space: nowrap; }
.tipitaka-chart .khuddaka { margin-top: 14px; padding: 12px 14px; border: 1px solid #c79a5a; border-radius: 10px; }
.tipitaka-chart h4 { margin: 0 0 8px; font: 500 1.05rem/1.3 var(--display); }
@media (min-width: 640px) {
  .tipitaka-chart .baskets { grid-template-columns: repeat(3, 1fr); padding-top: 22px; }
  .tipitaka-chart .baskets::before { content: ""; position: absolute; top: 0; left: 16.6%; right: 16.6%; height: 14px;
    border: 2px solid var(--muted); border-bottom: 0; }
  .tipitaka-chart .baskets::after { content: ""; position: absolute; top: -14px; left: 50%; height: 14px; border-left: 2px solid var(--muted); }
  .tipitaka-chart .khuddaka ol { columns: 3; column-gap: 24px; }
  .tipitaka-chart .khuddaka li { break-inside: avoid; }
}
@media (prefers-color-scheme: dark) {
  .tipitaka-chart { background: #221d16; }
  .tipitaka-chart .basket { background: #2a231a; }
}
