:root {
  --max-width: 1120px;
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 40px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --bg: #f7f7fb;
  --surface: #ffffff;
  --ink: #1b1b1f;
  --muted: #5f6368;
  --border: #e3e5ef;
  --accent: #1d4ed8;
  --accent-dark: #15389f;
  --accent-soft: #e9efff;
  --success: #1a7f37;
  --warning: #fff4d6;
  --warning-border: #f0d48a;
  --error: #ffe4e4;
  --error-border: #f2b7b7;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font: 16px/1.6 var(--font);
  color: var(--ink);
  background: var(--bg);
}

a {
  color: inherit;
}

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

.skip-link {
  position: absolute;
  top: -40px;
  left: 16px;
  background: var(--accent);
  color: #fff;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  z-index: 999;
}

.skip-link:focus {
  top: 12px;
}

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

main {
  padding: var(--spacing-xl) 0;
}

.section {
  margin-bottom: var(--spacing-xl);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(247, 247, 251, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-lg);
  padding: var(--spacing-md) 0;
  flex-wrap: wrap;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
}

.site-brand span {
  color: var(--muted);
  font-weight: 500;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  align-items: center;
}

.nav-link {
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--muted);
}

.nav-link:hover,
.nav-link:focus {
  border-color: var(--border);
  background: var(--surface);
  color: var(--ink);
}

.hero {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 5vw, 48px);
  box-shadow: var(--shadow);
  display: grid;
  gap: var(--spacing-lg);
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin: 0;
}

.hero p {
  color: var(--muted);
  max-width: 720px;
}

.lede {
  color: var(--muted);
  font-size: 1.05rem;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}

.button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.button.primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.button.secondary {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-dark);
}

.grid {
  display: grid;
  gap: var(--spacing-md);
}

.grid.cols-3 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.grid.cols-4 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.metrics-grid {
  display: grid;
  gap: var(--spacing-md);
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.card {
  background: var(--surface);
  padding: var(--spacing-lg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(17, 24, 39, 0.03);
  display: grid;
  gap: var(--spacing-sm);
  text-decoration: none;
}

.card h3,
.card h4 {
  margin: 0;
}

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

.card .meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.8rem;
  font-weight: 600;
}

.search-box {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.search-box input[type='search'] {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-size: 1rem;
  background: var(--surface);
}

.notice {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.notice-warning {
  background: var(--warning);
  border: 1px solid var(--warning-border);
}

.notice-error {
  background: var(--error);
  border: 1px solid var(--error-border);
}

.sources {
  color: var(--muted);
}

.list-grid {
  display: grid;
  gap: var(--spacing-md);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.list-card h3 {
  margin: 0;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.breadcrumbs a {
  text-decoration: none;
  color: var(--muted);
}

.breadcrumbs span {
  color: var(--muted);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface, var(--bg, inherit));
}

.table-tools {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  align-items: center;
  margin-bottom: var(--spacing-sm);
}

.table-tools label {
  font-weight: 600;
}

.table-tools input[type='search'] {
  flex: 1 1 240px;
  min-width: 200px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font: inherit;
}

.table-clear {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.table-clear:disabled {
  cursor: default;
  opacity: 0.6;
}

.table-status {
  font-size: 0.9rem;
  color: var(--muted);
}

@media (max-width: 640px) {
  .table-tools {
    align-items: stretch;
  }

  .table-tools label,
  .table-tools input[type='search'],
  .table-status {
    flex: 1 1 100%;
  }
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  background: #f4f6ff;
  font-weight: 700;
}

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

.data-table caption {
  text-align: left;
  padding: 12px 14px;
  font-weight: 600;
}

.list-article {
  display: grid;
  gap: var(--spacing-lg);
}

.list-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.debug-box {
  margin-top: var(--spacing-lg);
  padding: var(--spacing-md);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
}

.related-links {
  display: grid;
  gap: var(--spacing-sm);
}

.related-links a {
  text-decoration: none;
}

.metric-card {
  display: grid;
  gap: var(--spacing-sm);
  padding: var(--spacing-lg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
}

.metric-card h3 {
  margin: 0;
}

.metric-unit {
  color: var(--muted);
  font-size: 0.9rem;
}

.metric-link {
  text-decoration: none;
  color: var(--accent-dark);
  font-weight: 600;
}

.footer {
  background: #0f172a;
  color: #e2e8f0;
  padding: var(--spacing-xl) 0;
}

.footer .container {
  display: grid;
  gap: var(--spacing-lg);
}

.footer-grid {
  display: grid;
  gap: var(--spacing-lg);
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.footer a {
  color: inherit;
  text-decoration: none;
}

.footer ul {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: grid;
  gap: 6px;
}

.footer-note {
  color: #cbd5f5;
  margin-top: 8px;
}

.footer small {
  color: #94a3b8;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.list-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  font-size: 0.9rem;
  color: var(--muted);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  align-items: center;
}

.filter-button {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--surface);
  cursor: pointer;
}

.filter-button[data-active='true'] {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

@media (max-width: 720px) {
  .container {
    padding: 0 var(--spacing-md);
  }

  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero {
    padding: var(--spacing-lg);
  }
}

/* ------------------------------------------------------------------
   1. CARD HOVER EFFECTS
   Makes cards feel interactive and explorable
   ------------------------------------------------------------------ */

.card,
.list-card {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
}

.card:hover,
.list-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.15);
  border-color: var(--accent);
}

/* Add arrow indicator on hover */
.card::after,
.list-card::after {
  position: absolute;
  right: 1.5rem;
  bottom: 1.5rem;
  font-size: 1.5rem;
  color: var(--accent);
  opacity: 0;
  transition: all 0.2s ease;
  pointer-events: none;
}

.card:hover::after,
.list-card:hover::after {
  opacity: 1;
  transform: translateX(4px);
}

/* Make meta badges more prominent on hover */
.card:hover .meta,
.list-card:hover .meta {
  background: var(--accent);
  color: white;
}


/* ------------------------------------------------------------------
   2. SPECIAL RANDOM BUTTON
   Makes the "Surprise me" button visually distinctive
   ------------------------------------------------------------------ */

.random-button {
  background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
  color: white;
  border: none;
  font-weight: 600;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.random-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
  background: linear-gradient(135deg, #7c3aed 0%, #db2777 100%);
}

/* Shimmer effect on hover */
.random-button::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: left 0.5s;
}

.random-button:hover::after {
  left: 100%;
}


/* ------------------------------------------------------------------
   3. IMPROVED META BADGES
   Makes update dates more prominent
   ------------------------------------------------------------------ */

.meta {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.25rem 0.625rem;
  background: var(--accent-soft);
  border-radius: 999px;
  transition: all 0.2s ease;
}


/* ------------------------------------------------------------------
   4. SEARCH BOX ENHANCEMENTS
   Makes search feel more inviting
   ------------------------------------------------------------------ */

.search-box {
  background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  transition: all 0.2s ease;
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--surface);
}

.search-box input[type='search'] {
  transition: all 0.2s ease;
}

.search-box input[type='search']:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

.search-box input[type='search']::placeholder {
  color: var(--muted);
  font-style: italic;
}


/* ------------------------------------------------------------------
   5. BUTTON IMPROVEMENTS
   Better visual hierarchy
   ------------------------------------------------------------------ */

.button {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 600;
}

.button.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.3);
}

.button.secondary:hover {
  transform: translateY(-1px);
  background: var(--accent-soft);
  border-color: var(--accent);
}

.button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}


/* ------------------------------------------------------------------
   6. HERO SECTION POLISH
   Makes hero more impactful
   ------------------------------------------------------------------ */

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}

