/* ─── Blog layout styles ─────────────────────────────────────────────────── */

/* Font-face rules reference /fonts/ absolute path (root-relative for CF Pages) */
/* latin */
@font-face {
  font-family: 'Spectral';
  font-style: italic;
  font-weight: 300;
  font-display: swap;
  src: url(/fonts/rnCu-xNNww_2s0amA9M8qtHEWfSFXQ.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* latin */
@font-face {
  font-family: 'Spectral';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(/fonts/rnCs-xNNww_2s0amA9uSsG3BafY.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* latin */
@font-face {
  font-family: 'Spectral';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/fonts/rnCs-xNNww_2s0amA9vKsW3BafY.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --paper: #ffffff;
  --ink: #0f1111;
  --ink-muted: rgba(15, 17, 17, 0.62);
  --ink-mid: rgba(15, 17, 17, 0.82);
  --accent: rgba(15, 17, 17, 0.35);

  --aside-width: 200px;
  --aside-gap: 64px;
  --content-max: 660px;
  --page-pad-x: 48px;
  --page-pad-top: 56px;

  --text-nav: 13px;
  --text-body: 17px;
  --text-h1: 28px;
  --text-h2: 20px;
  --text-time: 14px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

html,
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Spectral', serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: #95E78E;
  color: #062C02;
}

:focus-visible {
  outline: 2px solid #0047CC;
  outline-offset: 3px;
  border-radius: 2px;
}

/* ─── Page shell ─────────────────────────────────────────────────────────── */

.blog-shell {
  display: grid;
  grid-template-columns: 1fr minmax(0, var(--content-max)) 1fr;
  min-height: 100dvh;
  padding: var(--page-pad-top) var(--page-pad-x);
}

/* ─── Left aside ─────────────────────────────────────────────────────────── */

.blog-aside {
  grid-column: 1;
  justify-self: end;
  width: var(--aside-width);
  margin-right: var(--aside-gap);
  position: sticky;
  top: var(--page-pad-top);
  align-self: start;
  height: calc(100dvh - var(--page-pad-top) * 2);
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.blog-shell>main {
  grid-column: 2;
  min-width: 0;
}

@media (max-width: 1284px) {
  .blog-shell {
    grid-template-columns: 1fr;
  }

  .blog-aside {
    grid-column: 1;
    justify-self: start;
    width: auto;
    margin-right: 0;
    position: static;
    height: auto;
    margin-bottom: 40px;
  }

  .blog-shell>main {
    grid-column: 1;
    max-width: var(--content-max);
    width: 100%;
    margin: 0 auto;
  }
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: 'Spectral', serif;
  font-weight: 300;
  font-size: var(--text-nav);
  color: var(--ink-muted);
  letter-spacing: 0.01em;
  transition: color 120ms var(--ease-out);
}

.back-link:hover {
  color: var(--ink);
}

.back-link svg {
  flex-shrink: 0;
  stroke: currentColor;
}

/* TOC nav */
.toc-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.toc-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.toc-nav li a {
  display: block;
  padding: 5px 0;
  font-family: 'Spectral', serif;
  font-weight: 300;
  font-size: var(--text-nav);
  color: var(--ink-muted);
  line-height: 1.4;
  transition: color 120ms var(--ease-out);
}

.toc-nav li a:hover {
  color: var(--ink);
}

.toc-nav li a.toc-active {
  color: var(--ink);
}

/* ─── Blog index list (used only on index.html) ──────────────────────────── */

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.post-list-item {
  display: grid;
  gap: 4px;
}

.post-list-item time {
  font-size: var(--text-time);
  color: var(--ink-muted);
  letter-spacing: 0.01em;
}

.post-list-item a {
  font-size: 20px;
  font-weight: 300;
  color: var(--ink);
  line-height: 1.35;
  text-decoration-thickness: 0.25px;
  text-underline-offset: 4px;
}

.post-list-item a:hover {
  text-decoration-line: underline;
}

@media (max-width: 640px) {
  :root {
    --page-pad-x: 24px;
    --page-pad-top: 40px;
    --aside-gap: 32px;
  }

  .back-link {
    padding: 12px 0;
  }

  .toc-nav li a {
    padding: 10px 0;
  }
}

.post-list-item .post-summary {
  font-size: var(--text-body);
  color: var(--ink-muted);
  line-height: 1.55;
  margin: 0;
  margin-top: 2px;
}

/* ─── Article ────────────────────────────────────────────────────────────── */

article {
  max-width: var(--content-max);
  padding-bottom: 120px;
}

article header {
  margin-bottom: 56px;
}

article header h1 {
  font-family: 'Spectral', serif;
  font-weight: 300;
  font-size: var(--text-h1);
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0 0 10px 0;
  color: var(--ink);
}

article header time {
  display: block;
  font-size: var(--text-time);
  color: var(--ink-muted);
  letter-spacing: 0.01em;
}

/* Section headings with hr divider (benji.org style) */
article .section-heading {
  display: grid;
  grid-template-columns: max-content 1fr;
  align-items: center;
  gap: 16px;
  margin: 56px 0 20px;
}

article .section-heading hr {
  border: none;
  border-top: 1px solid rgba(15, 17, 17, 0.12);
  margin: 0;
  flex: 1;
}

article .section-heading h2 {
  font-family: 'Spectral', serif;
  font-weight: 500;
  font-size: var(--text-h2);
  line-height: 1.2;
  margin: 0;
  color: var(--ink);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

article p {
  font-size: var(--text-body);
  line-height: 1.65;
  color: var(--ink-mid);
  margin: 0 0 20px 0;
}

article ul,
article ol {
  padding-left: 20px;
  margin: 0 0 20px 0;
}

article li {
  font-size: var(--text-body);
  line-height: 1.65;
  color: var(--ink-mid);
  margin-bottom: 6px;
}

article code {
  font-family: 'SF Mono', 'Fira Mono', monospace;
  font-size: 0.9em;
  background: rgba(15, 17, 17, 0.05);
  padding: 1px 5px;
  border-radius: 3px;
}

article strong {
  font-weight: 500;
  color: var(--ink);
}

article em {
  font-style: italic;
}

article blockquote {
  margin: 24px 0;
  padding: 0 0 0 20px;
  border-left: 2px solid rgba(15, 17, 17, 0.2);
  color: var(--ink-muted);
  font-style: italic;
}

article a {
  color: var(--ink);
  text-decoration-line: underline;
  text-decoration-thickness: 0.25px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(15, 17, 17, 0.4);
}

article a:hover {
  text-decoration-color: var(--ink);
}

/* ─── Index page header ──────────────────────────────────────────────────── */

.blog-index-header {
  margin-bottom: 52px;
}

.blog-index-header h1 {
  font-family: 'Spectral', serif;
  font-weight: 300;
  font-size: var(--text-h1);
  letter-spacing: -0.02em;
  margin: 0 0 8px 0;
}

.blog-index-header p {
  font-size: var(--text-body);
  color: var(--ink-muted);
  margin: 0;
}
