/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
  /* Colors */
  --color-primary: #2563eb;
  --color-primary-dark: #1e40af;
  --color-text: #1f2937;
  --color-text-light: #6b7280;
  --color-background: #ffffff;
  --color-background-alt: #f9fafb;
  --color-border: #e5e7eb;

  /* Typography */
  --font-family-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-size-base: 16px;
  --line-height-base: 1.6;

  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --spacing-2xl: 4rem;
  --spacing-3xl: 6rem;

  /* Layout */
  --max-width: 1200px;
  --max-width-content: 800px;

  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-base: 300ms ease-in-out;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Skip Link (Accessibility)
   ============================================ */
.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-primary);
  color: white;
  padding: var(--spacing-sm) var(--spacing-lg);
  text-decoration: none;
  border-radius: 0 0 8px 8px;
  font-weight: 600;
  font-size: 0.875rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 0;
  outline: 3px solid rgba(255, 255, 255, 0.8);
  outline-offset: 2px;
}

/* ============================================
   Navigation Bar
   ============================================ */
.site-header {
  background: white;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.site-nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--spacing-md) var(--spacing-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-lg);
}

.site-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
  white-space: nowrap;
  display: inline-block;
  line-height: 0;
}

.site-logo:hover {
  color: var(--color-primary-dark);
  opacity: 0.85;
}

.site-logo-image {
  display: block;
  height: auto;
  max-height: 50px;
  width: auto;
  transition: opacity var(--transition-fast);
}

@media (max-width: 768px) {
  .site-logo-image {
    max-height: 40px;
  }
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
  list-style: none;
}

.nav-link {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9375rem;
  transition: color var(--transition-fast);
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--color-primary);
}

.nav-link-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text-light);
}

.nav-link-icon svg {
  width: 18px;
  height: 18px;
}

.nav-link-icon:hover {
  color: var(--color-primary);
}

@media (max-width: 768px) {
  .site-nav {
    padding: var(--spacing-sm) var(--spacing-md);
  }

  .nav-links {
    gap: var(--spacing-md);
  }

  .nav-link {
    font-size: 0.875rem;
  }
}

/* ============================================
   Construction Notice Banner
   ============================================ */
.construction-notice {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-bottom: 1px solid #fbbf24;
  padding: var(--spacing-sm) var(--spacing-md);
}

.construction-content {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
}

.construction-icon {
  flex-shrink: 0;
  color: #d97706;
}

.construction-text {
  margin: 0;
  font-size: 0.875rem;
  color: #92400e;
  text-align: center;
}

.construction-text strong {
  font-weight: 700;
  color: #78350f;
}

@media (min-width: 768px) {
  .construction-text {
    font-size: 1rem;
  }
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-lg);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.hero-content {
  max-width: var(--max-width-content);
  text-align: center;
}

.hero h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--spacing-md);
}

.hero-description {
  font-size: 1.125rem;
  line-height: 1.6;
  margin-bottom: var(--spacing-xl);
  opacity: 0.95;
}

.cta-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  align-items: center;
  justify-content: center;
}

.cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-md) var(--spacing-xl);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-primary);
  background-color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  min-width: 44px;
  min-height: 44px;
}

.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.cta-button:focus {
  outline: 3px solid rgba(255, 255, 255, 0.5);
  outline-offset: 4px;
}

.cta-button:active {
  transform: translateY(0);
}

.cta-button-secondary {
  background-color: transparent;
  color: white;
  border: 2px solid white;
}

.cta-button-secondary:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: white;
}

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

/* ============================================
   Featured OpenSpec Section
   ============================================ */
.featured-section {
  padding: var(--spacing-3xl) var(--spacing-lg);
  background-color: var(--color-background);
}

.featured-content {
  max-width: var(--max-width);
  margin: 0 auto;
}

.featured-section h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: var(--spacing-md);
  color: var(--color-text);
  text-align: center;
  line-height: 1.3;
}

.featured-highlight {
  color: var(--color-primary);
}

.featured-description {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--color-text-light);
  margin-bottom: var(--spacing-xl);
  text-align: center;
  max-width: var(--max-width-content);
  margin-left: auto;
  margin-right: auto;
}

.featured-description strong {
  color: var(--color-text);
  font-weight: 600;
}

