/* Thammajaree, a Dhamma notebook: design system tj-.
   Theme sacca / bodhi leaf: robe ochre, deep pipal leaf green, sand,
   soft ink. Serif Iowan/Palatino for reading, system sans for furniture.
   Contemplative typographic hero, numbered doors 01-06, fine hairlines,
   inline SVG ornaments (leaf, wheel, seated bird, bowl). No webfonts,
   no external request, no blue, gentle automatic dark mode, print. */

:root {
  --sable: #f3eddd;          /* paper */
  --sable-creux: #eae2cc;    /* recessed reserves */
  --sable-vif: #f9f5e8;      /* lifted boxes, even table rows */
  --encre: #322c22;          /* soft warm ink: text */
  --encre-nuit: #262117;     /* darkest ground: header band, footer, table heads */
  --encre-douce: #6f6653;    /* captions, meta, chapo */
  --pipal: #3e6b4a;          /* deep pipal leaf: links (>= 4.5:1 on sable) */
  --pipal-nuit: #2f5339;     /* pressed pipal: hover */
  --robe: #a2531b;           /* robe ochre: plaques, lettrines, ::selection */
  --robe-claire: #c47a33;    /* ochre lifted: ticks, ornaments */
  --filet: #d9cfb4;          /* hairlines */
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --sans: system-ui, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --caps-inter: .22em;
  --vitesse: 150ms;
}

