/* ── Reset & base ─────────────────────────────────────────────────────────── */

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

:root {
  --color-primary: #1e293b;
  --color-accent: #3b82f6;
  --color-text: #1e293b;
  --color-muted: #64748b;
  --color-bg: #ffffff;
  --color-border: #e2e8f0;
  --color-card-bg: #f8fafc;

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, Roboto, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Code', 'Source Code Pro', monospace;

  --max-width: 960px;
  --header-height: 64px;
}

html {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  text-decoration: underline;
}

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

/* ── Layout helpers ───────────────────────────────────────────────────────── */

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

/* ── Hero ─────────────────────────────────────────────────────────────────── */

.site-hero {
  background-color: var(--color-primary);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
}

/* Optional overlay — set via hero.overlay in config e.g. "rgba(0,0,0,0.35)" */
.site-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--hero-overlay, transparent);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  padding: 2rem 1.5rem;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
  line-height: 1.15;
}

.hero-tagline {
  margin-top: 0.625rem;
  color: rgba(255, 255, 255, 0.88);
  font-size: clamp(1rem, 2vw, 1.25rem);
}

/* ── Header & nav ─────────────────────────────────────────────────────────── */

.site-header {
  background: var(--color-primary);
  height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.2);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.site-name {
  font-size: 1.125rem;
  font-weight: 700;
  color: #ffffff;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.site-name:hover {
  text-decoration: none;
  opacity: 0.9;
}

.site-nav ul {
  display: flex;
  list-style: none;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.nav-pending #site-nav-links { visibility: hidden; }

.site-nav ul a {
  display: block;
  padding: 0.375rem 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9375rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.site-nav ul a:hover,
.site-nav ul a.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  text-decoration: none;
}

/* ── Hero nav overrides (light nav bar below hero) ────────────────────────── */

body.has-hero .site-header {
  background: var(--color-bg);
  box-shadow: 0 1px 0 var(--color-border);
}

body.has-hero .site-nav ul a {
  color: var(--color-muted);
}

body.has-hero .site-nav ul a:hover,
body.has-hero .site-nav ul a.active {
  background: var(--color-border);
  color: var(--color-text);
}

/* ── Main ─────────────────────────────────────────────────────────────────── */

.site-main {
  min-height: calc(100vh - var(--header-height) - 80px);
  padding-block: 3rem;
}

/* ── Footer ── (columns + colors defined further down) ───────────────────── */

/* ── Page content ─────────────────────────────────────────────────────────── */

.page-content,
.post-content {
  padding-block: 1rem;
}

.page-content h1,
.post-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1.5rem;
  color: var(--color-text);
}

/* ── Post header ──────────────────────────────────────────────────────────── */

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

.breadcrumb {
  font-size: 0.875rem;
  color: var(--color-muted);
  margin-bottom: 0.75rem;
}

.breadcrumb a {
  color: var(--color-muted);
}

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

.post-date {
  display: block;
  color: var(--color-muted);
  font-size: 0.9375rem;
  margin-top: 0.5rem;
}

/* ── Prose ────────────────────────────────────────────────────────────────── */

.prose {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--color-text);
}

.prose h1, .prose h2, .prose h3, .prose h4 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
  line-height: 1.3;
}

.prose h2 { font-size: 1.5rem; }
.prose h3 { font-size: 1.25rem; }
.prose h4 { font-size: 1.0625rem; }

.prose p { margin-bottom: 1.25rem; }

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

.prose li { margin-bottom: 0.375rem; }

.prose blockquote {
  border-left: 4px solid var(--color-accent);
  padding-left: 1rem;
  margin-left: 0;
  margin-bottom: 1.25rem;
  color: var(--color-muted);
  font-style: italic;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.prose pre {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  padding: 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 1.25rem;
}

.prose pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.9rem;
}

.prose img {
  border-radius: 8px;
  margin-block: 1.5rem;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.25rem;
  font-size: 0.9375rem;
}

.prose th, .prose td {
  text-align: left;
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--color-border);
}

.prose th {
  font-weight: 600;
  background: var(--color-card-bg);
}

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

/* ── News index ───────────────────────────────────────────────────────────── */

.news-index h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  margin-bottom: 2rem;
}

.news-grid {
  display: grid;
  gap: 1.5rem;
}

/* ── News card ────────────────────────────────────────────────────────────── */

.news-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.75rem 2rem;
  transition: box-shadow 0.2s, border-color 0.2s;
  position: relative; /* anchors the stretched title link below */
}

/* Make the whole card clickable: the title link's ::after covers the card.
   The category pill sits above it so it still goes to its own page. */
.card-title a::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
}

.card-category {
  position: relative;
  z-index: 1;
}

.news-card:focus-within {
  border-color: var(--color-accent);
}

.news-card:hover {
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.08);
  border-color: var(--color-accent);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--color-muted);
  margin-bottom: 0.5rem;
}

.card-category {
  background: var(--color-accent);
  color: #fff;
  padding: 0.125rem 0.625rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.625rem;
}

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

.card-title a:hover {
  color: var(--color-accent);
  text-decoration: none;
}

.card-excerpt {
  color: var(--color-muted);
  font-size: 0.9375rem;
  line-height: 1.6;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-link {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-accent);
}

/* ── Footer columns ───────────────────────────────────────────────────────── */

.site-footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  border-top: none;
  padding-block: 0;
}

.footer-inner {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.footer-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 2rem;
  padding-block: 2.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-col-title {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--footer-head);
  margin-bottom: 0.875rem;
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-col a {
  color: var(--footer-link);
  font-size: 0.9375rem;
  text-decoration: none;
  transition: opacity 0.15s;
}

.footer-col a:hover {
  opacity: 0.75;
  text-decoration: none;
}

.footer-copy {
  padding-block: 1.25rem;
  font-size: 0.875rem;
  color: var(--footer-text);
}

/* Single-line footer (no columns) */
.site-footer:not(:has(.footer-cols)) .footer-inner {
  padding-block: 1.5rem;
}

/* ── Error page ───────────────────────────────────────────────────────────── */

.error-page {
  text-align: center;
  padding-block: 4rem;
}

.error-page h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.error-page p {
  color: var(--color-muted);
  margin-bottom: 1.5rem;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .site-nav {
    gap: 1rem;
  }

  .site-nav ul {
    gap: 0;
  }

  .site-nav ul a {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
  }

  .news-card {
    padding: 1.25rem;
  }
}

/* ── Pagination ────────────────────────────────────────────────────────────── */

.pagination {
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 2.5rem 0 1.5rem;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.625rem 1.375rem;
  border: 1.5px solid var(--color-border);
  background: var(--color-bg);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.pagination-btn--prev {
  border-radius: 8px 0 0 8px;
  border-right: none;
}

.pagination-btn--next {
  border-radius: 0 8px 8px 0;
  border-left: none;
}

.pagination-btn:not(.pagination-btn--disabled):hover {
  background: var(--color-card-bg);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.pagination-btn--disabled {
  color: var(--color-muted);
  cursor: default;
  pointer-events: none;
}

.pagination-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3rem;
  padding: 0 0.875rem;
  background: var(--color-accent);
  border: 1.5px solid var(--color-accent);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
}
