:root {
  /* Bay of Quinte Official Color Palette */
  --bg-color: #576C5C;
  --bg-secondary: #4a5d4f;
  --text-color: rgba(247, 249, 249, 0.9);
  --text-muted: rgba(228, 235, 242, 0.7);
  --icon-color: rgba(247, 249, 249, 0.7);
  
  /* Primary Greens */
  --green-dark: #576C5C;
  --green-mid: #84937B;
  --green-light: #A4AF9D;
  
  /* Primary Corals */
  --coral: #EF7B6D;
  --coral-light: #F4A79E;
  --coral-pale: #FCE4DF;
  
  /* Secondary (for maps, charts) */
  --yellow: #E69800;
  --yellow-light: #FFC051;
  
  /* Accent mappings */
  --accent-color: #EF7B6D;
  --accent-hover: #E69800;
  --accent-muted: rgba(239, 123, 109, 0.2);
  --yellow-muted: rgba(230, 152, 0, 0.2);
  
  /* Sage/Green accent */
  --sage-color: #A4AF9D;
  --sage-muted: rgba(164, 175, 157, 0.2);
}

/* Global link styles */
a {
  color: var(--text-color);
  transition: color 0.2s ease;
}

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

/* Text selection */
::selection {
  background: var(--accent-color);
  color: var(--bg-color);
}

::-moz-selection {
  background: var(--accent-color);
  color: var(--bg-color);
}

body {
  font-family: 'Tide Sans', 'Poppins', sans-serif;
  font-weight: 400;
  background-color: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* ========================================
   PROFILE CARD
   Glassmorphic style with darker green
   ======================================== */

.profile-card {
  background: rgba(74, 93, 79, 0.8); /* --bg-secondary with opacity */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 1.5rem;
  transition: all 0.3s ease;
}

.profile-card:hover {
  background: rgba(74, 93, 79, 0.9);
  border-color: rgba(230, 152, 0, 0.4);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* Profile header: logo + name side by side */
.profile-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.profile-pic-sm {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex-shrink: 0;
}

.profile-name {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-color);
  margin: 0;
  font-feature-settings: "ss01" on;
}

.profile-description {
  opacity: 0.8;
  margin-bottom: 1rem;
  font-size: 0.9375rem;
}

/* Follow button - pill style */
.follow-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-color);
  text-decoration: none;
  transition: all 0.3s ease;
}

.follow-button:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--yellow);
  color: var(--yellow);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.follow-button i {
  font-size: 1rem;
}

/* Profile buttons row */
.profile-buttons {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Join button - matches follow button style with coral accent */
.join-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--coral);
  border-radius: 9999px;
  border: 1px solid var(--coral);
  font-family: 'Tide Sans', 'Poppins', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.join-button:hover {
  background: var(--coral-light);
  border-color: var(--coral-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 123, 109, 0.3);
}

.join-button i {
  font-size: 1rem;
}

/* Logged-in state - more subtle appearance */
.join-button.is-member {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-color);
}

.join-button.is-member:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--yellow);
  color: var(--yellow);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Legacy profile-pic for other uses */
.profile-pic {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.profile-pic:hover {
  transform: scale(1.05);
  border-color: var(--yellow);
}

.link-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.link-card:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  border-color: var(--yellow);
}

.icon {
  color: var(--icon-color);
  transition: all 0.3s ease;
}

.link-card:hover .icon {
  transform: scale(1.1);
  color: var(--yellow);
}

.bg-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
}

.circle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
  animation: float 15s infinite linear;
}

@keyframes float {
  0% {
      transform: translateY(0) rotate(0deg);
      opacity: 1;
  }
  100% {
      transform: translateY(-1000px) rotate(720deg);
      opacity: 0;
  }
}

.info-box {
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(5px);
  border-left: 3px solid var(--accent-color);
}

.social-icons a {
  transition: all 0.3s ease;
}

.social-icons a:hover {
  transform: translateY(-3px) scale(1.1);
  color: var(--yellow);
}

/* Generate random circles for background */
.generate-circles {
  position: absolute;
  width: 100%;
  height: 100%;
}

