/* Canopy default theme. Edit freely: this file is yours. */

/* Inter (https://rsms.me/inter), served from static/fonts; OFL, see Inter-LICENSE.txt. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/InterVariable.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/InterVariable-Italic.woff2") format("woff2");
}

/* Dracula (https://draculatheme.com): Alucard when light, Dracula when dark. */
:root {
  --bg: light-dark(#fffbeb, #282a36);
  --text: light-dark(#1f1f1f, #f8f8f2);
  /* Dark muted is Dracula's comment (#6272a4) lightened: the original is under 4.5:1. */
  --muted: light-dark(#6c664b, #a3abcc);
  --rule: light-dark(#e6e0c8, #44475a);
  --accent: light-dark(#644ac9, #bd93f9);
  --heading: light-dark(#a3144d, #ff79c6);
  --code: light-dark(#14710a, #50fa7b);
  --code-bg: light-dark(#f2edd8, #21222c);
  /* Widths: the page is left-aligned, a small margin in from the left edge and
     90% of the window wide. On wide screens dates hang in a rail on the left,
     like the date column of a paper logbook. */
  --edge: 1.5rem;
  --page: min(90%, 100% - 2 * var(--edge));
  --rail: 8.5rem;
  --gutter: 2.5rem;
  /* One spacing scale for every margin. */
  --space-s: 0.75rem;
  --space-m: 1.5rem;
  --space-l: 2.5rem;
  --space-xl: 4rem;
  --header-top: var(--space-l);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}

/* The toggle pins one scheme; otherwise the system setting picks. */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  /* Sans body: a touch less leading than the old serif needed. */
  font: 1.0625rem/1.6 var(--sans);
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-underline-offset: 0.15em; }

.site-header,
.site-main,
.site-footer {
  width: var(--page);
  margin: 0 0 0 var(--edge);
}

.site-header { position: relative; padding: var(--header-top) 2.5rem var(--space-l) 0; }
.theme-toggle {
  position: absolute;
  /* Centred on the site title's 2.1rem line. */
  top: calc(var(--header-top) + 0.05rem);
  right: 0;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: 1rem/1 var(--sans);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.site-title {
  font: 700 1.75rem/1.2 var(--sans);
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.site-description { margin: 0.375rem 0 0; color: var(--muted); font-size: 1.125rem; }

.site-footer {
  display: flex;
  gap: 1.5rem;
  padding: var(--space-l) 0;
  margin-top: var(--space-xl);
  border-top: 1px solid var(--rule);
  font: 0.875rem var(--sans);
  color: var(--muted);
}

/* Lists of posts */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-item { padding: var(--space-m) 0; border-bottom: 1px solid var(--rule); }
.post-item:last-child { border-bottom: 0; }
.post-date { display: block; font: 0.8125rem var(--sans); font-variant-numeric: tabular-nums; color: var(--muted); }
.post-link { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.015em; line-height: 1.3; text-decoration: none; color: var(--text); }
.post-link:hover { color: var(--accent); }
.post-summary { margin: 0.375rem 0 0; color: var(--muted); }
.tag-title { font: 600 1.75rem/1.2 var(--sans); margin: 0 0 1rem; }

/* A post */
.post-header { margin-bottom: var(--space-l); }
.post-header > .post-date { margin-bottom: var(--space-s); }
.post-title { color: var(--heading); font-size: 2.25rem; font-weight: 700; line-height: 1.15; margin: 0; letter-spacing: -0.025em; text-wrap: balance; }
.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0.75rem 0 0;
  font: 0.875rem var(--sans);
  color: var(--muted);
}
.post-tag { text-decoration: none; }
.post-draft {
  padding: 0 0.5rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.post-body h2,
.post-body h3,
.post-body h4,
.post-body h5,
.post-body h6 {
  color: var(--heading);
  font-family: var(--sans);
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 2.25rem 0 0.5rem;
  text-wrap: balance;
}
.post-body h2 { font-size: 1.5rem; }
.post-body h3 { font-size: 1.25rem; }
.post-body h4,
.post-body h5,
.post-body h6 { font-size: 1.0625rem; }

.post-body p,
.post-body ul,
.post-body ol,
.post-body pre,
.post-body blockquote { margin: 0 0 1rem; }

.post-body ul,
.post-body ol { padding-left: 1.5rem; }
.post-body li > ul { margin: 0.25rem 0 0; }

.post-body blockquote {
  padding-left: 1.25rem;
  border-left: 3px solid var(--rule);
  color: var(--muted);
  font-style: italic;
}

.post-body code {
  font: 0.875em var(--mono);
  color: var(--code);
  background: var(--code-bg);
  padding: 0.1em 0.3em;
  border-radius: 4px;
}
.post-body pre {
  overflow-x: auto;
  padding: 1rem;
  background: var(--code-bg);
  border-radius: 6px;
  line-height: 1.5;
}
.post-body pre code { padding: 0; background: none; color: var(--text); }
.post-body img { max-width: 100%; height: auto; }

.post-feature {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 0 var(--space-l);
  border-radius: 6px;
}

/* Archived comments (read-only) */
.comments {
  margin-top: var(--space-xl);
  padding-top: var(--space-l);
  border-top: 1px solid var(--rule);
}
.comments-title { font: 600 1.25rem/1.3 var(--sans); margin: 0; }
.comments-note { margin: 0.25rem 0 1.5rem; font: 0.875rem var(--sans); color: var(--muted); }

.comment-list { list-style: none; margin: 0; padding: 0; }
.comment { padding: 1rem 0; border-top: 1px solid var(--rule); }
.comment:first-child { border-top: 0; }
.comment-replies {
  margin: 0.75rem 0 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--rule);
}
.comment-replies > .comment:first-child { padding-top: 0.25rem; }

.comment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  margin: 0 0 0.375rem;
  font: 0.875rem var(--sans);
}
.comment-author { font-weight: 600; }
.comment-date { color: var(--muted); text-decoration: none; }
.comment-date:hover { text-decoration: underline; }

.comment-body { font-size: 1rem; overflow-wrap: anywhere; }
.comment-body p { margin: 0 0 0.75rem; }
.comment-body p:last-child { margin-bottom: 0; }
.comment-body img { max-width: 100%; height: auto; }
.comment-body blockquote {
  margin: 0 0 0.75rem;
  padding-left: 1rem;
  border-left: 3px solid var(--rule);
  color: var(--muted);
}

/* Index pagination */
.pagination {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-top: var(--space-l);
  padding-top: var(--space-m);
  border-top: 1px solid var(--rule);
  font: 0.9375rem var(--sans);
}
.pagination-link { text-decoration: none; }
.pagination-link[rel="next"] { margin-left: auto; }
.pagination-count { color: var(--muted); }

/* The way home from any page but the first. */
.back { margin: 0 0 var(--space-m); }
.back-link {
  font: 0.875rem var(--sans);
  color: var(--muted);
  text-decoration: none;
}
.back-link:hover { color: var(--accent); text-decoration: underline; }
.post-end { margin: var(--space-l) 0 0; }

.post-author { color: var(--text); text-decoration: none; font-weight: 600; }
.post-author:hover { color: var(--accent); }

/* Wide screens: the date rail. Main and footer keep the text column; the
   header spans rail and text; rows pull back across the rail. */
@media (min-width: 60rem) {
  :root { --header-top: var(--space-xl); }

  .site-main,
  .site-footer { padding-left: calc(var(--rail) + var(--gutter)); }

  .post-item,
  .post-header {
    display: grid;
    grid-template-columns: var(--rail) minmax(0, 1fr);
    column-gap: var(--gutter);
    align-items: baseline;
    margin-left: calc(-1 * (var(--rail) + var(--gutter)));
  }
  .post-item > *,
  .post-header > * { grid-column: 2; }
  .post-item > .post-date,
  .post-header > .post-date {
    grid-column: 1;
    grid-row: 1;
    margin: 0;
    /* Left-aligned: dates share one edge with the site title above them. */
    text-align: left;
  }

  /* Quote bars and list bullets hang into the gutter so the text keeps one left edge. */
  .post-body blockquote { margin-left: calc(-1.25rem - 3px); }
  .post-body > ul,
  .post-body > ol { padding-left: 0; }

  .post-feature {
    width: calc(100% + var(--rail) + var(--gutter));
    max-width: none;
    margin-left: calc(-1 * (var(--rail) + var(--gutter)));
  }
}
