/* kspears.com */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #f5f2ed;
  --text: #2c2a27;
  --text-muted: #7a756e;
  --accent: #b55a3c;
  --accent-soft: rgba(181, 90, 60, 0.08);
  --link: #3d7a8a;
  --link-hover: #2d5f6d;
  --border: #d9d3cb;
  --code-bg: #2a2825;
  --code-text: #d4cfca;
  --ridge: #c4a882;
  --trail: #8b7355;
  --water: #6a9aaa;
  --max-width: min(1100px, 90vw);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  overflow-wrap: break-word;
  word-break: break-word;
}

body {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  border-top: 3px solid var(--accent);
  overflow-x: hidden;
}

/* Topo contour background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    url("data:image/svg+xml,%3Csvg width='1200' height='900' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cstyle%3Epath%7Bfill:none;stroke-linecap:round%7D%3C/style%3E%3C/defs%3E%3Cpath d='M-100 200 Q100 140 300 180 Q500 220 700 160 Q900 100 1100 170 Q1200 200 1400 160' stroke='%23c4a882' stroke-width='1' opacity='0.12'/%3E%3Cpath d='M-100 240 Q150 190 350 220 Q550 260 750 200 Q950 140 1150 210 Q1250 240 1400 200' stroke='%23c4a882' stroke-width='1' opacity='0.1'/%3E%3Cpath d='M-100 290 Q120 250 320 270 Q520 300 720 250 Q920 200 1120 260 Q1250 290 1400 250' stroke='%23c4a882' stroke-width='0.8' opacity='0.08'/%3E%3Cpath d='M-100 550 Q200 490 400 530 Q600 570 800 510 Q1000 450 1200 520 Q1300 550 1400 510' stroke='%236a9aaa' stroke-width='1' opacity='0.1'/%3E%3Cpath d='M-100 590 Q180 540 380 570 Q580 610 780 550 Q980 490 1180 560 Q1300 590 1400 550' stroke='%236a9aaa' stroke-width='0.8' opacity='0.08'/%3E%3Cpath d='M-100 640 Q160 600 360 620 Q560 650 760 600 Q960 550 1160 610 Q1300 640 1400 600' stroke='%236a9aaa' stroke-width='0.8' opacity='0.06'/%3E%3Cpath d='M-100 750 Q250 700 450 740 Q650 780 850 720 Q1050 660 1250 730' stroke='%23c4a882' stroke-width='1.2' opacity='0.09'/%3E%3Cpath d='M-100 800 Q220 760 420 785 Q620 820 820 770 Q1020 720 1220 780' stroke='%23c4a882' stroke-width='0.8' opacity='0.06'/%3E%3Ccircle cx='920' cy='520' r='3' fill='%23b55a3c' opacity='0.15'/%3E%3Ctext x='930' y='524' font-family='monospace' font-size='8' fill='%23b55a3c' opacity='0.12'%3E4892%3C/text%3E%3Ccircle cx='340' cy='210' r='3' fill='%23b55a3c' opacity='0.15'/%3E%3Ctext x='350' y='214' font-family='monospace' font-size='8' fill='%23b55a3c' opacity='0.12'%3E5210%3C/text%3E%3C/svg%3E");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 0;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: calc(3rem + 1.5rem) 1.5rem 0;
  position: relative;
  z-index: 1;
}

/* Header — fixed bar */
header {
  position: fixed;
  top: 3px;
  left: 0;
  right: 0;
  height: 3rem;
  background: rgba(245, 242, 237, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

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


header h1 {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

header h1 a {
  color: var(--text);
  text-decoration: none;
}

header h1 a:hover {
  color: var(--accent);
}

header nav {
  display: flex;
  gap: 1.5rem;
}

header nav a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.2s;
}

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

header nav a::before {
  content: '/';
  color: var(--accent);
  opacity: 0.6;
  margin-right: 0.15em;
}

/* Main */
main {
  padding: 3rem 0 4rem;
}

/* Home — intro */
.hero {
  margin-bottom: 3rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

.hero-content {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.hero-photo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--ridge);
}

.hero-text h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.hero-text .tagline {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.section-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

/* Post list — just text */
.post-list {
  list-style: none;
}

.post-list li {
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--border);
  transition: box-shadow 0.2s, border-color 0.2s;
}

.post-list li:hover {
  box-shadow: 0 3px 12px rgba(44, 42, 39, 0.08);
  border-color: var(--ridge);
}

.post-list a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 1.0625rem;
  transition: color 0.2s;
}

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

.post-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  letter-spacing: 0.01em;
}

/* Home two-column layout */
.home-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 3rem;
  align-items: start;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: calc(3rem + 1.5rem);
}

.sidebar__nav ul {
  list-style: none;
}

