/* Eternally Blessed — the illuminated library.
   Parchment + deep green + gold leaf; Fraunces display, Alegreya Sans text. */

:root {
  --parchment: #f6f1e6;
  --panel: #fffdf6;
  --panel-edge: #e7dfcd;
  --ink: #2b2419;
  --ink-soft: #57503f;
  --muted: #8a8171;
  --green: #1d4a38;
  --green-deep: #123124;
  --green-soft: #e4ece5;
  --gold: #b8892e;
  --gold-bright: #d3a94c;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Alegreya Sans", "Gill Sans", sans-serif;
  --shadow: 0 1px 2px rgba(43, 36, 25, .06), 0 8px 28px -12px rgba(43, 36, 25, .25);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 70% -10%, rgba(184, 137, 46, .07), transparent 60%),
    var(--parchment);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* faint paper grain */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 .17 0 0 0 0 .14 0 0 0 0 .1 0 0 0 .03 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 1;
}

main, header.site, footer.site { position: relative; z-index: 2; }

a { color: var(--green); text-decoration: none; }
a:hover { color: var(--gold); }

.wrap { width: min(1180px, 92vw); margin: 0 auto; }

/* ---------------------------------------------------------------- header */

header.site {
  border-bottom: 1px solid var(--panel-edge);
  background: color-mix(in srgb, var(--parchment) 88%, transparent);
  backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 50;
}
header.site .wrap {
  display: flex; align-items: baseline; gap: 2.2rem;
  padding: 1.05rem 0 .95rem;
}
.brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.45rem;
  letter-spacing: .01em;
  color: var(--green);
  white-space: nowrap;
}
.brand .amp { color: var(--gold); font-style: italic; }
nav.main { display: flex; gap: 1.6rem; font-size: .95rem; }
nav.main a {
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .78rem;
  font-weight: 500;
  padding-bottom: .2rem;
  border-bottom: 2px solid transparent;
}
nav.main a:hover, nav.main a.active { color: var(--green); border-color: var(--gold); }
header.site .spacer { flex: 1; }
.header-search { position: relative; }
.header-search input {
  font-family: var(--sans);
  font-size: .95rem;
  padding: .45rem .9rem .45rem 2.1rem;
  border: 1px solid var(--panel-edge);
  border-radius: 999px;
  background: var(--panel);
  width: 15.5rem;
  color: var(--ink);
  transition: width .25s ease, border-color .2s;
}
.header-search input:focus { outline: none; border-color: var(--gold); width: 19rem; }
.header-search::before {
  content: "";
  position: absolute; left: .8rem; top: 50%; translate: 0 -50%;
  width: .85rem; height: .85rem;
  border: 1.6px solid var(--muted); border-radius: 50%;
  box-shadow: 3px 4px 0 -2.2px var(--muted);
  rotate: -45deg;
}

/* ------------------------------------------------------------------ hero */

.hero { padding: 5.5rem 0 4rem; }
.hero .kicker, .kicker {
  text-transform: uppercase;
  letter-spacing: .28em;
  font-size: .72rem;
  font-weight: 600;
  color: var(--gold);
}
.hero h1 {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  font-weight: 500;
  line-height: 1.04;
  margin: .8rem 0 1.1rem;
  color: var(--green);
  max-width: 21ch;
}
.hero h1 em { font-style: italic; color: var(--ink); }
.hero p.lede {
  font-size: 1.18rem;
  color: var(--ink-soft);
  max-width: 52ch;
}
.hero-search { margin-top: 2.4rem; max-width: 620px; position: relative; }
.hero-search input {
  width: 100%;
  font-family: var(--sans);
  font-size: 1.12rem;
  padding: 1.05rem 8.4rem 1.05rem 1.4rem;
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--ink);
}
.hero-search input:focus { outline: 2px solid var(--gold); outline-offset: -1px; }
.hero-search button {
  position: absolute; right: .55rem; top: 50%; translate: 0 -50%;
  font-family: var(--sans);
  font-size: .95rem; font-weight: 600;
  letter-spacing: .06em;
  padding: .62rem 1.4rem;
  border: none; border-radius: 10px;
  background: var(--green); color: #f4efdf;
  cursor: pointer;
  transition: background .2s;
}
.hero-search button:hover { background: var(--gold); color: #fff; }
.hero-hints { margin-top: .8rem; font-size: .88rem; color: var(--muted); }
.hero-hints a { border-bottom: 1px dotted var(--gold); margin-right: .9rem; }

/* stat band */
.stats {
  display: flex; flex-wrap: wrap; gap: 0 3.2rem;
  margin-top: 3.4rem;
  border-top: 1px solid var(--panel-edge);
  padding-top: 1.6rem;
}
.stats div { padding: .2rem 0; }
.stats b {
  display: block;
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 550;
  color: var(--ink);
}
.stats span {
  text-transform: uppercase; letter-spacing: .18em;
  font-size: .68rem; color: var(--muted); font-weight: 600;
}

/* --------------------------------------------------------------- sections */

section.band { padding: 3.2rem 0; }
section.band.tinted {
  background: linear-gradient(180deg, rgba(29, 74, 56, .05), rgba(29, 74, 56, 0));
  border-top: 1px solid var(--panel-edge);
}
.band-head {
  display: flex; align-items: baseline; gap: 1.4rem;
  margin-bottom: 1.7rem;
}
.band-head h2 {
  font-family: var(--serif);
  font-size: 1.9rem;
  font-weight: 550;
  color: var(--green);
}
.band-head .rule { flex: 1; height: 1px; background: var(--panel-edge); }
.band-head a.more {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .14em;
  font-weight: 600;
}

/* ------------------------------------------------------------------ cards */

.grid { display: grid; gap: 1.1rem; }
.grid.works { grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); }
.grid.tiles { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }

