:root {
  --bg: #f5f4ee;
  --bg-soft: #faf9f5;
  --bg-medium: #f0eee6;
  --text: #141413;
  --text-secondary: #5e5d59;
  --text-tertiary: #87867f;
  --border: #d1cfc5;
  --code-bg: #f0eee6;
  --selection: rgb(0 100 255 / 26%);
  --serif: Georgia, "Times New Roman", "Iowan Old Style", serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --max-width: 38.75rem;
  --gap: 1.25rem;
  --underline-thickness: 0.08em;
  --underline-offset: 0.15em;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413;
    --bg-soft: #1c1c1a;
    --bg-medium: #222220;
    --text: #faf9f5;
    --text-secondary: #b0aea5;
    --text-tertiary: #87867f;
    --border: #5e5d59;
    --code-bg: #f0eee6;
    --selection: rgb(0 100 255 / 38%);
  }
}

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

html {
  height: 100%;
  scrollbar-gutter: stable;
  text-size-adjust: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background-color: var(--bg);
  font-family: var(--serif);
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.8;
  transition: color 0.2s linear, background-color 0.2s linear;
  -webkit-font-smoothing: antialiased;
}

::selection {
  color: inherit;
  background: var(--selection);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 0.5em;
  color: var(--text);
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.2;
}

h1 {
  margin: 0 0 0.2em;
  font-size: 3.1em;
  font-weight: 600;
  line-height: 1.1;
}

h2 {
  font-size: 1.6em;
}

h3 {
  font-size: 1.2em;
}

p {
  margin: 0 0 1em;
}

ul,
ol {
  margin: 0 0 1em;
  padding-left: 2.2em;
}

li {
  margin-bottom: 0.3em;
}

a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: var(--underline-thickness);
  text-underline-offset: var(--underline-offset);
  transition: color 0.2s linear;
}

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

b,
strong {
  font-weight: 600;
}

img {
  max-width: 100%;
  height: auto;
}

hr {
  height: 0;
  margin: 2em 0;
  border: 0;
  border-top: 1px solid var(--border);
}

blockquote {
  margin: 2em 0;
  padding: 0.25em 0 0.1em 1.25em;
  border-left: 1px solid var(--border);
  font-size: 1em;
  font-style: italic;
  line-height: 1.7;
}

blockquote p:last-child {
  margin-bottom: 0;
}

code,
pre {
  font-family: var(--mono);
}

code {
  color: inherit;
  font-size: 0.85em;
}

:not(pre) > code {
  padding: 0.12em 0.32em;
  background: rgb(0 0 0 / 6%);
  border-radius: 0.25rem;
}

@media (prefers-color-scheme: dark) {
  :not(pre) > code {
    background: rgb(255 255 255 / 10%);
  }
}

pre,
pre[class*="language-"] {
  max-width: 100%;
  margin: 0 0 1.5em;
  padding: 1em 1.2em;
  overflow-x: auto;
  color: #141413;
  background: var(--code-bg) !important;
  border-radius: 0.375rem;
  font-size: 0.82em;
  line-height: 1.55;
}

table {
  width: 100%;
  margin-bottom: 1.5em;
  border-collapse: collapse;
  font-size: 0.9em;
}

th,
td {
  padding: 0.5em 0.75em;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

th {
  font-weight: 600;
}

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

/* Site shell */

.site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-header {
  position: relative;
  z-index: 5;
  margin: 22px 0 25px;
  padding: 15px 0 10px;
  background: var(--bg);
}

.site-header-inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.site-name {
  display: inline-flex;
  align-items: flex-end;
  color: var(--text);
  font-size: 1.44em;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
}

.site-name:hover {
  color: var(--text);
}

.site-nav {
  display: flex;
  gap: 1.1rem;
  font-size: 0.9em;
  line-height: 1.2;
}

.site-nav a {
  color: var(--text-secondary);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: var(--underline-offset);
}

.site-nav a[aria-current="page"] {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: var(--underline-offset);
}

.site-main {
  flex: 1;
}

.site-container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gap) 5rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Link lists */

