@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: light dark;
  --bg-color: #f7f5f0;
  --bg-accent: #ebe7de;
  --surface-color: rgba(255, 255, 255, 0.72);
  --text-color: #2f3437;
  --heading-color: #111827;
  --link-color: #2457c5;
  --link-hover-color: #173f98;
  --meta-color: #6b7280;
  --border-color: rgba(17, 24, 39, 0.12);
  --border-strong-color: rgba(17, 24, 39, 0.18);
  --code-bg: rgba(17, 24, 39, 0.06);
  --blockquote-color: #4b5563;
  --shadow-color: rgba(17, 24, 39, 0.08);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #101214;
    --bg-accent: #171a1f;
    --surface-color: rgba(24, 27, 32, 0.72);
    --text-color: #d7dce1;
    --heading-color: #f4f6f8;
    --link-color: #8ab4ff;
    --link-hover-color: #b8cdfd;
    --meta-color: #9aa4af;
    --border-color: rgba(244, 246, 248, 0.12);
    --border-strong-color: rgba(244, 246, 248, 0.2);
    --code-bg: rgba(244, 246, 248, 0.08);
    --blockquote-color: #c8ced6;
    --shadow-color: rgba(0, 0, 0, 0.22);
  }
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at top left, var(--bg-accent), transparent 34rem),
    var(--bg-color);
}

body {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(32px, 6vw, 72px) 22px 56px;
  background: transparent;
  color: var(--text-color);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.75;
  letter-spacing: -0.006em;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: linear-gradient(var(--border-color) 1px, transparent 1px), linear-gradient(90deg, var(--border-color) 1px, transparent 1px);
  background-size: 88px 88px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.24), transparent 46%);
}

header {
  display: block !important;
  margin-bottom: 2.4rem;
  padding-bottom: 1.35rem;
  text-align: left !important;
}

header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1.15rem;
  color: transparent;
  font-size: 0;
}

header nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.2rem 0.66rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--surface-color);
  color: var(--heading-color);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 8px 24px var(--shadow-color);
}

header > span {
  display: block;
  max-width: 38rem;
  margin-top: 0.8rem;
  color: var(--text-color);
  font-size: 1.08rem;
  line-height: 1.6;
}

header nav a:hover {
  border-color: color-mix(in srgb, var(--link-color) 35%, var(--border-color));
  color: var(--link-color);
}

header h1 {
  max-width: 12ch;
  margin: 0 0 0.55rem;
  color: var(--heading-color);
  font-size: clamp(2.3rem, 8vw, 4.25rem);
  font-weight: 800;
  line-height: 0.96;
  letter-spacing: -0.075em;
  text-align: left !important;
}

#post header h1 {
  max-width: 18ch;
  font-size: clamp(2.1rem, 6vw, 3.4rem);
}

#post header h1::after {
  content: "by Alon Hearter";
  display: block;
  margin-top: 0.85rem;
  color: var(--meta-color);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.4;
}

#post header {
  margin-bottom: 1.25rem;
  padding-bottom: 0;
}

header p,
header aside {
  margin-top: 0.65rem;
  color: var(--meta-color);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.55;
  text-align: left !important;
}

header p {
  margin-bottom: 0;
}

header aside time {
  margin-right: 0.6rem;
}

header p a {
  color: var(--heading-color);
  font-family: var(--font-sans);
  font-weight: 700;
  text-decoration: none;
}

header p a:hover {
  color: var(--link-color);
}

.post-home-link {
  margin: 2.5rem 0 0;
  color: var(--meta-color);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.55;
  text-align: left !important;
}

.post-home-link a {
  color: var(--heading-color);
  font-family: var(--font-sans);
  font-weight: 700;
  text-decoration: none;
}

.post-home-link a:hover {
  color: var(--link-color);
}

header > hr {
  display: none;
}

main {
  display: block;
}

#blog main > section:first-child:not(.posts) {
  display: none;
}

#blog main > section:first-child article {
  margin: 0;
}

#blog main > section:first-child p:first-child {
  max-width: 36rem;
  margin-top: 0;
  color: var(--heading-color);
  font-size: 1.06rem;
}

hr {
  height: 1px;
  margin: 2.25rem 0;
  border: 0;
  background: linear-gradient(to right, transparent, var(--border-strong-color), transparent);
}

#blog .posts {
  margin-top: 0;
}

#blog .posts article {
  margin: 0;
  border-bottom: 1px solid var(--border-color);
}

#blog .posts article:last-child {
  border-bottom: none;
}

#blog .posts article > div {
  display: flex;
  gap: 1.2rem;
  align-items: baseline;
  padding: 1.05rem 0;
}

#blog .posts time {
  width: 6.7rem;
  flex-shrink: 0;
  color: var(--meta-color);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: -0.02em;
}

#blog .posts span {
  flex: 1;
  margin: 0;
}

