/* === technikheim.de — Stylesheet v2 === */
/* Redesign: Modern tech-savvy niche site */

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

:root {
  --color-bg: #F8FAFC;
  --color-surface: #FFFFFF;
  --color-text: #0F172A;
  --color-text-secondary: #475569;
  --color-text-muted: #94A3B8;
  --color-accent: #2563EB;
  --color-accent-hover: #1D4ED8;
  --color-accent-light: #EFF6FF;
  --color-accent-glow: rgba(37, 99, 235, 0.12);
  --color-border: #E2E8F0;
  --color-border-light: #F1F5F9;
  --color-code-bg: #F1F5F9;
  --color-footer-bg: #0F172A;
  --color-footer-surface: #1E293B;
  --color-footer-text: #CBD5E1;
  --color-footer-muted: #64748B;
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, monospace;
  --max-width: 1200px;
  --content-width: 720px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.08), 0 4px 8px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 40px rgba(15, 23, 42, 0.1), 0 8px 16px rgba(15, 23, 42, 0.05);
  --shadow-blue: 0 8px 24px rgba(37, 99, 235, 0.15);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --transition: 250ms var(--ease-out-quart);
  --transition-fast: 150ms var(--ease-out-quart);
}

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

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Grain overlay */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.02;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px;
}

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

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

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

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

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
  text-wrap: balance;
  line-height: 1.2;
}

p {
  text-wrap: pretty;
}

/* --- Scroll fade-in animation --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  opacity: 0;
  animation: fadeInUp 0.5s var(--ease-out-quart) forwards;
}

.fade-in.visible {
  opacity: 1;
}

/* Stagger children */
.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 60ms; }
.stagger-children > *:nth-child(3) { animation-delay: 120ms; }
.stagger-children > *:nth-child(4) { animation-delay: 180ms; }
.stagger-children > *:nth-child(5) { animation-delay: 240ms; }
.stagger-children > *:nth-child(6) { animation-delay: 300ms; }
.stagger-children > *:nth-child(7) { animation-delay: 360ms; }
.stagger-children > *:nth-child(8) { animation-delay: 420ms; }
.stagger-children > *:nth-child(9) { animation-delay: 480ms; }

/* --- Reading progress bar --- */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--color-accent);
  z-index: 200;
  width: 0%;
  transition: width 100ms linear;
}

/* --- Header --- */
.site-header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(226, 232, 240, 0.6);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--color-text);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.3rem;
  text-decoration: none;
  letter-spacing: -0.02em;
  transition: color var(--transition-fast);
}

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

.logo-icon {
  font-size: 1.5rem;
  display: flex;
  align-items: center;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

.nav-list {
  display: flex;
  list-style: none;
  gap: 0.125rem;
}

.nav-list a {
  display: block;
  padding: 0.5rem 0.75rem;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  transition: background var(--transition-fast), color var(--transition-fast);
  position: relative;
}

.nav-list a::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--color-accent);
  border-radius: 1px;
  transition: width var(--transition), left var(--transition);
}

.nav-list a:hover {
  color: var(--color-accent);
  background: transparent;
}

.nav-list a:hover::after {
  width: calc(100% - 1.5rem);
  left: 0.75rem;
}

/* --- Hero --- */
.hero {
  position: relative;
  padding: 6rem 0 5rem;
  text-align: center;
  overflow: hidden;
  background: linear-gradient(175deg, #FFFFFF 0%, #F0F4FF 50%, var(--color-bg) 100%);
}

/* Circuit/grid pattern */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    /* Dot grid */
    radial-gradient(circle, rgba(37, 99, 235, 0.08) 1px, transparent 1px),
    /* Horizontal lines */
    linear-gradient(0deg, transparent 49.5%, rgba(37, 99, 235, 0.04) 49.5%, rgba(37, 99, 235, 0.04) 50.5%, transparent 50.5%),
    /* Vertical lines */
    linear-gradient(90deg, transparent 49.5%, rgba(37, 99, 235, 0.04) 49.5%, rgba(37, 99, 235, 0.04) 50.5%, transparent 50.5%);
  background-size: 32px 32px, 32px 32px, 32px 32px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 30%, transparent 70%);
}

/* Circuit trace decoration */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='400' height='400' viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M50 200 H150 L170 180 H250' stroke='%232563EB' stroke-width='1' fill='none' opacity='0.06'/%3E%3Ccircle cx='250' cy='180' r='3' fill='%232563EB' opacity='0.08'/%3E%3Cpath d='M300 100 V180 L320 200 H380' stroke='%232563EB' stroke-width='1' fill='none' opacity='0.06'/%3E%3Ccircle cx='380' cy='200' r='3' fill='%232563EB' opacity='0.08'/%3E%3Cpath d='M100 350 H180 L200 330 V280' stroke='%232563EB' stroke-width='1' fill='none' opacity='0.05'/%3E%3Ccircle cx='200' cy='280' r='3' fill='%232563EB' opacity='0.07'/%3E%3Cpath d='M320 300 L340 280 V220' stroke='%232563EB' stroke-width='1' fill='none' opacity='0.05'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 400px;
  opacity: 0.7;
  pointer-events: none;
}

