:root {
  --color-bg: #ffffff;
  --color-text: #1a1a1a;
  --color-text-secondary: #6b7280;
  --color-accent: #2563EB;
  --color-accent-hover: #1d4ed8;
  --color-border: #e5e7eb;
  --color-grid: #e8ecf0;
  --max-width: 820px;
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

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

body {
  font-family: var(--font-stack);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  background-image:
    linear-gradient(var(--color-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-grid) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-font-smoothing: antialiased;
}

/* Intro photo */

.intro-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
}

.intro-text {
  flex: 1;
}

.intro-photo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-border);
  flex-shrink: 0;
}

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 5rem 2.5rem 3rem;
}

.section {
  margin-bottom: 3rem;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.25rem;
}

h2 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-secondary);
  margin-bottom: 1.25rem;
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

p {
  color: var(--color-text);
}

.tagline {
  color: var(--color-text-secondary);
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.social-links {
  display: flex;
  gap: 1.25rem;
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

.highlights {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 3rem;
}

.highlights li {
  font-size: 0.8rem;
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
  border-radius: 100px;
  padding: 0.25rem 0.75rem;
  white-space: nowrap;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

.entry-list {
  list-style: none;
}

.entry {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.entry:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.entry-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.entry-header h3 a {
  color: var(--color-text);
}

.entry-header h3 a:hover {
  color: var(--color-accent);
}

.entry-date {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.entry p {
  font-size: 0.925rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.gallery-link {
  font-size: 0.85rem;
  display: inline-block;
  margin-top: 0.4rem;
}

footer.section p {
  color: var(--color-text-secondary);
  font-size: 0.925rem;
}

footer.section a {
  color: var(--color-accent);
}

/* Post article page */

.post-article h1 {
  margin-bottom: 0.25rem;
}

.post-date {
  display: block;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-bottom: 2rem;
}

.post-body h2 {
  font-size: 1.2rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  color: var(--color-text);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.post-body h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.post-body p {
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 1rem;
  color: var(--color-text);
}

.post-body ul,
.post-body ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
  font-size: 0.95rem;
  line-height: 1.7;
}

.post-body li {
  margin-bottom: 0.25rem;
}

.post-body blockquote {
  border-left: 3px solid var(--color-accent);
  padding-left: 1rem;
  margin: 1.25rem 0;
  color: var(--color-text-secondary);
  font-style: italic;
}

.post-body code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85em;
  background: #f3f4f6;
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

.post-body pre {
  background: #f3f4f6;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.post-body pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.5;
}

.post-body img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  margin: 1rem 0;
  display: block;
}

.post-body video,
.post-body iframe {
  max-width: 100%;
  border-radius: 4px;
  margin: 1rem 0;
  display: block;
}

.post-body .katex-display {
  margin: 1.25rem 0;
  overflow-x: auto;
}

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

.post-body a:hover {
  color: var(--color-accent-hover);
}

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

/* Gallery page */

.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.gallery-grid img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
  border: 1px solid var(--color-border);
}

.gallery-empty {
  color: var(--color-text-secondary);
  font-size: 0.925rem;
}

@media (max-width: 680px) {
  .page {
    padding: 3.5rem 1.25rem 2rem;
  }

  .entry-header {
    flex-direction: column;
    gap: 0.15rem;
  }
}

@media (max-width: 480px) {
  .page {
    padding: 2.5rem 1rem 2rem;
  }

  h1 {
    font-size: 1.4rem;
  }

  h2 {
    margin-bottom: 1rem;
  }

  .tagline {
    font-size: 0.9rem;
  }

  .intro-photo {
    width: 60px;
    height: 60px;
  }

  .intro-row {
    gap: 1rem;
  }

  .social-links {
    gap: 1rem;
    font-size: 0.85rem;
  }

  .section {
    margin-bottom: 2.25rem;
  }

  .highlights {
    margin-bottom: 2.25rem;
    gap: 0.4rem;
  }

  .highlights li {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
  }

  .entry {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
  }

  .entry p {
    font-size: 0.875rem;
  }

  .gallery-link {
    font-size: 0.8rem;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .post-body h2 {
    font-size: 1.1rem;
  }

  .post-body p,
  .post-body ul,
  .post-body ol {
    font-size: 0.9rem;
  }

  .post-body pre {
    padding: 0.75rem;
    font-size: 0.8rem;
  }
}
