/* The public site, and the base the admin builds on (admin.css). The type follows Onward's: Literata to read,
   Inter for titles, JetBrains Mono for everything around the writing. The fonts are in /fonts, under the OFL. */
@font-face { font-family: "Literata"; src: url("/fonts/literata-latin-wght-normal.woff2") format("woff2"); font-weight: 200 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Literata"; src: url("/fonts/literata-latin-wght-italic.woff2") format("woff2"); font-weight: 200 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2"); font-weight: 100 800; font-style: normal; font-display: swap; }

:root {
  /* Paper, ink and the red of the mark. --text, --muted, --line, --link, --code and --bg are shared with admin.css. */
  --bg: #f6f4ef; --raised: #ece9e1; --code: #ece9e1; --line: #d8d3c9;
  --text: #2d2b28; --muted: #6d6962; --bright: #151412;
  --link: #b3262d; --mark: #e0484d;
  --serif: "Literata", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 6px;
  --gutter: max(20px, env(safe-area-inset-left, 0px));
  --gutter-end: max(20px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #181615; --raised: #23201e; --code: #23201e; --line: #3b3633;
    --text: #e3ded7; --muted: #9d968d; --bright: #ffffff;
    --link: #ff7b7f; --mark: #e0484d;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 1rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 3px; }
::selection { background: color-mix(in srgb, var(--mark) 28%, transparent); }
h1, h2, h3, h4 { color: var(--bright); font-family: var(--sans); text-wrap: balance; }
h1 { font-size: clamp(2.25rem, 6.5vw, 3.25rem); line-height: 1.06; font-weight: 800; letter-spacing: -.032em; margin: 0 0 1.75rem; }

/* One reading column, with the bars running the full width */
.col { max-width: 42.5rem; margin-inline: auto; min-width: 0; }
main.col { padding: clamp(2rem, 6vw, 3.5rem) var(--gutter-end) 0 var(--gutter); max-width: calc(42.5rem + var(--gutter) + var(--gutter-end)); }

header.site {
  padding: .875rem var(--gutter-end) .875rem var(--gutter);
  border-bottom: 1px solid var(--raised);
  font: 400 .8125rem/1 var(--mono);
}
header.site .col { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
header.site .home {
  display: inline-flex; align-items: center; gap: .5rem;
  color: var(--bright); font-weight: 600; text-decoration: none; letter-spacing: .01em;
}
/* Only the admin shows the mark; the public header is the title alone. */
header.site .mark { height: 1.5em; width: auto; flex: none; }
header.site .feed { display: inline-flex; padding: .375rem; margin: -.375rem; color: var(--muted); }
header.site .feed svg { width: 1.125rem; height: 1.125rem; }
header.site .feed:hover { color: var(--link); }

footer.site {
  margin-top: clamp(3rem, 8vw, 5rem);
  padding: 1.75rem var(--gutter-end) calc(1.75rem + env(safe-area-inset-bottom, 0px)) var(--gutter);
  border-top: 1px solid var(--raised);
  font: 400 .8125rem/1.6 var(--mono); color: var(--muted);
}
footer.site .col { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; }
footer.site a { color: inherit; }

/* Small mono labels: dates, tags, the line above a heading */
.meta, .kicker {
  display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin: 0 0 .75rem;
  font: 400 .8125rem/1.5 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums;
}
.meta .tags { display: flex; flex-wrap: wrap; gap: .25rem .875rem; }
.meta a { color: var(--muted); text-decoration: none; }
.meta a:hover { color: var(--link); }
.kicker { color: var(--link); letter-spacing: .08em; text-transform: uppercase; font-size: .75rem; }
.intro { font: 400 1.1875rem/1.6 var(--serif); color: var(--muted); margin: 0 0 1rem; }
.empty { color: var(--muted); font-family: var(--mono); font-size: .875rem; }

/* A post, in full: on the front page one after another, or alone on its own page */
.entry { padding-block: clamp(2.5rem, 6vw, 4rem); }
.entry:first-of-type { padding-top: 0; }
.entry + .entry { border-top: 1px solid var(--raised); }
.entry h2 { font-size: clamp(1.75rem, 4.6vw, 2.25rem); line-height: 1.12; font-weight: 800; letter-spacing: -.026em; margin: 0 0 1.5rem; }
.entry h2 a { color: inherit; text-decoration: none; }
.entry h2 a:hover { color: var(--link); }
.permalink { margin: 1.75rem 0 0; font: 400 .8125rem/1.5 var(--mono); }
.permalink a { color: var(--muted); text-decoration: none; }
.permalink a::before { content: "→ "; }
.permalink a:hover { color: var(--link); }
.intro + .entry { padding-top: clamp(1.5rem, 4vw, 2.5rem); }

/* The writing itself (also the admin's preview) */
.body { font: 400 1.125rem/1.75 var(--serif); font-feature-settings: "liga", "kern"; overflow-wrap: break-word; }
.body > :first-child { margin-top: 0; }
.body > :last-child { margin-bottom: 0; }
.body p, .body ul, .body ol, .body blockquote, .body pre, .body table, .body figure { margin: 0 0 1.25em; }
.body h1, .body h2, .body h3, .body h4 { margin: 2em 0 .6em; line-height: 1.25; letter-spacing: -.015em; }
.body h1 { font-size: 1.625rem; font-weight: 800; }
.body h2 { font-size: 1.375rem; font-weight: 750; }
.body h3 { font-size: 1.1875rem; font-weight: 700; }
.body h4 { font-size: 1rem; font-weight: 700; }
.body ul, .body ol { padding-left: 1.4em; }
.body li + li { margin-top: .3em; }
.body li::marker { color: var(--muted); font-family: var(--mono); font-size: .85em; }
.body img { display: block; max-width: 100%; height: auto; border-radius: var(--radius); }
.body hr { border: 0; border-top: 1px solid var(--line); margin: 2.5em 0; }
.body blockquote { padding-left: 1.1em; border-left: 2px solid var(--mark); color: var(--muted); font-style: italic; }
.body table { border-collapse: collapse; display: block; overflow-x: auto; font: 400 .9375rem/1.5 var(--sans); }
.body th, .body td { border: 0; border-bottom: 1px solid var(--line); padding: .45rem .9rem .45rem 0; text-align: left; }
.body th { color: var(--bright); font-weight: 600; }
code, kbd, samp { font-family: var(--mono); font-size: .84em; }
:not(pre) > code { background: var(--raised); padding: .12em .35em; border-radius: 4px; }
pre {
  background: var(--raised); padding: 1rem 1.125rem; overflow-x: auto; border-radius: var(--radius);
  font: 400 .875rem/1.65 var(--mono); tab-size: 4;
}
pre code { font-size: inherit; }
kbd { padding: .1em .4em; border: 1px solid var(--line); border-radius: 4px; color: var(--link); }

/* Newer / where / older, under the front page */
.pager {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem;
  margin-top: clamp(1rem, 4vw, 2rem); padding-top: 1.25rem; border-top: 1px solid var(--line);
  font: 400 .8125rem/1 var(--mono);
}
.pager a {
  justify-self: start; display: inline-flex; align-items: center; height: 2.25rem; padding-inline: .875rem;
  border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none;
}
.pager a[rel="next"] { justify-self: end; }
.pager a:hover { background: var(--raised); }
.pager .where { color: var(--muted); font-variant-numeric: tabular-nums; }

.back { margin-top: 1rem; padding-top: 1.25rem; border-top: 1px solid var(--line); font: 400 .8125rem/1 var(--mono); }
.back a { color: var(--muted); text-decoration: none; }
.back a:hover { color: var(--link); }

/* A list of titles, as on a tag's page */
ol.posts { list-style: none; margin: 0; padding: 0; }
ol.posts li { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: .25rem 1.25rem; padding: .875rem 0; border-top: 1px solid var(--raised); }
ol.posts li:last-child { border-bottom: 1px solid var(--raised); }
ol.posts time { font: 400 .8125rem/1.9 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
ol.posts .title { color: var(--bright); font-weight: 600; font-size: 1.0625rem; text-decoration: none; }
ol.posts .title:hover { color: var(--link); }
ol.posts p { margin: .2rem 0 0; color: var(--muted); font: 400 1rem/1.6 var(--serif); }
@media (max-width: 30rem) { ol.posts li { grid-template-columns: 1fr; } }

/* Shared with the admin */
.meta + h1 { margin-top: 0; }
table { border-collapse: collapse; }
th, td { border: 1px solid var(--line); padding: .3rem .6rem; }
