/* ============================================================
   philippp.net — "Reading Room" theme
   One stylesheet for every content page (home, blog, algos).

   Layout primitives:
     .page          outer padding for a content page
     .page--narrow  668px reading measure (blog entries, lists)
     .page--wide    1080px (home)
     .cols          responsive two-column grid
   Type primitives:
     .overline      letterspaced caps label (Spectral)
     .section-h     h2 with a hairline rule running to the margin
     .subhead       small-caps subcategory label
     .plain-list    unstyled list with vertical rhythm
     .desc          muted one-line description under a link
     .lnk           standard content link (dotted with warm underline)
     .meta .site .colophon .entry-meta figcaption
                    small Spectral metadata
   Behavior (theme.js):
     [data-top-items="N"] truncates a list to N items + toggle
   New pages: link this file (+ theme.js if you use collapsing
   lists), wrap content in .page.page--narrow or .page--wide.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;1,6..72,400;1,6..72,500&family=Spectral:ital,wght@0,400;0,500;0,600;1,400&display=swap');

:root {
  --bg: #fbfaf6;
  --ink: #221f19;
  --ink-2: #55503f;
  --muted: #6a6555;
  --rule: #e6e1d4;
  --accent: oklch(0.5 0.12 45);
  --accent-soft: oklch(0.55 0.11 45);
  --underline: oklch(0.85 0.05 45);
  --panel: #f2eee3;
  --panel-border: #e6e1d4;
  --serif: 'Newsreader', Georgia, serif;
  --caps: 'Spectral', Georgia, serif;
  --mono: ui-monospace, Menlo, Consolas, 'Courier New', monospace;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.7;
}

/* ---- Layout ---- */
.page { padding: 56px 24px 140px; }
.page--narrow { max-width: 716px; margin: 0 auto; }
.page--wide { max-width: 1128px; margin: 0 auto; }
.cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 72px;
  align-items: start;
}
@media (max-width: 860px) {
  .cols { grid-template-columns: 1fr; gap: 16px; }
}

/* ---- Links ---- */
a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--underline);
  transition: border-color 0.15s ease, color 0.15s ease;
}
a:hover { border-bottom-color: var(--accent); color: var(--accent); }
.inl { color: var(--accent); }
.inl:hover { border-bottom-color: var(--accent); }

/* ---- Headings & labels ---- */
h1 {
  font-size: 40px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0 0 20px;
}
.masthead h1 { font-size: 44px; margin-bottom: 22px; }
h2, .section-h {
  font-size: 27px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 64px 0 24px;
}
h2::after, .section-h::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}
h2, .section-h { display: flex; align-items: baseline; gap: 18px; }
article h2 { font-size: 25px; margin: 48px 0 20px; }
h3, .subhead {
  font-family: var(--caps);
  font-size: 12px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent-soft);
  margin: 32px 0 16px;
}
.overline {
  font-family: var(--caps);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--accent-soft);
  margin-bottom: 20px;
}

/* ---- Masthead (home) ---- */
.masthead { max-width: 640px; margin-bottom: 72px; }
.masthead .lede { font-size: 21px; margin: 0 0 14px; line-height: 1.5; }
.masthead .bio { color: var(--ink-2); font-size: 17px; line-height: 1.6; margin: 0 0 22px; }
.masthead .contact { display: flex; gap: 22px; font-size: 15px; margin: 0; }

/* ---- Breadcrumb / site line ---- */
.site, nav.site {
  font-family: var(--caps);
  font-size: 14px;
  letter-spacing: 0.02em;
  margin-bottom: 56px;
}
.site a { color: var(--muted); border-bottom-color: transparent; }
.site a:hover { border-bottom-color: #b9b3a3; color: var(--muted); }
.site .sep { color: #c3bdae; padding: 0 4px; }

/* ---- Body copy ---- */
p { margin: 0 0 22px; text-wrap: pretty; }
article > p, article li { font-size: 18px; }
em { font-style: italic; }
blockquote {
  margin: 28px 0;
  padding: 2px 0 2px 24px;
  border-left: 2px solid var(--rule);
  color: var(--ink-2);
  font-style: italic;
}
hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 40px 0;
}

/* ---- Lists ---- */
ul, ol { margin: 0 0 22px; padding-left: 24px; }
li { margin-bottom: 8px; }
.plain-list { list-style: none; padding: 0; margin: 0 0 8px; }
.plain-list > li { margin-bottom: 12px; }
.plain-list--spaced > li { margin-bottom: 20px; }
.plain-list .lnk { font-size: 18px; }
.plain-list--spaced .lnk { font-size: 19px; }
.desc { color: var(--muted); font-size: 15px; margin-top: 3px; }
span.desc { margin-left: 4px; }
.plain-list + .subhead { margin-top: 34px; }

/* ---- Blog index listing ---- */
ul.entry-list { list-style: none; padding: 0; margin: 0; }
ul.entry-list li { margin-bottom: 28px; }
a.entry-title { font-size: 21px; }
.entry-meta {
  font-family: var(--caps);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-top: 4px;
}
.entry-summary { color: var(--muted); font-size: 15.5px; margin-top: 2px; }

/* ---- Entry header ---- */
.meta {
  font-family: var(--caps);
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--muted);
  margin-bottom: 40px;
}

/* ---- Figures / images ---- */
figure { margin: 36px 0; }
img { max-width: 100%; height: auto; display: block; border: 1px solid var(--rule); }
figcaption {
  font-style: italic;
  color: var(--muted);
  font-size: 15px;
  margin-top: 10px;
}
figure.video { position: relative; padding-bottom: 56.25%; height: 0; }
figure.video iframe {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  border: 1px solid var(--rule);
}

/* ---- Code ---- */
pre {
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.6;
  color: #2c2920;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  padding: 22px 24px;
  margin: 0 0 32px;
  overflow-x: auto;
}
code { font-family: var(--mono); font-size: 0.88em; }
p code, li code {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  padding: 1px 5px;
}
pre code { background: none; border: 0; padding: 0; }
.codehilite { margin: 0 0 32px; }
.codehilite pre { margin: 0; }

/* ---- Collapsible lists (theme.js) ---- */
.toggle-more {
  font-family: var(--caps);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--underline);
  padding: 0 0 2px;
  margin: 4px 0 0;
  cursor: pointer;
}
.toggle-more:hover { border-bottom-color: var(--accent); }

/* ---- Footer ---- */
.colophon {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  font-size: 15px;
  color: var(--muted);
  line-height: 1.6;
}
.colophon a { color: var(--accent); }
.colophon .back { margin-top: 14px; }
.colophon .back a { color: var(--muted); border-bottom-color: transparent; }
.colophon .back a:hover { border-bottom-color: #b9b3a3; }
