/* ===== THEME VARIABLES ===== */
:root {
  --bg-primary: #f5f2eb;
  --bg-secondary: #ffffff;
  --bg-tertiary: #faf7f0;
  --text-primary: #2c2825;
  --text-secondary: #5a564f;
  --text-muted: #8b857a;
  --border-primary: #e6e1d6;
  --border-secondary: #f0ebe0;
  --shadow-light: rgba(44, 40, 37, 0.08);
  --shadow-medium: rgba(44, 40, 37, 0.12);
  --shadow-heavy: rgba(44, 40, 37, 0.16);
  --accent-primary: #17261e;
  --accent-secondary: #5a564f;
  --success-primary: #2c2825;
  --success-secondary: #5a564f;
  --gradient-header: #558b6e;
  --gradient-featured: #2c2825;
  --highlight-bg: #f5f2eb;
  --highlight-text: #2c2825;
  --extra-dk-blue: #001427;
}

[data-theme='dark'] {
  --bg-primary: #17261e;
  --bg-secondary: #001427;
  --bg-tertiary: #558b6e;
  --text-primary: #f5f2eb;
  --text-secondary: #d0cac0;
  --text-muted: #a69d94;
  --border-primary: #4a453b;
  --border-secondary: #544f45;
  --shadow-light: rgba(0, 0, 0, 0.2);
  --shadow-medium: rgba(0, 0, 0, 0.3);
  --shadow-heavy: rgba(0, 0, 0, 0.4);
  --accent-primary: #558b6e;
  --accent-secondary: #81b197;
  --success-primary: #8b7355;
  --success-secondary: #81b197;
  --gradient-header: #273f32;
  --gradient-featured: #8b7355;
  --highlight-bg: #4a453b;
  --highlight-text: #f5f2eb;
  --extra-dk-blue: #001427;
}

/* ===== RESET AND BASE STYLES ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  background-image:
    radial-gradient(circle at 20% 80%, rgba(44, 40, 37, 0.02) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(44, 40, 37, 0.02) 0%, transparent 50%);
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

h1 {
  font-size: 2rem;
  line-height: 1.2;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== LAYOUT COMPONENTS ===== */
/* Main content */
.site-content {
  min-height: calc(100vh - 200px);
  padding: 3rem 0;
  position: relative;
  z-index: 1;
}

/* ===== FEATURED SECTION ===== */
/* Featured Section */
.featured-section {
  margin: 2rem 0 3rem 0;
  display: flex;
  justify-content: center;
}

.featured-card {
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 2.5rem 3rem;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 16px var(--shadow-light);
  max-width: 450px;
  width: 100%;
  border: 1px solid var(--border-primary);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.featured-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px var(--shadow-medium);
}

.featured-card h2 {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.featured-card p {
  margin-bottom: 2rem;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.5;
}

.featured-btn {
  background: var(--accent-primary);
  border: 2px solid var(--accent-primary);
  color: var(--text-primary);
  padding: 0.875rem 2rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  letter-spacing: 0.01em;
  min-width: 160px;
}

[data-theme='light'] .featured-btn {
  color: #ffffff;
}

[data-theme='dark'] .featured-btn {
  color: #ffffff;
}

.featured-btn:hover {
  background: var(--accent-secondary);
  border-color: var(--accent-secondary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-medium);
}

.featured-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ===== YEAR LISTING AND CARDS ===== */
/* Years grid */
.years-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.year-card {
  background: var(--bg-secondary);
  border-radius: 8px;
  box-shadow: 0 2px 4px var(--shadow-light);
  overflow: hidden;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.year-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--shadow-medium);
}

.year-link {
  display: block;
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
}

.year-card h2 {
  font-size: 1.8rem;
  color: var(--accent-primary);
  margin-bottom: 0.5rem;
}

.year-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ===== INDIVIDUAL YEAR PAGES ===== */
/* Year content page */
.year-content {
  max-width: 800px;
  margin: 0 auto;
  background: var(--bg-secondary);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px var(--shadow-light);
}

.year-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-secondary);
}

.year-header-top {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 0.5rem;
}

.year-header h1 {
  font-size: 3rem;
  color: var(--accent-primary);
  margin-bottom: 0.5rem;
  line-height: 1.1;
}

