/* Catechese – donker, orthodox ontwerp: bladgoud, cinnaber-rubrieken en perkament.
   De kleuren staan als variabelen hieronder; de HTML komt uit scripts/build.py. */
:root {
  color-scheme: dark;

  --bg: #0d0a07;
  --panel: #15100b;
  --ink: #ebe0c8;
  --ink-strong: #f6eedc;
  --ink-muted: #bfae8c;
  --ink-faint: #8c7c5f;

  --gold: #c9a35a;
  --gold-bright: #e9cd8a;
  --gold-deep: #8a682b;
  --rule: rgba(201, 163, 90, 0.32);
  --rule-soft: rgba(201, 163, 90, 0.15);

  --cinnabar: #d9654a;
  --parchment: #f1e7cf;
  --parchment-edge: #e0cfa6;

  --font-body: 'EB Garamond', 'Garamond', 'Georgia', serif;
  --font-display: 'Cormorant Garamond', 'Garamond', 'Georgia', serif;
  --font-caps: 'Cinzel', 'Trajan Pro', 'Georgia', serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  scrollbar-color: var(--gold-deep) var(--bg);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1.1875rem;
  line-height: 1.7;
  font-variant-numeric: oldstyle-nums;
  color: var(--ink);
  background:
    radial-gradient(1000px 560px at 50% -80px, rgba(196, 142, 58, 0.2), transparent 70%),
    radial-gradient(1400px 700px at 50% 100%, rgba(110, 36, 22, 0.14), transparent 70%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* fijne korrel, als oud perkament in het donker */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection {
  background: rgba(201, 163, 90, 0.35);
  color: var(--ink-strong);
}

a {
  color: var(--gold-bright);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

a:hover {
  color: var(--ink-strong);
  text-decoration-color: var(--gold);
}

a:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 3px;
}

/* Ornamenten (bladgoud-SVG's uit docs/ornaments/gold/, gegenereerd door build.py) */
.ornament {
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
}

/* Kop */
.site-header {
  padding: clamp(2.75rem, 7vw, 5rem) 1rem clamp(2.5rem, 6vw, 4rem);
  text-align: center;
}

.masthead-ornament {
  width: min(300px, 64vw);
  aspect-ratio: 3592 / 3073;
  margin: 0 auto;
  background-image: url('ornaments/gold/Header illumination - Gould.svg');
  filter: drop-shadow(0 0 28px rgba(214, 170, 90, 0.18));
}

.header-rule {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  max-width: 420px;
  margin: 2.25rem auto 0;
  color: var(--gold);
}

.header-rule::before,
.header-rule::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--rule));
}

.header-rule::after {
  transform: scaleX(-1);
}

.cross {
  width: 15px;
  height: 25px;
  fill: currentColor;
  flex: none;
}

/* Indeling */
.lessons-container {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2rem) 2rem;
}

.lessons-container.single {
  grid-template-columns: minmax(0, 860px);
  justify-content: center;
}

.lessons-container.single .toc {
  display: none;
}

.lessons-main {
  display: flex;
  flex-direction: column;
  gap: clamp(2.5rem, 7vw, 4.5rem);
}

/* Inhoudsopgave */
.toc {
  position: sticky;
  top: 2rem;
  padding: 1.25rem 1.4rem;
  border: 1px solid var(--rule-soft);
  background: rgba(21, 16, 11, 0.7);
}

.toc-list {
  list-style: none;
}

.toc-list a {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.4rem 0.25rem;
  font-size: 1.05rem;
  line-height: 1.35;
  color: var(--ink-muted);
  text-decoration: none;
}

.toc-list a:hover {
  color: var(--gold-bright);
}

.toc-number {
  min-width: 1.25rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  font-variant-numeric: lining-nums;
  color: var(--gold);
}

/* Les: paneel met dubbele goudlijn, als de rand van een ikoon */
.lesson-card {
  position: relative;
  padding: clamp(2.25rem, 6vw, 4.25rem) clamp(1.35rem, 6vw, 4.5rem);
  border: 1px solid var(--rule);
  background:
    radial-gradient(ellipse 90% 320px at 50% 0, rgba(201, 163, 90, 0.07), transparent 75%),
    var(--panel);
  box-shadow: 0 40px 80px -40px #000;
  scroll-margin-top: 2rem;
}

.lesson-card::before {
  content: '';
  position: absolute;
  inset: 7px;
  border: 1px solid var(--rule-soft);
  pointer-events: none;
}

.lesson-card:target {
  animation: lesson-glow 1.8s ease-out;
}

