/* ============================================================
   Dharma — ruhiger, sattvischer Stil
   Creme-Papier · Salbeigrün · sanftes Gold · viel Luft
   Fraunces (Headlines) · Spectral (Lesetext) · Inter (UI)
   ============================================================ */

:root {
  /* Flächen */
  --bg:        #fbf3e7;   /* warmes Elfenbein */
  --bg-soft:   #f2e2cd;   /* warmer Sandton */
  --surface:   #fffaf2;   /* Karten */
  /* Tinte */
  --ink:       #2c2017;   /* warmes Espresso-Braun */
  --ink-soft:  #5f4a3b;
  --muted:     #927c66;
  /* Linien */
  --line:      #ecdcc5;
  --line-soft: #f4e8d7;
  /* Akzente (warm: Safran · Terrakotta · Tempelrot · Gold) */
  --accent:      #c4682d;   /* Safran-Terrakotta (primär) */
  --accent-deep: #9a3526;   /* tiefes Tempelrot (Links/Hover) */
  --accent-soft: #f8e3cf;   /* warmer Pfirsich-Ton */
  --clay:        #b0653a;   /* warmes Terrakotta */
  --gold:        #c2922f;   /* Gold-Hervorhebung */
  --gold-soft:   #f4e6c4;

  /* Maße */
  --max:     1200px;
  --measure: 760px;
  --radius:  14px;
  --radius-sm: 9px;
  --shadow:  0 1px 2px rgba(60,45,20,.04), 0 10px 30px rgba(60,45,20,.06);
  --shadow-sm: 0 1px 2px rgba(60,45,20,.05);

  /* Schrift */
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --read:  'Spectral', Georgia, serif;
  --sans:  'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;          /* 17px */
  line-height: 1.7;
  color: var(--ink);
  background-color: var(--bg);
  /* warmer Lichtschein von oben */
  background-image: radial-gradient(120% 60% at 50% -10%, #fff5e4 0%, rgba(255,245,228,0) 55%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 1.5rem; }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.2; color: var(--ink); letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 4vw, 2.7rem); }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1.1rem; }

a { color: var(--accent-deep); text-decoration: none; transition: color .18s ease; }
a:hover { color: var(--clay); }

.muted { color: var(--muted); }
.empty { color: var(--muted); font-style: italic; }

/* ---------- Kopfzeile ---------- */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent-deep); color: #fff; padding: 0.6rem 1rem; border-radius: 0 0 var(--radius-sm) 0;
  font-family: var(--sans); font-size: 0.9rem;
}
.skip-link:focus { left: 0; color: #fff; }

.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(251,243,231,.88);
  backdrop-filter: saturate(150%) blur(10px);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 0.5rem 1.25rem; padding: 0.6rem 1.5rem; max-width: var(--max); margin: 0 auto; }
.brand { display: flex; flex-direction: column; line-height: 1.15; margin-right: auto; flex: 0 0 auto; }
.brand-title { font-family: var(--serif); font-size: 1.4rem; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.brand-tagline { font-size: 0.7rem; color: var(--muted); letter-spacing: 0.02em; }

.site-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 0.15rem; }
.site-nav a {
  color: var(--ink-soft); font-size: 0.9rem; padding: 0.35rem 0.65rem; border-radius: 999px;
  transition: background .18s ease, color .18s ease; white-space: nowrap;
}
.site-nav a:hover { background: var(--accent-soft); color: var(--accent-deep); }
.site-nav a.active { background: var(--accent-soft); color: var(--accent-deep); font-weight: 600; }

.header-search { flex: 0 1 200px; min-width: 150px; margin-left: 0.5rem; }
.header-search input {
  width: 100%; padding: 0.45rem 0.9rem; font: inherit; font-size: 0.88rem;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.header-search input::placeholder { color: var(--muted); }
.header-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Hamburger (nur mobil sichtbar) */
.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 42px; height: 40px; padding: 8px 9px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  cursor: pointer;
}
.nav-toggle-bar { display: block; height: 2px; border-radius: 2px; background: var(--ink-soft); transition: transform .2s ease, opacity .2s ease; }
.nav-toggle.open .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle.open .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 1120px) {
  .nav-toggle { display: flex; }
  .site-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0.15rem;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 0.75rem 1.5rem 1rem; box-shadow: 0 14px 30px rgba(60,45,20,.10);
  }
  .site-nav.open { display: flex; }
  .site-nav a { font-size: 1rem; padding: 0.6rem 0.75rem; border-radius: var(--radius-sm); }
  .header-search { flex: 1 1 auto; max-width: none; margin: 0.5rem 0 0; }
  .header-search input { font-size: 1rem; padding: 0.6rem 1rem; }
}