.year-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.year-body {
  margin-bottom: 2rem;
}

.year-body h1 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-size: 2rem;
  line-height: 1.2;
}

.year-body ul {
  list-style: none;
  padding: 0;
}

/* ===== NAVIGATION COMPONENTS ===== */
/* Navigation */
.year-navigation {
  border-top: 2px solid var(--border-secondary);
  padding-top: 1rem;
}

.nav-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.nav-link {
  padding: 0.5rem 1rem;
  background: var(--accent-primary);
  color: white;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.nav-link:hover {
  background: var(--accent-secondary);
}

.nav-link.home {
  background: var(--success-primary);
}

.nav-link.home:hover {
  background: var(--success-secondary);
}

/* Favorites feature */
.favorite-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 2rem;
  width: 2rem;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px var(--shadow-light);
}

.favorite-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-secondary);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px var(--shadow-light);
}

.favorite-btn.active {
  background: var(--accent-primary);
  color: var(--bg-primary);
  border-color: var(--accent-primary);
}

.favorite-btn.active:hover {
  background: var(--accent-secondary);
  border-color: var(--accent-secondary);
}

.favorites-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.favorite-link {
  padding: 0.4rem 0.8rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.favorite-link:hover {
  background: var(--accent-primary);
  color: white;
}

.favorites-empty {
  font-style: italic;
  color: var(--text-secondary);
}

/* Scroll to top button */
.scroll-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #ffffff;
  font-size: 1.5rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px var(--shadow-medium);
  z-index: 1000;
}

.scroll-to-top.show {
  display: flex;
}

.scroll-to-top:hover {
  background: var(--accent-secondary);
}

/* ===== SEARCH COMPONENT ===== */
.search-container {
  position: relative;
  width: 100%;
  max-width: 400px;
}

.search-box {
  position: relative;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 2.5rem;
  border: 2px solid var(--border-primary);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(85, 139, 110, 0.1);
}

.search-speech-btn {
  position: absolute;
  left: 0.75rem;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-secondary);
  cursor: pointer;
  z-index: 2;
}

.search-clear {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  z-index: 2;
}

.search-clear:hover {
  color: var(--text-primary);
}

.search-spinner {
  position: absolute;
  right: 0.75rem;
  font-size: 1rem;
  z-index: 2;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 2px solid var(--border-primary);
  border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 9999;
  box-shadow: 0 4px 16px var(--shadow-medium);
}

.search-results-header {
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  font-size: 0.9rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-secondary);
}

.search-results-list {
  padding: 0;
}

.search-result-item {
  border-bottom: 1px solid var(--border-secondary);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-link {
  display: block;
  padding: 1rem;
  text-decoration: none;
  color: inherit;
  transition: background-color 0.2s ease;
}

.search-result-link:hover {
  background: var(--bg-tertiary);
}

.search-result-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.search-result-year {
  font-weight: 600;
  color: var(--accent-primary);
  font-size: 1.1rem;
}

.search-result-topic-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1.1rem;
}

.search-result-topic-badge {
  background: var(--accent-primary);
  color: var(--bg-primary);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
}

.search-result-context {
  color: var(--text-secondary);
  line-height: 1.4;
  font-size: 0.9rem;
}

.search-highlight {
  background: var(--highlight-bg);
  color: var(--highlight-text);
  font-weight: 600;
  padding: 0.125rem 0.25rem;
  border-radius: 3px;
}

.search-no-results {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
}

/* ===== FOOTER ===== */
/* Footer */
.site-footer {
  background: var(--bg-secondary);
  color: var(--text-primary);
  text-align: center;
  padding: 1.5rem 0;
  margin-top: 2rem;
  border-top: 1px solid var(--border-primary);
}

