/* ===== Reset & Variables ===== */

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

:root {
  --primary: #c41e3a;
  --primary-hover: #a01830;
  --primary-subtle: #fde8ec;
  --accent: #8b1225;
  --accent-hover: #a01830;
  --accent-subtle: #fde8ec;
  --warm: #d4a017;
  --text: #2c2c2c;
  --text-secondary: #5a5a5a;
  --bg: #faf8f5;
  --bg-surface: #ffffff;
  --bg-hero: #c41e3a;
  --border: #e0dcd5;
  --border-light: #f0ede8;
  --max-width: 1100px;
  --content-width: 720px;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #f05a5a;
    --primary-hover: #f07070;
    --primary-subtle: #2e1a1a;
    --accent: #e88090;
    --accent-hover: #f090a0;
    --accent-subtle: #2e1a1a;
    --warm: #e8b83d;
    --text: #e0ddd8;
    --text-secondary: #9a9590;
    --bg: #121110;
    --bg-surface: #1c1b19;
    --bg-hero: #7a1020;
    --border: #2e2c28;
    --border-light: #232220;
  }
}

/* ===== Base ===== */

html {
  font-size: 18px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--primary-hover);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ===== Typography ===== */

h1, h2, h3, h4 {
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.25;
  color: var(--text);
}

h1 { font-size: 2.2rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.5rem; margin-top: 2.5rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.2rem; margin-top: 1.75rem; margin-bottom: 0.5rem; }

p {
  margin-bottom: 1.25rem;
}

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

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.86em;
  background: var(--border-light);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

pre {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

pre code {
  background: none;
  padding: 0;
}

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

/* ===== Header ===== */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}

.site-header nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.site-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

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

.site-logo {
  height: 40px;
  width: auto;
}

.nav-toggle-checkbox {
  display: none;
}

.nav-toggle-label {
  display: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
}

.nav-toggle-label span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  transition: transform 0.2s, opacity 0.2s;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links a {
  font-size: 0.88rem;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--primary);
}

/* ===== Hero ===== */

.hero {
  background: linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.55)), url('/images/hero.jpg') center/cover no-repeat;
  color: #ffffff;
  padding: 3rem 1.5rem;
  text-align: center;
}

.hero-content {
  max-width: var(--content-width);
  margin: 0 auto;
}

.hero h1 {
  font-size: 2.4rem;
  color: #ffffff;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
  font-size: 1.05rem;
  opacity: 0.92;
  line-height: 1.6;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* ===== Sections ===== */

.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.section-title {
  font-size: 1.6rem;
  margin-bottom: 1.5rem;
  margin-top: 0;
}

.section-more {
  text-align: center;
  margin-top: 2rem;
}

.more-link {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: background 0.2s, color 0.2s;
}

.more-link:hover {
  background: var(--primary);
  color: #ffffff;
}

/* ===== Article Grid ===== */

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

/* ===== Article Card ===== */

.article-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.article-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.card-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card-category {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.card-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  line-height: 1.35;
  margin-bottom: 0.5rem;
  margin-top: 0;
}

.card-title a {
  color: var(--text);
}

.card-title a:hover {
  color: var(--primary);
}

.card-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 0.75rem;
}

.card-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: auto;
  padding-top: 1rem;
}

/* ===== Category Grid ===== */

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.category-card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s, transform 0.2s;
}

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

.category-name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.category-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* ===== Terms Grid ===== */

.terms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.term-card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s;
}

.term-card:hover {
  border-color: var(--primary);
}

.term-name {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.term-count {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* ===== List Page ===== */

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

.list-page h1 {
  margin-bottom: 1.5rem;
}

/* ===== Breadcrumbs ===== */

.breadcrumbs {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 1rem 1.5rem 0;
}

.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.breadcrumbs li:not(:last-child)::after {
  content: "/";
  margin-left: 0.4rem;
  color: var(--border);
}

.breadcrumbs a {
  color: var(--text-secondary);
}

.breadcrumbs a:hover {
  color: var(--primary);
}

/* ===== Article Single ===== */

.article {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
}

.article-header {
  margin-bottom: 2rem;
}

.article-categories {
  margin-bottom: 0.75rem;
}

.category-label {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.category-label:hover {
  color: var(--accent-hover);
}

.article-header h1 {
  font-size: 2.4rem;
  margin-bottom: 0.75rem;
}

.article-meta {
  font-size: 0.88rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sep {
  opacity: 0.5;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.tag {
  display: inline-block;
  font-size: 0.78rem;
  padding: 0.2rem 0.65rem;
  background: var(--primary-subtle);
  color: var(--primary);
  border-radius: 100px;
  transition: background 0.2s;
}

.tag:hover {
  background: var(--primary);
  color: #ffffff;
}

.article-content {
  margin-top: 2rem;
}

.article-content h2 {
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.5rem;
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.92rem;
  overflow-x: auto;
  display: block;
}

.article-content thead {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.article-content tbody {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.article-content th {
  text-align: left;
  font-weight: 600;
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}

.article-content td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.article-content tbody tr:hover {
  background: var(--primary-subtle);
}

@media (max-width: 480px) {
  .article-content table {
    font-size: 0.82rem;
  }

  .article-content th,
  .article-content td {
    padding: 0.45rem 0.5rem;
  }
}

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

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

/* ===== Author Bio ===== */

.author-bio {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.author-name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.author-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* ===== Footer ===== */

.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  margin-top: 4rem;
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem 2rem;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1.5fr;
  gap: 2rem;
}

.footer-site-name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.footer-tagline {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.footer-heading {
  font-weight: 600;
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.footer-nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.footer-nav a {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.footer-nav a:hover {
  color: var(--primary);
}

.footer-author p:last-child {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.footer-bottom {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.rss-link {
  color: var(--text-secondary);
}

.rss-link:hover {
  color: var(--primary);
}

/* ===== 404 Page ===== */

.error-page {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 5rem 1.5rem;
  text-align: center;
}

.error-page h1 {
  font-size: 5rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

.error-page p {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.error-page a {
  color: var(--primary);
  font-weight: 600;
}

/* ===== Mobile ===== */

@media (max-width: 768px) {
  html {
    font-size: 16px;
  }

  .nav-toggle-label {
    display: flex;
  }

  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0;
    padding-top: 0.75rem;
  }

  .nav-toggle-checkbox:checked ~ .nav-links {
    display: flex;
  }

  .nav-links a {
    padding: 0.6rem 0;
    border-top: 1px solid var(--border-light);
  }

  .hero {
    padding: 2.5rem 1.5rem;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .article-header h1 {
    font-size: 1.8rem;
  }

  .article-grid {
    grid-template-columns: 1fr;
  }

  .category-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .category-grid {
    grid-template-columns: 1fr;
  }
}
