@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,400;0,500;1,400&family=Newsreader:ital,opsz,wght@0,6..72,400..700;1,6..72,400..600&display=swap");

:root {
  color-scheme: light dark;
  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #faf7f2;
  --surface: #f2ede4;
  --ink: #1c1a18;
  --muted: #5c564f;
  --rule: #dfd8cc;
  --accent: #c42e15;
  --accent-warm: #e67e22;
  --accent-soft: rgba(196, 46, 21, 0.35);
  --selection: rgba(230, 88, 38, 0.18);
  --spectrum: linear-gradient(90deg, #9c1f14 0%, #c42e15 32%, #e85525 65%, #f09a2b 92%, #c42e15 100%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131211;
    --surface: #1c1a18;
    --ink: #ece7df;
    --muted: #9e968b;
    --rule: #2e2a26;
    --accent: #ff6442;
    --accent-warm: #ffaa4c;
    --accent-soft: rgba(255, 100, 66, 0.45);
    --selection: rgba(255, 100, 66, 0.25);
    --spectrum: linear-gradient(90deg, #a31d19 0%, #e6341c 30%, #ff5a36 62%, #ffba49 90%, #ff6442 100%);
  }
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1.125rem;
  line-height: 1.72;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration-color: var(--accent-soft);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1.5px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:hover,
a:focus-visible {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

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

/* Top navigation strip */
.strip {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem 1.25rem;
  padding: 0.7rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--muted);
}

.strip::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--spectrum);
}

.strip a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.strip a:hover,
.strip a:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Shared page column */
.masthead,
main,
.colophon {
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* Masthead */
.masthead {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  grid-template-rows: auto auto;
  column-gap: 1.25rem;
  row-gap: 0.25rem;
  align-items: center;
  padding-top: 3.25rem;
  padding-bottom: 2rem;
  margin-bottom: 2.25rem;
  border-bottom: 1px solid var(--rule);
}

.avatar {
  grid-column: 1;
  grid-row: 1 / 3;
  display: block;
  width: 4.5rem;
  height: 4.5rem;
  margin: 0;
  border-radius: 12px;
}

.blog-title {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.85rem, 4vw, 2.35rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.blog-title a {
  text-decoration: none;
  color: var(--ink);
}

.blog-title a:hover,
.blog-title a:focus-visible {
  color: var(--accent);
}

.tagline {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
}

/* Compact masthead on post pages */
body.post .masthead {
  grid-template-columns: 3.1rem 1fr;
  column-gap: 1rem;
  padding-top: 1.75rem;
  padding-bottom: 1.25rem;
  margin-bottom: 2.25rem;
}

body.post .avatar {
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 9px;
}

body.post .blog-title {
  font-size: 1.35rem;
}

body.post .tagline {
  font-size: 0.76rem;
}

/* Main content */
main {
  padding-bottom: 3.5rem;
}

/* Front page: About */
.about {
  padding: 1.4rem 1.6rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
}

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

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

/* Front page: Posts list */
.posts h2 {
  margin: 2.75rem 0 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.post-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.25rem 1.25rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--rule);
}

.post-link {
  font-size: 1.18rem;
  font-weight: 500;
  line-height: 1.35;
  text-decoration: none;
  color: var(--ink);
}

.post-link:hover,
.post-link:focus-visible {
  color: var(--accent);
}

.empty {
  margin-top: 1.25rem;
  font-style: italic;
  color: var(--muted);
}

/* Post page */
.post-header {
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
}

.post-header h1 {
  margin: 0 0 0.6rem;
  font-size: clamp(1.75rem, 4.2vw, 2.4rem);
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: -0.02em;
}

time {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--muted);
  white-space: nowrap;
}

.post-body p {
  margin: 0 0 1.25rem;
}

.post-body h2 {
  margin: 2.4rem 0 0.75rem;
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.post-body h3 {
  margin: 1.9rem 0 0.55rem;
  font-size: 1.18rem;
  font-weight: 600;
  line-height: 1.3;
}

.post-body h4 {
  margin: 1.6rem 0 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.post-body ul,
.post-body ol {
  margin: 0 0 1.35rem;
  padding-left: 1.45rem;
}

.post-body li {
  margin-bottom: 0.4rem;
}

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

blockquote {
  margin: 1.6rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 3px solid var(--accent);
  font-style: italic;
  color: var(--muted);
}

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

code {
  font-family: var(--font-mono);
  font-size: 0.84em;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.1em 0.35em;
}

pre {
  margin: 1.6rem 0;
  padding: 1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.55;
}

pre code {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: inherit;
}

hr {
  border: 0;
  width: 5.5rem;
  height: 2px;
  margin: 2.5rem auto;
  background: var(--spectrum);
  border-radius: 2px;
}

.notice {
  margin: 2rem 0 0;
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent-warm);
  border-radius: 0 5px 5px 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
}

.receipt {
  margin-top: 2.75rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--rule);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--muted);
}

/* Footer */
.colophon {
  border-top: 1px solid var(--rule);
  padding-top: 1.25rem;
  padding-bottom: 3rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--muted);
}

.colophon p {
  margin: 0;
}

/* Small screens */
@media (max-width: 34rem) {
  body {
    font-size: 1.05rem;
  }

  .strip {
    padding: 0.65rem 1rem;
    font-size: 0.72rem;
  }

  .masthead,
  main,
  .colophon {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  body.home .masthead {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    row-gap: 0.4rem;
    padding-top: 2rem;
    padding-bottom: 1.5rem;
    margin-bottom: 1.75rem;
  }

  body.home .avatar {
    grid-column: 1;
    grid-row: auto;
    width: 4rem;
    height: 4rem;
    margin-bottom: 0.45rem;
  }

  body.home .blog-title,
  body.home .tagline {
    grid-column: 1;
    grid-row: auto;
  }

  .about {
    padding: 1.15rem 1.2rem;
  }
}
