/* Main stylesheet - layout, components, light/dark themes, and responsive breakpoints */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* --- CSS Variables (Light Theme) --- */
:root {
  /* Colors */
  --background:         #ffffff;
  --foreground:         #0f172a;
  --muted:              #f1f5f9;
  --muted-foreground:   #64748b;
  --border:             #e2e8f0;
  --accent:             #3b82f6;          /* light theme: blue */
  --accent-hover:       #2563eb;
  --secondary:          #f8fafc;
  --card:               #ffffff;
  --card-hover:         #f8fafc;
  --color-line:         #3b82f6;          /* colored lines: blue in light theme */

  /* Typography */
  --font-sans:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:          'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

  /* Dimensions */
  --max-width:          48rem;            /* 768px max content width */
  --nav-height:         4rem;
  --radius:             0.5rem;

  /* Shadows */
  --shadow-sm:          0 1px 2px rgba(0,0,0,0.06);
  --shadow:             0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
}

/* --- Dark Theme --- */
html.dark {
  --background:         #0f172a;
  --foreground:         #f1f5f9;
  --muted:              #1e293b;
  --muted-foreground:   #94a3b8;
  --border:             #1e293b;
  --accent:             #f97316;          /* dark theme: orange */
  --accent-hover:       #fb923c;
  --secondary:          #1e293b;
  --card:               #1e293b;
  --card-hover:         #253248;
  --color-line:         #f97316;          /* colored lines: orange in dark theme */
}

/* --- Reset & Base Styles --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* --- Skip to Content Link --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 4rem;
  z-index: 50;
  padding: 0.5rem 0.75rem;
  background: var(--background);
  color: var(--accent);
  border-radius: var(--radius);
  font-weight: 500;
  text-decoration: none;
  backdrop-filter: blur(8px);
  transition: top 0.2s;
}
.skip-link:focus { top: 1rem; }

/* --- Page Container --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .container { padding: 0; }
}

/* --- Header & Navigation --- */
header {
  position: static;       /* static position, not sticky */
  background: var(--background);
  transition: background-color 0.2s;
}

/* Colored header line */
.header-line-wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}
@media (min-width: 640px) {
  .header-line-wrap { padding: 0; }
}
.header-colorline {
  height: 1px;
  width: 100%;
}

#nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

@media (min-width: 640px) {
  #nav-container { flex-direction: row; }
}

#top-nav-wrap {
  position: relative;
  display: flex;
  width: 100%;
  align-items: baseline;
  justify-content: space-between;
  background: var(--background);
  padding: 1rem 0.5rem;  /* mobile: tighter side padding */
}

@media (min-width: 640px) {
  #top-nav-wrap {
    align-items: center;
    padding: 1.5rem 0;
  }
}

/* Site title / Logo */
.site-title {
  position: absolute;
  left: 0.5rem;   /* mobile: name aligned left */
  padding: 0.25rem 0;
  font-size: 1.5rem;
  line-height: 1.75rem;
  font-weight: 600;
  color: var(--foreground);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.025em;
}

@media (min-width: 640px) {
  .site-title {
    position: static;
    left: auto;
  }
}

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

/* Navigation menu */
#nav-menu {
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: center;
}

@media (min-width: 640px) {
  #nav-menu {
    flex-direction: row;
    justify-content: flex-end;
    margin-left: 0.5rem;
  }
}

/* Hamburger button */
#menu-btn {
  display: flex;
  align-self: flex-end;
  padding: 0.5rem 0;   /* flush to right edge */
  margin-right: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--foreground);
  border-radius: var(--radius);
}

@media (min-width: 640px) {
  #menu-btn { display: none; }
}

/* Menu item list */
#menu-items {
  display: none;
  margin-top: 1rem;
  width: 11rem;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  place-content: center;
}

#menu-items.open { display: grid; }

@media (min-width: 640px) {
  #menu-items {
    display: flex !important;
    width: auto;
    gap: 1.25rem;
    margin-top: 0;
    margin-left: 0;
  }
}

