/* Main CSS for Appalachian Runner */
/* Imports design tokens and implements layout system */

/* Reset and base styles */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-base);
  line-height: var(--line-height-body);
  color: var(--color-text-primary);
  background-color: var(--color-page-bg);
  background-image: 
    var(--gradient-hero-overlay),
    url('/assets/images/snowshoewv.jpeg');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  position: relative; /* For absolute positioned photo credit */
}

@supports (background-image: image-set(url('/assets/images/snowshoewv.avif') 1x)) {
  body {
    /* Prefer modern formats while keeping gradient overlay */
    background-image:
      var(--gradient-hero-overlay),
      image-set(
        url('/assets/images/snowshoewv.avif') type('image/avif'),
        url('/assets/images/snowshoewv.webp') type('image/webp'),
        url('/assets/images/snowshoewv.jpeg') type('image/jpeg')
      );
  }
}

/* Main Content Area */
.main-content {
  padding-top: 80px; /* Account for fixed header height */
  min-height: auto; /* Let content determine height, don't force full viewport */
}

/* Accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: rgba(11, 43, 36, 0.95);
  color: var(--color-sunrise-gold);
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 1000;
  transition: top 0.3s;
  border: 1px solid var(--color-border-card);
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Header and Navigation */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(20, 40, 30, 0.85); /* More transparent Deep Pine */
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: all var(--transition-medium);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.main-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  max-width: 1200px;
  margin: 0 auto;
  gap: var(--space-md);
}

/* Navigation Tagline */
.nav-tagline {
  flex: 0 0 auto;
}

.tagline-text {
  font-family: var(--font-heading);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-body-medium);
  color: var(--color-text-muted);
  font-style: italic;
  text-shadow: var(--text-shadow-card);
  white-space: nowrap;
}

/* Navigation Logo */
.nav-logo {
  flex: 0 0 auto;
}

.nav-logo a {
  text-decoration: none;
  display: block;
}

.logo-text {
  font-family: var(--font-hero);
  font-size: var(--font-size-h3);
  font-weight: var(--font-weight-heading-bold);
  color: var(--color-sunrise-gold);
  text-shadow: var(--text-shadow-card);
  transition: all var(--transition-fast);
}

.nav-logo a:hover .logo-text,
.nav-logo a:focus .logo-text {
  color: var(--color-text-primary);
  text-shadow: var(--text-shadow-hero);
  transform: translateY(-1px);
}

/* Menu Toggle - Updated Position */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--color-text-primary);
  cursor: pointer;
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  order: 2;
}

.menu-toggle:focus {
  outline: 2px solid var(--color-sunrise-gold);
  outline-offset: 2px;
}

.menu-toggle:hover,
.menu-toggle:focus {
  background: var(--color-surface-card);
  color: var(--color-sunrise-gold);
}

.menu-icon {
  display: flex;
  flex-direction: column;
  width: 24px;
  height: 18px;
  justify-content: space-between;
}

.menu-line {
  height: 2px;
  background: var(--color-text-primary);
  border-radius: 1px;
  transition: all 0.3s ease;
}

.navigation-menu {
  display: flex;
  list-style: none;
  gap: var(--space-md);
  flex: 1;
  justify-content: center;
  align-items: center;
}

.navigation-menu a {
  font-family: var(--font-heading);
  color: var(--color-text-primary);
  text-decoration: none;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  font-weight: var(--font-weight-body-medium);
  position: relative;
}

.navigation-menu a:focus {
  outline: 2px solid var(--color-sunrise-gold);
  outline-offset: 2px;
}

.navigation-menu a:hover,
.navigation-menu a:focus {
  background: var(--color-surface-card);
  transform: translateY(-1px);
  color: var(--color-text-primary);
  box-shadow: var(--shadow-sm);
}