/* Sichtbarer Tastatur-Fokus überall */
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px;
}

/* ---------- Hauptbereich ---------- */
.content { padding-top: 2.5rem; padding-bottom: 5rem; }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 3.5rem 0 1rem; position: relative; }
.hero::before {
  content: ""; position: absolute; top: -36px; left: 50%; transform: translateX(-50%);
  width: 480px; height: 480px; max-width: 94vw;
  background: url(/static/img/borobudur-mandala.svg) center / contain no-repeat;
  opacity: .08; pointer-events: none; z-index: 0;
}
.hero > * { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 600; margin: 0 0 0.5rem; letter-spacing: -0.02em; }
.hero .lead { max-width: 36rem; margin: 0 auto; }
.hero::after {
  content: ""; display: block; width: 30px; height: 34px; position: relative; z-index: 1;
  background: url(/static/img/stupa.svg) center / contain no-repeat;
  opacity: .5; margin: 1.6rem auto 0;
}
.lead { color: var(--ink-soft); font-size: 1.15rem; font-family: var(--read); }

/* ---------- Foto-Hero (Startseite) ---------- */
.hero-banner {
  width: 100vw; margin-left: calc(50% - 50vw); margin-top: -2.5rem; margin-bottom: 3rem;
  position: relative; overflow: hidden; min-height: min(56vh, 460px);
  display: grid; place-items: center; text-align: center; background: #3a241a;
}
.hero-banner::before {  /* Foto – mit reduziertem Kontrast */
  content: ""; position: absolute; inset: 0;
  background: url(/static/img/hero-borobudur.jpg) center 58% / cover no-repeat;
  filter: contrast(0.8) brightness(1.06) saturate(1.02);
}
.hero-banner::after {   /* sanfter, warmer Verlauf für Lesbarkeit */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(44,22,12,.12) 0%, rgba(44,20,12,.38) 60%, rgba(40,18,10,.72) 100%);
}
.hero-content { position: relative; z-index: 1; padding: 3rem 1.5rem; max-width: 42rem; color: #fbeede; }
.hero-content h1 { color: #fff; font-size: clamp(2.6rem, 6.5vw, 4.4rem); margin: 0 0 0.6rem; letter-spacing: -0.02em; text-shadow: 0 2px 28px rgba(0,0,0,.5); }
.hero-content .lead { color: #f5ddc4; font-size: clamp(1.1rem, 2.4vw, 1.35rem); margin: 0 auto; max-width: 33rem; text-shadow: 0 1px 14px rgba(0,0,0,.45); }
.hero-ornament { width: 50px; height: 2px; margin: 1.6rem auto 0; background: var(--gold); border-radius: 2px; opacity: .9; }
.hero-actions { display: flex; gap: 0.7rem; justify-content: center; flex-wrap: wrap; margin-top: 1.7rem; }
.hero-actions .btn { font-size: 0.95rem; padding: 0.65rem 1.4rem; }
.hero-actions .btn.ghost {
  background: rgba(255,250,242,.14); border-color: rgba(255,250,242,.55); color: #fff;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.hero-actions .btn.ghost:hover { background: rgba(255,250,242,.28); border-color: #fff; color: #fff; }

/* ---------- Intro-Band mit Foto ---------- */
.intro-band {
  display: grid; grid-template-columns: 200px 1fr; gap: 1.9rem; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); margin: 0 0 2.75rem; padding: 1.6rem 1.9rem;
}
.intro-band img {
  width: 200px; height: 200px; object-fit: cover; display: block; border-radius: var(--radius);
  filter: contrast(0.5) brightness(1.12) saturate(0.92);  /* kleiner + deutlich weicher */
}
.intro-band h2 { margin: 0 0 0.6rem; }
.intro-band p { color: var(--ink-soft); font-family: var(--read); }
@media (max-width: 640px) {
  .intro-band { grid-template-columns: 1fr; text-align: center; }
  .intro-band img { width: 160px; height: 160px; margin: 0 auto; }
}

/* ---------- Bereichs-Banner (Foto + Titel) ---------- */
.page-banner { width: 100vw; margin-left: calc(50% - 50vw); margin-top: -2.5rem; margin-bottom: 2.5rem; position: relative; overflow: hidden; min-height: 200px; display: grid; place-items: center; text-align: center; background: #2a160e; }
.page-banner::before { content: ""; position: absolute; inset: 0; background: var(--banner) center 55% / cover no-repeat; filter: contrast(0.8) brightness(0.98); }
.page-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(40,18,10,.28) 0%, rgba(40,16,9,.46) 60%, rgba(38,15,8,.72) 100%); }
.page-banner > div { position: relative; z-index: 1; padding: 2rem 1.5rem; }
.page-banner h1 { color: #fff; font-size: clamp(2rem, 5vw, 3rem); margin: 0; text-shadow: 0 2px 20px rgba(0,0,0,.5); }
.page-banner p { color: #f4ddc6; font-family: var(--read); margin: 0.4rem 0 0; text-shadow: 0 1px 12px rgba(0,0,0,.45); }

/* ---------- Karten-Raster (Start) ---------- */
.sections-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1.1rem; margin: 2.75rem 0; }
.section-card {
  display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.4rem 1.3rem; text-align: center; color: var(--ink);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.section-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent); text-decoration: none; }
.section-card h2 { margin: 0 0 0.3rem; font-size: 1.2rem; }
.section-card p { margin: 0; color: var(--muted); font-size: 0.9rem; font-family: var(--sans); }
.section-card.feature { background: linear-gradient(160deg, var(--accent-soft), var(--surface)); border-color: var(--accent); }

/* ---------- Startseite: Sektionen + Einstiegs-Karten ---------- */
.home-section { margin: 0 0 3.25rem; }
.home-section > h2 { text-align: center; font-size: 1.6rem; margin: 0 0 0.4rem; }
.home-section > .section-lead { text-align: center; color: var(--muted); font-family: var(--read); margin: 0 auto 1.6rem; max-width: 40rem; }

.entry-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.1rem; }
@media (max-width: 760px) { .entry-grid { grid-template-columns: 1fr; } }
.entry-card {
  display: flex; gap: 1.05rem; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.35rem 1.35rem 1.25rem; color: var(--ink); box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.entry-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent); }