.pulsating-box {
  animation: glowWave 4s infinite;
}

@keyframes glowWave {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.2);
  }
  50% {
    box-shadow: 0 0 20px 20px rgba(255, 255, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  }
}

.border-trace::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 12px; /* match your card radius */
  box-sizing: border-box;
  pointer-events: none;

  /* Gradient border using a mask trick */
  border: 3px solid transparent;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.8), rgba(209, 77, 77, 0.224), rgba(255, 255, 255, 0.8));
  -webkit-mask: 
    linear-gradient(#fff 0 0) content-box, 
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  padding: 3px; /* same as border thickness */

  /* Animation */
  clip-path: inset(0 100% 0 0); /* start hidden */
  animation: drawBorder 10s linear infinite; /* slower: 10s */
}

@keyframes drawBorder {
  0% {
    clip-path: inset(0 100% 0 0); /* hidden */
  }
  25% {
    clip-path: inset(0 0 0 0); /* fully visible */
  }
  50% {
    clip-path: inset(100% 0 0 0); /* start hiding from top */
  }
  75% {
    clip-path: inset(0 0 0 100%); /* hide from right */
  }
  100% {
    clip-path: inset(0 100% 0 0); /* back to hidden */
  }
}

/* ========================================
   VIDEO SECTION & ACCORDION
   Glassmorphism style matching theme
   Mobile-first responsive design
   ======================================== */

.video-section {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.video-section-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-color);
}

.video-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.video-accordion-item {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  transition: all 0.3s ease;
}

.video-accordion-item:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(230, 152, 0, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.video-accordion-item[open] {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent-color);
}

/* Remove default marker/arrow */
.video-accordion-item summary {
  list-style: none;
}

.video-accordion-item summary::-webkit-details-marker {
  display: none;
}

/* Accordion header */
.video-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
}

.video-accordion-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

/* Toggle icon (chevron) */
.video-accordion-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.video-accordion-icon svg {
  width: 1rem;
  height: 1rem;
  opacity: 0.7;
}

/* Rotate icon when open */
.video-accordion-item[open] .video-accordion-icon {
  transform: rotate(90deg);
}

.video-accordion-title {
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* YouTube badge */
.video-accordion-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: rgba(255, 0, 0, 0.15);
  border-radius: 8px;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.video-accordion-badge svg {
  width: 1rem;
  height: 1rem;
  color: #ff4444;
  transition: color 0.3s ease;
}

.video-accordion-item:hover .video-accordion-badge {
  background: rgba(255, 0, 0, 0.25);
}

.video-accordion-item:hover .video-accordion-badge svg {
  color: #ff6666;
}

/* Content area with smooth expand animation */
.video-accordion-content {
  padding: 0 1rem 1rem 1rem;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 16:9 video wrapper */
.video-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  background: rgba(0, 0, 0, 0.4);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.video-description {
  font-size: 0.875rem;
  color: var(--text-color);
  opacity: 0.75;
  margin-top: 0.875rem;
  line-height: 1.6;
  padding-left: 0.25rem;
}

/* ========================================
   RESPONSIVE BREAKPOINTS
   Mobile-first approach
   ======================================== */

/* Small screens (default - mobile first) */
@media (max-width: 480px) {
  .video-section {
    padding: 1rem;
    border-radius: 10px;
  }

  .video-section-title {
    font-size: 1.125rem;
  }

  .video-accordion {
    gap: 0.5rem;
  }

  .video-accordion-header {
    padding: 0.875rem;
  }

  .video-accordion-title {
    font-size: 0.875rem;
  }

  .video-accordion-badge {
    width: 1.75rem;
    height: 1.75rem;
  }

  .video-accordion-content {
    padding: 0 0.875rem 0.875rem 0.875rem;
  }

  .video-wrapper {
    border-radius: 8px;
  }

  .video-description {
    font-size: 0.8125rem;
  }
}

/* Medium screens (tablets) */
@media (min-width: 481px) and (max-width: 768px) {
  .video-section {
    padding: 1.25rem;
  }
}

/* Large screens (desktop) */
@media (min-width: 769px) {
  .video-section {
    padding: 1.5rem;
  }

  .video-accordion {
    gap: 0.875rem;
  }

  .video-accordion-header {
    padding: 1.125rem 1.25rem;
  }

  .video-accordion-title {
    font-size: 1rem;
  }

  .video-accordion-content {
    padding: 0 1.25rem 1.25rem 1.25rem;
  }
}

/* ========================================
   HOMEPAGE FEATURED ROUTES CARD
   ======================================== */

.featured-routes-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  transition: all 0.3s ease;
}

.featured-routes-card:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(230, 152, 0, 0.4);
}

