:root {
  color-scheme: dark;

  --color-page: #111213;
  --color-page-soft: #151617;
  --color-border: #2c2d2e;
  --color-text: #ddd8d0;
  --color-text-soft: #aaa5a0;
  --color-text-muted: #85817d;
  --color-accent: #c5acd5;
  --color-accent-soft: rgb(197 172 213 / 8%);

  --font-serif: "Newsreader", Georgia, serif;
  --font-ui: "Inter", system-ui, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  --width-home: 54rem;
  --width-prose: 43rem;
  --gutter: clamp(1.25rem, 5vw, 3.25rem);

  --space-1: 0.375rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 3rem;
  --space-7: 4.5rem;

  --line: 1px solid var(--color-border);
  --transition: 160ms ease;
}

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

html {
  background: var(--color-page);
  scroll-behavior: smooth;
}

body {
  min-width: 20rem;
  min-height: 100vh;
  margin: 0;
  background: var(--color-page);
  color: var(--color-text);
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--color-accent);
  color: var(--color-page);
}

.site-shell {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  background:
    radial-gradient(circle at 50% 30%, rgb(255 255 255 / 1.7%), transparent 30rem),
    var(--color-page);
}

.site-header {
  display: flex;
  min-height: 4.5rem;
  padding-inline: var(--gutter);
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  border-bottom: var(--line);
}

.wordmark {
  color: var(--color-text);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.23em;
  line-height: 1;
  text-transform: uppercase;
}

nav ul {
  display: flex;
  margin: 0;
  padding: 0;
  align-items: center;
  gap: clamp(1.25rem, 3vw, 2.25rem);
  list-style: none;
}

nav li {
  margin: 0;
}

nav a,
.back-link,
.site-footer {
  font-family: var(--font-ui);
}

nav a {
  color: var(--color-text-soft);
  font-size: 0.72rem;
  line-height: 1;
}

nav a[aria-current="page"] {
  color: var(--color-text);
}

.rss-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.rss-link svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

main {
  width: 100%;
  flex: 1;
  padding-inline: var(--gutter);
}

article {
  width: 100%;
  max-width: var(--width-prose);
  margin-inline: auto;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin-block: 0;
  color: var(--color-text);
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.12;
  text-wrap: balance;
}

h1 {
  margin-bottom: var(--space-4);
  font-size: clamp(2.15rem, 5vw, 3.35rem);
  letter-spacing: -0.025em;
}

h2 {
  margin: var(--space-6) 0 var(--space-3);
  font-size: clamp(1.65rem, 3vw, 2.1rem);
}

h3 {
  margin: var(--space-5) 0 var(--space-2);
  font-size: 1.4rem;
}

h4,
h5,
h6 {
  margin: var(--space-5) 0 var(--space-2);
  font-size: 1.05rem;
}

p,
ul,
ol,
blockquote,
pre,
table,
figure {
  margin-block: 0 var(--space-4);
}

p,
li {
  color: var(--color-text);
}

p {
  overflow-wrap: break-word;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition), opacity var(--transition);
}

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

a:focus-visible {
  border-radius: 0.15rem;
  outline: 2px solid var(--color-accent);
  outline-offset: 0.25rem;
}

article :where(p, li) a {
  text-decoration: underline;
  text-decoration-color: rgb(197 172 213 / 35%);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

article :where(p, li) a:hover {
  text-decoration-color: currentColor;
}

strong,
b {
  color: var(--color-text);
  font-weight: 600;
}

em,
i {
  font-style: italic;
}

small,
time,
address {
  color: var(--color-text-muted);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-style: normal;
}

ul,
ol {
  padding-left: 1.4rem;
}

li {
  margin-bottom: var(--space-1);
}

li::marker {
  color: var(--color-accent);
}

blockquote {
  margin-block: var(--space-5);
  padding: 0.1rem 0 0.1rem var(--space-4);
  border-left: 2px solid var(--color-accent);
}

blockquote p {
  margin: 0;
  font-size: clamp(1.3rem, 3vw, 1.55rem);
  line-height: 1.45;
}

blockquote cite {
  display: block;
  margin-top: var(--space-2);
  color: var(--color-text-muted);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-style: normal;
}

hr {
  margin-block: var(--space-6);
  border: 0;
  border-top: var(--line);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
  margin-block: var(--space-5);
}

figure img {
  margin-bottom: var(--space-2);
}

figcaption {
  color: var(--color-text-muted);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  text-align: center;
}

code {
  padding: 0.15em 0.4em;
  border-radius: 0.2rem;
  background: var(--color-page-soft);
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 0.88em;
}

pre {
  padding: var(--space-4);
  overflow-x: auto;
  border: var(--line);
  background: var(--color-page-soft);
  line-height: 1.55;
}

pre code {
  padding: 0;
  background: transparent;
  color: var(--color-text-soft);
}

table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  padding: var(--space-2) var(--space-3);
  border-bottom: var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--color-text-soft);
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.home article {
  max-width: var(--width-home);
  padding-block: var(--space-7) var(--space-6);
}