.hero .container {
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-size: clamp(2.25rem, 5.5vw, 3.75rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  max-width: 720px;
  margin: 0 auto 1.5rem;
  color: var(--color-text);
}

.hero .highlight {
  color: var(--color-accent);
  position: relative;
}

.hero-sub {
  font-size: 1.1875rem;
  color: var(--color-text-secondary);
  max-width: 560px;
  margin: 0 auto 2rem;
  line-height: 1.65;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: 0.5rem 1.125rem;
  border-radius: 100px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  box-shadow: var(--shadow-sm);
}

.hero-badge .badge-accent {
  color: var(--color-accent);
  font-weight: 700;
}

/* --- Sections --- */
.section-title {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.section-desc {
  color: var(--color-text-secondary);
  margin-bottom: 2.5rem;
  font-size: 1.0625rem;
}

.categories-section,
.featured-section,
.latest-section {
  padding: 4rem 0;
}

.featured-section {
  background: var(--color-surface);
}

/* --- Category Grid (Homepage) --- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}

.category-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.75rem 1.5rem;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
  border: 1px solid transparent;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  position: relative;
  overflow: hidden;
}

.category-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--color-accent);
  opacity: 0;
  transition: opacity var(--transition);
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), 0 4px 16px rgba(37, 99, 235, 0.08);
  color: var(--color-text);
  border-color: rgba(37, 99, 235, 0.1);
}

.category-card:hover::before {
  opacity: 1;
}

.category-icon {
  font-size: 2.25rem;
  line-height: 1;
}

.category-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
}

.category-desc-text {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.category-count {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-accent);
  background: var(--color-accent-light);
  padding: 0.25rem 0.625rem;
  border-radius: 100px;
  width: fit-content;
}

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

.article-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid transparent;
  position: relative;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.article-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-accent);
  opacity: 0;
  transition: opacity var(--transition);
}

.card-visual {
  height: 180px;
  position: relative;
  overflow: hidden;
}

.card-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.article-card:hover .card-visual img {
  transform: scale(1.05);
}

.card-body {
  padding: 1.5rem 1.75rem 1.75rem;
}

.article-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), 0 4px 16px rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.08);
}

.article-card:hover::before {
  opacity: 1;
}

.article-card:hover .card-arrow {
  opacity: 1;
  transform: translateX(0);
}

.card-link {
  display: flex;
  flex-direction: column;
  color: var(--color-text);
  text-decoration: none;
  height: 100%;
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.card-category {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-accent);
  background: var(--color-accent-light);
  padding: 0.25rem 0.625rem;
  border-radius: 100px;
  margin-bottom: 0.875rem;
  width: fit-content;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: 0.75rem;
}

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

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.card-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-accent-light);
  color: var(--color-accent);
  font-size: 0.875rem;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity var(--transition), transform var(--transition);
  flex-shrink: 0;
}

/* --- Breadcrumb --- */
.breadcrumb {
  padding: 1.5rem 0 0;
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  gap: 0.25rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.breadcrumb li:not(:last-child)::after {
  content: '/';
  margin-left: 0.375rem;
  color: var(--color-border);
}

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

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

/* --- Article Page --- */
.article-page {
  padding-bottom: 4rem;
}

/* Article layout with sticky TOC sidebar */
.article-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  max-width: calc(var(--content-width) + 280px + 3rem);
  margin: 0 auto;
}

@media (min-width: 1080px) {
  .article-layout {
    grid-template-columns: 1fr 240px;
  }
}

.article-content {
  max-width: var(--content-width);
  min-width: 0;
}

.article-sidebar {
  display: none;
}

@media (min-width: 1080px) {
  .article-sidebar {
    display: block;
    position: relative;
  }

  .article-sidebar .toc-sticky {
    position: sticky;
    top: 84px;
  }

  /* Hide inline TOC when sidebar is visible */
  .toc-inline {
    display: none;
  }
}

/* --- Article Hero (image banner) --- */
.article-hero {
  padding: 4rem 1.5rem 3.5rem;
  color: #fff;
  position: relative;
  overflow: hidden;
  min-height: 280px;
  display: flex;
  align-items: flex-end;
}

.article-hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.article-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.25) 60%, rgba(0,0,0,0.1) 100%);
  z-index: 1;
  pointer-events: none;
}