.entry-icon {
  flex: 0 0 auto; width: 52px; height: 52px; display: grid; place-items: center;
  border-radius: 14px; background: linear-gradient(150deg, var(--accent-soft), #fdf1e2);
  border: 1px solid var(--line); color: var(--accent-deep);
}
.entry-icon svg { width: 26px; height: 26px; display: block; }
.entry-card h3 { margin: 0.1rem 0 0.25rem; font-size: 1.22rem; }
.entry-card p { margin: 0 0 0.55rem; color: var(--ink-soft); font-size: 0.95rem; line-height: 1.55; }
.entry-fact {
  display: inline-block; font-family: var(--sans); font-size: 0.74rem; font-weight: 600;
  color: var(--accent-deep); background: var(--accent-soft); border-radius: 999px; padding: 0.15rem 0.6rem;
}

.more-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.9rem; }
.more-card {
  display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem; color: var(--ink);
  transition: box-shadow .2s ease, border-color .2s ease;
}
.more-card:hover { box-shadow: var(--shadow-sm); border-color: var(--accent); }
.more-card h3 { margin: 0 0 0.15rem; font-size: 1.02rem; }
.more-card p { margin: 0; color: var(--muted); font-size: 0.85rem; font-family: var(--sans); line-height: 1.45; }

/* ---------- Listen ---------- */
.latest { margin-top: 3rem; }
.latest h2 { margin-bottom: 0.75rem; }
.item-list { list-style: none; padding: 0; margin: 0; }
.item-list li { padding: 0.75rem 0; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 0.7rem; }
.item-list li:last-child { border-bottom: 0; }
.item-list a { font-family: var(--read); font-size: 1.05rem; }

