:root{
  color-scheme:dark;
  /* night palette — warm, low-glare, nothing pure black or pure white */
  --paper:#16110D; --paper-2:#1E1811; --paper-3:#271F16; --paper-4:#100C09;
  --ink:#E2D0B5; --ink-2:#AF9C82; --ink-3:#87755F;
  --edge:#4B3B2C; --rule:#382C21; --rule-soft:#2A2119;
  --blue:#93B4C4; --sage:#9AA88A;
  --flame:#E8A64B; --flame-2:#C46B41;
  --tab-1:#C9A46B; --tab-6:#9A4A2A;
  --shadow:0 12px 34px -18px #000;
  --measure:37rem;
  --display:'Fraunces',Georgia,serif;
  --body:'Newsreader',Georgia,serif;
  --mono:'IBM Plex Mono',ui-monospace,Menlo,monospace;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%; background:var(--paper); scroll-behavior:smooth}
body{
  margin:0; background:var(--paper); color:var(--ink);
  font-family:var(--body); font-size:19px; line-height:1.7;
  font-variant-numeric:oldstyle-nums;
}
body::before{ /* the lamp's glow, low in the page */
  content:""; position:fixed; inset:0; z-index:0; pointer-events:none;
  background:radial-gradient(60rem 40rem at 50% -6rem, rgba(232,166,75,.09), transparent 70%);
}
body::after{ /* paper grain, barely there */
  content:""; position:fixed; inset:0; z-index:0; pointer-events:none;
  opacity:.16; mix-blend-mode:overlay;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)' opacity='.4'/%3E%3C/svg%3E");
}
.wrap{position:relative; z-index:1; max-width:78rem; margin:0 auto; padding:0 1.25rem 5rem}
::selection{background:rgba(232,166,75,.28)}

