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

:root {
  --bg: #fafafa;
  --bg-card: #ffffff;
  --text: #1a1a1a;
  --text-muted: #666666;
  --text-light: #999999;
  --accent: #0066cc;
  --accent-light: #e6f0ff;
  --border: #e5e5e5;
  --max-width: 720px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-title: 'Bodoni Moda', Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d0d;
    --bg-card: #1a1a1a;
    --text: #f0f0f0;
    --text-muted: #a0a0a0;
    --text-light: #666666;
    --accent: #4da6ff;
    --accent-light: #1a2a3a;
    --border: #2a2a2a;
  }
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

#app {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

/* Header */
header {
  padding: 2rem 0 1.5rem;
}

header h1 {
  font-family: var(--font-title);
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

header h1 a {
  color: inherit;
  text-decoration: none;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 1.5rem;
  padding: 0 0 1.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab {
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.15s;
  padding-bottom: 0.5rem;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
}

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

.tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}

/* Preview cards (home page) */
.preview-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.preview-card {
  display: block;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.preview-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.preview-topic {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.preview-title {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.preview-excerpt {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.preview-date {
  font-size: 0.8rem;
  color: var(--text-light);
}

/* Newsletter card (full view) */
.newsletter-card {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.newsletter-card:last-child {
  border-bottom: none;
}

.topic-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.newsletter-card h2 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.newsletter-card .date {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* Newsletter content - serif for readability */
.newsletter-content {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.8;
}

.newsletter-content h1,
.newsletter-content h2,
.newsletter-content h3 {
  font-family: var(--font-sans);
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
}

.newsletter-content h1 { font-size: 1.4rem; }
.newsletter-content h2 { font-size: 1.2rem; }
.newsletter-content h3 { font-size: 1.05rem; }

.newsletter-content p {
  margin-bottom: 1rem;
}

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

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

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

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

.newsletter-content blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--text-muted);
}

.newsletter-content code {
  background: var(--border);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

.newsletter-content pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1rem 0;
}

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

.newsletter-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.newsletter-content strong {
  font-weight: 600;
}

/* Older issues section */
.older-section {
  margin-top: 2rem;
}

.older-section h3 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.older-list {
  display: flex;
  flex-direction: column;
}

.older-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: color 0.15s;
}

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

.older-item:hover {
  color: var(--accent);
}

.older-title {
  font-weight: 500;
}

.older-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: 1rem;
}

/* Back link */
.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

.back-link:hover {
  text-decoration: underline;
}

/* Loading state */
.loading {
  text-align: center;
  padding: 3rem 0;
  color: var(--text-muted);
}

/* Empty state */
.empty {
  text-align: center;
  padding: 3rem 0;
  color: var(--text-muted);
}

/* Mobile adjustments */
@media (max-width: 480px) {
  header h1 {
    font-size: 1.5rem;
  }

  .tabs {
    gap: 0.25rem;
    padding: 0.75rem 0;
  }

  .tab {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
  }

  .newsletter-card h2 {
    font-size: 1.3rem;
  }

  .newsletter-content {
    font-size: 0.95rem;
  }
}
