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

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --text-light: #64748b;
  --text-muted: #94a3b8;
  --accent: #2563eb;
  --accent-light: #dbeafe;
  --border: #e2e8f0;
  --radius: 6px;
  --font:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", monospace;
  --max-width: 680px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #f1f5f9;
    --text-light: #94a3b8;
    --text-muted: #64748b;
    --accent: #60a5fa;
    --accent-light: #1e3a5f;
    --border: #334155;
  }
}

[data-theme="light"] {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --text-light: #64748b;
  --text-muted: #94a3b8;
  --accent: #2563eb;
  --accent-light: #dbeafe;
  --border: #e2e8f0;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --text: #f1f5f9;
  --text-light: #94a3b8;
  --text-muted: #64748b;
  --accent: #60a5fa;
  --accent-light: #1e3a5f;
  --border: #334155;
}

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

html {
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Wallpaper */

.wallpaper {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.wallpaper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.18;
}

@media (prefers-color-scheme: dark) {
  .wallpaper img {
    opacity: 0.1;
  }
}

[data-theme="dark"] .wallpaper img {
  opacity: 0.1;
}

/* Layout */

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header & Nav */

header {
  padding: 3rem 0 2rem;
}

header .container {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--text);
}

.site-title:hover {
  color: var(--accent);
}

nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

nav a {
  color: var(--text-light);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

nav a[aria-current] {
  color: var(--text);
  font-weight: 600;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-light);
  cursor: pointer;
  transition:
    color 0.2s ease,
    border-color 0.2s ease;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.theme-toggle-sun,
.theme-toggle-moon {
  display: block;
}

.theme-toggle.is-dark .theme-toggle-sun {
  display: none;
}

.theme-toggle:not(.is-dark) .theme-toggle-moon {
  display: none;
}

/* Main */

main {
  flex: 1;
  padding: 2rem 0 4rem;
}

/* Typography */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

h1 {
  font-size: 2.25rem;
  margin-top: 0;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
}

p {
  margin-bottom: 1.5rem;
}

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

a:hover {
  text-decoration: underline;
}

/* Post List */

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

.postlist-item {
  padding: 2rem 0;
  border-bottom: 1px solid var(--border);
}

.postlist-item:first-child {
  padding-top: 0;
}

.postlist-item:last-child {
  border-bottom: none;
}

.postlist-link {
  display: block;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 0.5rem;
}

.postlist-link h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  transition: color 0.2s ease;
}

.postlist-link:hover h2 {
  color: var(--accent);
}

.postlist-link:hover {
  text-decoration: none;
}

.postlist-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-light);
  flex-wrap: wrap;
}

.postlist-date {
  font-variant-numeric: tabular-nums;
}

.post-summary {
  color: var(--text-light);
  font-size: 0.9375rem;
  margin-top: 0.75rem;
  margin-bottom: 0;
  line-height: 1.6;
  white-space: pre-line;
}

.post-summary a {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.post-summary a:hover {
  color: inherit;
}

.post-summary-short {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Tags */

.tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  padding: 0.15rem 0.6rem;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 100px;
  text-decoration: none;
  transition: background 0.2s ease;
}

.tag:hover {
  text-decoration: none;
  background: var(--accent);
  color: #fff;
}

/* Post Page */

.post-header {
  margin-bottom: 3rem;
}

.post-header h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-light);
  flex-wrap: wrap;
}

.post-content h2 {
  margin-top: 2.5rem;
}

.post-content h3 {
  margin-top: 2rem;
}

.post-content ul,
.post-content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.post-content li {
  margin-bottom: 0.5rem;
}

.post-content blockquote {
  margin: 2rem 0;
  padding: 0 0 0 1.5rem;
  border-left: 3px solid var(--accent);
  color: var(--text-light);
  font-style: italic;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 2rem 0;
}

.post-content pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
  margin: 2rem 0;
}

.post-content code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--surface);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.post-content pre code {
  background: none;
  padding: 0;
  border: none;
  font-size: inherit;
}

/* Direct link anchors */
.direct-link {
  color: var(--text-muted);
  text-decoration: none;
  margin-left: 0.25rem;
  font-weight: 400;
}

.direct-link:hover {
  color: var(--accent);
  text-decoration: none;
}

h1 .direct-link,
h2 .direct-link,
h3 .direct-link,
h4 .direct-link,
h5 .direct-link,
h6 .direct-link {
  color: inherit;
  margin-left: 0;
  font-weight: inherit;
}

/* Back link */
.back-link {
  display: inline-block;
  margin-top: 3rem;
  font-size: 0.875rem;
  color: var(--text-light);
}

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

/* Intro */
.intro {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.intro h1 {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
}

.intro p {
  color: var(--text-light);
  font-size: 1.0625rem;
  margin-bottom: 0;
}

/* Footer */

footer {
  padding: 2.5rem 0;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

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

/* Page title */
.page-title {
  font-size: 1.75rem;
  margin-bottom: 2rem;
}

/* Archive list simple variant */
.archive-list .postlist-item {
  padding: 1.25rem 0;
}

.archive-list .postlist-link h2 {
  font-size: 1.1rem;
}

/* Responsive */

@media (max-width: 600px) {
  html {
    font-size: 16px;
  }

  header .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  h1 {
    font-size: 1.75rem;
  }

  .post-header h1 {
    font-size: 1.5rem;
  }
}