/* Responsive design */
@media (max-width: 768px) {
  .header-content {
    grid-template-columns: 1fr;
    gap: 1rem;
    text-align: center;
  }

  .header-branding,
  .header-nav {
    text-align: center;
  }

  .header-branding .site-title a {
    font-size: 1.5rem;
  }

  .header-branding .site-description {
    font-size: 0.8rem;
  }

  .search-compact {
    max-width: 280px;
  }

  .search-compact .search-input {
    font-size: 0.85rem;
    padding: 0.5rem 2.2rem 0.5rem 2.2rem;
  }

  .site-description {
    font-size: 1rem;
  }

  .featured-section {
    margin: 1.5rem 0 2rem 0;
  }

  .featured-card {
    margin: 0 1rem;
    padding: 1.5rem;
  }

  .featured-card h2 {
    font-size: 1.5rem;
  }

  .featured-btn {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
  }

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

  .year-content {
    padding: 1rem;
    margin: 0 1rem;
  }

  .year-header h1 {
    font-size: 2rem;
  }

  .nav-links {
    flex-direction: column;
    text-align: center;
  }
}

/* ===== TABLES ===== */
/* Table responsive styles */
.year-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  background: var(--bg-secondary);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px var(--shadow-light);
}

.year-body table th,
.year-body table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-secondary);
  vertical-align: top;
}

.year-body table th {
  font-weight: 600;
  color: var(--text-primary);
}

/* ===== VIDEO COMPONENTS ===== */
/* Video container styles */
.video-container {
  margin: 2rem 0;
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: 8px;
  border-left: 4px solid var(--accent-primary);
}

.video-container h3 {
  margin-bottom: 1rem;
  color: var(--text-primary);
  font-size: 1.2rem;
}

.video-iframe {
  width: 100%;
  height: 400px;
  border: none;
  border-radius: 4px;
  box-shadow: 0 2px 8px var(--shadow-light);
}

/* ===== VIEW TRANSITIONS ===== */
/* Enable view transitions for browsers that support it */
@view-transition {
  navigation: auto;
}

/* Define smooth transitions for page changes */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.3s;
  animation-timing-function: ease-in-out;
}

/* Fade transition for general content */
::view-transition-old(root) {
  animation-name: fade-out;
}

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

/* Cross-fade animation keyframes */
@keyframes fade-out {
  to {
    opacity: 0;
  }
}

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

/* Specific transitions for main content areas */
.site-content {
  view-transition-name: main-content;
}

::view-transition-old(main-content),
::view-transition-new(main-content) {
  animation-duration: 0.4s;
  animation-timing-function: ease-out;
}

::view-transition-old(main-content) {
  animation-name: slide-out-left;
}

::view-transition-new(main-content) {
  animation-name: slide-in-right;
}

@keyframes slide-out-left {
  to {
    transform: translateX(-20px);
    opacity: 0;
  }
}

@keyframes slide-in-right {
  from {
    transform: translateX(20px);
    opacity: 0;
  }
}

/* Header should remain stable during transitions */
.site-header {
  view-transition-name: header;
}

::view-transition-old(header),
::view-transition-new(header) {
  animation: none;
}

/* Footer transitions */
.site-footer {
  view-transition-name: footer;
}

::view-transition-old(footer),
::view-transition-new(footer) {
  animation-duration: 0.2s;
}

/* Fallback for browsers without view transition support */
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root),
  ::view-transition-old(main-content),
  ::view-transition-new(main-content) {
    animation: none;
  }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .site-description {
    font-size: 1rem;
  }

  .featured-section {
    margin: 1.5rem 0 2rem 0;
  }

  .featured-card {
    margin: 0 1rem;
    padding: 2rem 1.5rem;
    max-width: 100%;
  }

  .featured-card h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }

  .featured-card p {
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
  }

  .featured-btn {
    padding: 0.8rem 1.5rem;
    font-size: 0.9rem;
    min-width: 140px;
  }

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

  .year-content {
    padding: 1rem;
    margin: 0 1rem;
  }

  .year-header h1 {
    font-size: 2rem;
  }

  .nav-links {
    flex-direction: column;
    text-align: center;
  }

  /* Hide the "Why It Matters" column on mobile devices */
  .year-body table th:nth-child(3),
  .year-body table td:nth-child(3) {
    display: none;
  }

  /* Adjust table layout for mobile */
  .year-body table th,
  .year-body table td {
    padding: 0.5rem;
    font-size: 0.9rem;
  }

  /* Make video responsive on mobile */
  .video-iframe {
    height: 250px;
  }

  .video-container {
    margin: 1.5rem 0;
    padding: 0.75rem;
  }
}