.card {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
  padding: 1.15rem 1.2rem 1.05rem;
  box-shadow: 0 1px 2px rgba(43, 36, 25, .05);
  display: flex; flex-direction: column; gap: .45rem;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
  position: relative;
  overflow: hidden;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--gold) 45%, var(--panel-edge));
}
.card .kind {
  font-size: .66rem; text-transform: uppercase; letter-spacing: .17em;
  font-weight: 700; color: var(--gold);
}
.card h3 {
  font-family: var(--serif);
  font-size: 1.13rem;
  font-weight: 560;
  line-height: 1.25;
  color: var(--ink);
}
.card h3 a { color: inherit; }
.card h3 a:hover { color: var(--green); }
.card .meta { font-size: .84rem; color: var(--muted); margin-top: auto; }
.card .meta b { color: var(--ink-soft); font-weight: 600; }
.card p.desc {
  font-size: .9rem; color: var(--ink-soft);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card .formats { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip {
  font-size: .68rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  padding: .18rem .55rem;
  border-radius: 999px;
  background: var(--green-soft); color: var(--green);
}

/* tile cards (teachers, collections, decades) */
.tile {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
  padding: 1.3rem 1.25rem;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.tile:hover {
  transform: translateY(-2px); box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--gold) 45%, var(--panel-edge));
}
.tile h3 { font-family: var(--serif); font-size: 1.2rem; font-weight: 560; color: var(--green); }
.tile .n { font-size: .82rem; color: var(--muted); margin-top: .3rem; }
.tile.decade { text-align: center; padding: 1.6rem 1rem; }
.tile.decade h3 { font-size: 1.7rem; }

/* ---------------------------------------------------------------- browse */

.browse-layout { display: grid; grid-template-columns: 250px 1fr; gap: 2.4rem; padding: 2.6rem 0 3.5rem; }
@media (max-width: 900px) { .browse-layout { grid-template-columns: 1fr; } }
aside.filters h2 { font-family: var(--serif); font-size: 1.3rem; color: var(--green); margin-bottom: 1rem; }
.fgroup { margin-bottom: 1.4rem; }
.fgroup label {
  display: block;
  font-size: .7rem; text-transform: uppercase; letter-spacing: .16em;
  font-weight: 700; color: var(--muted); margin-bottom: .4rem;
}
.fgroup select, .fgroup input {
  width: 100%; font-family: var(--sans); font-size: .95rem;
  padding: .5rem .7rem;
  border: 1px solid var(--panel-edge); border-radius: 8px;
  background: var(--panel); color: var(--ink);
}
.results-head {
  display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1.2rem;
}
.results-head h1 { font-family: var(--serif); font-size: 1.7rem; font-weight: 550; color: var(--green); }
.results-head .count { color: var(--muted); font-size: .92rem; }
.pager { display: flex; gap: .5rem; justify-content: center; margin: 2.2rem 0 0; }
.pager button {
  font-family: var(--sans); font-size: .9rem; font-weight: 600;
  padding: .5rem 1.1rem;
  border: 1px solid var(--panel-edge); border-radius: 8px;
  background: var(--panel); color: var(--green); cursor: pointer;
}
.pager button:disabled { opacity: .4; cursor: default; }
.pager button:not(:disabled):hover { border-color: var(--gold); }
.pager .pageinfo { align-self: center; font-size: .88rem; color: var(--muted); padding: 0 .6rem; }

/* ------------------------------------------------------------------ work */

.work-page { padding: 2.8rem 0 4rem; max-width: 880px; }
.crumbs { font-size: .82rem; color: var(--muted); margin-bottom: 1.6rem; }
.crumbs a { color: var(--muted); border-bottom: 1px dotted var(--panel-edge); }
.crumbs a:hover { color: var(--gold); }
.work-page h1 {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 4vw, 2.9rem);
  font-weight: 520; line-height: 1.12;
  color: var(--green);
  margin: .5rem 0 1rem;
}
.work-meta {
  display: flex; flex-wrap: wrap; gap: .4rem 1.6rem;
  font-size: .92rem; color: var(--ink-soft);
  padding-bottom: 1.4rem; margin-bottom: 1.6rem;
  border-bottom: 1px solid var(--panel-edge);
}
.work-meta b { font-weight: 600; }
.work-desc { font-size: 1.06rem; color: var(--ink-soft); max-width: 65ch; white-space: pre-line; }
.topic-row { margin: 1.3rem 0; display: flex; gap: .45rem; flex-wrap: wrap; }

