@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=Source+Serif+4:ital,wght@0,400..700;1,400..700&display=swap');

/* Design tokens */
:root {
  --accent: hsl(212 90% 45%);
  --accent-ink: #ffffff;
  --muted: hsl(212 10% 45%);
  --edge: GrayText;
  --tint-weak: hsl(212 90% 45% / 0.07);
  --tint-strong: hsl(212 90% 45% / 0.12);
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: hsl(212 100% 65%);
    --muted: hsl(212 10% 70%);
    --edge: hsl(212 10% 35%);
    --tint-weak: hsl(212 100% 65% / 0.12);
    --tint-strong: hsl(212 100% 65% / 0.18);
  }
}

/* Type & layout */
body {
  font: 1.06rem/1.75 "Source Serif 4", Georgia, "Times New Roman", serif;
  background: Canvas;
  color: CanvasText;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.strip {
  background: var(--tint-weak);
  border-bottom: 1px solid var(--edge);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, sans-serif;
  gap: 0.4rem 1.2rem;
}
.strip a {
  text-underline-offset: 0.12em;
  text-decoration-thickness: 1.5px;
  text-decoration-color: var(--accent);
}
.strip a:hover { color: var(--accent); }

.masthead, main, .colophon { max-width: 44rem; }

/* Masthead with optional avatar */
.masthead {
  padding-top: 2.6rem;
  padding-bottom: 1.2rem;
  display: grid;
  grid-template-columns: 5rem 1fr;
  grid-template-areas:
    "avatar title"
    "avatar tag";
  column-gap: 1rem;
  row-gap: 0.2rem;
  align-items: center;
}
.masthead .avatar {
  grid-area: avatar;
  width: 5rem; height: 5rem;
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--edge) inset;
}
.masthead .blog-title {
  grid-area: title;
  font: 700 2rem/1.2 Inter, system-ui, sans-serif;
  letter-spacing: -0.01em;
  margin: 0;
}
.masthead .blog-title a { text-decoration: none; }
.masthead .tagline {
  grid-area: tag;
  margin: 0.2rem 0 0;
  color: var(--muted);
  font: 500 0.98rem/1.4 Inter, system-ui, sans-serif;
}

@media (max-width: 34rem) {
  .masthead {
    grid-template-columns: 1fr;
    grid-template-areas:
      "avatar"
      "title"
      "tag";
    text-align: left;
  }
  .masthead .avatar { margin-bottom: 0.4rem; }
}

/* Headings and text */
h1, h2, h3, h4 {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: -0.005em;
}
h1 { font-size: 1.7rem; line-height: 1.25; margin: 2rem 0 0.35rem; }
h2 { font-size: 1.28rem; line-height: 1.3; margin: 2rem 0 0.55rem; }
h3, h4 { font-size: 1.05rem; margin: 1.4rem 0 0.5rem; }

p, li { max-width: 70ch; }

time {
  font: 0.85rem/1.4 Inter, system-ui, sans-serif;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Links */
a {
  color: inherit;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1.8px;
  text-underline-offset: 0.16em;
}
a:hover { color: var(--accent); }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* Lists of posts */
.posts h2 { margin-top: 1.5rem; }
.post-list { list-style: none; margin: 0.2rem 0 0; padding: 0; }
.post-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 0.3rem 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--edge);
}
.post-link {
  position: relative;
  padding-right: 1.3rem;
  text-decoration: none;
  font-weight: 600;
  font-family: Inter, system-ui, sans-serif;
}
.post-link::after {
  content: "→";
  color: var(--muted);
  position: absolute;
  right: 0; top: 0; transform: translateY(0.05em);
  transition: transform 120ms ease, color 120ms ease;
}
.post-link:hover { color: var(--accent); }
.post-link:hover::after { transform: translate(0.15rem, 0.05em); color: var(--accent); }
.empty { color: var(--muted); }

/* About */
.about {
  background: var(--tint-weak);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 1rem;
}
.about p:last-child { margin-bottom: 0; }

/* Article */
.post-header time { display: block; margin-bottom: 0.4rem; }
blockquote {
  margin: 1rem 0;
  padding: 0.2rem 0 0.2rem 1rem;
  border-left: 4px solid var(--accent);
  background: var(--tint-strong);
  border-radius: 0 var(--radius) var(--radius) 0;
}
pre {
  background: var(--tint-weak);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  font-size: 0.88rem;
  line-height: 1.55;
}
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }

/* Horizontal rule and receipts */
hr { border: 0; border-top: 1px solid var(--edge); margin: 2rem 0; }
.notice, .receipt, .colophon { color: var(--muted); }
.receipt { margin-top: 2.2rem; }

/* Footer */
.colophon {
  border-top: 1px solid var(--edge);
  padding-top: 1rem; padding-bottom: 3rem;
  font-family: Inter, system-ui, sans-serif;
}

/* Small niceties */
::selection { background: var(--accent); color: var(--accent-ink); }

/* Ensure readable overflow */
main { padding-bottom: 3rem; overflow-wrap: anywhere; }

/* Keep the top strip visible but calm */
.strip span { color: var(--muted); }

/* Respect base avatar size if none is present */
.masthead .avatar:empty { display: none; }

/* Tighten spacing when there’s no tagline */
.masthead .tagline:empty { display: none; }

/* Post page masthead title is a <p>; keep styles consistent */
.post .masthead .blog-title {
  font: 700 1.85rem/1.2 Inter, system-ui, sans-serif;
}

/* Buttons are not in markup, but make focused elements visible regardless */
:focus-visible { scroll-margin: 6rem; }
