/* ── Fonts ── */
@font-face {
  font-family: "et-book";
  src: url("fonts/et-book-roman-line-figures.woff") format("woff"),
       url("fonts/et-book-roman-line-figures.ttf") format("truetype");
  font-weight: normal; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "et-book";
  src: url("fonts/et-book-display-italic-old-style-figures.woff") format("woff"),
       url("fonts/et-book-display-italic-old-style-figures.ttf") format("truetype");
  font-weight: normal; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "et-book";
  src: url("fonts/et-book-bold-line-figures.woff") format("woff"),
       url("fonts/et-book-bold-line-figures.ttf") format("truetype");
  font-weight: bold; font-style: normal; font-display: swap;
}

/* ── Palette ── */
:root {
  --stone:      #fafaf8;
  --ink:        #1a1a1a;
  --bronze:     #7c6b5d;
  --steel:      #4a6a7c;
  --annotation: #6b6b6b;
  --rule:       #d4d0c8;
  --code-bg:    #f2f0ec;
}

@media (prefers-color-scheme: dark) {
  :root {
    --stone:      #1a1a1a;
    --ink:        #f0f0ec;
    --bronze:     #b8957a;
    --steel:      #7a9ab0;
    --annotation: #9a9a94;
    --rule:       #3a3a36;
    --code-bg:    #242420;
  }
}

/* ── Paper grain ── */
body {
  background-color: var(--stone);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.04'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23grain)'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: "et-book", Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 1rem;
  line-height: 1.6;
  margin: 0;
  padding: 0;
}

.endmark {
  display: block;
  text-align: center;
  margin: 3rem 0;
  color: var(--rule);
  font-size: 0.9rem;
  letter-spacing: 0.3em;
}

/* ── Page ── */
.page {
  max-width: 56rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

@media (min-width: 900px) {
  .page { padding: 5rem 2rem 7rem; }
}

/* ── Navigation ── */
nav {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 0.85rem;
  color: var(--steel);
  margin-bottom: 3rem;
}
nav a { color: var(--steel); text-decoration: none; }
nav a:hover { color: var(--bronze); }

/* ── Main column ── */
.main { max-width: 34em; }

/* ── Headings ── */
h1 {
  font-weight: 400;
  font-size: 2.25em;
  line-height: 1.15;
  margin: 0 0 0.5rem;
  letter-spacing: -0.005em;
}

.title-rule {
  border: 0;
  border-top: 1px solid var(--rule);
  width: 100%;
  margin: 0 0 0.6rem;
}

.dateline {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 0.85rem;
  color: var(--steel);
  margin: 0 0 2.5rem;
}

h2 {
  font-weight: 400;
  font-style: italic;
  font-size: 1.5em;
  margin: 3.5rem 0 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}

h3 {
  font-weight: 400;
  font-style: italic;
  font-size: 1.125em;
  margin: 2rem 0 0.75rem;
}

/* ── Body ── */
p { margin: 0 0 1.25rem; }

/* ── Paragraph markers ── */
hr.par-mark {
  display: block;
  width: 4em;
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2rem auto;
}

hr.par-mark.num {
  width: auto;
  border: 0;
  height: 0;
  text-align: center;
  margin: 2rem 0;
  overflow: visible;
}
hr.par-mark.num::after {
  content: attr(data-n);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 0.7rem;
  color: var(--annotation);
  position: relative;
  top: -0.5em;
  background: var(--stone);
  padding: 0 0.6em;
}

/* ── Sidenotes ── */
.sn-ref {
  color: var(--bronze);
  font-size: 0.75em;
  vertical-align: super;
  line-height: 0;
  cursor: default;
}

@media (min-width: 900px) {
  .sidenote {
    float: right;
    clear: right;
    width: 28%;
    margin-right: -32%;
    margin-top: 0.2rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--annotation);
  }
  .sidenote .sn-num { color: var(--bronze); font-size: 0.8em; margin-right: 0.25em; }
}
@media (max-width: 899px) {
  .sidenote {
    display: block;
    font-size: 0.85rem;
    color: var(--annotation);
    margin: 0.5rem 0 1rem 0.75rem;
    padding-left: 0.75rem;
    border-left: 1px solid var(--rule);
  }
  .sidenote .sn-num { color: var(--bronze); }
}

/* ── Blockquote ── */
blockquote {
  margin: 2rem 0;
  padding: 0 0 0 1.2rem;
  font-style: italic;
  border-left: 2px solid var(--rule);
}
@media (min-width: 900px) {
  blockquote { border-left-color: var(--bronze); border-left-width: 1px; }
}
blockquote p { margin-bottom: 0.5rem; }
blockquote footer {
  font-style: normal;
  font-size: 0.85rem;
  color: var(--steel);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  margin-top: 0.5rem;
}
blockquote footer::before { content: "— "; }

/* ── Journal ── */
.journal-list {
  list-style: none;
  margin: 0 0 2.5rem;
  padding: 0;
}
.journal-list li {
  margin: 0 0 1.1rem;
  padding-left: 5.5rem;
  position: relative;
}
.jn-date {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 0.8rem;
  color: var(--steel);
  position: absolute;
  left: 0;
  top: 0.25rem;
  white-space: nowrap;
}
.jn-title { font-style: italic; color: var(--ink); }
.closing {
  margin-top: 2rem;
  color: var(--annotation);
  font-size: 0.9rem;
}

/* ── Footer ── */
.site-footer {
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 0.85rem;
  color: var(--steel);
}

/* ── Links in body ── */
.main a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.15em;
}
.main a:hover { color: var(--bronze); }

code {
  font-family: "Cascadia Code", "Fira Code", Consolas, "Liberation Mono", Menlo, Courier, monospace;
  font-size: 0.875em;
  background: var(--code-bg);
}

::selection { background: var(--bronze); color: var(--stone); }