@keyframes lesson-glow {
  from {
    box-shadow: 0 0 0 1px var(--gold), 0 0 70px rgba(201, 163, 90, 0.25);
  }
}

.lesson-header {
  margin-bottom: clamp(2.25rem, 5vw, 3.25rem);
  text-align: center;
}

.lesson-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.3rem, 5.5vw, 3.4rem);
  line-height: 1.08;
  color: var(--ink-strong);
  text-wrap: balance;
}

.lesson-ornament {
  width: min(250px, 70%);
  aspect-ratio: 2379 / 408;
  margin: 0 auto;
  background-image: url('ornaments/gold/bar6-M.svg');
}

.lesson-title + .lesson-ornament {
  margin-top: 1.5rem;
}

/* Secties */
.lesson-section + .lesson-section {
  margin-top: clamp(2.5rem, 6vw, 3.5rem);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-bottom: 1.5rem;
  font-family: var(--font-caps);
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1.4;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-align: center;
  color: var(--gold);
}

.section-title span {
  margin-right: -0.22em;
}

.section-title::before,
.section-title::after {
  content: '';
  flex: 1;
  min-width: 1.5rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--rule));
}

.section-title::after {
  transform: scaleX(-1);
}

.section-content p {
  margin-bottom: 1.1em;
  text-wrap: pretty;
}

.section-content > :last-child {
  margin-bottom: 0;
}

/* Rode initiaal bij de eerste alinea van elke les (staand, dus ook goed bij één regel) */
.lesson-card > .lesson-section:first-of-type .section-content > p:first-child::first-letter {
  margin-right: 0.04em;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2.3em;
  line-height: 0;
  color: var(--cinnabar);
}

.section-content strong {
  font-weight: 600;
  color: var(--ink-strong);
}

.section-content em {
  font-style: italic;
}

/* Lijsten: gouden ruitjes */
.section-content ul,
.section-content ol {
  list-style: none;
  margin-bottom: 1.1em;
}

.section-content li {
  position: relative;
  margin-bottom: 0.3rem;
}

.section-content ul > li {
  padding-left: 1.6rem;
}

.section-content ul > li::before {
  content: '';
  position: absolute;
  left: 0.3rem;
  top: 0.68em;
  width: 0.36rem;
  height: 0.36rem;
  background: var(--gold);
  transform: rotate(45deg);
}

.section-content li ul,
.section-content li ol {
  margin: 0.3rem 0 0.55rem;
}

.section-content li li {
  font-size: 0.95em;
  color: var(--ink-muted);
}

.section-content li ul > li::before {
  background: transparent;
  border: 1px solid var(--gold-deep);
}

/* Genummerde stappen met rode cijfers */
.section-content ol {
  counter-reset: stap;
}

.section-content ol > li {
  counter-increment: stap;
  min-height: 1.85rem;
  margin-bottom: 0.65rem;
  padding-left: 2.75rem;
}

.section-content ol > li::before {
  content: counter(stap);
  position: absolute;
  left: 0;
  top: 0.05em;
  display: grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  padding-bottom: 0.08em;
  border: 1px solid var(--rule);
  border-radius: 50%;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1;
  font-variant-numeric: lining-nums;
  color: var(--cinnabar);
}

/* Afbeeldingen op perkament */
.lesson-figure {
  margin: 2.5rem 0;
}

.figure-plate {
  isolation: isolate;
  padding: clamp(0.75rem, 3vw, 1.6rem);
  border: 1px solid var(--gold-deep);
  background: radial-gradient(ellipse at center, var(--parchment) 55%, var(--parchment-edge) 100%);
  box-shadow: 0 0 0 4px var(--panel), 0 0 0 5px var(--rule-soft), 0 24px 48px -24px #000;
}

.figure-plate img {
  display: block;
  width: 100%;
  height: auto;
  mix-blend-mode: multiply;
}

