/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Theme variables — light defaults */
:root {
  --color-bg: #fff;
  --color-text: #000;
  --color-link: #000;
  --color-border-heavy: #000;
  --color-border-light: #e0e0e0;
  --color-meta: #555;
  --color-lead: #222;
}

/* Default (light): show moon, hide sun */
.icon-sun { display: none; }
.icon-moon { display: inline; }

/* OS-level dark preference (no cookie) */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #1a1a1a;
    --color-text: #e0e0e0;
    --color-link: #e0e0e0;
    --color-border-heavy: #e0e0e0;
    --color-border-light: #333;
    --color-meta: #999;
    --color-lead: #ccc;
  }

  /* In OS dark with no explicit choice: show sun, hide moon */
  .icon-sun { display: inline; }
  .icon-moon { display: none; }
}

/* Explicit dark (cookie wins over OS preference) */
html[data-theme="dark"] {
  --color-bg: #1a1a1a;
  --color-text: #e0e0e0;
  --color-link: #e0e0e0;
  --color-border-heavy: #e0e0e0;
  --color-border-light: #333;
  --color-meta: #999;
  --color-lead: #ccc;
}

html[data-theme="dark"] .icon-sun { display: inline; }
html[data-theme="dark"] .icon-moon { display: none; }

/* Explicit light (cookie wins over OS dark preference) */
html[data-theme="light"] {
  --color-bg: #fff;
  --color-text: #000;
  --color-link: #000;
  --color-border-heavy: #000;
  --color-border-light: #e0e0e0;
  --color-meta: #555;
  --color-lead: #222;
}

html[data-theme="light"] .icon-sun { display: none; }
html[data-theme="light"] .icon-moon { display: inline; }

/* Base */
body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica,
    Arial, sans-serif, "Apple Color Emoji";
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* Links */
a {
  color: var(--color-link);
  text-decoration: underline;
}

a:hover {
  text-decoration: none;
}

/* Header */
header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-bottom: 1px dashed var(--color-border-heavy);
  padding-bottom: 0.75rem;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 2.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

header h1 span  {
  color: #1A73E8FF;
}

header h1 a {
  text-decoration: none;
}

/* Nav */
nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.95rem;
}

nav a {
  text-decoration: none;
}

nav a:hover {
  text-decoration: underline;
}

/* Language switcher */
.lang-switcher {
  font-size: 0.85rem;
  border-left: 1px solid var(--color-border-light);
  padding-left: 1rem;
}

.lang-switcher a {
  text-decoration: none;
}

.lang-switcher a:hover {
  text-decoration: underline;
}

/* Theme toggle button */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  color: var(--color-text);
  border-left: 1px solid var(--color-border-light);
  padding-left: 1rem;
}

.theme-toggle svg {
  stroke: var(--color-text);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--color-link);
  outline-offset: 2px;
}

.rss-link {
  display: flex;
  align-items: center;
  color: orange;
  border-left: 1px solid var(--color-border-light);
  padding-left: 1rem;
  text-decoration: none;
}

.rss-link svg {
  stroke: orange;
}

.rss-link:hover {
  opacity: 0.7;
}

/* Main */
main {
  min-height: 60vh;
}

/* Post list */
.post-list article {
  margin-bottom: 2.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--color-border-light);
}

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

.post-list h1 {
  font-size: 2rem;
  font-weight: 300;
  margin-bottom: 0.25rem;
}

.post-list h1 a {
  text-decoration: none;
  color: #1A73E8FF;
}

.post-list h1 a:hover {
  text-decoration: underline 2px;
}

.post-meta {
  font-size: 0.8rem;
  color: var(--color-meta);
  margin-bottom: 0.5rem;
}

.post-lead {
  font-size: 1.1rem;
  color: var(--color-lead);
  font-weight: 300;
}

/* Post detail */
.post-detail h1 {
  font-size: 2rem;
  font-weight: 300;
  margin-bottom: 0.5rem;
  color: #1A73E8FF;
}

.post-detail .post-lead {
  font-size: 1.3rem;
  font-weight: 300;
  line-height: 1.75;
}

.post-detail .post-lead::first-letter {
  color: white;
  background-color: black;
  border-radius: 5px;
  box-shadow: 3px 3px 0 grey;
  font-size: 150%;
  padding: 6px 24px;
  margin-right: 6px;
  float: left;
}

.post-content {
  margin-top: 1.5rem;
  line-height: 1.75;
  font-weight: 300;
}

.post-content p {
  margin-bottom: 1.25rem;
}

.post-content a {
    color: #1A73E8FF;
    text-decoration: none;
}

.post-content a:hover {
    text-decoration: underline;
}

.post-content h2, .post-content h3 {
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.post-content ul, .post-content ol {
  margin-left: 2.5rem;
  margin-bottom: 0.5rem;
}

.post-content pre {
  margin-bottom: 1.25rem;
  border-radius: 6px;
  overflow-x: auto;
}

.post-content pre code {
  display: block;
  padding: 1rem;
  font-size: 0.9rem;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  line-height: 1.5;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2rem;
  font-size: 0.9rem;
}

/* Footer */
footer {
  border-top: 1px solid var(--color-border-light);
  margin-top: 3rem;
  padding-top: 1rem;
  font-size: 0.8rem;
  color: var(--color-meta);
}

/* Error page */
.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40vh;
}

.error-page h1 {
  font-size: 2.5rem;
  font-weight: 700;
}

.menu-under-article {
    margin-top: 2rem;
}