#menu-items li { list-style: none; grid-column: span 2; }
#menu-items li a {
  display: block;
  padding: 0.75rem 1rem;
  text-align: center;
  font-weight: 500;
  color: var(--foreground);
  text-decoration: none;
  border-radius: var(--radius);
  transition: color 0.15s;
}

@media (min-width: 640px) {
  #menu-items li a { padding: 0.25rem 0.5rem; }
}

#menu-items li a:hover,
#menu-items li a.active-nav {
  color: var(--accent);
}

/* Theme toggle + search - desktop only */
.nav-actions {
  display: none;  /* hidden on mobile */
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.5rem;
}
@media (min-width: 640px) {
  .nav-actions {
    display: flex;
    gap: 0;
    margin-left: 0;
  }
}

/* Search + theme toggle inside mobile sidebar */
.menu-actions-mobile {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  margin-top: 0.25rem;
  grid-column: span 2;
}
@media (min-width: 640px) {
  .menu-actions-mobile { display: none !important; }
}

/* Equal gap between nav links */
@media (min-width: 640px) {
  #nav-menu { gap: 0; }
  #menu-items { gap: 0 !important; }
  #menu-items li a { padding: 0.25rem 0.875rem; }
  .nav-actions { gap: 0; margin-left: 0; }
  .nav-actions .nav-btn { padding: 0.25rem 0.875rem; }
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--foreground);
  border-radius: var(--radius);
  transition: color 0.15s, transform 0.2s;
  text-decoration: none;
}

.nav-btn:hover {
  color: var(--accent);
  transform: rotate(6deg);
}

@media (min-width: 640px) {
  .nav-btn { padding: 0.25rem; }
}

.nav-btn svg {
  width: 1.5rem;
  height: 1.5rem;
}

/* --- Main Content Area --- */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* --- Home Page --- */
.home-header {
  padding: 2rem 1rem 3rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

@media (min-width: 640px) {
  .home-header { padding: 2rem 0 3rem; }
}

.home-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--foreground);
  margin-bottom: 1rem;
  letter-spacing: -0.025em;
}

.home-header p {
  color: var(--muted-foreground);
  font-size: 1rem;
  line-height: 1.75;
  max-width: 38rem;
}

.home-header p a {
  color: var(--foreground);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.15s;
}

.home-header p a:hover {
  text-decoration-color: var(--accent);
  color: var(--accent);
}

/* --- Post List (home) --- */
.posts-section {
  padding: 0 1rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

@media (min-width: 640px) {
  .posts-section { padding: 0; }
}

.posts-section h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Post card */
.post-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  transition: background 0.15s;
  text-decoration: none;
  color: inherit;
}

.post-card:last-child { border-bottom: 1px solid var(--border); }

@media (min-width: 640px) {
  .post-card {
    flex-direction: row;
    align-items: flex-start;
    gap: 1.5rem;
  }
}

.post-card-date {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  white-space: nowrap;
  min-width: 5.5rem;
  padding-top: 0.125rem;
}

.post-card-body { flex: 1; }

.post-card-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--foreground);
  line-height: 1.4;
  margin-bottom: 0.25rem;
  transition: color 0.15s;
}

.post-card:hover .post-card-title { color: var(--accent); }

.post-card-desc {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.5rem;
}

.tag-badge {
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
  background: var(--muted);
  color: var(--muted-foreground);
  border-radius: 9999px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.tag-badge:hover {
  background: var(--accent);
  color: white;
}

/* All posts link */
.all-posts-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 2rem;
  margin-bottom: 2rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  transition: gap 0.2s;
}

.all-posts-link:hover { gap: 0.625rem; }