.link-list-section {
  margin-top: calc(1.3em + 1rem);
}

.link-list-section:last-child {
  margin-bottom: 3em;
}

.link-list-heading {
  margin: 0 0 0.7em;
  font-size: 1.2em;
  font-weight: 500;
  line-height: 1.2;
}

.link-list {
  display: flex;
  flex-flow: column;
  gap: 0.8em;
  margin: 0;
  padding: 0;
  list-style: none;
}

.link-list-item {
  margin: 0;
  padding-left: 1em;
}

.link-list-item::before {
  content: "•";
  display: inline-block;
  margin-right: 0.3em;
  margin-left: -0.7em;
}

.link-list-link {
  margin-right: 0.25em;
}

.link-list-note {
  display: inline-flex;
  color: var(--text-secondary);
  font-size: 0.95em;
}

/* Articles */

.article-back {
  display: inline-block;
  margin-bottom: 1.5em;
  color: var(--text-secondary);
  font-size: 0.9em;
  text-decoration: none;
}

.article-back:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: var(--underline-offset);
}

.article-title {
  margin: 0.2em 0 0.28em;
  text-wrap: balance;
}

.article-subtitle {
  margin: 0;
  padding-block: calc((1.8 - 1.5) * 0.5em);
  font-size: 1.1em;
  font-style: italic;
  line-height: 1.5;
}

.article-date {
  margin: 2em 0 1em;
  color: var(--text-secondary);
  font-size: 0.9em;
}

.rich-text {
  text-wrap: pretty;
}

.rich-text > :first-child {
  margin-top: 0;
}

.rich-text > :last-child {
  margin-bottom: 0;
}

.rich-text h2,
.rich-text h3,
.rich-text h4 {
  margin-top: 1.4em;
  text-wrap: balance;
}

.rich-text h2 {
  font-size: 1.6em;
}

.rich-text h3 {
  font-size: 1.2em;
}

.rich-text ul,
.rich-text ol {
  padding-left: 1.5em;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em 1em;
  margin-top: 3em;
  padding-top: 1em;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.85em;
}

.article-tags-label {
  color: var(--text-tertiary);
}

.article-tags a {
  color: var(--text-secondary);
}

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

.article-tags .badge {
  display: inline;
  padding: 0;
  color: inherit !important;
  background: transparent !important;
  border-radius: 0 !important;
  font-family: inherit;
  font-size: 1em;
  font-weight: inherit;
  line-height: inherit;
  white-space: normal;
  vertical-align: baseline;
}

.article-footer {
  margin-top: 3em;
}

/* Inner pages */

.page-title {
  margin: 0 0 0.6em;
  font-size: 1.6em;
  font-weight: 500;
  line-height: 1.2;
}

.page-lead {
  margin-bottom: 2.5em;
}

.project {
  margin-bottom: 2.25em;
}

.project-title {
  margin: 0 0 0.25em;
  font-size: 1.2em;
  font-weight: 500;
  line-height: 1.4;
}

.project-note {
  color: var(--text-secondary);
  font-size: 0.9em;
  font-weight: 400;
}

.project-description {
  margin: 0;
}

/* Responsive */

@media (max-width: 767px) {
  h1 {
    font-size: 2.4em;
  }

  .site-header {
    position: sticky;
    top: 0;
    margin: 0 0 2rem;
    padding: 0.85rem 0 0.7rem;
    border-bottom: 1px solid var(--border);
  }

  .site-header-inner {
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 1rem;
  }

  .site-name {
    font-size: 1.2em;
  }

  .site-nav {
    width: 100%;
    gap: 1rem;
    font-size: 0.82em;
  }

  .site-container {
    padding-bottom: 3rem;
  }

  .rich-text ul,
  .rich-text ol {
    padding-left: 1.25em;
  }
}

@media (max-width: 479px) {
  :root {
    --gap: 1rem;
  }

  body {
    font-size: 1.05rem;
  }

  .site-header-inner {
    padding: 0 0.75rem;
  }

  .site-nav {
    gap: 0.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