@media (prefers-color-scheme: dark) {
  :root {
    --sable: #171410;
    --sable-creux: #1e1a13;
    --sable-vif: #221e15;
    --encre: #e8e1cd;
    --encre-nuit: #100e0a;
    --encre-douce: #a89f88;
    --pipal: #93bf97;
    --pipal-nuit: #b3d4b2;
    --robe: #d19a55;
    --robe-claire: #e0b276;
    --filet: #38321f;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--sable);
  color: var(--encre);
  font-family: var(--serif);
  font-size: clamp(1.02rem, .97rem + .22vw, 1.13rem);
  line-height: 1.68;
}
img { max-width: 100%; height: auto; }
::selection { background: var(--robe); color: var(--sable-vif); }

a { color: var(--pipal); text-decoration: none; transition: color var(--vitesse) ease; }
a:hover { color: var(--pipal-nuit); text-decoration: underline; text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:focus-visible { outline: 2px solid var(--robe); outline-offset: 2px; border-radius: 2px; }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.12; margin: 0; }
h1 { font-size: clamp(2.3rem, 1.3rem + 3.4vw, 4rem); letter-spacing: -.012em; }
h2 { font-size: clamp(1.45rem, 1.12rem + 1.4vw, 2.1rem); line-height: 1.18; }
h3 { font-size: clamp(1.15rem, 1.05rem + .5vw, 1.38rem); }

.tj-evite { position: absolute; left: -9999px; }
.tj-evite:focus-visible { left: 1rem; top: 1rem; z-index: 10; background: var(--sable-vif); color: var(--encre); padding: .6rem 1rem; border: 1px solid var(--filet); }

/* --- furniture: the useful width --- */
.tj-voie { width: min(100% - 2.6rem, 1140px); margin-inline: auto; }

/* --- frontispiece (header) --- */
.tj-frontis { border-bottom: 1px solid var(--filet); background: var(--sable); }
.tj-frontis__rang { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .8rem 2rem; padding-block: 1.1rem 1rem; }
.tj-frontis__mot { display: inline-flex; align-items: baseline; gap: .55rem; color: var(--encre); }
.tj-frontis__mot:hover { color: var(--robe); text-decoration: none; }
.tj-frontis__mot .tj-glyphe { align-self: center; color: var(--robe-claire); }
.tj-frontis__nom { font-family: var(--serif); font-weight: 700; font-size: 1.42rem; letter-spacing: .01em; }
.tj-frontis__basline { font-family: var(--sans); font-size: .72rem; text-transform: uppercase; letter-spacing: var(--caps-inter); color: var(--encre-douce); }
.tj-sentiers ul { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem 1.35rem; margin: 0; padding: 0; }
.tj-sentiers a { font-family: var(--sans); font-size: .8rem; text-transform: uppercase; letter-spacing: .13em; color: var(--encre-douce); border-bottom: 1px solid transparent; padding-bottom: .15rem; }
.tj-sentiers a:hover { color: var(--robe); border-bottom-color: var(--robe-claire); text-decoration: none; }

/* --- surtitre, dates, plaques --- */
.tj-surtitre { font-family: var(--sans); font-size: .78rem; text-transform: uppercase; letter-spacing: var(--caps-inter); color: var(--robe); margin: 0; display: flex; align-items: center; gap: .5rem; }
.tj-date { font-family: var(--sans); font-size: .78rem; text-transform: uppercase; letter-spacing: .14em; color: var(--robe); margin: 0; }
.tj-glyphe { flex: none; color: var(--robe-claire); }

/* --- seuil (contemplative typographic hero) --- */
.tj-seuil { padding-block: clamp(4rem, 9vw, 7rem) clamp(3rem, 7vw, 5rem); text-align: center; }
.tj-seuil .tj-surtitre { justify-content: center; }
.tj-seuil h1 { margin: 1.1rem auto .9rem; max-width: 22ch; }
.tj-seuil__deck { max-width: 58ch; margin: 0 auto; color: var(--encre-douce); font-size: clamp(1.02rem, .96rem + .3vw, 1.18rem); }
.tj-exergue { margin: 2.6rem auto 0; max-width: 46ch; padding-top: 1.7rem; border-top: 1px solid var(--filet); }
.tj-exergue p { margin: 0; font-style: italic; font-size: clamp(1.22rem, 1.05rem + .95vw, 1.58rem); line-height: 1.4; }
.tj-exergue footer { margin-top: .9rem; font-family: var(--sans); font-style: normal; font-size: .78rem; text-transform: uppercase; letter-spacing: var(--caps-inter); color: var(--encre-douce); }

/* --- portes (the six numbered doors) --- */
.tj-portes { padding-block: clamp(2.2rem, 5vw, 3.6rem); }
.tj-portes__tete { margin-bottom: 1.8rem; }
.tj-portes__titre { display: flex; align-items: baseline; gap: 1.1rem; flex-wrap: wrap; }
.tj-portes__numeros { font-family: var(--sans); font-size: .82rem; letter-spacing: .34em; color: var(--robe-claire); font-weight: 400; }
.tj-portes__numeros--mot { letter-spacing: var(--caps-inter); text-transform: uppercase; }
.tj-portes__note { font-family: var(--sans); font-size: .92rem; color: var(--encre-douce); margin: .5rem 0 0; }

/* --- feuillets (cards) --- */
.tj-feuillets { list-style: none; margin: 0; padding: 0; display: grid; gap: 2rem 1.6rem; }
.tj-feuillets--portes { grid-template-columns: repeat(3, 1fr); }
.tj-feuillet { margin: 0; }
.tj-feuillet__vignette { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; border: 1px solid var(--filet); background: var(--sable-creux); }
.tj-feuillet__cartel { padding-top: .85rem; margin-top: .85rem; border-top: 1px solid var(--filet); }
.tj-feuillet__numero { letter-spacing: .38em; }
.tj-feuillet__titre { margin: .45rem 0 .4rem; font-size: 1.22rem; line-height: 1.25; }
.tj-feuillet__titre a { color: var(--encre); }
.tj-feuillet__titre a:hover { color: var(--robe); text-decoration: none; }
.tj-feuillet__note { font-family: var(--sans); font-size: .88rem; line-height: 1.55; color: var(--encre-douce); margin: 0; }

/* --- oiseau fleuron --- */
.tj-oiseau { display: flex; align-items: center; gap: 1.4rem; width: min(100% - 2.6rem, 1140px); margin-inline: auto; color: var(--robe-claire); padding-block: .4rem; }
.tj-oiseau::before, .tj-oiseau::after { content: ""; flex: 1; height: 1px; background: var(--filet); }

/* --- registre (the dated ledger) --- */
.tj-registre-section { padding-block: clamp(2.2rem, 5vw, 3.6rem); }
.tj-registre { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 3.4rem; }
.tj-ligne { break-inside: avoid; display: grid; grid-template-columns: 92px 1fr; gap: 1.1rem; padding-block: 1.05rem; border-bottom: 1px solid var(--filet); }
.tj-ligne__vignette { width: 92px; aspect-ratio: 4 / 3; object-fit: cover; display: block; border: 1px solid var(--filet); background: var(--sable-creux); }
.tj-ligne p { margin: 0 0 .25rem; font-family: var(--sans); font-size: .9rem; line-height: 1.5; color: var(--encre-douce); }
.tj-ligne h3 { font-size: 1.12rem; line-height: 1.3; margin: .1rem 0 .25rem; }
.tj-ligne h3 a { color: var(--encre); }
.tj-ligne h3 a:hover { color: var(--robe); text-decoration: none; }
.tj-note-fin { font-family: var(--sans); font-size: .92rem; line-height: 1.6; color: var(--encre-douce); max-width: 64ch; margin: 2rem 0 0; padding-top: 1.2rem; border-top: 1px solid var(--filet); }

/* --- scene: heads of pages --- */
.tj-scene { padding-bottom: clamp(2.5rem, 6vw, 4.5rem); }
.tj-fil { font-family: var(--sans); font-size: .78rem; letter-spacing: .04em; padding-top: 1.4rem; color: var(--encre-douce); }
.tj-fil ol { list-style: none; display: flex; flex-wrap: wrap; gap: .45rem; margin: 0; padding: 0; }
.tj-fil li { display: inline-flex; align-items: center; gap: .45rem; margin: 0; }
.tj-fil li + li::before { content: "\203A"; color: var(--robe-claire); }
.tj-fil a { color: var(--encre-douce); }
.tj-fil a:hover { color: var(--robe); text-decoration: none; }
.tj-ouverture { padding-top: clamp(1.8rem, 4vw, 3rem); max-width: 60rem; }
.tj-ouverture h1 { margin: .9rem 0 1rem; max-width: 26ch; }
.tj-ouverture__chapo { font-family: var(--sans); font-size: clamp(.98rem, .94rem + .2vw, 1.08rem); line-height: 1.6; color: var(--encre-douce); max-width: 58ch; margin: 0; }
.tj-indications { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem 0; margin: 1.2rem 0 0; padding: .8rem 0 0; border-top: 1px solid var(--filet); max-width: 58ch; }
.tj-indications li { font-family: var(--sans); font-size: .78rem; text-transform: uppercase; letter-spacing: .14em; color: var(--encre-douce); }
.tj-indications li + li::before { content: "\00B7"; margin-inline: .7rem; color: var(--robe-claire); }
.tj-indications a { color: var(--encre-douce); }
.tj-indications a:hover { color: var(--robe); text-decoration: none; }

/* --- planche (head image) --- */
.tj-planche { margin: 2rem 0 0; }
.tj-planche__vue { width: 100%; aspect-ratio: 2048 / 1152; object-fit: cover; display: block; border: 1px solid var(--filet); background: var(--sable-creux); }

/* --- colonne (reading column, 60-64ch, discreet lettrine) --- */
.tj-colonne { max-width: 64ch; margin-top: 2.2rem; }
.tj-colonne p { margin: 0 0 1.05em; }
.tj-colonne ul, .tj-colonne ol { margin: 0 0 1.05em; padding-left: 1.35rem; }
.tj-colonne li { margin-block: .3rem; }
.tj-colonne h2 { margin: 2.1em 0 .65em; }
.tj-colonne h2::before { content: ""; display: block; width: 3.2rem; height: 1px; background: var(--robe-claire); margin-bottom: .65em; }
.tj-colonne > p:first-of-type::first-letter {
  float: left; font-size: 3.05em; line-height: .82; padding: .04em .1em 0 0;
  color: var(--robe); font-weight: 600;
}

/* --- tableau (canonical tables) --- */
.tj-tableau { margin: 1.8rem 0; overflow-x: auto; }
.tj-tableau table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-variant-numeric: tabular-nums; }
.tj-tableau caption { caption-side: top; text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .18em; color: var(--encre-douce); padding-bottom: .6rem; }
.tj-tableau th { background: var(--encre-nuit); color: var(--sable); font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; text-align: left; padding: .55rem .7rem; font-weight: 600; }
.tj-tableau td { font-size: .87rem; line-height: 1.5; padding: .6rem .7rem; border-bottom: 1px solid var(--filet); vertical-align: top; }
.tj-tableau tbody tr:nth-child(even) { background: var(--sable-vif); }
.tj-tableau a { color: var(--pipal); }