.home article > h1 {
  max-width: 39rem;
  margin-bottom: var(--space-3);
  font-size: clamp(2.1rem, 5vw, 3rem);
  font-weight: 400;
  line-height: 1.08;
}

.home article > h1 + p {
  max-width: 37rem;
  margin-bottom: 0;
  color: var(--color-text-soft);
  font-size: 1.05rem;
  line-height: 1.55;
}

.home article > hr {
  margin-block: var(--space-6) var(--space-4);
}

.home article > h2 {
  margin: 0 0 var(--space-2);
  color: var(--color-accent);
  font-size: 1rem;
  font-weight: 400;
}

.home article > h2 + ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.home article > h2 + ul > li {
  display: grid;
  margin: 0;
  padding-block: var(--space-4);
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: var(--space-5);
  border-bottom: var(--line);
}

.home article > h2 + ul > li:last-child {
  border-bottom: 0;
}

.home article > h2 + ul > li > p:first-child {
  margin: 0;
  padding-top: 0.15rem;
  grid-column: 1;
  grid-row: 1 / span 3;
  color: var(--color-text-muted);
  font-family: var(--font-ui);
  font-size: 0.72rem;
  line-height: 1.5;
}

.home article > h2 + ul > li > h3 {
  margin: 0 0 0.35rem;
  grid-column: 2;
  font-size: 1.3rem;
  font-weight: 400;
}

.home article > h2 + ul > li > h3 a {
  color: var(--color-accent);
  text-decoration: none;
}

.home article > h2 + ul > li > p:not(:first-child) {
  max-width: 34rem;
  margin-bottom: var(--space-2);
  grid-column: 2;
  color: var(--color-text-soft);
  font-size: 0.94rem;
  line-height: 1.55;
}

.back-link {
  display: inline-flex;
  align-items: center;
  color: var(--color-accent);
  font-size: 0.72rem;
}

.home article > h2 + ul > li > p:last-child a {
  color: var(--color-accent);
  font-family: var(--font-ui);
  font-size: 0.72rem;
  text-decoration: none;
}

.site-footer {
  padding: var(--space-4) var(--gutter);
  border-top: var(--line);
  color: var(--color-text-muted);
  font-size: 0.68rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

.site-footer span {
  margin-inline: var(--space-2);
}

.post article {
  padding-top: var(--space-5);
}

.back-link {
  margin-bottom: var(--space-6);
}

.post-content > h1 {
  margin-bottom: var(--space-2);
  font-size: clamp(2.15rem, 5vw, 2.85rem);
  font-weight: 400;
}

.post-content > h1 + p {
  display: flex;
  margin: 0;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-muted);
  font-size: 0.72rem;
}

.post-content > h1 + p + hr {
  margin-block: var(--space-4) var(--space-4);
}

.post-content > p {
  margin-bottom: 1.15rem;
}

.post-content > hr + ul:last-child {
  margin-top: var(--space-5);
}

.post-content > ul:last-child {
  display: flex;
  margin: 0;
  padding-block: var(--space-4);
  justify-content: space-between;
  list-style: none;
}

.post-content > ul:last-child li {
  margin: 0;
}

.post-content > ul:last-child a {
  color: var(--color-accent);
  font-family: var(--font-ui);
  font-size: 0.72rem;
  text-decoration: none;
}

@media (max-width: 44rem) {
  body {
    padding: 0;
  }

  .site-shell {
    min-height: 100vh;
  }

  .site-header {
    min-height: 4.25rem;
  }

  .wordmark {
    font-size: 0.9rem;
    letter-spacing: 0.18em;
  }

  nav ul {
    gap: var(--space-3);
  }

  .home article {
    padding-block: var(--space-6) var(--space-5);
  }

  .home article > h2 + ul > li {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }

  .home article > h2 + ul > li > p:first-child,
  .home article > h2 + ul > li > h3,
  .home article > h2 + ul > li > p:not(:first-child) {
    grid-column: 1;
    grid-row: auto;
  }

  .post article {
    padding-top: var(--space-4);
  }

  .back-link {
    margin-bottom: var(--space-5);
  }

  blockquote {
    padding-left: var(--space-3);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