.article-hero-inner {
  max-width: 720px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
  width: 100%;
}

.article-hero .article-category-tag a {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.18);
  padding: 0.3rem 0.875rem;
  border-radius: 100px;
  margin-bottom: 1.25rem;
  transition: background var(--transition-fast);
  text-decoration: none;
}

.article-hero .article-category-tag a:hover {
  background: rgba(255, 255, 255, 0.28);
}

.article-hero h1 {
  font-size: clamp(1.875rem, 4.5vw, 2.75rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin-bottom: 1.25rem;
  color: #fff;
}

.article-hero .article-meta {
  display: flex;
  gap: 1.5rem;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.75);
}

/* Legacy fallback */
.article-header {
  padding: 2.5rem 0 2rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--color-border-light);
}

.article-category-tag a {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-accent);
  background: var(--color-accent-light);
  padding: 0.3rem 0.875rem;
  border-radius: 100px;
  margin-bottom: 1.25rem;
  transition: background var(--transition-fast);
}

.article-category-tag a:hover {
  background: rgba(37, 99, 235, 0.12);
}

.article-header h1 {
  font-size: clamp(1.875rem, 4.5vw, 2.75rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin-bottom: 1.25rem;
}

.article-meta {
  display: flex;
  gap: 1.5rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* --- Table of Contents --- */
.toc {
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2.5rem;
}

.toc-title {
  font-family: var(--font-heading);
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: 0.875rem;
}

.toc-list {
  list-style: none;
  counter-reset: toc;
}

.toc-list li {
  counter-increment: toc;
}

.toc-list li::before {
  content: counter(toc) ".";
  color: var(--color-accent);
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 0.5rem;
  font-family: var(--font-mono);
}

.toc-list a {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  line-height: 2;
  transition: color var(--transition-fast);
}

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

.toc-level-3 {
  padding-left: 1.5rem;
}

/* Sidebar TOC styling */
.toc-sticky .toc-title {
  font-size: 0.6875rem;
}

.toc-sticky .toc-list a {
  font-size: 0.8125rem;
  line-height: 1.8;
}

/* --- Prose (Article Body) --- */
.prose h1 {
  font-family: var(--font-heading);
  font-size: 2.25rem;
  font-weight: 800;
  margin: 3rem 0 1.25rem;
  line-height: 1.15;
}

.prose h2 {
  font-family: var(--font-heading);
  font-size: 1.625rem;
  font-weight: 700;
  margin: 3rem 0 1rem;
  line-height: 1.25;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-accent-light);
}

.prose h3 {
  font-family: var(--font-heading);
  font-size: 1.3125rem;
  font-weight: 600;
  margin: 2.25rem 0 0.75rem;
  line-height: 1.3;
}

.prose h4 {
  font-family: var(--font-heading);
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 1.75rem 0 0.5rem;
}

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

.prose a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(37, 99, 235, 0.3);
  transition: text-decoration-color var(--transition-fast);
}

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

.prose ul, .prose ol {
  margin: 0 0 1.375rem 1.5rem;
}

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

.prose blockquote {
  border-left: 3px solid var(--color-accent);
  padding: 1rem 1.5rem;
  margin: 2rem 0;
  background: var(--color-accent-light);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.prose blockquote p {
  margin: 0;
  color: var(--color-text-secondary);
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--color-code-bg);
  padding: 0.2em 0.45em;
  border-radius: 5px;
  font-weight: 500;
}

.prose pre {
  margin: 2rem 0;
  padding: 1.5rem;
  background: #0F172A;
  color: #E2E8F0;
  border-radius: var(--radius-lg);
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.7;
  box-shadow: var(--shadow-lg);
}

.prose pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
  font-weight: 400;
}

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

.prose strong {
  font-weight: 600;
}

.prose figure {
  margin: 2.5rem 0;
}