.featured-routes-header {
  display: block;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-decoration: none;
  color: inherit;
  transition: background 0.2s ease;
}

.featured-routes-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.featured-routes-grid {
  display: flex;
  flex-direction: column;
}

.featured-route-mini {
  display: block;
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.2s ease;
}

.featured-route-mini:last-child {
  border-bottom: none;
}

.featured-route-mini:hover {
  background: var(--yellow-muted);
  padding-left: 1.5rem;
}

.mini-route-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.5rem;
}

.difficulty-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.difficulty-dot.difficulty-casual {
  background: #22c55e;
}

.difficulty-dot.difficulty-easy {
  background: #3b82f6;
}

.difficulty-dot.difficulty-moderate {
  background: #fbbf24;
}

.difficulty-dot.difficulty-hard {
  background: #ef4444;
}

.difficulty-dot.difficulty-multi_day {
  background: #a855f7;
}

.mini-route-name {
  font-weight: 500;
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-route-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.875rem;
  font-size: 0.8125rem;
  opacity: 0.7;
  margin-bottom: 0.5rem;
}

.mini-stat {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.mini-stat i {
  font-size: 0.6875rem;
  opacity: 0.8;
}

.mini-route-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.difficulty-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1875rem 0.5rem;
  border-radius: 4px;
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: capitalize;
}

.difficulty-badge.difficulty-casual {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
}

.difficulty-badge.difficulty-easy {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

.difficulty-badge.difficulty-moderate {
  background: rgba(251, 191, 36, 0.2);
  color: #fcd34d;
}

.difficulty-badge.difficulty-hard {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.difficulty-badge.difficulty-multi_day {
  background: rgba(168, 85, 247, 0.2);
  color: #c4b5fd;
}

.terrain-tag {
  font-size: 0.6875rem;
  padding: 0.1875rem 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  text-transform: capitalize;
}

.featured-routes-footer {
  display: block;
  padding: 0.875rem 1.25rem;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent-color);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-decoration: none;
  transition: all 0.2s ease;
}

.featured-routes-footer:hover {
  background: var(--yellow-muted);
  color: var(--yellow);
}

/* ========================================
   MASONRY GRID LAYOUT
   CSS columns fallback + CSS Grid masonry
   Progressive: 1 col → 2 col → 3 col
   ======================================== */

.masonry-grid {
  /* Fallback: CSS columns for Chrome/Edge/older browsers */
  column-count: 1;
  column-gap: 1.5rem;
}

.masonry-item {
  break-inside: avoid;
  margin-bottom: 1.5rem;
}

/* 2 columns on tablets (768px+) */
@media (min-width: 768px) {
  .masonry-grid {
    column-count: 2;
  }
}

/* 3 columns on desktop (1024px+) */
@media (min-width: 1024px) {
  .masonry-grid {
    column-count: 3;
  }
}

/* CSS Grid masonry for Safari 17+ and future browsers */
@supports (grid-template-rows: masonry) {
  .masonry-grid {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: masonry;
    gap: 1.5rem;
    column-count: unset;
  }

  .masonry-item {
    margin-bottom: 0;
  }

  /* 2 columns on tablets (768px+) */
  @media (min-width: 768px) {
    .masonry-grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }

  /* 3 columns on desktop (1024px+) */
  @media (min-width: 1024px) {
    .masonry-grid {
      grid-template-columns: repeat(3, 1fr);
    }
  }
}