/* player */
.player {
  margin: 2rem 0;
  background: linear-gradient(135deg, var(--green), var(--green-deep));
  color: #efe9d6;
  border-radius: 16px;
  padding: 1.4rem 1.6rem;
  box-shadow: var(--shadow);
}
.player .ptitle { font-size: .8rem; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-bright); font-weight: 700; margin-bottom: .8rem; }
.player-row { display: flex; align-items: center; gap: 1.1rem; }
.pbtn {
  width: 54px; height: 54px; flex: none;
  border-radius: 50%; border: none; cursor: pointer;
  background: var(--gold-bright); color: var(--green-deep);
  display: grid; place-items: center;
  transition: transform .15s, background .2s;
}
.pbtn:hover { transform: scale(1.06); background: #e6bd5e; }
.pbtn svg { width: 22px; height: 22px; fill: currentColor; }
.ptrack { flex: 1; }
.pbar {
  height: 7px; border-radius: 99px;
  background: rgba(244, 239, 223, .25);
  cursor: pointer; position: relative;
}
.pbar .fill {
  position: absolute; inset: 0 auto 0 0; width: 0%;
  border-radius: 99px;
  background: var(--gold-bright);
}
.ptime { display: flex; justify-content: space-between; font-size: .8rem; margin-top: .5rem; opacity: .85; font-variant-numeric: tabular-nums; }
.pdownloads { margin-top: 1rem; display: flex; gap: .6rem; flex-wrap: wrap; }
.pdownloads a {
  font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: #efe9d6; border: 1px solid rgba(239, 233, 214, .35);
  padding: .34rem .8rem; border-radius: 999px;
}
.pdownloads a:hover { border-color: var(--gold-bright); color: var(--gold-bright); }

.doc-links { margin: 1.8rem 0; display: flex; gap: .7rem; flex-wrap: wrap; }
.doc-links a {
  display: inline-flex; align-items: center; gap: .5rem;
  font-weight: 600; font-size: .95rem;
  background: var(--panel); border: 1px solid var(--panel-edge);
  padding: .65rem 1.1rem; border-radius: 10px;
  box-shadow: 0 1px 2px rgba(43,36,25,.05);
}
.doc-links a:hover { border-color: var(--gold); }

.related h2 { font-family: var(--serif); font-size: 1.5rem; color: var(--green); font-weight: 550; margin: 2.6rem 0 1.1rem; }

/* ---------------------------------------------------------------- footer */

footer.site {
  margin-top: auto;
  border-top: 1px solid var(--panel-edge);
  background: var(--green-deep);
  color: #cfc9b4;
  padding: 2.6rem 0 2.2rem;
  font-size: .9rem;
}
footer.site .wrap { display: flex; flex-wrap: wrap; gap: 1rem 3rem; align-items: baseline; }
footer.site .fbrand { font-family: var(--serif); font-size: 1.2rem; color: #efe9d6; }
footer.site a { color: var(--gold-bright); }
footer.site .verse { font-style: italic; opacity: .8; }

/* ------------------------------------------------------------- utilities */

.loading { text-align: center; color: var(--muted); padding: 3rem 0; font-style: italic; }
.reveal { animation: rise .5s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.grid > * { animation: rise .45s ease both; }
.grid > *:nth-child(2) { animation-delay: .04s; }
.grid > *:nth-child(3) { animation-delay: .08s; }
.grid > *:nth-child(4) { animation-delay: .12s; }
.grid > *:nth-child(5) { animation-delay: .16s; }
.grid > *:nth-child(6) { animation-delay: .2s; }

@media (max-width: 720px) {
  header.site .wrap { flex-wrap: wrap; gap: .7rem 1.2rem; }
  .header-search { display: none; }
  .hero { padding: 3.2rem 0 2.6rem; }
  .stats { gap: 0 2rem; }
}
