@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,wght@1,400&family=Geist:wght@400;500;600&display=swap');

:root {
  --bg: #f4f3f0;
  --surface: #eae9e5;
  --text-primary: #1a1917;
  --text-secondary: #44433f;
  --text-tertiary: #918f88;
  --accent: #44433f;
  --border: #d8d5ce;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #181714;
    --surface: #222120;
    --text-primary: #e4e2da;
    --text-secondary: #c4c2bc;
    --text-tertiary: #87857e;
    --accent: #c4c2bc;
    --border: #2c2b28;
  }
}
::selection {
  background-color: var(--surface);
  color: var(--text-primary);
}
*, *::before, *::after {
  box-sizing: border-box;
}

/* --- Scrollbar --- */
html {
  overflow-y: scroll; /* always reserve scrollbar space, prevents layout shift */
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background-color: var(--text-tertiary);
}

body {
  font-family: 'Geist', ui-sans-serif, system-ui, sans-serif;
  background-color: var(--bg);
  color: var(--text-secondary);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  font-size: 1rem;
  margin: 0;
}
.container {
  max-width: 42rem;
  margin: 0 auto;
  padding: 20px;
}
main {
  padding-top: 2rem;
}

/* --- Headings --- */
h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 2rem;
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text-primary);
  margin: 0 0 0.25rem;
}

.home-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.9rem;
  font-style: normal;
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.1;
  padding: 0.50rem 0;
}
h2 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.4;
  color: var(--text-primary);
  margin: 1.75rem 0 0.5rem;
}
h3 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.4;
  color: var(--text-primary);
  margin: 1.4rem 0 0.4rem;
}
h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 1.25rem 0 0.35rem;
}

/* --- Body text --- */
p {
  font-size: 0.975rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin: 0 0 0.85rem;
}
p:last-child {
  margin-bottom: 0;
}
strong {
  font-weight: 500;
  color: var(--text-primary);
}
em {
  font-style: italic;
}
a {
  color: var(--text-secondary);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s, color 0.15s;
}
a:hover,
a:focus-visible {
  color: var(--text-primary);
  text-decoration-color: var(--text-tertiary);
}

/* --- Lists --- */
ul, ol {
  margin: 0 0 0.85rem 1.1rem;
  padding: 0;
}
li {
  font-size: 0.975rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}
li strong {
  font-weight: 500;
  color: var(--text-primary);
}
li + li {
  margin-top: 0.3rem;
}

/* --- Long-form reading --- */
.prose {
  max-width: 44rem;
}

.prose p {
  font-size: 1rem;
  line-height: 1.9;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

/* --- Code --- */
code {
  font-family: ui-monospace, 'Fira Code', monospace;
  font-size: 0.875em;
  background: var(--surface);
  border-radius: 5px;
  padding: 0.1em 0.35em;
  color: var(--text-primary);
}
pre {
  background: var(--surface);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin: 0 0 1rem;
  user-select: text;
  -webkit-user-select: text;
}
pre code {
  background: transparent;
  padding: 0;
  font-size: 0.875rem;
  user-select: text;
  -webkit-user-select: text;
}
pre::selection,
pre code::selection {
  background: color-mix(in srgb, var(--accent) 28%, white);
  color: var(--text-primary);
}

/* --- Blockquote --- */
blockquote {
  border-left: 2px solid #c8c4bc;
  margin: 1.25rem 0;
  padding-left: 1rem;
  font-style: italic;
}
blockquote p {
  color: var(--text-tertiary);
}

/* --- Eyebrow / meta --- */
.eyebrow {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 0.6rem;
}
.meta,
.post-meta {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-size: 0.9rem;
  color: var(--text-tertiary);
  margin: 0 0 1.5rem;
}
.lede {
  font-size: 0.975rem;
  color: var(--text-secondary);
  max-width: 36rem;
  margin-bottom: 0;
}

/* --- Divider --- */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.75rem 0;
}

/* --- Post list --- */
.page-header {
  margin-bottom: 2rem;
}
.post-year-group + .post-year-group {
  margin-top: 2rem;
}
.year-heading {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}
.post-month-group + .post-month-group {
  margin-top: 1rem;
}
.month-heading {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 0.45rem;
}
.post-year-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.post-year-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}
.post-year-item:first-child {
  border-top: 1px solid var(--border);
}
.post-year-item a {
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text-secondary);
  text-decoration: none;
}
.post-year-item a:hover {
  color: var(--text-primary);
}
.post-year-item .meta,
.post-year-item .post-meta {
  font-size: 0.8rem;
  margin: 0;
}

/* --- Callouts --- */
.mdx-callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 1.25rem 0;
  padding: 0.9rem 1.1rem;
}
.mdx-callout__title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}
.mdx-callout__body > :last-child {
  margin-bottom: 0;
}
.mdx-callout--tip {
  border-color: rgba(160, 150, 130, 0.3);
}
.mdx-callout--warning {
  border-color: #d49a45;
}
.mdx-callout--danger {
  border-color: #c96b5f;
}

/* --- Empty state --- */
.empty-state {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

@media (max-width: 640px) {
  .container {
    padding: 18px;
  }

  .prose {
    max-width: 100%;
  }

  .prose p {
    font-size: 0.995rem;
    line-height: 1.85;
    text-align: justify;
  }
}

@media (max-width: 520px) {
  .prose p {
    text-align: left;
  }
}