/* --- Posts Archive Page --- */
.posts-list-header {
  padding: 2rem 1rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

@media (min-width: 640px) {
  .posts-list-header { padding: 2rem 0; }
}

.posts-list-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

/* Year groups */
.year-group { margin-bottom: 2rem; }

.year-heading {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 0.5rem;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .year-heading { padding: 0; }
}

/* --- Single Post Page --- */
.post-detail {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem 4rem;
}

@media (min-width: 640px) {
  .post-detail { padding: 0 0 4rem; }
}

.post-detail-header {
  padding: 2rem 0 1.5rem;
}

.post-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
}

.post-detail-title {
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--foreground);
  margin-bottom: 1rem;
}

@media (min-width: 640px) {
  .post-detail-title { font-size: 2.25rem; }
}

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

.post-meta-sep { opacity: 0.4; }

/* Cover image */
.post-cover {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin-bottom: 2rem;
  aspect-ratio: 2/1;
  object-fit: cover;
  background: var(--muted);
}

/* --- Article / Prose Content --- */
.prose {
  color: var(--foreground);
  line-height: 1.75;
  font-size: 1rem;
}

.prose h1, .prose h2, .prose h3, .prose h4 {
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--foreground);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  line-height: 1.3;
  scroll-margin-top: 5rem;
}

.prose h1 { font-size: 1.875rem; }
.prose h2 { font-size: 1.5rem; border-bottom: none; padding-bottom: 0; }
.prose h3 { font-size: 1.25rem; }
.prose h4 { font-size: 1.125rem; }

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

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
}

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

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

.prose ul { list-style-type: disc; }
.prose ol { list-style-type: decimal; }
.prose li { margin-bottom: 0.25rem; }

.prose blockquote {
  border-left: 4px solid var(--accent);
  padding: 0.5rem 1rem;
  margin: 1.5rem 0;
  background: var(--muted);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--muted-foreground);
  font-style: italic;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--muted);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  color: var(--foreground);
}

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

.prose pre code {
  background: none;
  padding: 0;
  font-size: 0.875rem;
  line-height: 1.7;
}
.prose pre { padding: 0; }
.prose pre .hljs { padding: 1rem 1.25rem; border-radius: var(--radius); font-size: 0.875rem; line-height: 1.7; }

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 1.5rem 0;
}

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

.prose strong { font-weight: 700; }
.prose em { font-style: italic; }

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.875rem;
}

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

.prose th {
  background: var(--muted);
  font-weight: 600;
}

/* YouTube embed wrapper */
.youtube-embed-container {
  margin: 2rem 0;
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
}

.youtube-embed-container iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: 0;
  border-radius: var(--radius);
}

/* --- Post Navigation (prev/next) --- */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.post-nav-link {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem;
  background: var(--secondary);
  border-radius: var(--radius);
  text-decoration: none;
  transition: background 0.15s;
}

.post-nav-link:hover { background: var(--muted); }
.post-nav-link.next { text-align: right; }

.post-nav-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.post-nav-link.next .post-nav-label { justify-content: flex-end; }

.post-nav-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
  line-height: 1.4;
}

/* --- About Page --- */
.about-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

@media (min-width: 640px) {
  .about-section { padding: 2rem 0 4rem; }
}

.about-section h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 2rem;
}

.about-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

.about-section p {
  color: var(--muted-foreground);
  margin-bottom: 1rem;
  line-height: 1.75;
}

.about-section a {
  color: var(--foreground);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: transparent;
  transition: all 0.15s;
}

.about-section a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* GitHub contribution graph */
.github-chart {
  background: transparent;
  padding: 0;
  margin-bottom: 1rem;
}

.github-chart img {
  width: 100%;
  height: auto;
  display: block;
}

/* Newsletter box */
.newsletter-box {
  background: var(--secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 2rem 0;
}

.newsletter-box p {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-bottom: 1rem;
}

.newsletter-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .newsletter-form { flex-direction: row; }
}