/* ---------- masthead ---------- */
.masthead{padding:1.6rem 0 2rem; text-align:center}
.hero-lamp{width:min(100%,44rem); margin:0 auto .4rem}
.hero-lamp img{
  display:block; width:100%; height:auto;
  -webkit-mask-image:radial-gradient(ellipse 62% 60% at 50% 48%, #000 40%, transparent 78%);
  mask-image:radial-gradient(ellipse 62% 60% at 50% 48%, #000 40%, transparent 78%);
}
.eyebrow{
  font-family:var(--mono); font-size:.66rem; letter-spacing:.22em; text-transform:uppercase;
  color:var(--ink-3); margin:0 0 1rem;
}
.masthead h1{
  font-family:var(--display); font-optical-sizing:auto;
  font-variation-settings:'SOFT' 40,'WONK' 1;
  font-weight:500; font-size:clamp(2.7rem,9.4vw,6rem); line-height:.94;
  margin:0; letter-spacing:-.02em; color:#EFE0C6;
}
.masthead h1 em{
  display:block; font-style:italic; font-weight:400;
  color:var(--flame); font-size:.5em; letter-spacing:0; margin-top:.34em;
}
.masthead p.sub{
  max-width:31rem; margin:1.4rem auto 0; color:var(--ink-2);
  font-size:1.03rem; font-style:italic;
}
.byline{font-family:var(--mono); font-size:.68rem; letter-spacing:.13em; color:var(--ink-3);
  text-transform:uppercase; margin-top:1.4rem; line-height:1.9}

.masthead.compact{padding:1.9rem 0 1.5rem; text-align:center}
.masthead.compact .home{
  font-family:var(--mono); font-size:.72rem; letter-spacing:.18em; text-transform:uppercase;
  color:var(--ink-3); text-decoration:none; display:inline-flex; align-items:center; gap:.6rem;
  padding:.5rem .2rem;
}
.masthead.compact .home:hover{color:var(--flame)}
.masthead.compact .lamp{color:var(--flame); font-size:.95rem}

/* ---------- the drawer: table of contents ---------- */
.toc{
  border:1.5px solid var(--edge); border-radius:.9rem; background:var(--paper-2);
  box-shadow:var(--shadow); overflow:hidden; margin:2.4rem auto 0; max-width:44rem;
  scroll-margin-top:1rem;
}
.toc h2{
  font-family:var(--mono); font-size:.68rem; letter-spacing:.2em; text-transform:uppercase;
  color:var(--flame); font-weight:500; margin:0; padding:1.15rem 1.4rem .9rem;
  border-bottom:1px solid var(--rule); text-align:center;
}
.toc-row{
  display:flex; gap:.95rem; align-items:baseline; text-decoration:none; color:inherit;
  padding:.85rem 1.4rem .85rem 1.1rem; border-bottom:1px solid var(--rule-soft);
  border-left:4px solid var(--bg); transition:background .16s ease;
}
.toc-row:last-child{border-bottom:none}
.toc-row:hover{background:rgba(232,166,75,.09)}
.toc-row:hover .t{color:var(--flame)}
.toc-row:focus-visible{outline:2px solid var(--flame); outline-offset:-3px}
.toc-row .n{font-family:var(--mono); font-size:.72rem; color:var(--bg); flex:0 0 1.4rem}
.toc-row .t{font-weight:600; color:#EFE0C6; flex:0 0 9rem}
.toc-row .d{color:var(--ink-2); font-size:.9rem; flex:1; line-height:1.5}
@media (max-width:600px){
  .toc-row{flex-wrap:wrap; gap:.3rem .95rem; padding:.85rem 1rem .9rem .85rem}
  .toc-row .t{flex:1 0 auto}
  .toc-row .d{flex:1 0 100%; padding-left:2.35rem; font-size:.87rem}
}

/* ---------- back to contents ---------- */
.up{
  position:absolute; top:-.35rem; right:0; line-height:0;
  padding:.5rem; border-radius:.5rem; transition:transform .2s ease, opacity .2s ease;
  opacity:.62;
}
.up img{width:26px; height:auto; display:block}
.up:hover{opacity:1; transform:translateY(-4px)}
.up:focus-visible{outline:2px solid var(--flame); outline-offset:2px; opacity:1}
.up-end{
  position:static; display:block; width:max-content; margin:2.6rem auto 0;
  opacity:.7; padding:.7rem;
}
.up-end img{width:34px}
@media (min-width:781px){ .up img{width:32px} }

.book{margin-top:2.6rem}
.folder{
  position:relative; border:1.5px solid var(--edge); border-radius:.9rem;
  scroll-margin-top:.9rem; margin-bottom:2.2rem;
  background:var(--paper-2); box-shadow:var(--shadow);
  padding:clamp(1.9rem,4.5vw,3.6rem) clamp(1.1rem,4vw,3.4rem) 3.4rem;
  overflow:hidden;
}
.folder::before{ /* the open tab's colour carried into the folder */
  content:""; position:absolute; top:0; left:0; right:0; height:4px;
  background:var(--active,var(--tab-1)); opacity:.9;
}


/* ---------- chapter typography ---------- */
.chapter{max-width:var(--measure); margin:0 auto}
.chapter > *{max-width:var(--measure)}
.ch-head{position:relative; margin:0 0 2.4rem; text-align:center; max-width:none;
  padding-top:.2rem}
.ch-kicker{
  font-family:var(--mono); font-size:.68rem; letter-spacing:.2em; text-transform:uppercase;
  color:var(--flame); opacity:.75; margin:0 0 .9rem;
}
.ch-head h2{
  font-family:var(--display); font-variation-settings:'SOFT' 40,'WONK' 1;
  font-weight:500; font-size:clamp(2rem,5.6vw,3.4rem); line-height:1.04;
  margin:0; letter-spacing:-.018em; color:#EFE0C6;
}
.ch-head .dek{
  font-style:italic; color:var(--ink-2); margin:1rem auto 0; max-width:30rem; font-size:1.04rem;
}
.chapter h3{
  font-family:var(--display); font-variation-settings:'SOFT' 30,'WONK' 1;
  font-weight:500; font-size:1.6rem; line-height:1.18; letter-spacing:-.01em;
  margin:3.2rem 0 .9rem; color:#EBDCC1;
}
.chapter h4{
  font-family:var(--mono); font-size:.73rem; letter-spacing:.16em; text-transform:uppercase;
  color:var(--ink-3); font-weight:500; margin:2.3rem 0 .7rem;
}
.chapter p{margin:0 0 1.15rem}
.chapter p.lead{font-size:1.18rem; line-height:1.58}
.chapter p.lead::first-letter{
  float:left; font-family:var(--display); font-variation-settings:'WONK' 1;
  font-size:3.5em; line-height:.78; font-weight:500; padding:.06em .1em 0 0;
  color:var(--flame);
}
.chapter a{color:var(--blue); text-decoration-thickness:1px; text-underline-offset:.16em}
.chapter a:hover{color:var(--flame)}
.chapter strong{font-weight:600; color:#EFE0C6}
.chapter ul,.chapter ol{margin:0 0 1.3rem; padding-left:1.25rem}
.chapter li{margin:0 0 .55rem; padding-left:.2rem}
.chapter ul{list-style:none; padding-left:1.35rem}
.chapter ul > li::before{
  content:"\\2014"; color:var(--flame-2); margin-left:-1.35rem; margin-right:.6rem;
  display:inline-block; width:.75rem;
}
.chapter ol{list-style:none; counter-reset:n; padding-left:1.9rem}
.chapter ol > li{counter-increment:n}
.chapter ol > li::before{
  content:counter(n); font-family:var(--mono); font-size:.72rem; color:var(--flame);
  margin-left:-1.9rem; margin-right:.9rem; display:inline-block; width:1rem; text-align:right;
}
blockquote{
  margin:2rem 0; padding:0 0 0 1.4rem; border-left:3px solid var(--flame);
  font-style:italic; color:var(--ink-2); font-size:1.06rem;
}
blockquote p:last-child{margin-bottom:0}
code{
  font-family:var(--mono); font-size:.83em; background:rgba(232,166,75,.12);
  color:#EDC98E; padding:.11em .34em; border-radius:.22rem; font-style:normal;
}
pre{
  font-family:var(--mono); font-size:.79rem; line-height:1.64;
  background:var(--paper-4); color:#DCC9AB; border:1px solid var(--rule);
  border-radius:.55rem; padding:1.05rem 1.15rem; overflow-x:auto; margin:1.4rem 0;
}
pre code{background:none; padding:0; font-size:1em; color:inherit}
pre .c{color:#8A7660; font-style:italic}
pre .p{color:var(--flame)}

/* ---------- the lamps ---------- */
hr.rule{
  border:none; height:64px; margin:3.2rem auto; max-width:24rem; opacity:.95;
  background:center/contain no-repeat url("img/diya-strip.png");
}

/* ---------- plates ---------- */
figure.plate{
  margin:2.6rem 0; max-width:none; width:min(100%,52rem);
  margin-left:50%; transform:translateX(-50%);
}
figure.plate img{
  display:block; width:100%; height:auto; border-radius:.5rem;
  border:1px solid var(--rule);
  filter:brightness(.56) contrast(.95) sepia(.26) saturate(1.14);
  transition:filter .45s ease; cursor:pointer;
}
figure.plate img.lit{filter:none}
figure.plate.night img{filter:brightness(.9) saturate(1.02); border-color:var(--rule-soft)}
figure.plate.night img.lit{filter:none}
figure.plate figcaption{
  font-family:var(--mono); font-size:.69rem; letter-spacing:.06em; color:var(--ink-3);
  margin-top:.7rem; text-align:center; line-height:1.6;
}
figure.plate.small{width:min(100%,34rem)}

/* ---------- boxes ---------- */
.card{
  border:1px solid var(--edge); border-radius:.55rem; background:var(--paper-3);
  padding:1.3rem 1.45rem; margin:2rem 0;
}
.card > :first-child{margin-top:0}
.card > :last-child{margin-bottom:0}
.card .label{
  font-family:var(--mono); font-size:.65rem; letter-spacing:.19em; text-transform:uppercase;
  color:var(--flame); margin:0 0 .7rem; display:block;
}
.card.try{background:rgba(232,166,75,.09); border-color:rgba(232,166,75,.34)}
.card.warn{background:rgba(196,107,65,.11); border-color:rgba(196,107,65,.4)}
.card.warn .label{color:#E08B60}
.card.note{background:rgba(147,180,196,.07); border-color:rgba(147,180,196,.3)}
.card.note .label{color:var(--blue)}

table{width:100%; border-collapse:collapse; margin:1.7rem 0; font-size:.92rem}
th,td{text-align:left; padding:.6rem .7rem; border-bottom:1px solid var(--rule); vertical-align:top}
th{
  font-family:var(--mono); font-size:.65rem; letter-spacing:.13em; text-transform:uppercase;
  color:var(--ink-3); font-weight:500; border-bottom:1.5px solid var(--edge);
}
td code{font-size:.78rem}

/* ---------- contents ---------- */
ul.contents{list-style:none; padding:0; margin:2.2rem 0; border-top:1.5px solid var(--edge)}
ul.contents > li{margin:0; padding:0; border-bottom:1px solid var(--rule)}
ul.contents > li::before{content:none; display:none}
ul.contents a{
  display:flex; gap:1rem; align-items:baseline; width:100%; text-align:left;
  color:inherit; text-decoration:none;
  padding:.8rem .45rem; transition:background .15s ease;
}
ul.contents a:hover{background:rgba(232,166,75,.09)}
ul.contents a:hover .t{color:var(--flame)}
ul.contents a:focus-visible{outline:2px solid var(--flame); outline-offset:-2px}
ul.contents .n{font-family:var(--mono); font-size:.7rem; color:var(--flame); flex:0 0 1.5rem}
ul.contents .t{font-weight:600; flex:0 0 8.5rem; color:#EFE0C6}
ul.contents .d{color:var(--ink-2); font-size:.92rem; flex:1}
@media (max-width:560px){
  ul.contents button{flex-wrap:wrap; gap:.35rem 1rem}
  ul.contents .t{flex:1 0 auto}
  ul.contents .d{flex:1 0 100%; padding-left:2.5rem}
}

.aside{
  font-size:.94rem; color:var(--ink-2); border-top:1px solid var(--rule);
  border-bottom:1px solid var(--rule); padding:1.1rem 0; margin:2.2rem 0;
}

/* ---------- chapter foot ---------- */
.ch-foot{
  display:flex; justify-content:space-between; gap:1rem; align-items:center;
  margin:4rem auto 0; padding-top:1.4rem; border-top:1px solid var(--rule);
  max-width:var(--measure); font-family:var(--mono); font-size:.72rem; letter-spacing:.06em;
}
.ch-foot a{color:var(--blue); text-decoration:none; padding:.4rem; text-align:left}
.ch-foot a:hover{color:var(--flame); text-decoration:underline; text-underline-offset:.2em}
.ch-foot a:focus-visible{outline:2px solid var(--flame); outline-offset:2px}
.ch-foot .off{opacity:.25; padding:.4rem}
.ch-foot .nx{text-align:right}

footer.colophon{
  max-width:var(--measure); margin:4rem auto 0; padding-top:2rem;
  border-top:1px solid var(--rule); text-align:center;
  font-size:.85rem; color:var(--ink-3); line-height:1.75;
}
footer.colophon a{color:var(--blue)}
footer.colophon .flame{color:var(--flame); font-size:1.1rem; display:block; margin-bottom:.9rem}

@media (max-width:640px){
  body{font-size:18px}
  .chapter p.lead::first-letter{font-size:3em}
  figure.plate{width:100%; margin-left:0; transform:none}
  hr.rule{max-width:17rem; height:46px}
}
@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  *{animation:none !important; transition:none !important}
}
/* ---------- field-book addendum: seated plates ----------
   The plates in this book are composited onto the page background before
   publishing, so their deckled watercolour edges dissolve into #16110D.
   The shared stylesheet dims plates until tapped; applied here that dimming
   would darken the composited border below the page colour and draw a visible
   rectangle around every plate. So plates in this book render unfiltered and
   unbordered, and there is nothing to tap.                                   */
figure.plate img{filter:none; border:none; border-radius:0}
figure.plate img.lit{filter:none}
.hero-lamp img{filter:none}
.byline{
  font-family:var(--mono); font-size:.68rem; letter-spacing:.14em;
  text-transform:uppercase; color:var(--ink-3); margin:1.5rem 0 0;
}
hr.rule{
  border:0; height:1px; background:var(--rule);
  max-width:12rem; margin:4.5rem auto;
}