.featured-image-container {
  margin-bottom: var(--spacing-xl);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.featured-image-container:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.featured-image-link {
  display: block;
  position: relative;
  overflow: hidden;
}

.featured-image-link:focus {
  outline: 3px solid var(--color-primary);
  outline-offset: 4px;
  border-radius: 16px;
}

.featured-image {
  width: 100%;
  height: auto;
  display: block;
  transition: transform var(--transition-base);
}

.featured-image-link:hover .featured-image {
  transform: scale(1.02);
}

.featured-cta {
  text-align: center;
}

.cta-button-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  font-size: 1.125rem;
  padding: var(--spacing-md) var(--spacing-xl);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  text-decoration: none;
  font-weight: 600;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  min-width: 44px;
  min-height: 44px;
}

.cta-button-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
}

.cta-button-primary:focus {
  outline: 3px solid rgba(37, 99, 235, 0.5);
  outline-offset: 4px;
}

.cta-button-primary:active {
  transform: translateY(0);
}

/* Responsive - Tablet and Desktop */
@media (min-width: 768px) {
  .featured-section {
    padding: var(--spacing-3xl) var(--spacing-xl);
  }

  .featured-section h2 {
    font-size: 2.5rem;
  }

  .featured-description {
    font-size: 1.25rem;
  }

  .cta-button-primary {
    font-size: 1.25rem;
  }
}

@media (min-width: 1024px) {
  .featured-section {
    padding: var(--spacing-3xl) var(--spacing-2xl);
  }

  .featured-section h2 {
    font-size: 3rem;
  }

  .featured-description {
    font-size: 1.375rem;
  }
}

/* ============================================
   Latest Insights Section
   ============================================ */
.insights {
  padding: var(--spacing-3xl) var(--spacing-lg);
  background-color: var(--color-background-alt);
}

.insights-content {
  max-width: var(--max-width);
  margin: 0 auto;
}

.insights h2 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: var(--spacing-sm);
  color: var(--color-text);
  text-align: center;
}

.insights-highlight {
  color: var(--color-primary);
}

.insights-intro {
  font-size: 1.125rem;
  color: var(--color-text-light);
  margin-bottom: var(--spacing-2xl);
  text-align: center;
}

/* Insights Grid */
.insights-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-2xl);
}

/* Insight Card */
.insight-card {
  background-color: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: var(--spacing-lg);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.insight-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

/* Date */
.insight-date {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: 0.875rem;
  color: var(--color-text-light);
}

.date-icon {
  flex-shrink: 0;
  color: var(--color-text-light);
}

/* Title */
.insight-title {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--color-text);
  margin: 0;
}

/* Description */
.insight-description {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text-light);
  margin: 0;
  flex-grow: 1;
}

/* Link */
.insight-link {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-base);
  padding: var(--spacing-xs) 0;
}

.insight-link:hover {
  color: var(--color-primary-dark);
}

.insight-link:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 4px;
  border-radius: 4px;
}

.external-icon {
  flex-shrink: 0;
  color: currentColor;
}

/* Footer with View All Link */
.insights-footer {
  text-align: center;
  padding-top: var(--spacing-lg);
}

.view-all-link {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-base);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: 8px;
}

.view-all-link:hover {
  color: var(--color-primary-dark);
  background-color: rgba(37, 99, 235, 0.05);
}

.view-all-link:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 4px;
}

/* ============================================
   Knowledge Pages
   ============================================ */
.knowledge-page {
  max-width: var(--max-width-content);
  margin: 0 auto;
  padding: var(--spacing-xl) var(--spacing-lg);
}

/* Breadcrumb Navigation */
.breadcrumb {
  font-size: 0.875rem;
  color: var(--color-text-light);
  margin-bottom: var(--spacing-md);
}

.breadcrumb a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.breadcrumb a:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

/* Knowledge Header */
.knowledge-header {
  margin-bottom: var(--spacing-xl);
  padding-bottom: var(--spacing-lg);
  border-bottom: 2px solid var(--color-border);
}

.knowledge-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--spacing-sm);
  line-height: 1.2;
}

.knowledge-meta {
  font-size: 0.875rem;
  color: var(--color-text-light);
  display: flex;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

.knowledge-meta-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

/* Knowledge Sections */
.knowledge-section {
  margin-bottom: var(--spacing-xl);
}

.knowledge-section h2 {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--spacing-md);
}