.hero p {
  font-size: clamp(1.0625rem, 2vw, 1.1875rem);
  line-height: 1.6;
  color: var(--muted);
  max-width: 65ch;
}

.hero .tag {
  margin-bottom: 0.75rem;
}


/* ------------------------------------------------------------------
   7. SECTION HEADINGS
   More authority and clarity
   ------------------------------------------------------------------ */

.section h2 {
  font-size: clamp(1.75rem, 3.5vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 0.75rem;
}

.section .lede {
  font-size: 1.0625rem;
  line-height: 1.7;
  max-width: 70ch;
  margin-bottom: 1.5rem;
}


/* ------------------------------------------------------------------
   8. ACCESSIBILITY IMPROVEMENTS
   ------------------------------------------------------------------ */

/* Focus visible for keyboard navigation */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

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


/* ------------------------------------------------------------------
   9. MOBILE OPTIMIZATIONS
   ------------------------------------------------------------------ */

@media (max-width: 640px) {
  /* Stack buttons vertically on mobile */
  .button-group {
    flex-direction: column;
    width: 100%;
  }
  
  .button {
    width: 100%;
    justify-content: center;
  }
  
  /* Remove arrow on mobile (not enough space) */
  .card::after,
  .list-card::after {
    display: none;
  }
  
  /* Adjust hero spacing */
  .hero {
    padding: var(--spacing-lg);
  }
  
  .hero h1 {
    font-size: 2rem;
  }
}


/* ------------------------------------------------------------------
   10. PRINT STYLES
   Clean output for printing
   ------------------------------------------------------------------ */

@media print {
  .button,
  .search-box,
  #site-header,
  #site-footer {
    display: none;
  }
  
  .card,
  .list-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
  
  .hero {
    box-shadow: none;
  }
}

/* ------------------------------------------------------------------
   11. OPTIONAL: ADD THESE IF YOU WANT EXTRA POLISH
   ------------------------------------------------------------------ */

/* Subtle background pattern on hero */
.hero {
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(29, 78, 216, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.03) 0%, transparent 50%);
}

/* Fade-in animation on page load */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero,
.section {
  animation: fadeInUp 0.6s ease-out;
}

.section:nth-child(2) { animation-delay: 0.1s; }
.section:nth-child(3) { animation-delay: 0.2s; }
.section:nth-child(4) { animation-delay: 0.3s; }

/* Disable animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .hero,
  .section {
    animation: none;
  }
}