.newsletter-input {
  flex: 1;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.newsletter-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.newsletter-input::placeholder { color: var(--muted-foreground); }

.newsletter-btn {
  padding: 0.5rem 1.5rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.875rem;
  font-family: var(--font-sans);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.newsletter-btn:hover { background: var(--accent-hover); }

.newsletter-note {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.75rem;
}

/* --- Footer --- */
footer {
  margin-top: auto;
  width: 100%;
}

.footer-hr {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}
@media (min-width: 640px) {
  .footer-hr { padding: 0; }
}
.footer-hr hr {
  border: none;
  border-top: 1px solid var(--color-line);
  margin: 0;
  transition: border-color 0.3s;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1rem;
}

@media (min-width: 640px) {
  .footer-inner {
    flex-direction: row-reverse;
    padding: 1rem 0;
  }
}

.footer-social {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem;
}

.footer-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  color: var(--foreground);
  text-decoration: none;
  border-radius: var(--radius);
  transition: color 0.15s, transform 0.2s;
}

@media (min-width: 640px) {
  .footer-social a { padding: 0.25rem; }
}

.footer-social a:hover {
  color: var(--accent);
  transform: rotate(6deg);
}

.footer-social a svg {
  width: 1.75rem;
  height: 1.75rem;
}

@media (min-width: 640px) {
  .footer-social a svg {
    width: 1.625rem;
    height: 1.625rem;
  }
}

.footer-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.15rem;
  margin: 0.5rem 0;
}

@media (min-width: 640px) {
  .footer-copy {
    flex-direction: row;
    gap: 0.5rem;
  }
  .footer-copy span + span::before {
    content: '·';
    margin-right: 0.5rem;
    opacity: 0.4;
  }
}

.footer-copy a {
  color: var(--muted-foreground);
  text-decoration: none;
  font-size: 1rem;
  transition: color 0.15s;
}

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

/* --- Search Page --- */
.search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  align-items: flex-start;
  justify-content: center;
  padding-top: 5rem;
}

.search-overlay.open { display: flex; }

.search-box {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 36rem;
  margin: 0 1rem;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.search-input {
  flex: 1;
  background: none;
  border: none;
  font-size: 1rem;
  font-family: var(--font-sans);
  color: var(--foreground);
  outline: none;
}

.search-input::placeholder { color: var(--muted-foreground); }

.search-results {
  max-height: 20rem;
  overflow-y: auto;
}

.search-result-item {
  display: block;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: var(--foreground);
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.search-result-item:hover { background: var(--muted); }
.search-result-item:last-child { border-bottom: none; }

.search-result-title {
  font-weight: 500;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.search-result-desc {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.search-empty {
  padding: 2rem;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

/* --- Alert / Flash Messages --- */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

html.dark .alert-success { background: #052e16; color: #86efac; border-color: #14532d; }
html.dark .alert-error   { background: #450a0a; color: #fca5a5; border-color: #7f1d1d; }
html.dark .alert-info    { background: #0c1a3d; color: #93c5fd; border-color: #1e3a5f; }

/* --- Pagination --- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding: 2rem 0;
}

.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.75rem;
  font-size: 0.875rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  color: var(--foreground);
}

.pagination a:hover { background: var(--muted); }
.pagination .active { background: var(--accent); color: white; }
.pagination .disabled { opacity: 0.4; pointer-events: none; }

/* --- Loading Spinner --- */
.loading-spinner {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* --- View Transitions --- */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 180ms;
    animation-timing-function: cubic-bezier(0.76, 0, 0.24, 1);
  }

  ::view-transition-old(root) {
    animation-name: fade-out;
  }

  ::view-transition-new(root) {
    animation-name: fade-in;
  }

  @keyframes fade-out {
    from { opacity: 1; }
    to   { opacity: 0; }
  }

  @keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* --- Responsive utility classes --- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}

/* Mobile menu: search and theme icon vertical alignment fix */
.menu-actions-mobile a.nav-btn,
.menu-actions-mobile button.nav-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  padding: 0.5rem !important;
  line-height: 1;
  vertical-align: middle;
}