.prose figcaption {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: 0.625rem;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 2rem 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

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

.prose th {
  background: var(--color-accent);
  color: #FFFFFF;
  font-family: var(--font-heading);
  font-weight: 600;
  text-align: left;
  padding: 0.875rem 1.25rem;
  white-space: nowrap;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.prose th:first-child {
  border-radius: var(--radius-lg) 0 0 0;
}

.prose th:last-child {
  border-radius: 0 var(--radius-lg) 0 0;
}

.prose td {
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--color-border-light);
}

.prose tr:nth-child(even) td {
  background: #F8FAFC;
}

.prose tr:last-child td {
  border-bottom: none;
}

.prose tr:last-child td:first-child {
  border-radius: 0 0 0 var(--radius-lg);
}

.prose tr:last-child td:last-child {
  border-radius: 0 0 var(--radius-lg) 0;
}

/* --- Related Articles --- */
.related-articles {
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: 1px solid var(--color-border);
  max-width: var(--max-width);
}

.related-articles h2 {
  font-family: var(--font-heading);
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.related-articles .article-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

/* --- Category Page --- */
.category-page {
  padding-bottom: 4rem;
}

.category-header {
  text-align: center;
  padding: 3.5rem 0;
}

.category-icon-large {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 1.25rem;
}

.category-header h1 {
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 0.875rem;
}

.category-desc {
  color: var(--color-text-secondary);
  max-width: 560px;
  margin: 0 auto 1.25rem;
  font-size: 1.0625rem;
}

.category-article-count {
  display: inline-flex;
  align-items: center;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-accent);
  background: var(--color-accent-light);
  padding: 0.375rem 0.875rem;
  border-radius: 100px;
}

/* --- Static Pages --- */
.static-page {
  padding: 2rem 0 4rem;
}

.static-page .article-content {
  max-width: var(--content-width);
  margin: 0 auto;
}

.static-page h1 {
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 2rem;
}

/* --- Back to top --- */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #FFFFFF;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: var(--shadow-md), 0 2px 8px rgba(37, 99, 235, 0.25);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--transition), transform var(--transition), background var(--transition-fast);
  z-index: 50;
  pointer-events: none;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--color-accent-hover);
  transform: translateY(-2px);
}

/* --- Footer --- */
.site-footer {
  background: var(--color-footer-bg);
  padding: 4rem 0 2rem;
  margin-top: 3rem;
  color: var(--color-footer-text);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-brand .logo {
  color: #FFFFFF;
  margin-bottom: 0.75rem;
}

.footer-brand .logo:hover {
  color: var(--color-accent);
}

.footer-brand p {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--color-footer-muted);
  line-height: 1.65;
}

.footer-links h4 {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-footer-muted);
  margin-bottom: 1.25rem;
}

.footer-links ul {
  list-style: none;
}

.footer-links a {
  display: block;
  padding: 0.3rem 0;
  color: var(--color-footer-text);
  font-size: 0.875rem;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: #FFFFFF;
}

.footer-newsletter h4 {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-footer-muted);
  margin-bottom: 1.25rem;
}

.footer-newsletter p {
  font-size: 0.875rem;
  color: var(--color-footer-muted);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.newsletter-form {
  display: flex;
  gap: 0.5rem;
}

.newsletter-form input {
  flex: 1;
  padding: 0.625rem 0.875rem;
  background: var(--color-footer-surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  color: #FFFFFF;
  font-family: var(--font-body);
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

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

.newsletter-form input:focus {
  border-color: var(--color-accent);
}

.newsletter-form button {
  padding: 0.625rem 1rem;
  background: var(--color-accent);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast);
  white-space: nowrap;
}

.newsletter-form button:hover {
  background: var(--color-accent-hover);
}

.footer-bottom {
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.8125rem;
  color: var(--color-footer-muted);
}

.footer-bottom p {
  margin-bottom: 0.5rem;
}

.affiliate-notice {
  font-size: 0.75rem;
  color: var(--color-footer-muted);
  opacity: 0.7;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  .nav-list {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    padding: 0.75rem 1.5rem 1rem;
    box-shadow: var(--shadow-xl);
  }

  .nav-list.open {
    display: flex;
  }

  .nav-list a {
    padding: 0.875rem 0;
    font-size: 1rem;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .nav-list a::after {
    display: none;
  }

  .hero {
    padding: 3.5rem 0 3rem;
  }

  .hero h1 {
    font-size: clamp(1.75rem, 7vw, 2.25rem);
  }

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

  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

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

  .breadcrumb {
    padding-top: 1rem;
  }

  .article-header h1,
  .article-hero h1 {
    font-size: 1.625rem;
  }

  .article-hero {
    padding: 2.5rem 1.25rem 2rem;
  }

  .prose h2 { font-size: 1.3125rem; }
  .prose h3 { font-size: 1.125rem; }

  .back-to-top {
    bottom: 1.25rem;
    right: 1.25rem;
  }

  .section-title {
    font-size: 1.5rem;
  }

  .categories-section,
  .featured-section,
  .latest-section {
    padding: 3rem 0;
  }
}

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

  .hero-sub {
    font-size: 1rem;
  }

  .card-body {
    padding: 1.375rem;
  }

  .toc {
    padding: 1.25rem;
  }

  .newsletter-form {
    flex-direction: column;
  }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  .fade-in {
    opacity: 1;
  }

  .reading-progress {
    transition: none;
  }
}

/* --- Print --- */
@media print {
  .site-header, .site-footer, .toc, .related-articles, .nav-toggle, .reading-progress, .back-to-top {
    display: none;
  }

  .article-content {
    max-width: 100%;
  }

  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }

  body::before {
    display: none;
  }
}
