/* ───────────────────────────────────────────────────────────────────────────
   phareim.md — Tufte-styled reading surface.

   Warm paper, ET Book serif, a single generous reading measure, hairline
   rules, and exactly one accent (crimson) spent on links and the moment that
   deserves the eye. No client runtime; this file is the whole design.

   Tokens follow the tufte-viz house palette. ET Book is bundled in fonts/
   (MIT/SIL — see fonts/ET-Book-LICENSE.txt).
   ─────────────────────────────────────────────────────────────────────────── */

@font-face {
  font-family: "ET Book";
  font-weight: 400; font-style: normal; font-display: swap;
  src: url("fonts/et-book-roman.woff") format("woff"),
       url("fonts/et-book-roman.ttf") format("truetype");
}
@font-face {
  font-family: "ET Book";
  font-weight: 400; font-style: italic; font-display: swap;
  src: url("fonts/et-book-italic.woff") format("woff"),
       url("fonts/et-book-italic.ttf") format("truetype");
}
@font-face {
  font-family: "ET Book";
  font-weight: 600; font-style: normal; font-display: swap;
  src: url("fonts/et-book-semibold.woff") format("woff");
}
@font-face {
  font-family: "ET Book";
  font-weight: 700; font-style: normal; font-display: swap;
  src: url("fonts/et-book-bold.woff") format("woff");
}

:root {
  --paper:      #fbf9f4;
  --paper-sunk: #f4f1e9;
  --ink:        #111111;
  --ink-soft:   #2e2b24;
  --ink-quiet:  #6b675d;
  --rule:       #e7e2d8;
  --rule-strong:#d6cfc0;
  --accent:     #c1351d;
  --accent-ink: #9a2a17;
  --measure:    38rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:      #15140f;
    --paper-sunk: #1d1b15;
    --ink:        #ececec;
    --ink-soft:   #d8d4c8;
    --ink-quiet:  #9a958a;
    --rule:       #2c2a22;
    --rule-strong:#3a382e;
    --accent:     #ff6b4a;
    --accent-ink: #ff8164;
  }
}

* { box-sizing: border-box; }

html {
  font-size: 112.5%;          /* ~18px base */
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-soft);
  font-family: "ET Book", Charter, "Palatino Linotype", Palatino, Georgia, serif;
  line-height: 1.55;
  font-feature-settings: "onum" 1, "liga" 1;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 4rem 1.5rem 6rem;
}

/* ── Masthead ──────────────────────────────────────────────────────────── */
.masthead {
  margin-bottom: 3.5rem;
}
.masthead a.site-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.01em;
}
.masthead .tagline {
  margin: 0.35rem 0 0;
  color: var(--ink-quiet);
  font-style: italic;
  font-size: 1.02rem;
}
.masthead.small { margin-bottom: 2.5rem; }
.masthead.small a.site-title { font-size: 1.15rem; }

/* ── Headings ──────────────────────────────────────────────────────────── */
h1, h2, h3 {
  color: var(--ink);
  font-weight: 600;
  line-height: 1.18;
  margin: 2.4rem 0 0.6rem;
}
h1 { font-size: 2.2rem; margin-top: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

article > h1 { margin-bottom: 0.3rem; }

p, ul, ol, blockquote, figure, pre, table { margin: 0 0 1.2rem; }
p { max-width: 100%; }

/* ── Links ─────────────────────────────────────────────────────────────── */
a { color: var(--accent-ink); text-decoration: none; border-bottom: 1px solid var(--rule-strong); }
a:hover { border-bottom-color: var(--accent); color: var(--accent); }
.masthead a.site-title, a.bare { border-bottom: none; }

/* ── Article metadata ──────────────────────────────────────────────────── */
.meta {
  color: var(--ink-quiet);
  font-size: 0.92rem;
  font-style: italic;
  margin: 0 0 2.2rem;
}
.summary { color: var(--ink-quiet); font-style: italic; }

/* ── Body elements ─────────────────────────────────────────────────────── */
blockquote {
  margin-left: 0;
  padding-left: 1.4rem;
  border-left: 2px solid var(--rule-strong);
  color: var(--ink-quiet);
  font-style: italic;
}
ul, ol { padding-left: 1.4rem; }
li { margin: 0.25rem 0; }

code {
  font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: var(--paper-sunk);
  padding: 0.1em 0.34em;
  border-radius: 3px;
}
pre {
  background: var(--paper-sunk);
  padding: 1rem 1.2rem;
  overflow-x: auto;
  border-radius: 4px;
  line-height: 1.45;
}
pre code { background: none; padding: 0; font-size: 0.82rem; }

hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2.5rem 0;
}

img { max-width: 100%; height: auto; }

table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--rule); }
th { font-weight: 600; color: var(--ink); }

/* ── Index list ────────────────────────────────────────────────────────── */
.index { list-style: none; padding: 0; margin: 0; }
.index li {
  margin: 0;
  padding: 1.3rem 0;
  border-bottom: 1px solid var(--rule);
}
.index li:first-child { border-top: 1px solid var(--rule); }
.index .entry-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
  border: none;
}
.index .entry-title:hover { color: var(--accent); }
.index .entry-meta {
  display: block;
  color: var(--ink-quiet);
  font-size: 0.9rem;
  font-style: italic;
  margin-top: 0.15rem;
}
.index .entry-summary { margin: 0.45rem 0 0; color: var(--ink-soft); }

.empty-note { color: var(--ink-quiet); font-style: italic; }

/* ── Footer / colophon ─────────────────────────────────────────────────── */
.colophon {
  margin-top: 4rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-quiet);
  font-size: 0.88rem;
}
.colophon a { border-bottom: none; color: var(--ink-quiet); }
.colophon a:hover { color: var(--accent); }

.backlink { display: inline-block; margin-bottom: 2rem; font-size: 0.95rem; }
