:root {
  --bg: #f1ebde;
  --bg-darker: #284a4a;
  --ink: #161614;
  --ink-inverted: #f1ebde;
  --muted: #67665f;
  --accent: #284a4a;
  --line: #e6dcc6;
  --border-color: #284a4a;

  --font-normal: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  --font-fancy: "Cormorant Garamond", serif;
  --font-code: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Dark theme variables (explicit) */
:root[data-theme='dark'] {
  --bg: #0f1113;
  --bg-darker: #0f1113;
  --ink: #ece9e2;
  --ink-inverted: #ece9e2;
  --muted: #a6a39e;
  --accent: #b1a79d;
  --line: #262a2e;
  --border-color: #262a2e;
}

/* Respect system preference by default */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0f1113;
    --ink: #ece9e2;
    --muted: #a6a39e;
    --accent: #b1a79d;
    --line: #262a2e;
    --border-color: #262a2e;
  }
}

* {
  box-sizing: border-box
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink)
}

body {
  font-family: var(--font-normal);
  line-height: 1.65
}

a {
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-fancy);
}

a.underline {
  border-bottom: 1px solid #dedede;
}

a:hover {
  color: var(--ink);
}

.text-left {
  text-align: left;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(120%) blur(6px);
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bg-darker);
  color: var(--ink-inverted);
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-darker);
  color: var(--ink-inverted);
  border-radius: 999px;
  padding: 6px;
  font: inherit;
  cursor: pointer;
  font-size: 14px;
  font-family: var(--font-fancy);
  letter-spacing: 0;
}

.brand {
  font-family: var(--font-fancy);
  font-weight: 600;
  font-size: 24px;
  letter-spacing: 0.3px;
  color: var(--ink-inverted);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center
}

.brand img {
  width: 35px;
  height: 35px;
  margin-right: 0.5rem;
  border: 1px solid #dedede;
  border-radius: 50%;
}

.nav {
  display: flex;
  gap: 18px
}

.nav-link {
  color: var(--muted);
  text-decoration: none
}

.nav-link:hover {
  color: var(--ink)
}

.icon {
  display: inline-block;
  vertical-align: middle
}

/* Circular icon buttons matching theme */
.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-inverted);
  background: transparent;
  text-decoration: none;
}

.icon-btn:hover {
  background: color-mix(in oklab, var(--bg) 90%, var(--ink));
}

.icon-btn .icon {
  width: 18px;
  height: 18px
}

.hero {
  padding: 1rem;
  border-bottom: 1px solid var(--line)
}

.hero-title {
  font-family: var(--font-fancy);
  font-weight: 500;
  font-size: 24px;
  margin: 0 0 8px 0;
  letter-spacing: 0.2px
}

.hero-sub {
  margin: 0;
  color: var(--muted)
}

.post-list {
  display: grid;
  grid-template-columns:1fr;
  gap: 20px;
  padding: 24px 0
}

.post-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  justify-content: end;
  margin-bottom: 1rem;
}

.pill {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  font-family: var(--font-fancy);
  cursor: pointer;
}

.pill.active {
  background: var(--accent);
  color: var(--ink-inverted);
}

.post-card {
  padding: 1rem;
  border-bottom: 1px solid var(--line);
  transition: background 120ms ease, transform 120ms ease;
  position: relative;
  text-decoration: none;
}

a.post-card:hover {
  color: var(--ink);
  text-decoration: none;
}

.post-title {
  font-family: var(--font-fancy);
  color: var(--ink);
  text-decoration: none;
  font-size: 26px
}

.post-card:hover{
  background: color-mix(in oklab, var(--bg) 95%, var(--ink));
}

.post-cta{color: var(--accent); text-decoration: none}
.post-cta:hover{text-decoration: underline}

/* Make entire card clickable */
.stretched-link{position:absolute;inset:0;z-index:1;text-indent:-9999px;overflow:hidden}
.post-card > *{position:relative;z-index:2}

.post-meta {
  font-family: var(--font-normal);
  color: var(--muted);
  font-size: 14px;
  margin-top: 6px
}

.post-summary {
  margin: 8px 0 0 0;
  color: var(--ink)
}

.page-title {
  font-family: var(--font-fancy);
  font-size: 36px;
  margin: 12px 0 12px 0
}

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

.post-list-basic li {
  padding: 12px 0;
  border-bottom: 1px solid var(--line)
}

.footer {
  padding: 32px 24px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  text-align: center
}

.footer-main-text {
  font-family: var(--font-fancy);
  font-size: 20px;
}

@media (min-width: 900px) {
  .hero-title {
    font-size: 54px
  }

  .post-title {
    font-size: 28px
  }
}

/* Prose styling for markdown content */
.prose {
  max-width: 760px;
  margin: 32px auto 48px auto
}

.prose h1, .prose h2, .prose h3 {
  font-family: var(--font-fancy);
  color: var(--ink);
  margin: 28px 0 8px 0
}

.prose h1 {
  font-size: 38px
}

.prose h2 {
  font-size: 28px
}

.prose h3 {
  font-size: 22px
}

.prose p {
  margin: 14px 0;
  color: var(--ink)
}

.prose a {
  color: var(--accent);
  text-underline-offset: 3px
}

.prose img {
  object-fit: contain;
  width: 100%;
}

.prose a:hover {
  text-decoration: underline
}

.prose pre {
  background: color-mix(in oklab, var(--bg) 88%, var(--ink));
  color: var(--ink);
  padding: 16px;
  border-radius: 8px;
  overflow: auto;
  border: 1px solid var(--line);
  font-family: var(--font-code);
  font-size: 0.95rem;
  position: relative;
}

.prose pre code {
  color: inherit
}

.prose ul, .prose ol {
  padding-left: 22px
}

.prose blockquote {
  margin: 16px 0;
  padding-left: 16px;
  border-left: 2px solid var(--line);
  color: var(--muted)
}

.post-header {
  margin-top: 24px;
  margin-bottom: 16px
}

/* Dark theme code block overrides */
:root[data-theme='dark'] .prose pre {
  background: #0f1317;
  color: #eae7df;
  border-color: #262a2e
}

/* Explicit light override to ensure high contrast when forced light */
:root[data-theme='light'] .prose pre {
  background: #f2efe9;
  color: #1c1b19;
  border-color: #e0dbd3
}

/* Copy button on code blocks */
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 1px solid var(--line);
  background: color-mix(in oklab, var(--bg) 85%, white);
  color: var(--ink);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}
.copy-btn:hover {
  background: color-mix(in oklab, var(--bg) 80%, var(--ink));
}

/* Theme toggle */
.theme-toggle {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-inverted);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  cursor: pointer
}

.theme-toggle:hover {
  background: color-mix(in oklab, var(--bg) 90%, var(--ink))
}