#blog .posts a {
  color: var(--heading-color);
  font-size: 1.04rem;
  font-weight: 650;
  line-height: 1.35;
  text-decoration: none;
}

#blog .posts a:hover {
  color: var(--link-color);
}

article {
  margin-top: 2.2rem;
}

#post article {
  margin-top: 0;
}

:is(h1, h2, h3, h4, h5, h6) > a.anchor {
  display: none;
}

ul,
ol {
  margin: 0 0 1.65rem;
  padding-left: 1.35rem;
}

li {
  margin: 0.35rem 0;
}

h2,
h3,
h4 {
  margin-top: 2.2em;
  margin-bottom: 0.75em;
  color: var(--heading-color);
  font-weight: 750;
  line-height: 1.18;
  letter-spacing: -0.035em;
}

h2 {
  font-size: 1.75rem;
}

h3 {
  font-size: 1.38rem;
}

p {
  margin: 0 0 1.65rem;
}

a {
  color: var(--link-color);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 44%, transparent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.18em;
  transition: color 160ms ease, text-decoration-color 160ms ease, background-color 160ms ease;
}

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

small {
  color: var(--meta-color);
}

img {
  max-width: 100%;
  height: auto;
  margin: 2rem 0;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 18px 44px var(--shadow-color);
}

body#post.about header {
  position: relative;
  min-height: 128px;
}

body#post.about header::after {
  content: "";
  position: absolute;
  top: 0.15rem;
  left: min(19rem, calc(100% - 112px));
  width: 112px;
  aspect-ratio: 1;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background-image: url("/alon-avatar.jpg");
  background-position: center;
  background-size: cover;
  box-shadow: 0 18px 44px var(--shadow-color);
}

@media (prefers-color-scheme: dark) {
  img {
    opacity: 0.9;
  }
}

pre {
  margin: 2rem 0;
  padding: 1.25rem;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: var(--code-bg);
  font-size: 0.9em;
}

code {
  padding: 0.2em 0.38em;
  border-radius: 6px;
  background: var(--code-bg);
  color: var(--heading-color);
  font-family: var(--font-mono);
  font-size: 0.9em;
}

pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

blockquote {
  margin: 2rem 0;
  padding: 1rem 1.2rem;
  border-left: 3px solid var(--link-color);
  border-radius: 0 12px 12px 0;
  background: var(--surface-color);
  color: var(--blockquote-color);
  font-style: italic;
}

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

.contact-email {
  color: var(--text-color);
}

.contact-email strong {
  color: var(--heading-color);
  font-weight: 650;
}

.email-symbol {
  display: inline-block;
  width: 0.95em;
  height: 0.95em;
  margin: 0 0.04em;
  background: currentColor;
  vertical-align: -0.12em;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
}

.email-at {
  mask-image: url("/email-at.svg");
  -webkit-mask-image: url("/email-at.svg");
}

.email-dot {
  width: 0.28em;
  height: 0.28em;
  margin: 0 0.08em;
  vertical-align: 0.04em;
  mask-image: url("/email-dot.svg");
  -webkit-mask-image: url("/email-dot.svg");
}

footer {
  display: none !important;
}

body#post.about #last-updated {
  display: none;
}

#post-footer {
  margin-top: 3.25rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  color: var(--meta-color);
  font-size: 0.86rem;
  text-align: center;
}

#post-footer p {
  margin-bottom: 0;
}

#post-footer a {
  margin: 0 0.45rem;
  color: var(--meta-color);
  font-weight: 500;
  text-decoration: none;
}

#post-footer a:hover {
  color: var(--link-color);
  text-decoration: underline;
}

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

.footnotes ol {
  padding-left: 1.5rem;
  list-style: decimal;
}

.footnotes li {
  display: list-item;
  padding: 0.25rem 0;
  border-bottom: none;
}

.footnotes li a {
  color: var(--link-color);
  font-size: 0.9rem;
  font-weight: 500;
}

.footnotes p {
  display: inline;
  margin: 0;
}

.footnote-ref {
  font-size: 0.75em;
  text-decoration: none;
  vertical-align: super;
}

.footnote-backref {
  margin-left: 0.25rem;
  text-decoration: none;
}

@media (max-width: 620px) {
  body {
    padding: 28px 18px 44px;
    font-size: 16px;
    line-height: 1.7;
  }

  header {
    margin-bottom: 2rem;
  }

  #blog .posts article > div {
    display: block;
    padding: 1rem 0;
  }

  #blog .posts time {
    display: block;
    width: auto;
    margin-bottom: 0.25rem;
  }

  body#post.about header {
    min-height: 94px;
    padding-right: 0;
  }

  body#post.about header::after {
    left: min(13rem, calc(100% - 76px));
    right: auto;
    width: 76px;
  }

  #post-footer {
    text-align: left;
  }
}