.navigation-menu a[aria-current="page"],
.navigation-menu a.navigation-active {
  background: var(--color-sunrise-gold);
  color: var(--color-text-on-accent);
  font-weight: var(--font-weight-emphasis);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Hero Section */
.hero-section {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  z-index: -1;
}

.hero-content {
  text-align: center;
  max-width: 90%;
}

.hero-card {
  background: var(--color-surface-hero);
  border: var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  max-width: var(--hero-card-max-width);
  margin: 0 auto;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(25px);
  transition: transform var(--transition-medium), box-shadow var(--transition-medium);
  font-family: var(--font-heading);
}

.hero-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.hero-title {
  font-family: var(--font-hero);
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: var(--font-weight-heading-bold);
  margin-bottom: var(--space-sm);
  color: var(--color-text-primary);
  text-shadow: var(--text-shadow-hero);
  line-height: var(--line-height-heading);
}

.hero-subtitle {
  font-family: var(--font-heading);
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  font-weight: var(--font-weight-body-medium);
  margin-bottom: var(--space-md);
  color: var(--color-text-muted);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
  text-shadow: var(--text-shadow-card);
  line-height: var(--line-height-body);
}

.hero-description {
  font-family: var(--font-base);
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: var(--font-weight-body);
  line-height: var(--line-height-body);
  color: var(--color-text-muted);
  text-shadow: var(--text-shadow-card);
}

/* Cards Section */
.cards-section {
  padding: 0;
  margin: 0;
  min-height: auto;
}

/* Fixed photo credit for background image */
.fixed-photo-credit {
  position: absolute;
  bottom: var(--space-lg); /* Position above footer with spacing */
  right: 2rem;
  z-index: 20; /* Above all content */
}

.cards-grid {
  margin: var(--space-md) auto var(--space-sm) auto;
  max-width: 1200px;
  padding: 0 var(--space-md);
}

.cards-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--grid-gap);
}

/* Base Card Component - Solid Design */
.card {
  background: var(--color-deep-pine);
  border: 1px solid var(--color-border-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-medium);
  cursor: pointer;
  position: relative;
  aspect-ratio: var(--card-aspect-ratio);
  box-shadow: var(--shadow-md);
  font-family: var(--font-base);
  display: block; /* Change from flex to block for absolute positioning */
}

.card--skeleton {
  pointer-events: none;
  background: rgba(11, 43, 36, 0.6);
  box-shadow: var(--shadow-sm);
  border: var(--card-border);
  animation: cardSkeletonPulse 1.4s ease-in-out infinite;
}

.card-skeleton__media {
  width: 100%;
  height: 60%;
  background: rgba(26, 58, 74, 0.5);
  border-bottom: 1px solid var(--color-border-subtle);
}

.card-skeleton__text {
  padding: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.card-skeleton__line {
  display: block;
  height: 12px;
  background: rgba(244, 194, 106, 0.25);
  border-radius: var(--radius-sm);
  width: 80%;
}

.card-skeleton__line--short {
  width: 60%;
}

/* Card Image Container */
.card-image-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(135deg, 
    rgba(11, 43, 36, 0.1), 
    rgba(26, 58, 74, 0.1)
  ); /* Subtle background to help SVG visibility */
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-medium);
}

/* Mobile SVG optimization */
@media (max-width: 768px) {
  .card-image {
    object-fit: contain; /* Switch to contain for better SVG visibility */
    object-position: center;
    padding: var(--space-sm); /* Add padding around SVGs */
    background: transparent;
  }
  
  .card-image-container {
    background: linear-gradient(135deg, 
      rgba(11, 43, 36, 0.05), 
      rgba(26, 58, 74, 0.05)
    ); /* Lighter background for mobile */
  }
}

@media (max-width: 480px) {
  .card-image {
    padding: var(--space-md); /* More padding on small screens */
    min-height: 160px;
  }
}

.card-image-fallback {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--color-deep-pine), var(--color-ridge-blue));
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-sm);
}

.fallback-icon {
  font-size: 2rem;
  margin-bottom: var(--space-xs);
  opacity: 0.8;
}

@keyframes cardSkeletonPulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

.fallback-text {
  font-family: var(--font-heading);
  font-size: var(--font-size-h5);
  font-weight: var(--font-weight-heading);
  color: var(--color-text-primary);
  margin-bottom: var(--space-xs);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.fallback-subtitle {
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
  opacity: 0.8;
}

/* Card States and Hover Effects - Appalachian Brand */
.card:hover,
.card:focus-within {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--color-border-card);
  background: var(--color-surface-card);
}

.card:active {
  transform: translateY(-1px);
  transition: all var(--transition-fast);
}

/* Card Featured Variant - Appalachian Brand */
.card--featured {
  border: 2px solid var(--color-border-card);
  background: var(--color-surface-card);
  position: relative;
}

.card--featured::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, var(--color-sunrise-gold), var(--color-moss-green));
  border-radius: var(--radius-lg);
  z-index: -1;
  opacity: 0;
  transition: opacity var(--transition-medium);
}

