@font-face {
  font-family: "Abril Fatface";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/abril-fatface-latin-ext-400.woff2") format("woff2");
}

@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/playfair-display-latin-ext-400.woff2") format("woff2");
}

@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/playfair-display-latin-ext-700.woff2") format("woff2");
}

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/nunito-latin-ext-400.woff2") format("woff2");
}

@font-face {
  font-family: "Courier Prime";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/courier-prime-latin-ext-400.woff2") format("woff2");
}

@font-face {
  font-family: "Courier Prime";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/courier-prime-latin-ext-700.woff2") format("woff2");
}

@font-face {
  font-family: "Special Elite";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/special-elite-latin-ext-400.woff2") format("woff2");
}

:root {
  --bg: #f4f0e8;
  --surface: #fffaf2;
  --border: #d9cdb8;
  --text: #2f2a24;
  --text-muted: #6f6256;
  --primary: #1f6a72;
  --accent: #b85c38;
  --code-bg: #efe4d4;
  --shadow: 0 10px 24px rgba(63, 42, 24, 0.1);
  --theme-toggle-bg: #fffaf2;
  --theme-toggle-text: #2f2a24;
  --bg-glow-1: rgba(31, 106, 114, 0.12);
  --bg-glow-2: rgba(184, 92, 56, 0.1);
  --font-title: "Abril Fatface", Georgia, "Times New Roman", serif;
  --font-heading: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-body: "Nunito", sans-serif;
  --font-meta: "Special Elite", "Courier New", Courier, monospace;
  --font-mono: "Courier Prime", "Courier New", Courier, monospace;
}

[data-theme="dark"] {
  --bg: #151a1e;
  --surface: #1f262c;
  --border: #33404a;
  --text: #e8e1d6;
  --text-muted: #b6ab9b;
  --primary: #73c2c8;
  --accent: #e08a66;
  --code-bg: #2a333b;
  --shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  --theme-toggle-bg: #1f262c;
  --theme-toggle-text: #e8e1d6;
  --bg-glow-1: rgba(115, 194, 200, 0.12);
  --bg-glow-2: rgba(224, 138, 102, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 10% 0%, var(--bg-glow-1), transparent 42%),
    radial-gradient(circle at 90% 100%, var(--bg-glow-2), transparent 40%);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.8;
  font-weight: 400;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 160ms ease;
}

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

.container {
  width: min(920px, calc(100% - 2rem));
  margin: 0 auto;
}

.blog-toolbar {
  display: flex;
  justify-content: flex-end;
  padding-top: 1rem;
}

.theme-toggle {
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: var(--theme-toggle-bg);
  color: var(--theme-toggle-text);
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: border-color 180ms ease, transform 180ms ease;
}

.theme-toggle:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

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

.theme-icon::before {
  content: "\263D";
  font-size: 1.05rem;
  line-height: 1;
  color: var(--primary);
}

[data-theme="dark"] .theme-icon::before {
  content: "\2600";
}

.hero {
  padding: 2rem 0 1.5rem;
}

.hero h1 {
  margin: 0 0 0.75rem;
  font-size: 2rem;
  line-height: 1.2;
  font-family: var(--font-title);
  font-weight: 700;
}

.hero p {
  margin: 0;
  color: var(--text-muted);
}

.topics-grid-section h2,
.posts-list-section h2 {
  margin: 0 0 1rem;
  font-size: 1.35rem;
  font-family: var(--font-heading);
  font-weight: 400;
}

.topics-grid {
  display: flex;
  flex-wrap: wrap;
  margin: -0.55rem -0.7rem 0;
}

.topic-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: calc(50% - 1.4rem);
  margin: 0.55rem 0.7rem;
  min-height: 84px;
}

/* Show a row divider only when there is more than one row of topics (2 columns). */
.topic-card:nth-child(n + 3) {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.topic-card h3 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.15;
  font-family: var(--font-heading);
  font-weight: 400;
}

.topic-card h3 a {
  color: var(--text);
  font-weight: 400;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

.topic-card h3 a:hover {
  color: var(--accent);
}

.topic-page-header {
  padding-top: 2rem;
  margin-bottom: 1.3rem;
}

.topic-page-header h1 {
  margin: 0.2rem 0 0.4rem;
  font-size: 1.95rem;
  line-height: 1.2;
  font-family: var(--font-title);
  font-weight: 700;
}

.topic-page-header p {
  margin: 0;
  color: var(--text-muted);
}

.topic-breadcrumb {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: var(--font-meta);
}

.posts-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.9rem;
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  transition: border-color 180ms ease, transform 180ms ease;
}

.post-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.post-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.08rem;
  font-family: var(--font-heading);
  font-weight: 700;
}

.post-date {
  margin: 0 0 0.55rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: var(--font-meta);
}

.footer {
  border-top: 1px solid var(--border);
  margin-top: 2.5rem;
  padding: 1rem 0 1.8rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-family: var(--font-meta);
}

.post-content {
  padding-top: 2rem;
}

.post-header h1 {
  margin: 0 0 0.4rem;
  font-size: 2rem;
  line-height: 1.2;
  font-family: var(--font-title);
  font-weight: 700;
}

.prose {
  margin-top: 1.5rem;
}

.prose h2,
.prose h3 {
  line-height: 1.3;
  margin-top: 1.6rem;
  font-family: var(--font-heading);
  font-weight: 700;
}

.prose h4,
.prose h5,
.prose h6 {
  font-family: var(--font-heading);
  font-weight: 700;
}

.prose code {
  background: var(--code-bg);
  border-radius: 4px;
  padding: 0.1rem 0.3rem;
  font-family: var(--font-mono);
  font-size: 14px;
}

.prose pre {
  background: var(--code-bg);
  border-radius: 8px;
  padding: 0.9rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 14px;
}

.prose pre code,
code,
pre {
  font-family: var(--font-mono);
  font-size: 14px;
}

.prose img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.post-back-link {
  margin-top: 2rem;
}

.posts-empty-note {
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .topic-card {
    width: 100%;
    margin: 0.45rem 0;
  }

  .topic-card:nth-child(n + 3) {
    border-top: 0;
    padding-top: 0;
  }

  .topic-card:nth-child(n + 2) {
    border-top: 1px solid var(--border);
    padding-top: 0.8rem;
  }

  .hero h1,
  .topic-page-header h1,
  .post-header h1 {
    font-size: 1.6rem;
  }

  .topic-card h3 {
    font-size: 1.6rem;
  }
}
