@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

:root {
  --bg-color: #ffffff;
  --text-color: #3d3d3d;
  --heading-color: #111111;
  --link-color: #2563eb;
  --link-hover-color: #1d4ed8;
  --meta-color: #666666;
  --border-color: #eeeeee;
  --code-bg: #f5f5f5;
  --blockquote-color: #555555;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #1a1a1a;
    --text-color: #d4d4d4;
    --heading-color: #f5f5f5;
    --link-color: #60a5fa;
    --link-hover-color: #93c5fd;
    --meta-color: #a3a3a3;
    --border-color: #333333;
    --code-bg: #262626;
    --blockquote-color: #c4c4c4;
  }
}

html {
  /* color-scheme: light; Removed to allow system preference */
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.75;
  margin: 0 auto;
  padding: 40px 20px;
  max-width: 760px;
}

/* Post Header (Title, Date, Blog Link) */
header {
  margin-bottom: 1.5rem;
  border-bottom: none;
  display: block !important; /* Force block to prevent flex centering */
  text-align: left !important; /* Force left alignment */
}

/* Hide the auto-injected RSS link from header */
header a[href*="rss"] {
  display: none !important;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  line-height: 1.2;
  text-align: left !important; /* Force left alignment on title */
}

header aside { /* Container for date and home link */
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--meta-color);
  margin-top: 0.5rem;
  text-align: left !important; /* Force left alignment on meta */
}

header aside time {
  margin-right: 1rem;
}

/* Main Content */
main {
  display: block;
}

/* Post List (Index Page) */
ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

li {
  display: flex;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

li:last-child {
  border-bottom: none;
}

/* Date in list */
li span, li time {
  flex-shrink: 0;
  width: 120px;
  color: var(--meta-color);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

/* Title in list */
li a {
  font-weight: 600;
  color: var(--heading-color);
  text-decoration: none;
  font-size: 1.1rem;
}

li a:hover {
  color: var(--link-color);
}

/* Post Content (Single Page) */
article {
  margin-top: 2rem;
}

h2, h3, h4 {
  color: var(--heading-color);
  margin-top: 2em;
  margin-bottom: 0.8em;
  font-weight: 700;
}

h2 { font-size: 1.75rem; letter-spacing: -0.02em; }
h3 { font-size: 1.4rem; }

p {
  margin-bottom: 1.75rem;
}

a {
  color: var(--link-color);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}

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

img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 2rem 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  opacity: 1;
}

/* Dim images slightly in dark mode to reduce glare */
@media (prefers-color-scheme: dark) {
  img {
    opacity: 0.9;
  }
}

pre {
  background: var(--code-bg);
  padding: 1.5rem;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.9em;
  margin: 2rem 0;
}

code {
  font-family: var(--font-mono);
  background: var(--code-bg);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--heading-color);
}

pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

blockquote {
  border-left: 3px solid var(--link-color);
  margin: 2rem 0;
  padding-left: 1.5rem;
  font-style: italic;
  color: var(--blockquote-color);
}

/* Footer */
footer {
  display: none !important;
}

#post-footer {
  margin-top: 80px;
  padding-top: 40px;
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--meta-color);
  font-size: 0.85rem;
}

#post-footer p {
  margin-bottom: 0;
}

#post-footer a {
  color: var(--meta-color);
  text-decoration: none;
  font-weight: normal;
  margin: 0 8px;
}

#post-footer a:hover {
  color: var(--link-color);
  text-decoration: underline;
}

/* Footnotes */
.footnotes {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.9rem;
  color: var(--meta-color);
}

.footnotes ol {
  padding-left: 1.5rem;
  list-style: decimal;
}

.footnotes li {
  display: list-item;
  padding: 0.25rem 0;
  border-bottom: none;
}

.footnotes li a {
  font-weight: normal;
  font-size: 0.9rem;
  color: var(--link-color);
}

.footnotes p {
  margin: 0;
  display: inline;
}

.footnote-ref {
  font-size: 0.75em;
  vertical-align: super;
  text-decoration: none;
}

.footnote-backref {
  text-decoration: none;
  margin-left: 0.25rem;
}