.card--featured:hover::before {
  opacity: 0.6;
}

/* Card Image Handling */
.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 1;
}

.card:hover .card-image {
  transform: scale(1.05);
}

.card-image::after {
  display: none; /* Remove dark overlay to let SVG show clearly */
}

.card:hover .card-image::after {
  opacity: 0.8;
}

/* Card Content - Mobile-first design with visible text */
.card-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(
    to top,
    rgba(11, 43, 36, 0.95) 0%,
    rgba(11, 43, 36, 0.85) 60%,
    transparent 100%
  );
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: var(--space-md);
  color: var(--color-text-primary);
  border-top: 1px solid rgba(244, 194, 106, 0.2);
  transition: all var(--transition-medium);
  z-index: 2;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.card:hover .card-content {
  background: linear-gradient(
    to top,
    rgba(11, 43, 36, 0.98) 0%,
    rgba(11, 43, 36, 0.90) 60%,
    transparent 100%
  );
}

.card-title {
  font-family: var(--font-heading);
  font-size: var(--font-size-h4);
  font-weight: var(--font-weight-heading-bold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-xs);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  line-height: var(--line-height-heading);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card:hover .card-title {
  color: var(--color-sunrise-gold);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.card-description {
  font-family: var(--font-base);
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
  line-height: var(--line-height-body);
  margin: 0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  opacity: 0.9;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card:hover .card-description {
  color: var(--color-text-primary);
  opacity: 1;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* Card Link Accessibility */
.card-link {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  text-decoration: none;
  color: inherit;
  z-index: 3;
  border-radius: var(--radius-lg);
}

.card-link:focus {
  outline: 3px solid var(--color-sunrise-gold);
  outline-offset: 2px;
}

/* Card Loading State */
.card--loading {
  pointer-events: none;
}

.card--loading .card-image {
  background: linear-gradient(90deg, rgba(255,255,255,0.1) 25%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 75%);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

.card--loading .card-title,
.card--loading .card-description {
  background: linear-gradient(90deg, rgba(255,255,255,0.1) 25%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 75%);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
  color: transparent;
  border-radius: 4px;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Card Error State */
.card--error {
  border-color: rgba(255, 100, 100, 0.5);
  background: rgba(255, 100, 100, 0.05);
}

.card--error .card-image {
  background: rgba(255, 100, 100, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
}

/* Consistent Borders and Shadows */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(255, 255, 255, 0.02) 100%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

/* Content Sections */
.content-section {
  padding: var(--space-lg) var(--space-md);
  max-width: 1200px;
  margin: var(--space-md) auto;
  min-height: 80vh;
  background: rgba(20, 40, 30, 0.05); /* Subtle overlay for readability */
  backdrop-filter: blur(3px);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.content-section[hidden] {
  display: none;
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-lg);
}

.section-header h2 {
  font-family: var(--font-heading);
  font-size: clamp(var(--font-size-h2), 5vw, 3rem);
  font-weight: var(--font-weight-heading-bold);
  margin-bottom: var(--space-sm);
  color: var(--color-text-primary);
  line-height: var(--line-height-heading);
}

.section-description {
  font-family: var(--font-base);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-body);
  color: var(--color-text-muted);
  line-height: var(--line-height-body);
  max-width: 600px;
  margin: 0 auto;
}

.content-placeholder {
  text-align: center;
  padding: var(--space-lg);
  color: var(--color-text-muted);
  font-style: italic;
}

/* Dynamic Content Styles */
.section-content-wrapper {
  max-width: 1000px;
  margin: 0 auto;
}

.section-intro {
  text-align: center;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border-card);
}

.section-intro h3 {
  font-size: 2rem;
  color: var(--color-text-primary);
  margin-bottom: var(--space-sm);
}

.section-intro .section-description {
  font-size: 1.1rem;
  line-height: 1.6;
}

/* Loading States */
.section-loading,
.section-placeholder,
.section-error {
  text-align: center;
  padding: var(--space-lg);
  background: var(--color-bg-card);
  border: var(--card-border);
  border-radius: var(--radius-lg);
  margin: var(--space-lg) 0;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top: 3px solid var(--color-text-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto var(--space-md);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.section-error {
  border-color: rgba(255, 100, 100, 0.3);
  background: rgba(255, 100, 100, 0.05);
}

.retry-button {
  background: var(--color-surface-card);
  border: 2px solid var(--color-sunrise-gold);
  color: var(--color-text-primary);
  padding: var(--button-padding);
  border-radius: var(--button-border-radius);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: var(--space-sm);
  font-family: var(--font-heading);
  font-weight: var(--button-font-weight);
  min-height: 44px;
}

.retry-button:hover {
  background: var(--color-sunrise-gold);
  color: var(--color-text-on-accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

/* Button System - Appalachian Brand */
.btn {
  font-family: var(--font-heading);
  font-size: var(--font-size-body);
  font-weight: var(--button-font-weight);
  padding: var(--button-padding);
  border-radius: var(--button-border-radius);
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  min-height: 44px; /* Accessibility touch target */
  text-align: center;
  line-height: var(--line-height-heading);
}

.btn:focus {
  outline: 2px solid var(--color-sunrise-gold);
  outline-offset: 2px;
}

/* Primary Button - Sunrise Gold */
.btn--primary {
  background: var(--color-sunrise-gold);
  color: var(--color-text-on-accent);
  box-shadow: var(--shadow-sm);
}

.btn--primary:hover {
  background: var(--color-sunrise-gold);
  filter: brightness(0.95);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.btn--primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

/* Secondary Button - Transparent with Gold Border */
.btn--secondary {
  background: transparent;
  color: var(--color-text-primary);
  border: 2px solid var(--color-sunrise-gold);
  box-shadow: var(--shadow-sm);
}

.btn--secondary:hover {
  background: var(--color-sunrise-gold);
  color: var(--color-text-on-accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.btn--secondary:active {
  transform: translateY(0);
  transition: all var(--transition-fast);
}

/* Tertiary Button - Minimal */
.btn--tertiary {
  background: transparent;
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-card);
}

.btn--tertiary:hover {
  background: var(--color-surface-card);
  border-color: var(--color-sunrise-gold);
  transform: translateY(-1px);
}

/* Button Sizes */
.btn--small {
  font-size: var(--font-size-small);
  padding: calc(var(--space-xs) * 0.75) var(--space-sm);
  min-height: 36px;
}

.btn--large {
  font-size: var(--font-size-h4);
  padding: var(--space-sm) var(--space-lg);
  min-height: 52px;
}

/* Button States */
.btn:disabled,
.btn--disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.btn--loading {
  color: transparent;
  pointer-events: none;
}

.btn--loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spinner 0.8s linear infinite;
}

@keyframes btn-spinner {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Icon Buttons */
.btn--icon {
  padding: var(--space-xs);
  min-width: 44px;
  aspect-ratio: 1;
}

.btn--icon-text {
  gap: var(--space-xs);
}

/* Link System - Appalachian Brand */
.link,
a:not(.btn):not(.card-link):not([class*="navigation"]):not([class*="footer"]) {
  color: var(--color-sunrise-gold);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 2px;
  transition: all var(--transition-fast);
}

.link:hover,
a:not(.btn):not(.card-link):not([class*="navigation"]):not([class*="footer"]):hover {
  color: var(--color-text-primary);
  text-decoration-color: var(--color-sunrise-gold);
}

.link:focus,
a:not(.btn):not(.card-link):not([class*="navigation"]):not([class*="footer"]):focus {
  outline: 2px solid var(--color-sunrise-gold);
  outline-offset: 2px;
}

/* Interactive Elements */
.interactive {
  cursor: pointer;
  transition: all var(--transition-fast);
}

.interactive:hover {
  transform: translateY(-1px);
}

/* Content Cards */
.race-cards,
.trail-cards,
.club-cards,
.spotlight-cards,
.opportunity-cards,
.story-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.race-card,
.trail-card,
.club-card,
.spotlight-card,
.opportunity-card,
.story-card {
  background: var(--color-bg-card);
  border: var(--card-border);
  border-radius: var(--radius-lg);
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.race-card:hover,
.trail-card:hover,
.club-card:hover,
.spotlight-card:hover,
.opportunity-card:hover,
.story-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(255, 255, 255, 0.3);
}

.race-card h5,
.trail-card h5,
.club-card h5,
.spotlight-card h5,
.opportunity-card h5,
.story-card h5 {
  font-family: var(--font-heading);
  font-size: var(--font-size-h4);
  font-weight: var(--font-weight-heading);
  color: var(--color-text-primary);
  margin-bottom: var(--space-xs);
  line-height: var(--line-height-heading);
}

.race-date,
.race-location,
.race-details,
.trail-state,
.trail-difficulty,
.trail-length,
.club-location,
.club-members,
.spotlight-meta,
.spotlight-subject,
.story-meta,
.story-location {
  font-family: var(--font-base);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-body);
  color: var(--color-text-muted);
  margin-bottom: var(--space-xs);
  line-height: var(--line-height-body);
}

.race-description,
.trail-description,
.club-description,
.spotlight-excerpt,
.opportunity-description,
.story-excerpt {
  font-family: var(--font-base);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-body);
  color: var(--color-text-muted);
  line-height: var(--line-height-body);
  margin-bottom: var(--space-sm);
}

.gpx-available,
.read-time {
  background: rgba(0, 255, 100, 0.2);
  color: #00ff64;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
}

.read-time {
  background: rgba(100, 200, 255, 0.2);
  color: #64c8ff;
}

/* Lists and Schedules */
.club-schedule,
.opportunity-benefits {
  margin-top: var(--space-sm);
}

.club-schedule h6,
.opportunity-benefits h6 {
  font-size: 0.9rem;
  color: var(--color-text-primary);
  margin-bottom: var(--space-xs);
  font-weight: 600;
}

.club-schedule ul,
.opportunity-benefits ul {
  list-style: none;
  padding-left: 0;
}

.club-schedule li,
.opportunity-benefits li {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 4px;
  padding-left: var(--space-sm);
  position: relative;
}

.club-schedule li::before,
.opportunity-benefits li::before {
  content: '•';
  color: var(--color-text-primary);
  position: absolute;
  left: 0;
}

/* Upcoming Events List */
.upcoming-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.upcoming-race {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.race-title {
  font-weight: 500;
  color: var(--color-text-primary);
}

/* Story Tags */
.story-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin: var(--space-sm) 0;
}

.tag {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text-muted);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Featured Content Headers */
.featured-races h4,
.featured-trails h4,
.featured-clubs h4,
.featured-spotlights h4,
.partnership-opportunities h4,
.featured-stories h4,
.upcoming-races h4 {
  font-size: 1.4rem;
  color: var(--color-text-primary);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-xs);
  border-bottom: 2px solid var(--color-border-card);
}

/* Section Content States */
.section-placeholder,
.section-error,
.section-loading {
  text-align: center;
  padding: var(--space-xl);
  background: var(--color-surface-card);
  border: var(--card-border);
  border-radius: var(--radius-lg);
  backdrop-filter: var(--backdrop-blur);
  margin: var(--space-md) 0;
}

.placeholder-icon,
.error-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.8;
}

.section-placeholder h3,
.section-error h3,
.section-loading h3 {
  font-family: var(--font-heading);
  font-size: var(--font-size-h3);
  color: var(--color-text-primary);
  margin-bottom: var(--space-sm);
}

.section-placeholder p,
.section-error p {
  color: var(--color-text-muted);
  margin-bottom: var(--space-sm);
  line-height: var(--line-height-body);
}

.placeholder-note {
  font-size: var(--font-size-small);
  opacity: 0.8;
  font-style: italic;
}

.error-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  margin: var(--space-md) 0;
  flex-wrap: wrap;
}

.error-details {
  margin-top: var(--space-md);
  text-align: left;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.error-details summary {
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
}

.error-details summary:hover {
  color: var(--color-text-primary);
  background: rgba(255, 255, 255, 0.05);
}

/* Loading Spinner */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(244, 194, 106, 0.3);
  border-top: 3px solid var(--color-sunrise-gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto var(--space-md) auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Footer */
.site-footer {
  background: linear-gradient(
    0deg,
    #0A201B 0%,
    rgba(11, 43, 36, 0.85) 100%
  );
  border-top: 1px solid rgba(244, 194, 106, 0.25);
  padding: 3rem var(--space-md) var(--space-md);
  margin-top: var(--space-md);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-lg);
}

.footer-section h3,
.footer-section h4 {
  color: #F8F8F8;
  margin-bottom: var(--space-sm);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.footer-title {
  font-size: 1.5rem;
  font-weight: 700;
}

.footer-heading {
  font-size: 1.1rem;
  font-weight: 600;
}

.footer-description {
  color: var(--color-text-muted);
  opacity: 0.9;
  line-height: 1.85;
  margin-bottom: var(--space-sm);
}

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

.footer-links li {
  margin-bottom: var(--space-xs);
}

.footer-links a {
  color: var(--color-sunrise-gold);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover,
.footer-links a:focus {
  color: #ffd998;
  text-decoration: underline;
}

.social-links {
  display: flex;
  gap: var(--space-sm);
  list-style: none;
}

.footer-bottom {
  max-width: 1200px;
  margin: var(--space-lg) auto 0;
  padding-top: var(--space-md);
  border-top: 1px solid rgba(244, 194, 106, 0.25);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.copyright {
  color: var(--color-text-muted);
  opacity: 0.7;
}

.legal-links {
  display: flex;
  gap: var(--space-md);
  list-style: none;
}

.legal-links a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.legal-links a:hover,
.legal-links a:focus {
  opacity: 1;
}

/* Fallback styles for no-js */
.fallback-message {
  background: var(--color-bg-card);
  border: var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
  color: var(--color-text-muted);
}

.fallback-message a {
  color: var(--color-sunrise-gold);
  text-decoration: underline;
  font-weight: var(--font-weight-body-medium);
  transition: color var(--transition-fast);
}

.fallback-message a:hover {
  color: var(--color-text-primary);
}

/* Responsive Design - Mobile Optimizations */
@media (max-width: 768px) {
  .main-navigation {
    padding: var(--space-sm) var(--space-md);
  }

  .nav-tagline {
    display: none;
  }

  .logo-text {
    font-size: var(--font-size-h4);
  }
  .menu-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
  }

  .navigation-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-surface-nav);
    backdrop-filter: var(--backdrop-blur);
    flex-direction: column;
    gap: var(--space-sm);
    border-top: 1px solid var(--color-border-card);
  }

  .navigation-menu.show {
    display: flex;
  }

  /* Enhanced mobile card grid */
  .cards-container {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    justify-items: center; /* Better centering */
    align-items: start;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
  }

  .cards-grid {
    margin: var(--space-md) auto var(--space-sm) auto;
    padding: 0 var(--space-md);
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  /* Fix card content overflow and improve typography */
  .card {
    width: 100%;
    max-width: 180px; /* Prevent cards from getting too wide */
    min-height: 280px; /* Ensure adequate height */
    margin: 0 auto; /* Center individual cards */
  }

  /* Enhanced mobile typography with better overflow handling */
  .card-title {
    font-size: clamp(0.9rem, 3.5vw, 1.1rem); /* More conservative scaling */
    line-height: 1.2;
    margin-bottom: 0.5rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limit to 2 lines max */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .card-description {
    font-size: clamp(0.75rem, 2.8vw, 0.85rem); /* Better mobile readability */
    line-height: 1.3;
    margin-bottom: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limit to 2 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
    max-width: 100%;
  }

  .card-content {
    padding: var(--space-sm) var(--space-sm) var(--space-md);
    min-height: 80px; /* More compact on mobile */
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 0.4rem; /* Tighter spacing */
    max-width: 100%;
    overflow: hidden;
  }

  /* Critical SVG icon scaling fixes */
  .card-image {
    min-height: 120px; /* Ensure minimum visible size */
    object-fit: contain;
    object-position: center;
    padding: var(--space-sm); /* Add padding for SVGs */
  }

  .fallback-icon {
    font-size: 3rem; /* Much larger fallback icons */
    margin-bottom: var(--space-sm);
  }

  .fallback-text {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
  }

  .fallback-subtitle {
    font-size: 0.9rem;
  }

  .hero-card {
    margin: 0 var(--space-sm);
    backdrop-filter: var(--backdrop-blur-light);
    padding: var(--space-md); /* More generous mobile padding */
  }
  
  .hero-background {
    background-attachment: scroll; /* Improve mobile performance */
    background-position: center center;
  }

  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

  .social-links {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .main-navigation {
    padding: var(--space-xs) var(--space-sm);
  }

  .nav-logo {
    flex-shrink: 1;
  }

  .logo-text {
    font-size: 1rem;
    white-space: nowrap;
  }
  
  /* Single column layout for small screens with perfect centering */
  .cards-container {
    grid-template-columns: 1fr;
    gap: var(--space-md); /* Consistent spacing */
    max-width: 300px; /* Optimal single card width */
    margin: 0 auto;
    justify-items: center;
    padding: 0;
  }
  
  .cards-grid {
    margin: var(--space-md) auto var(--space-sm) auto;
    padding: 0 var(--space-sm); /* Reduce side padding */
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 100%;
  }
  
  .card {
    aspect-ratio: 4 / 3; /* Better mobile aspect ratio */
    min-height: 260px; /* Slightly smaller for single column */
    max-width: 280px;
    width: 100%;
    margin: 0 auto;
  }

  /* Optimized mobile typography for single column */
  .card-title {
    font-size: clamp(1rem, 4vw, 1.2rem); /* Larger for single column */
    line-height: 1.2;
    margin-bottom: 0.6rem;
    -webkit-line-clamp: 2; /* Max 2 lines */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .card-description {
    font-size: clamp(0.8rem, 3.5vw, 0.9rem);
    line-height: 1.4;
    -webkit-line-clamp: 3; /* Allow 3 lines on single column */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .card-content {
    min-height: 90px;
    padding: var(--space-sm) var(--space-sm) var(--space-md); /* Consistent padding */
    gap: 0.6rem;
    max-width: 100%;
  }

  /* Larger SVG icons for better visibility on single column */
  .card-image {
    min-height: 140px; /* Larger icons on small screens */
    padding: var(--space-sm);
  }

  .fallback-icon {
    font-size: 4rem; /* Even larger fallback */
  }

  .fallback-text {
    font-size: 1.2rem;
    font-weight: 600;
  }
  
  .hero-card {
    padding: var(--space-md);
    margin: 0 var(--space-sm);
  }

  /* Improve touch targets */
  .card {
    cursor: pointer;
    touch-action: manipulation;
  }

  .card:active {
    transform: translateY(1px); /* Tactile feedback */
    transition: transform 0.1s ease;
  }
}

/* Animation for enhanced user experience */
@media (prefers-reduced-motion: no-preference) {
  .card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .card-image {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .card-title,
  .card-description {
    transition: all 0.3s ease;
  }
  
  .hero-card {
    animation: fadeInUp 1s ease-out;
  }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .card,
  .card-image,
  .card-title,
  .card-description,
  .hero-card {
    transition: none;
    animation: none;
  }
  
  .card:hover,
  .card:focus-within {
    transform: none;
  }
  
  .card:hover .card-image {
    transform: none;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .card,
  .hero-card {
    border-width: 2px;
    border-color: var(--color-text-primary);
  }
  
  .navigation-menu a:focus,
  .card-link:focus {
    outline-width: 3px;
  }
}

/* Logo Image Styling */
.logo-image {
  height: 50px;
  width: auto;
  max-width: 180px;
  transition: all var(--transition-fast);
}

.nav-logo a:hover .logo-image,
.nav-logo a:focus .logo-image {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

/* Mountain Graphic Styling */
.nav-mountains {
  flex: 0 0 auto;
}

.mountains-image {
  height: 40px;
  width: auto;
  max-width: 120px;
  transition: all var(--transition-fast);
}

.nav-mountains:hover .mountains-image {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

/* Mobile Navigation Updates */
@media (max-width: 768px) {
  .nav-mountains {
    display: none; /* Hide mountain graphic on mobile to save space */
  }

  .logo-image {
    height: 40px;
    max-width: 140px;
  }
}

@media (max-width: 480px) {
  .nav-mountains {
    display: none;
  }
  
  .logo-image {
    height: 35px;
    max-width: 120px;
  }
}

/* Ultra-wide mobile support (iPhone 15 Pro Max, etc.) with improved centering */
@media (min-width: 430px) and (max-width: 768px) {
  .cards-container {
    grid-template-columns: repeat(2, 1fr);
    max-width: 480px; /* Better proportion for wide screens */
    gap: var(--space-lg);
    margin: 0 auto;
    justify-items: center;
  }

  .cards-grid {
    padding: 0 var(--space-md);
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .card {
    max-width: 200px; /* Optimal card width for 2-column on wide mobile */
    min-height: 280px;
  }

  .card-title {
    font-size: clamp(0.95rem, 3.2vw, 1.15rem);
    line-height: 1.25;
    -webkit-line-clamp: 2;
  }

  .card-description {
    font-size: clamp(0.8rem, 2.8vw, 0.9rem);
    -webkit-line-clamp: 2;
    line-height: 1.3;
  }

  .card-content {
    padding: var(--space-sm);
    min-height: 85px;
    gap: 0.5rem;
  }
}

/* Compact mobile (iPhone SE, etc.) with enhanced text handling */
@media (max-width: 375px) {
  .cards-grid {
    padding: 0 var(--space-sm);
    max-width: 100%;
  }

  .cards-container {
    max-width: 280px; /* Optimal for small screens */
    gap: var(--space-md);
  }

  .card {
    min-height: 240px; /* More compact */
    max-width: 260px;
    width: 100%;
  }

  .card-content {
    padding: var(--space-xs) var(--space-sm) var(--space-sm);
    min-height: 70px; /* Compact content area */
    gap: 0.4rem;
  }

  .card-title {
    font-size: clamp(0.85rem, 4vw, 1rem); /* Smaller but readable */
    line-height: 1.2;
    margin-bottom: 0.4rem;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 2.4em; /* Explicit height limit */
  }

  .card-description {
    font-size: clamp(0.7rem, 3vw, 0.8rem);
    -webkit-line-clamp: 2; /* Strict 2-line limit */
    line-height: 1.2;
    max-height: 2.4em; /* Explicit height limit */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .card-image {
    min-height: 120px; /* Slightly smaller for compact layout */
    padding: var(--space-xs);
  }

  .hero-card {
    margin: 0 var(--space-xs);
    padding: var(--space-sm);
  }
}

/* Global mobile text and overflow improvements */
@media (max-width: 768px) {
  /* Ensure no horizontal scrolling */
  body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
  }

  /* Improve overall mobile typography hierarchy */
  .hero-title {
    font-size: clamp(2rem, 8vw, 3rem); /* Better mobile scaling */
    line-height: 1.1;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .hero-subtitle {
    font-size: clamp(1rem, 4vw, 1.4rem);
    line-height: 1.3;
    text-align: center;
    word-wrap: break-word;
  }

  .hero-description {
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    line-height: 1.4;
    text-align: center;
    word-wrap: break-word;
  }

  /* Ensure all content respects mobile boundaries */
  * {
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Improve section spacing for mobile */
  .cards-section {
    padding: var(--space-md) 0;
    width: 100%;
    overflow: hidden;
  }

  /* Better mobile footer spacing */
  .site-footer {
    padding: 3rem var(--space-md) var(--space-md);
    margin-top: var(--space-lg);
  }
}

/* Fix SVG display in cards */
.card-image {
  object-fit: contain !important;
}

/* Photo Credit Badge System */
.photo-credit {
  position: absolute;
  z-index: 10;
  opacity: 0.8; /* Visible by default for background images */
  transition: opacity 0.3s ease;
  pointer-events: auto;
  cursor: pointer;
}

/* Default position: bottom-right */
.photo-credit.bottom-right {
  bottom: 1rem;
  right: 1rem;
}

/* Alternative position: bottom-left (for bright right corners) */
.photo-credit.bottom-left {
  bottom: 1rem;
  left: 1rem;
}

/* Frosted glass badge label */
.photo-credit .label {
  background: rgba(11, 43, 36, 0.55); /* Deep Pine with transparency */
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #F8F8F8;
  font-size: 0.75rem;
  font-family: var(--font-base);
  font-weight: 400;
  line-height: 1.2;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(244, 194, 106, 0.25); /* Sunrise Gold accent */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Enhanced visibility on hover */
.photo-container:hover .photo-credit,
.card:hover .photo-credit,
.hero-section:hover .photo-credit,
body:hover .photo-credit {
  opacity: 1;
}

/* For container-based photo credits (hover to show) */
.photo-container .photo-credit,
.card .photo-credit,
.hero-section .photo-credit {
  opacity: 0;
}

.photo-container:hover .photo-credit,
.card:hover .photo-credit,
.hero-section:hover .photo-credit {
  opacity: 1;
}

/* Mobile: Always show credits for accessibility */
@media (max-width: 768px) {
  .photo-credit {
    opacity: 0.8;
  }
  
  .photo-credit .label {
    font-size: 0.7rem;
    padding: 0.4rem 0.6rem;
    max-width: 150px;
  }
  
  /* Adjust background photo credit position on mobile */
  .background-photo-credit {
    top: 1rem;
    right: 1rem;
  }
}

/* Photo container for background images with credits */
.photo-container {
  position: relative;
  overflow: hidden;
}