/* De plaat is een knop die de vergroting opent (docs/lightbox.js) */
button.figure-plate {
  position: relative;
  display: block;
  width: 100%;
  font: inherit;
  color: inherit;
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

button.figure-plate:hover,
button.figure-plate:focus-visible {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px var(--panel), 0 0 0 5px var(--rule), 0 0 40px rgba(201, 163, 90, 0.22), 0 24px 48px -24px #000;
}

.zoom-hint {
  position: absolute;
  right: 0.6rem;
  bottom: 0.6rem;
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: rgba(21, 16, 11, 0.8);
  color: var(--gold-bright);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.zoom-hint svg,
.lightbox-close svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button.figure-plate:hover .zoom-hint,
button.figure-plate:focus-visible .zoom-hint {
  opacity: 1;
  transform: none;
}

@media (hover: none) {
  .zoom-hint {
    opacity: 0.9;
    transform: none;
  }
}

/* Vergroting */
html:has(.lightbox[open]) {
  overflow: hidden;
}

.lightbox {
  --lb-pad: clamp(1rem, 4vw, 3rem);
  --lb-plate: clamp(0.5rem, 2vw, 1.25rem);
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: hidden;
}

.lightbox[open] {
  animation: lightbox-in 0.25s ease-out;
}

.lightbox::backdrop {
  background: rgba(8, 6, 4, 0.97);
}

@keyframes lightbox-in {
  from {
    opacity: 0;
  }
}

.lightbox-stage {
  position: absolute;
  inset: 0;
  display: flex;
  overflow: auto;
  overscroll-behavior: contain;
  padding: var(--lb-pad);
}

.lightbox-plate {
  flex: none;
  margin: auto;
  padding: var(--lb-plate);
  border: 1px solid var(--gold-deep);
  background: radial-gradient(ellipse at center, var(--parchment) 55%, var(--parchment-edge) 100%);
  box-shadow: 0 0 0 5px var(--bg), 0 0 0 6px var(--rule-soft), 0 30px 80px -20px #000;
  isolation: isolate;
  line-height: 0;
}

.lightbox-plate img {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - 2 * var(--lb-pad) - 2 * var(--lb-plate) - 2px);
  max-height: calc(100vh - 2 * var(--lb-pad) - 2 * var(--lb-plate) - 2px);
  max-height: calc(100dvh - 2 * var(--lb-pad) - 2 * var(--lb-plate) - 2px);
  mix-blend-mode: multiply;
  cursor: zoom-in;
}

.lightbox.zoomed .lightbox-plate img {
  max-width: none;
  max-height: none;
  cursor: zoom-out;
}

.lightbox-close {
  position: fixed;
  top: 0.9rem;
  right: 0.9rem;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: rgba(21, 16, 11, 0.85);
  color: var(--gold-bright);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  outline: none;
  border-color: var(--gold);
  color: var(--ink-strong);
}

.lesson-figure figcaption {
  margin-top: 1rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.4;
  text-align: center;
  color: var(--ink-faint);
}

.figure-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 1.75rem;
  align-items: start;
  margin: 2.5rem 0;
}

.figure-group .lesson-figure {
  margin: 0;
}

/* Voet */
.site-footer {
  padding: clamp(3rem, 8vw, 4.5rem) 1rem clamp(3rem, 8vw, 4.5rem);
}

.footer-medallion {
  width: 120px;
  aspect-ratio: 4989 / 5035;
  margin: 0 auto;
  background-image: url('ornaments/gold/Holy Trinity - Lukovich.svg');
  opacity: 0.9;
}

/* Responsief */
@media (max-width: 960px) {
  .lessons-container {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
  }

  .toc {
    position: static;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 1.0625rem;
  }

  .section-title {
    gap: 0.75rem;
    font-size: 0.85rem;
    letter-spacing: 0.16em;
  }

  .section-title span {
    margin-right: -0.16em;
  }

  .lesson-card::before {
    inset: 5px;
  }
}

/* Afdrukken: licht en zonder versiering */
@media print {
  body {
    background: #fff;
    color: #000;
    font-size: 12pt;
  }

  body::before,
  .site-header,
  .toc,
  .lesson-ornament,
  .site-footer {
    display: none;
  }

  .lessons-container,
  .lessons-container.single {
    display: block;
    padding: 0;
  }

  .lesson-card {
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
  }

  .lesson-card + .lesson-card {
    break-before: page;
  }

  .lesson-card::before {
    display: none;
  }

  .lesson-title,
  .section-content strong,
  .section-content li li {
    color: #000;
  }

  .section-title {
    color: #6b4f1d;
  }

  .figure-plate {
    background: none;
    box-shadow: none;
    border: 0;
  }

  .zoom-hint {
    display: none;
  }

  .lesson-figure {
    break-inside: avoid;
  }
}

.lesson-section blockquote {
  margin: 1.25rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 2px solid var(--gold);
  font-style: italic;
}

.lesson-section blockquote p {
  margin: 0 0 0.6rem;
}

.lesson-section blockquote .quote-source {
  font-style: normal;
  text-align: right;
  opacity: 0.8;
}