.card-list { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: 1.1rem; }
.card-list.grid2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
@media (max-width: 480px) { .card-list.grid2 { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem 1.4rem; box-shadow: var(--shadow-sm); transition: box-shadow .2s ease, transform .2s ease; }
.card:hover { box-shadow: var(--shadow); }
.card h2, .card h3 { margin: 0 0 0.4rem; }
.card h2 { font-size: 1.25rem; }
.card h3 { font-size: 1.1rem; }
.card audio { width: 100%; margin-top: 0.7rem; }

/* ---------- Badges ---------- */
.badge { display: inline-block; font-family: var(--sans); font-size: 0.66rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; padding: 0.18rem 0.55rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent-deep); }
.badge-pdf { background: var(--gold-soft); color: #8a6d1f; }
.badge-html { background: var(--accent-soft); color: var(--accent-deep); }
.badge-audio { background: #e7e9ef; color: #4a5572; }
.badge-doc { background: #efe6dd; color: var(--clay); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; font-family: var(--sans); font-size: 0.9rem; font-weight: 500;
  padding: 0.55rem 1rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; transition: all .18s ease; text-decoration: none;
}
.btn:hover { border-color: var(--accent); color: var(--accent-deep); background: var(--accent-soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; }
.btn.danger { color: #9c4a3c; border-color: #e7ccc6; background: var(--surface); }
.btn.danger:hover { border-color: #9c4a3c; background: #f7ebe8; color: #9c4a3c; }

/* ---------- Einzel-Eintrag / Prosa ---------- */
.entry { max-width: var(--measure); margin: 0 auto; }
.entry h1 { margin-bottom: 0.3rem; }
.back { font-family: var(--sans); font-size: 0.9rem; color: var(--muted); }
.back:hover { color: var(--accent-deep); }
.prose { font-family: var(--read); font-size: 1.15rem; line-height: 1.85; color: var(--ink); }
.prose h1, .prose h2, .prose h3, .prose h4 { font-family: var(--serif); margin: 2rem 0 0.8rem; }
.prose h2 { font-size: 1.45rem; }
.prose h3 { font-size: 1.2rem; }
.prose p { margin: 0 0 1.15rem; }
.prose img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin: 0.25rem 0; }
.prose blockquote { border-left: 3px solid var(--gold); margin: 1.4rem 0; padding: 0.3rem 1.2rem; color: var(--ink-soft); background: var(--gold-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.prose .verse { font-style: italic; background: transparent; border-left-color: var(--accent); }
.prose dl { margin: 1rem 0; }

/* ---------- Bibliothek ---------- */
.collection-card h2 { font-size: 1.15rem; }
.total-note { margin-top: 1.75rem; }
.sutta-index { list-style: none; padding: 0; margin-top: 1.75rem; columns: 1; }
.sutta-index li { border-bottom: 1px solid var(--line-soft); }
.sutta-index a { display: flex; gap: 1rem; align-items: baseline; padding: 0.7rem 0.4rem; color: var(--ink); border-radius: var(--radius-sm); }
.sutta-index a:hover { background: var(--accent-soft); text-decoration: none; }
.sutta-num { flex: 0 0 5rem; font-variant-numeric: tabular-nums; color: var(--accent-deep); font-weight: 600; font-size: 0.82rem; font-family: var(--sans); }
.sutta-title { flex: 1; font-family: var(--read); }
.lang-tag { font-family: var(--sans); font-size: 0.62rem; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 0.3rem; vertical-align: middle; letter-spacing: .04em; }

/* ---------- Lese-Seite (Sutta / Werk) ---------- */
.sutta { max-width: var(--measure); margin: 0 auto; }
.sutta-head { text-align: center; margin: 1rem 0 1.75rem; }
.sutta-ref { font-family: var(--sans); color: var(--accent-deep); font-weight: 600; letter-spacing: 0.12em; font-size: 0.78rem; margin: 0 0 0.4rem; }
.sutta-head h1 { font-size: clamp(1.8rem, 3.5vw, 2.4rem); margin: 0.2rem 0; }
.sutta-pali-title { color: var(--muted); font-family: var(--read); font-style: italic; margin: 0.3rem 0 0; }

.reader-toolbar {
  display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: space-between; align-items: center;
  padding: 0.7rem 0; margin-bottom: 1.75rem; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 56px; background: rgba(251,243,231,.92); backdrop-filter: blur(8px); z-index: 5;
}
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.lang-switch button { border: 0; background: transparent; padding: 0.4rem 0.95rem; font: inherit; font-family: var(--sans); font-size: 0.88rem; cursor: pointer; color: var(--ink-soft); transition: background .18s, color .18s; }
.lang-switch button:hover { background: var(--accent-soft); }
.lang-switch button.active { background: var(--accent); color: #fff; }

.sutta-body { font-family: var(--read); font-size: 1.18rem; line-height: 1.9; }
.sutta-body h2 { font-size: 1.5rem; margin: 2.8rem 0 0.9rem; padding-top: 1.5rem; border-top: 1px solid var(--line); scroll-margin-top: 96px; }
.sutta-body h2:first-child { border-top: 0; padding-top: 0; margin-top: 0.5rem; }
.sutta-body h3 { font-size: 1.18rem; color: var(--accent-deep); margin: 2rem 0 0.5rem; scroll-margin-top: 96px; }
.sutta-body h4 { font-size: 1.02rem; color: var(--muted); scroll-margin-top: 96px; }

/* ===== Studien-Dokument — Lese- & Studienfassung (aufklappbar) ===== */
.study-doc {
  --bark: #3a281c; --bark-soft: #4d3826;
  --gold: #e6b450; --gold-deep: #c2922f;
  --saffron: #e8941f; --terra: #c4682d; --templered: #9a3526;
  --parch: #f7efe0; --card: #fffaf0; --line2: #e7d6bd; --ink2: #473a2c;
  --dshadow: rgba(58,40,20,.10);
  --pf: 'Playfair Display', 'Fraunces', Georgia, serif;
  --mono: ui-monospace, 'JetBrains Mono', 'SFMono-Regular', Menlo, monospace;
}

/* Kopf-Karte (Titel-„Cover") */
.doc-header { position: relative; overflow: hidden; border-radius: 18px; margin: 0.4rem 0 1.75rem; padding: 2.4rem 2.2rem 1.9rem; background: linear-gradient(140deg, #5a4029 0%, #3f2c1c 55%, #2f2013 100%); box-shadow: 0 14px 36px rgba(50,32,14,.22); border: 1px solid rgba(230,180,80,.14); }
.doc-header::before { content: ""; position: absolute; top: 50%; right: -56px; transform: translateY(-50%); width: 330px; height: 330px; background: url(/static/img/borobudur-mandala.svg) center / contain no-repeat; opacity: .10; filter: saturate(0) brightness(2.6); pointer-events: none; }
.doc-header::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, var(--saffron), var(--gold), var(--terra)); }
.doc-topic { position: relative; font-family: var(--sans); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.18em; color: var(--gold); margin: 0 0 0.7rem; display: flex; align-items: center; gap: 0.65rem; }
.doc-topic::after { content: ""; flex: 1; height: 1px; max-width: 130px; background: linear-gradient(90deg, rgba(230,180,80,.55), transparent); }
.doc-header h1 { position: relative; font-family: var(--pf); font-size: clamp(1.9rem, 4.4vw, 2.7rem); font-weight: 700; color: #fbe7c4; letter-spacing: -0.02em; line-height: 1.12; margin: 0; max-width: 30ch; text-shadow: 0 1px 18px rgba(0,0,0,.25); }
.doc-header h1 small { display: block; font-size: 1rem; font-weight: 400; color: #e3c9a0; margin-top: 0.7rem; font-style: italic; font-family: var(--read); line-height: 1.5; max-width: 46ch; }
.doc-meta { position: relative; margin: 1.15rem 0 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; font-family: var(--sans); font-size: 0.77rem; color: #d8bb8e; }
.doc-meta span { display: inline-flex; align-items: center; gap: 0.45rem; }
.doc-meta span::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--saffron); }

/* Ganzseiten-Layout: feste Inhalts-Seitenleiste links + Lesespalte rechts */
.study-doc { width: 100vw; margin-left: calc(50% - 50vw); }
.study-doc .reader-toolbar { justify-content: flex-start; }
.study-inner { max-width: 1320px; margin: 0 auto; padding: 0 2rem; }
.study-layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: 2.75rem; align-items: start; }
/* Ohne Inhaltsleiste (Dokument ohne Kapitel): zentrierte Lesespalte statt schmaler Grid-Spalte */
.study-layout.no-toc { display: block; }
.study-layout.no-toc .study { max-width: 760px; margin: 0 auto; }
/* Flache Texte ohne Kapitelkarten: angenehme Lese-Typografie für direkte Absätze */
.study > p { font-size: 1.12rem; line-height: 1.85; color: var(--ink2); margin: 0 0 1.15rem; }
.study-toc { position: sticky; top: 74px; align-self: start; max-height: calc(100vh - 92px); overflow-y: auto; padding: 0.2rem 0.4rem 1rem 0; }
.toc-label { font-family: var(--sans); font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .16em; color: var(--terra); margin: .2rem 0 .9rem; }
.study-toc ol { list-style: none; padding: 0; margin: 0; counter-reset: tocn; border-left: 1px solid var(--line2); }
.study-toc li { counter-increment: tocn; }
.study-toc a { position: relative; display: flex; gap: .6rem; padding: .4rem .55rem .4rem .95rem; margin-left: -1px; border-left: 2px solid transparent; color: var(--ink-soft); font-family: var(--sans); font-size: .86rem; line-height: 1.35; text-decoration: none; border-radius: 0 6px 6px 0; transition: color .15s, border-color .15s, background .15s; }
.study-toc a::before { content: counter(tocn); flex: 0 0 1.4rem; font-size: .72rem; font-variant-numeric: tabular-nums; color: var(--muted); text-align: right; padding-top: .05rem; }
.study-toc a:hover { color: var(--accent-deep); background: var(--accent-soft); }
.study-toc a.active { color: var(--templered); border-left-color: var(--terra); font-weight: 600; background: linear-gradient(90deg, var(--accent-soft), transparent); }
.study-toc a.active::before { color: var(--terra); }
@media (max-width: 900px) {
  .study-inner { padding: 0 1.25rem; }
  .study-layout { grid-template-columns: 1fr; gap: 0; }
  .study-toc { position: static; max-height: none; overflow: visible; margin-bottom: 1.5rem; border: 1px solid var(--line2); border-radius: var(--radius); background: var(--surface); padding: .75rem 1.1rem; }
  .study-toc ol { border-left: 0; }
}

/* „Auf einen Blick" — Kapitel-Dashboard (Kachelraster) oben im Dokument */
.doc-overview { margin: 0 0 1.75rem; }
.overview-label { font-family: var(--sans); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .16em; color: var(--terra); margin: 0 0 .85rem; }
.overview-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .7rem; }
.overview-grid a { display: flex; gap: .65rem; align-items: flex-start; height: 100%; padding: .75rem .9rem; background: var(--card); border: 1px solid var(--line2); border-radius: 12px; box-shadow: 0 1px 6px var(--dshadow); color: var(--bark); text-decoration: none; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.overview-grid a:hover { transform: translateY(-2px); box-shadow: 0 7px 18px rgba(58,40,20,.14); border-color: var(--gold); }
.ov-num { flex: 0 0 auto; font-family: var(--mono); font-size: .72rem; font-weight: 600; width: 1.6rem; height: 1.6rem; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: linear-gradient(135deg, var(--terra), var(--templered)); color: #fde7c8; box-shadow: 0 2px 6px rgba(154,53,38,.28); }
.ov-title { font-family: var(--read); font-size: .92rem; line-height: 1.3; color: var(--ink2); padding-top: .12rem; }

.reader-hint { font-family: var(--sans); font-size: 0.85rem; color: var(--muted); margin: 0 0 0.85rem; }
.reader-intro { position: relative; font-family: var(--read); font-size: 1.13rem; line-height: 1.8; color: #4a3c2e; background: linear-gradient(180deg, #fffaf0, #fbf3e3); border: 1px solid var(--line2); border-radius: 14px; padding: 1.3rem 1.5rem 1.3rem 1.7rem; margin-bottom: 1.75rem; box-shadow: 0 2px 12px var(--dshadow); }
.reader-intro::before { content: ""; position: absolute; left: 0; top: 1rem; bottom: 1rem; width: 3px; border-radius: 3px; background: linear-gradient(180deg, var(--saffron), var(--terra)); }
.reader-intro p { margin: 0 0 0.8rem; }
.reader-intro p:last-child { margin-bottom: 0; }
.reader-intro p:first-child::first-letter { font-family: var(--pf); font-size: 2.6rem; font-weight: 700; float: left; line-height: .78; padding: .35rem .5rem 0 0; color: var(--terra); }

.study summary::-webkit-details-marker { display: none; }
.study summary:focus-visible { outline: 2px solid var(--saffron); outline-offset: 3px; border-radius: 6px; }

/* Kapitel (h2) — abgesetzte Karten mit Akzent, Nummern-Medaillon & Geister-Ziffer */
.study { counter-reset: secnum; font-family: var(--read); }
.study > .sec { counter-increment: secnum; position: relative; overflow: hidden; background: var(--card); border: 1px solid var(--line2); border-radius: 16px; box-shadow: 0 3px 18px var(--dshadow); margin: 0 0 1.5rem; padding: 0.2rem 1.9rem 1.3rem; transition: box-shadow .2s ease, border-color .2s ease; }
.study > .sec:hover { box-shadow: 0 8px 28px rgba(58,40,20,.14); border-color: var(--gold); }
.study > .sec::before { content: counter(secnum); position: absolute; top: -0.5rem; right: 1.1rem; font-family: var(--pf); font-weight: 700; font-size: 6rem; line-height: 1; color: var(--terra); opacity: .07; pointer-events: none; }
.study > .sec::after { content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 3px; background: linear-gradient(90deg, var(--saffron), var(--terra) 60%, transparent); opacity: 0; transition: opacity .2s ease; }
.study > .sec[open]::after { opacity: 1; }
.study .sec > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 0.85rem; padding: 1.05rem 0.1rem 0.8rem; }
.study .sec > summary::before { content: counter(secnum); flex: 0 0 auto; align-self: center; font-family: var(--mono); font-size: .8rem; font-weight: 600; background: linear-gradient(135deg, var(--terra), var(--templered)); color: #fde7c8; width: 2rem; height: 2rem; display: flex; align-items: center; justify-content: center; border-radius: 50%; box-shadow: 0 2px 8px rgba(154,53,38,.3); }
.study .sec-title { flex: 1; font-family: var(--pf); font-size: clamp(1.2rem, 2.4vw, 1.45rem); font-weight: 700; color: var(--bark); line-height: 1.25; padding-bottom: .45rem; background-image: linear-gradient(90deg, var(--gold), var(--saffron)); background-repeat: no-repeat; background-position: 0 100%; background-size: 0% 2px; transition: background-size .3s ease; }
.study .sec[open] > summary .sec-title, .study .sec > summary:hover .sec-title { background-size: 100% 2px; }
.study .sec > summary::after { content: "⌄"; flex: 0 0 auto; align-self: center; color: var(--terra); font-size: 1.2rem; line-height: 1; transition: transform .25s ease; }
.study .sec[open] > summary::after { transform: rotate(180deg); }
.study .sec-body { padding: .3rem 0 .4rem; max-width: 72ch; font-size: 1.1rem; line-height: 1.85; color: var(--ink2); }
.study .sec-body > p:first-of-type { margin-top: .2rem; }
.study .sec > .sec-body > p:first-of-type { font-size: 1.16rem; color: #3c3024; }

/* Unterabschnitte (h3) */
.study .subsec { margin: 0.7rem 0; border-left: 2px solid var(--line2); }
.study .subsec > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 0.55rem; padding: 0.45rem 0.2rem 0.45rem 0.85rem; font-family: var(--pf); font-size: 1.08rem; font-weight: 600; color: var(--templered); }
.study .subsec > summary::before { content: ""; flex: 0 0 auto; width: 7px; height: 7px; transform: rotate(45deg); background: var(--saffron); box-shadow: 0 0 0 3px rgba(232,148,31,.15); }
.study .subsec > summary::after { content: "+"; margin-left: auto; color: var(--terra); font-family: var(--sans); font-weight: 700; }
.study .subsec[open] > summary::after { content: "–"; }
.study .subsec-body { padding: 0.3rem 0 0.8rem 1.4rem; max-width: 72ch; }

.study h4 { font-family: var(--pf); font-size: 1.04rem; font-weight: 600; color: var(--templered); margin: 1.3rem 0 0.4rem; }
.study p { margin: 0 0 1.05rem; }
.study ul, .study ol { padding-left: 1.4rem; margin: 0 0 1.05rem; }
.study li { margin: 0.32rem 0; }
/* kurze Listen als Raster (mehrspaltig) */
.study .cols { columns: 16rem; column-gap: 2.5rem; max-width: none; }
.study .cols li { break-inside: avoid; }

/* Zitate / Verse als Pergament-Karte mit Anführungs-Ornament */
.study blockquote { position: relative; background: linear-gradient(180deg, #fbf4e6, var(--parch)); border: 1px solid var(--line2); border-left: 4px solid var(--saffron); border-radius: 12px; padding: 1.2rem 1.3rem 1rem 1.6rem; margin: 1.3rem 0; max-width: 72ch; box-shadow: 0 2px 12px var(--dshadow); font-family: var(--pf); font-style: italic; color: var(--bark); line-height: 1.65; }
.study blockquote::before { content: "\201C"; position: absolute; top: .35rem; left: .55rem; font-family: var(--pf); font-size: 2.3rem; color: var(--gold); opacity: .55; line-height: 1; }
.study blockquote p:last-child { margin-bottom: 0; }
.study .verse { font-style: italic; }

/* Tabellen (für umgewandelte HTML-Dokumente) */
.study table { width: 100%; border-collapse: collapse; margin: 1.3rem 0; font-size: 0.95rem; background: #fff; border: 1px solid var(--line2); border-radius: 10px; overflow: hidden; box-shadow: 0 2px 12px var(--dshadow); }
.study th, .study td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--line2); vertical-align: top; }
.study th { background: linear-gradient(180deg, #f3e7d2, var(--parch)); font-family: var(--sans); font-size: 0.8rem; letter-spacing: 0.02em; text-transform: uppercase; color: var(--bark); }
.study tbody tr:nth-child(even) td { background: #fffaf0; }
.study tr:last-child td { border-bottom: 0; }
.sutta-body p { margin: 0 0 1.15rem; }
.lang-block[data-lang="pli"] { font-style: italic; color: var(--ink-soft); }
.sutta-foot { margin-top: 3.5rem; padding-top: 1.2rem; border-top: 1px solid var(--line-soft); font-family: var(--sans); font-size: 0.85rem; }

/* ---------- Suche ---------- */
.search-page-form { display: flex; gap: 0.6rem; margin: 1.25rem 0 0.5rem; max-width: var(--measure); }
.search-page-form input { flex: 1; padding: 0.7rem 1rem; border: 1px solid var(--line); border-radius: 999px; font: inherit; font-size: 1.05rem; background: var(--surface); }
.search-page-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-summary { margin: 0.6rem 0 1.75rem; }
.result-group { font-size: 1.2rem; padding-bottom: 0.35rem; margin: 2.25rem 0 1rem; border-bottom: 1px solid var(--line); }
.result-list { list-style: none; padding: 0; margin: 0; }
.result { padding: 0.95rem 0; border-bottom: 1px solid var(--line-soft); }
.result-ref { display: inline-block; font-family: var(--sans); color: var(--accent-deep); font-weight: 600; font-size: 0.78rem; margin-right: 0.5rem; letter-spacing: .04em; }
.result-title { font-family: var(--read); font-size: 1.12rem; font-weight: 500; }
.result-snippet { margin: 0.4rem 0 0; color: var(--ink-soft); font-family: var(--read); font-size: 1rem; line-height: 1.65; }
.result-snippet mark { background: var(--gold-soft); color: var(--ink); padding: 0 0.15rem; border-radius: 3px; box-shadow: inset 0 -0.35em 0 var(--gold-soft); }

/* ---------- Admin ---------- */
.incoming-box { background: var(--accent-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem 1.5rem; margin: 1rem 0 2.25rem; }
.incoming-box h2 { margin-top: 0; }
.incoming-box code { background: var(--surface); padding: 0.1rem 0.4rem; border-radius: 5px; font-size: 0.85em; }
.upload-box { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; margin: 1rem 0; }
.incoming-list { margin: 0.5rem 0 0; padding-left: 1.2rem; }
.admin-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin: 1.25rem 0; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { text-align: left; padding: 0.65rem 0.5rem; border-bottom: 1px solid var(--line-soft); }
.admin-table th { font-family: var(--sans); font-size: 0.8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.admin-table form { margin: 0; }

/* ---------- Formulare ---------- */
.form { display: grid; gap: 1.1rem; max-width: 620px; margin-top: 1.5rem; }
.form label { display: grid; gap: 0.35rem; font-family: var(--sans); font-weight: 500; font-size: 0.92rem; }
.form input, .form select, .form textarea { font: inherit; padding: 0.6rem 0.7rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); width: 100%; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form textarea { resize: vertical; font-family: var(--read); }

/* ---------- PDF-Viewer ---------- */
.pdf-frame { margin-top: 1rem; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); }
.pdf-frame iframe { width: 100%; height: 80vh; border: 0; display: block; }

/* ---------- Fußzeile ---------- */
.site-footer { border-top: 1px solid var(--line-soft); color: var(--muted); font-family: var(--sans); font-size: 0.85rem; padding: 2.25rem 0 2rem; margin-top: 2rem; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent-deep); }
.footer-nav {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1.25rem;
  max-width: 760px; margin: 0 auto 1.75rem; text-align: left;
}
.footer-nav h3 { font-family: var(--sans); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 0.5rem; }
.footer-nav ul { list-style: none; margin: 0; padding: 0; }
.footer-nav li { margin: 0.25rem 0; }
.footer-nav a { color: var(--ink-soft); }
.footer-meta { text-align: center; }
.footer-meta p { margin: 0 0 0.3rem; }
.site-stats { margin: 0.4rem 0 0; font-size: 0.78rem; color: var(--muted); opacity: 0.85; }
@media (max-width: 560px) { .footer-nav { text-align: center; } }

/* ---------- Borobudur: dezente Hintergrund-Präsenz ---------- */
body::after {
  content: ""; position: fixed; left: 0; right: 0; bottom: 0; height: 150px;
  background: url(/static/img/borobudur-skyline.svg) center bottom / 1100px auto no-repeat;
  opacity: .035; pointer-events: none; z-index: -1;
}

/* ---------- Bewegung reduzieren ---------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- Druck / PDF ---------- */
@media print {
  .site-header, .site-footer, .reader-toolbar, .no-print, .back { display: none !important; }
  body::after, .hero::before, .hero::after { display: none !important; }
  body { background: #fff; color: #000; }
  .wrap, .content { max-width: 100%; padding: 0; }
  .sutta, .entry { max-width: 100%; }
  .lang-block[hidden] { display: none !important; }
  .study .sec-body, .study .subsec-body { display: block !important; max-width: none !important; }
  .study summary::after { display: none !important; }
  .study > .sec { box-shadow: none !important; border-color: #ddd !important; break-inside: avoid; }
  .study > .sec::before, .study > .sec::after { display: none !important; }
  .study .sec > summary::before { background: none !important; color: #000 !important; box-shadow: none !important; }
  .doc-header { background: #fff !important; box-shadow: none !important; padding: 0 !important; border: 0 !important; }
  .doc-header::before, .doc-header::after { display: none !important; }
  .doc-header h1, .doc-topic { color: #000 !important; }
  .doc-header h1 small { color: #444 !important; }
  .doc-meta { color: #555 !important; }
  .sutta-body, .prose { font-size: 12pt; line-height: 1.6; }
  .sutta-body h2, .sutta-body h3, .prose h2, .prose h3 { page-break-after: avoid; }
  .sutta-body p, .prose p { orphans: 3; widows: 3; }
  a { color: #000; text-decoration: none; }
  @page { margin: 2cm; }
}
