@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("fonts/source-serif-4-latin-wght-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url("fonts/source-serif-4-latin-wght-italic.woff2") format("woff2");
}

:root {
  color-scheme: light dark;

  --bg: #f6f1e9;
  --bg-glow: #ffffff;
  --bg-code: #ede6da;
  --text: #2b241d;
  --muted: #6b5d4f;
  --accent: #9a4a12;
  --rule: #ddd3c4;

  --code-keyword: #8c3b6e;
  --code-string: #3f6b21;
  --code-number: #1f5f8b;
  --code-function: #8a4b00;

  --shadow-color: rgba(84, 58, 30, 0.30);
  --drop-shadow: rgba(84, 58, 30, 0.22);

  --font-body: "Source Serif 4", Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-code: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  
  --measure: 38.5rem;
  --gutter: 1rem;

  --float: 5px;
  --float-duration: 5.5s;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14110f;
    --bg-glow: #221c19;
    --bg-code: #1f1a17;
    --text: #e9e2d8;
    --muted: #a89c8e;
    --accent: #f0a868;
    --rule: #3a322c;

    --code-keyword: #e39ac6;
    --code-string: #a8cc8c;
    --code-number: #86c1e6;
    --code-function: #f2c079;

    --shadow-color: rgba(0, 0, 0, 0.72);
    --drop-shadow: rgba(0, 0, 0, 0.6);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

@media (min-width: 40em) {
  body { font-size: 1.1875rem; }
}

.site-header,
.page,
.site-footer {
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

.page {
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

.site-header {
  padding-top: max(1.25rem, env(safe-area-inset-top));
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-header__home {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  
  padding: 0.6rem 0;
  color: var(--muted);
  text-decoration: none;
}

.site-header__home img {
  width: auto;
  height: 1.6em;
}

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

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding-top: 1.5rem;
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--rule);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.25rem 0;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-ui);
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 2.2em 0 0.6em;
  text-wrap: balance;
}

h1 { font-size: 1.95rem; margin-top: 0.5em; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }

@media (min-width: 40em) {
  h1 { font-size: 2.3rem; }
  h2 { font-size: 1.6rem; }
  h3 { font-size: 1.3rem; }
}

[id] { scroll-margin-top: 1.5rem; }

p, ul, ol, dl, blockquote, figure, pre, table {
  margin: 0 0 1.25em;
}

p { text-wrap: pretty; }

ul, ol { padding-left: 1.4em; }
li { margin: 0.3em 0; }
li > ul, li > ol { margin: 0.3em 0 0; }
li::marker { color: var(--muted); }

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover { text-decoration-thickness: 2px; }

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

strong { font-weight: 650; }

blockquote {
  margin-left: 0;
  margin-right: 0;
  padding-left: 1.1em;
  border-left: 3px solid var(--rule);
  color: var(--muted);
  font-style: italic;
}

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

hr {
  border: 0;
  margin: 3em auto;
  width: 30%;
  border-top: 1px solid var(--rule);
}

.meta {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.875rem;
}

.draft {
  color: var(--accent);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

figure { margin-left: 0; margin-right: 0; }

figure img {
  display: block;
  margin: 0 auto;
  border-radius: 4px;
}

figcaption {
  margin-top: 0.6em;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  text-align: center;
}

code, pre, kbd {
  font-family: var(--font-code);
  font-size: 0.85em;
}

:not(pre) > code {
  padding: 0.1em 0.3em;
  border-radius: 3px;
  background: var(--bg-code);
  overflow-wrap: anywhere;
}

pre {
  padding: 1rem var(--gutter);
  margin-left: calc(-1 * var(--gutter));
  margin-right: calc(-1 * var(--gutter));
  overflow-x: auto;
  background: var(--bg-code);
  line-height: 1.5;
  tab-size: 4;
}

pre code { font-size: 1em; }

@media (min-width: 40em) {
  pre { border-radius: 6px; }
}

.hljs-comment,
.hljs-quote { color: var(--muted); font-style: italic; }

.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-built_in,
.hljs-meta .hljs-keyword { color: var(--code-keyword); }

.hljs-string,
.hljs-regexp,
.hljs-addition,
.hljs-attr,
.hljs-template-tag { color: var(--code-string); }

.hljs-number,
.hljs-symbol,
.hljs-variable,
.hljs-template-variable,
.hljs-type,
.hljs-selector-class,
.hljs-selector-id { color: var(--code-number); }

.hljs-title,
.hljs-section,
.hljs-name,
.hljs-attribute { color: var(--code-function); }

.hljs-meta { color: var(--muted); }
.hljs-deletion { color: var(--accent); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.9em;
  line-height: 1.45;
}

th, td {
  padding: 0.45em 0.8em;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

th {
  font-family: var(--font-ui);
  font-weight: 600;
  border-bottom-width: 2px;
}

.post-header { margin-bottom: 2.25rem; }
.post-header h1 { margin-bottom: 0.35em; }

.back {
  margin-top: 3rem;
  font-family: var(--font-ui);
  font-size: 0.875rem;
}

.footnotes {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9em;
  color: var(--muted);
}

.footnotes ol { padding-left: 1.2em; }

.footnotes a { color: var(--muted); }

[data-fn_ref] {
  text-decoration: none;
  padding: 0 0.1em;
}

sup { line-height: 0; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.home {
  background-image: radial-gradient(circle at 50% 0, var(--bg-glow) 0%, transparent 32rem);
  background-repeat: no-repeat;
}

.home .page { padding-top: max(2rem, env(safe-area-inset-top)); }

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

.intro h1 { margin-bottom: 0.5em; }

.list-heading {
  margin-top: 2.5rem;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.post-list {
  list-style: none;
  padding: 0;
}

.post-list li {
  display: flex;
  flex-direction: column;
  margin: 0 0 1.1em;
}

.post-list time {
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.post-list a { font-weight: 500; }

@media (min-width: 40em) {
  .post-list li {
    flex-direction: row;
    align-items: baseline;
    gap: 1.25rem;
  }

  .post-list time {
    flex: 0 0 6.5rem;
  }
}

.almond {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 5.5rem;
  margin: 0 auto 1.5rem;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.almond__img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 8px 12px var(--drop-shadow));
  animation: float var(--float-duration) ease-in-out infinite;
  -webkit-user-drag: none;
}

.almond__shadow {
  width: 62%;
  height: 10px;
  margin-top: 12px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, var(--shadow-color) 0%, transparent 72%);
  filter: blur(2px);
  animation: shadow-pulse var(--float-duration) ease-in-out infinite;
}

.almond__press,
.almond__shadow-press {
  width: 100%;
  display: flex;
  justify-content: center;
  transition: transform 460ms cubic-bezier(0.3, 1.6, 0.5, 1);
}

.almond__press { transform-origin: 50% 100%; }

.almond.is-pressed .almond__press,
.almond.is-pressed .almond__shadow-press {
  transition-duration: 110ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0.3, 1);
}

.almond.is-pressed .almond__press { transform: translateY(3px) scale(1.02, 0.95); }
.almond.is-pressed .almond__shadow-press { transform: scale(0.9); }

@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50%      { transform: translate3d(0, calc(-1 * var(--float)), 0); }
}

@keyframes shadow-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(0.92); opacity: 0.72; }
}

@media (prefers-reduced-motion: reduce) {
  .almond__img,
  .almond__shadow { animation: none; }

  .almond__press,
  .almond__shadow-press { transition-timing-function: ease-out; }
}

.legal .page {
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.legal h1 {
  margin: 0.5em 0 1.2em;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.legal h2 {
  margin: 1.6em 0 0.3em;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.legal p { margin: 0 0 0.4em; }