.knowledge-section h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-text);
  margin-top: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

.knowledge-section p {
  margin-bottom: var(--spacing-md);
  line-height: 1.7;
}

.knowledge-section ul,
.knowledge-section ol {
  margin-bottom: var(--spacing-md);
  padding-left: var(--spacing-lg);
}

.knowledge-section li {
  margin-bottom: var(--spacing-sm);
  line-height: 1.6;
}

/* Source Attribution */
.source-attribution {
  background-color: var(--color-background-alt);
  border-left: 4px solid var(--color-primary);
  padding: var(--spacing-md);
  margin: var(--spacing-lg) 0;
  border-radius: 4px;
}

.source-attribution p {
  margin: 0;
  font-size: 0.95rem;
}

.source-attribution a {
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.source-attribution a:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

/* Related Topics Sidebar */
.knowledge-related {
  background-color: var(--color-background-alt);
  border-radius: 8px;
  padding: var(--spacing-lg);
  margin-top: var(--spacing-2xl);
}

.knowledge-related h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--spacing-md);
}

.related-topics-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.related-topic-item {
  margin-bottom: var(--spacing-md);
}

.related-topic-link {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition-fast);
  display: block;
}

.related-topic-link:hover {
  color: var(--color-primary-dark);
}

.related-topic-description {
  font-size: 0.875rem;
  color: var(--color-text-light);
  margin-top: var(--spacing-xs);
}

/* Resources Section */
.resources-list {
  list-style: none;
  padding: 0;
}

.resource-item {
  margin-bottom: var(--spacing-md);
  padding: var(--spacing-md);
  background-color: var(--color-background-alt);
  border-radius: 4px;
  transition: background-color var(--transition-fast);
}

.resource-item:hover {
  background-color: #f3f4f6;
}

.resource-link {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  transition: color var(--transition-fast);
}

.resource-link:hover {
  color: var(--color-primary-dark);
}

.resource-description {
  font-size: 0.875rem;
  color: var(--color-text-light);
  margin-top: var(--spacing-xs);
}

/* Responsive - Tablet and Desktop */
@media (min-width: 768px) {
  .knowledge-page {
    padding: var(--spacing-2xl) var(--spacing-xl);
  }

  .knowledge-header h1 {
    font-size: 3rem;
  }

  .knowledge-section h2 {
    font-size: 2.25rem;
  }
}

@media (min-width: 1024px) {
  .knowledge-page {
    padding: var(--spacing-3xl) var(--spacing-2xl);
  }
}

/* ============================================
   Footer Section
   ============================================ */
.footer {
  padding: var(--spacing-xl) var(--spacing-lg);
  background-color: var(--color-text);
  color: white;
  width: 100%;
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
  text-align: center;
}

.footer-logo {
  display: block;
  height: auto;
  max-height: 50px;
  width: auto;
  margin: 0 auto var(--spacing-md);
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

@media (max-width: 768px) {
  .footer-logo {
    max-height: 40px;
  }
}

.copyright {
  font-size: 0.875rem;
  opacity: 0.8;
}

/* ============================================
   Responsive Design - Tablet (768px+)
   ============================================ */
@media (min-width: 768px) {
  .hero h1 {
    font-size: 3rem;
  }

  .hero-description {
    font-size: 1.25rem;
  }

  .insights {
    padding: var(--spacing-3xl) var(--spacing-xl);
  }

  .insights h2 {
    font-size: 3rem;
  }

  /* 2-column grid for tablets */
  .insights-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================
   Responsive Design - Desktop (1024px+)
   ============================================ */
@media (min-width: 1024px) {
  .hero h1 {
    font-size: 3.5rem;
  }

  .hero-description {
    font-size: 1.375rem;
  }

  .insights {
    padding: var(--spacing-3xl) var(--spacing-2xl);
  }

  .insights h2 {
    font-size: 3.5rem;
  }

  .cta-button {
    font-size: 1.25rem;
  }

  /* 3-column grid for desktop */
  .insights-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .insight-title {
    font-size: 1.375rem;
  }
}

/* ============================================
   Focus Visible (Modern Browsers)
   ============================================ */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 4px;
}

/* ============================================
   Reduced Motion (Accessibility)
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