/* --- note (practice box, checklist) --- */
.tj-note { background: var(--sable-vif); border: 1px solid var(--filet); border-left: 3px solid var(--robe-claire); padding: 1.15rem 1.35rem; margin: 1.7rem 0; }
.tj-note h4 { font-family: var(--sans); font-size: .8rem; text-transform: uppercase; letter-spacing: .16em; color: var(--robe); margin: 0 0 .55rem; }
.tj-note ul { margin: 0; padding-left: 1.2rem; }
.tj-note li { font-family: var(--sans); font-size: .93rem; line-height: 1.55; margin-block: .32rem; }

/* --- suite (read next) --- */
.tj-suite { margin-top: 3rem; padding-top: 1.5rem; border-top: 3px double var(--filet); }
.tj-suite h2 { font-family: var(--sans); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: var(--caps-inter); color: var(--encre-douce); margin-bottom: .8rem; }
.tj-suite ul { list-style: none; margin: 0; padding: 0; }
.tj-suite li { font-size: .98rem; margin-block: .4rem; padding-left: 1.2rem; position: relative; }
.tj-suite li::before { content: ""; position: absolute; left: 0; top: .72em; width: .55rem; height: 1px; background: var(--robe-claire); }

/* --- colophon (footer) --- */
.tj-colophon { margin-top: clamp(3rem, 7vw, 5rem); background: var(--encre-nuit); color: var(--sable); }
.tj-colophon__rang { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; padding-block: 2.6rem 2.2rem; }
.tj-colophon h2 { font-family: var(--sans); font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: var(--caps-inter); color: var(--robe-claire); margin-bottom: .8rem; }
.tj-colophon ul { list-style: none; margin: 0; padding: 0; }
.tj-colophon li { margin-block: .34rem; }
.tj-colophon a { font-family: var(--sans); font-size: .9rem; color: #cdc4a9; }
.tj-colophon a:hover { color: var(--robe-claire); text-decoration: none; }
.tj-colophon__bas { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.4rem; padding-block: 1.2rem 1.5rem; border-top: 1px solid rgba(233, 225, 205, .16); font-family: var(--sans); font-size: .78rem; color: #a89f88; }
.tj-colophon__bas .tj-glyphe { color: var(--robe-claire); }
.tj-colophon__bas em { font-family: var(--serif); font-style: italic; font-size: .84rem; color: #c9c0a6; }

/* --- responsive --- */
@media (max-width: 1000px) {
  .tj-feuillets--portes { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .tj-registre { columns: 1; }
  .tj-colophon__rang { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .tj-colonne > p:first-of-type::first-letter { float: none; font-size: inherit; color: inherit; padding: 0; font-weight: inherit; }
}
@media (max-width: 640px) {
  .tj-feuillets--portes { grid-template-columns: 1fr; }
  .tj-colophon__rang { grid-template-columns: 1fr; }
  .tj-frontis__rang { align-items: flex-start; flex-direction: column; }
}

/* --- motion, print --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
@media print {
  :root {
    --sable: #ffffff; --sable-vif: #ffffff; --sable-creux: #ffffff;
    --encre: #000000; --encre-douce: #444444; --filet: #bbbbbb;
    --pipal: #000000; --pipal-nuit: #000000; --robe: #000000; --robe-claire: #666666;
  }
  body { background: #fff; font-size: 11pt; }
  .tj-frontis__rang .tj-sentiers, .tj-evite, .tj-oiseau, .tj-colophon { display: none; }
  .tj-voie { width: 100%; }
  .tj-planche__vue, .tj-feuillet__vignette, .tj-ligne__vignette { border: none; }
  a { color: #000; text-decoration: none; }
  .tj-seuil { padding-block: 1.5rem; }
}
