:root {
  --bg: #f9f5ec;
  --text: #2c2c2c;
  --muted: #707070;
  --border: #e5dfd4;
  --accent: #2563eb;

  --font-body: Georgia, "Times New Roman", serif;
  --font-heading: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --content-width: 680px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1e1e1e;
    --text: #e8e3d9;
    --muted: #999;
    --border: #333;
    --accent: #60a5fa;
  }
}

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

html {
  font-size: 20px;
  -webkit-text-size-adjust: 100%;
  overflow-y: scroll;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--text);
  background-color: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Reading Progress Bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--muted);
  z-index: 1000;
  transition: width 50ms linear;
}

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

main {
  flex: 1;
}

/* Header & Nav */
.site-header {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.site-title {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.02em;
}

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

.site-nav a {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  margin-left: 1.5rem;
}

.site-nav a:hover {
  color: var(--text);
}

/* Footer */
.site-footer {
  padding: 1rem 0;
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-heading);
  font-size: 0.7rem;
  color: var(--muted);
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.footer-made {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  text-align: center;
}

.texas-icon {
  display: inline-block;
  width: 1.5em;
  height: 1.25em;
  vertical-align: -0.2em;
  background-color: var(--muted);
  -webkit-mask-image: url("/images/texas.svg");
  mask-image: url("/images/texas.svg");
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.flag-emoji {
  font-size: 1.4em;
  vertical-align: -0.15em;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 1rem;
}

.footer-links a:hover {
  color: var(--text);
}

/* Post List */
.post-list {
  list-style: none;
}

.post-list-item {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

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

.post-list-item h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.post-list-item h2 a {
  color: var(--text);
  text-decoration: none;
}

.post-list-item h2 a:hover {
  color: var(--accent);
}

.post-meta {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.post-description {
  color: var(--muted);
  font-size: 0.95rem;
}

/* Post Detail */
.post-header {
  margin-bottom: 2rem;
}

.post-header h1 {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.post-header .post-meta {
  margin-bottom: 0;
}

.post-content h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.post-content h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

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

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

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

.post-content blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
  font-style: italic;
}

.post-content code {
  font-size: 0.88em;
  background: var(--border);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

.post-content pre {
  background: var(--border);
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: 1.25rem;
}

.post-content pre code {
  background: none;
  padding: 0;
}

.post-content img,
.post-content picture img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin-bottom: 1.25rem;
}

.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

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

.back-link {
  display: inline-block;
  margin-top: 2rem;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
}

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

/* Page Content (about, privacy, etc.) */
.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
}

.page-content h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.page-content h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

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

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

.page-content li {
  margin-bottom: 0.35rem;
}

.page-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.page-content a:hover {
  text-decoration: none;
}

/* 404 */
.not-found {
  text-align: center;
  padding: 4rem 0;
}

.not-found h1 {
  font-family: var(--font-heading);
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.not-found p {
  color: var(--muted);
  margin-bottom: 1rem;
}

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

.not-found a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 600px) {
  html {
    font-size: 18px;
  }

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