.sidebar__nav li {
  margin-bottom: 0.15rem;
}

.sidebar__nav ul a {
  display: block;
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  line-height: 1.4;
}

.sidebar__nav ul a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.5);
}

.sidebar__nav ul a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(255, 255, 255, 0.5);
  font-weight: 500;
}

.sidebar__all-posts {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6875rem;
  color: var(--accent);
  text-decoration: none;
  text-align: center;
  padding: 0.45rem 0.75rem;
  margin: 0.75rem 0.75rem 0;
  border: 1px solid var(--accent);
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}

.sidebar__all-posts:hover {
  background: var(--accent);
  color: #fff;
}

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(44, 42, 39, 0.08);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, color 0.2s;
  z-index: 50;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.home-content {
  min-width: 0;
  overflow: hidden;
}

/* Full post on home page */
.full-post {
  margin-bottom: 3rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 1.5rem;
}

.full-post:last-child {
  border-bottom: none;
}

.full-post h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.35rem 0;
  letter-spacing: -0.02em;
}

.full-post h2 a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}

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

.full-post .post-meta {
  margin-bottom: 1.5rem;
}

.full-post .post-featured-img {
  margin-bottom: 1.25rem;
}

.full-post__content {
  overflow-x: auto;
}

/* Post featured image */
.post-featured-img {
  margin: 0 0 2rem 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1.5px solid var(--border);
  background: #fff;
  box-shadow: 0 2px 12px rgba(44, 42, 39, 0.08);
}

.post-featured-img img {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  margin: 0;
}

/* Prose typography — shared by article pages and inline posts */
article h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.03em;
}

article .post-meta {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

article h2,
.full-post__content h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 2.5rem 0 0.75rem 0;
  letter-spacing: -0.01em;
  color: var(--accent);
}

article h3,
.full-post__content h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 2rem 0 0.5rem 0;
}

article p,
.full-post__content p {
  margin: 0 0 1.25rem 0;
}

article ul, article ol,
.full-post__content ul,
.full-post__content ol {
  margin: 0 0 1.25rem 0;
  padding-left: 1.5rem;
}

article li,
.full-post__content li {
  margin: 0.3rem 0;
}

article li::marker,
.full-post__content li::marker {
  color: var(--trail);
}

article pre,
.full-post__content pre {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  line-height: 1.65;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  border-radius: 4px;
  margin: 1.5rem -1rem;
  border-top: 2px solid var(--accent);
  max-width: calc(100% + 2rem);
}

article code,
.full-post__content code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875em;
}

article pre code,
.full-post__content pre code {
  background: none;
  padding: 0;
  color: inherit;
}

article :not(pre) > code,
.full-post__content :not(pre) > code {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

article blockquote,
.full-post__content blockquote {
  margin: 1.5rem 0;
  padding: 0 0 0 1.25rem;
  border-left: 3px solid var(--ridge);
  color: var(--text-muted);
}

article blockquote p:last-child,
.full-post__content blockquote p:last-child {
  margin-bottom: 0;
}

article table,
.full-post__content table {
  width: calc(100% + 2rem);
  border-collapse: collapse;
  margin: 1.5rem -1rem;
  font-size: 0.9375rem;
}

article th, article td,
.full-post__content th,
.full-post__content td {
  padding: 0.6rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

article th,
.full-post__content th {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

article img,
.full-post__content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

article a,
.full-post__content a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: rgba(74, 102, 112, 0.3);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.2s;
}

article a:hover,
.full-post__content a:hover {
  text-decoration-color: var(--link);
}

article hr,
.full-post__content hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 2.5rem 0;
}

/* Back link */
.back-link {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  display: inline-block;
  margin-bottom: 2rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--text);
}

/* About — profile */
.profile {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  margin: 1.5rem 0 2.5rem 0;
}

.profile img {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--ridge);
}

.profile p {
  margin: 0;
}

/* Footer */
footer {
  margin-top: 3rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

footer a {
  color: var(--text-muted);
  text-decoration: none;
}

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

/* Page titles */
main > h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 1.5rem 0;
  letter-spacing: -0.02em;
}

/* Responsive — tablet */
@media (max-width: 768px) {
  .home-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .sidebar {
    display: none;
  }

  .full-post__content pre,
  .full-post__content table,
  article pre,
  article table {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    max-width: 100%;
  }
}

/* Responsive — mobile */
@media (max-width: 640px) {
  header .header-inner {
    padding: 0 1rem;
  }

  header nav {
    gap: 1rem;
  }

  .container {
    max-width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .hero-content {
    gap: 1rem;
  }

  .hero-photo {
    width: 56px;
    height: 56px;
  }

  .profile {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  article h1 {
    font-size: 1.625rem;
  }

  article pre {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    max-width: 100%;
  }

  article table {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

}
