@font-face {
    font-family: 'Euclid Circular A';
    src: url('../assets/fonts/EuclidCircularA-Regular.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Euclid Circular A';
    src: url('../assets/fonts/EuclidCircularA-Light.otf') format('opentype');
    font-weight: 300;
    font-style: normal;
}

@font-face {
    font-family: 'Euclid Circular A';
    src: url('../assets/fonts/EuclidCircularA-Semibold.otf') format('opentype');
    font-weight: 600;
    font-style: normal;
}

@font-face {
    font-family: 'Euclid Circular A';
    src: url('../assets/fonts/EuclidCircularA-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: 'Archer Pro'; /* Choose a name for your custom font */
    src: url('../assets/fonts/ArcherPro-Light.otf') format('opentype'); /* Path to the font file and its format */
    font-weight: normal; /* Define the font weight */
    font-style: normal; /* Define the font style */
}

@font-face {
    font-family: 'icons';
    src: url('../assets/fonts/tdf-icons.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
}

@font-face {
  font-family: 'weathericons';
  src: url('../assets/fonts/weathericons-regular-webfont.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
}

:root {
    /* Light mode colors */
    --background-color: #ffffff;
    --text-color: #1A1B25;
    --toggle-btn-background-color: #f8f8f8;
    --gc-table-odds-background-color: #f8f8f8;
    --tooltip-background-color: #f8f8f8;
    --tooltip-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --winner-background-color: #e8e8e9;
    --winner-border: 2px solid #e8e8e9;
    --rider-background-color: #e8e8e9;
    --rider-border: 2px solid #e8e8e9;
}

/* Use html.dark-mode so theme can be applied in <head> before first paint (avoids flash when navigating) */
html.dark-mode,
body.dark-mode {
    /* Dark mode colors */
    --background-color: #1A1B25;
    --text-color: #e8e9ea;
    --toggle-btn-background-color: #31323b;
    --gc-table-odds-background-color: #31323b;
    --tooltip-background-color: #31323b;
    --tooltip-box-shadow: 0 2px 4px rgba(232, 232, 233, 0.2);
    --winner-background-color: #31323b;
    --winner-border: 2px solid #31323b;
    --rider-background-color: #484951;
    --rider-border: 2px solid #484951;
}

body {
    font-family: 'Euclid Circular A', Arial, sans-serif;
    color: var(--text-color);
    background-color: var(--background-color);
    margin: 0 auto;
    max-width: 1420px;
    padding: 0 0 300px 0px;
    transition: background-color 0.22s ease-out, color 0.22s ease-out;
}

li {
    margin-left: 12px; /* Adjust the space between bullet and text */
}

li::marker {
    margin-right: 2px; /* Adjust the space between bullet and text */
}

/* Tour de France logo outside the stage containers */
.tour-logo {
    max-width: 1052px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-year-group {
    display: flex;
    align-items: center;
    gap: 24px;
}

#tdf-logo {
    width: 90px;
    vertical-align: middle;
    display: block;
    margin-right: 24px;
}

.top-year-selector {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    display: inline-flex;
}

/* Home page header matches year-page header geometry exactly */
body.home-page .tour-logo {
    margin: 0 auto;
    position: static;
    min-height: 64px;
    max-width: 1052px;
    width: min(1052px, calc(100% - 32px));
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-start;
}

body.home-page .logo-year-group {
    position: static;
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

body.home-page .top-year-selector {
    order: 1;
    margin-right: 0;
    z-index: 2;
    max-width: none;
}

body.home-page .top-year-selector .custom-dropdown {
    min-width: 0;
}

body.home-page .logo-year-group > a {
    order: 2;
    flex: 0 0 auto;
}

body.home-page #tdf-logo {
    position: static;
    left: auto;
    top: auto;
    transform: none;
    margin-right: 0;
}

body.home-page .toggle-container {
    order: 3;
    margin-left: auto;
}

body.home-page .switch::before {
    top: calc(100% + 6px);
    left: auto;
    right: 0;
    margin-top: 0;
    z-index: 1200;
}

@media (min-width: 769px) {
    body.home-page .tour-logo {
        position: relative;
        justify-content: space-between;
    }

    body.home-page .logo-year-group {
        gap: 0;
    }

    body.home-page .top-year-selector {
        margin-right: auto;
        max-width: calc(50% - 56px);
    }

    body.home-page #tdf-logo {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
    }

    body.home-page .toggle-container {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    body.home-page .tour-logo {
        margin: 16px 16px 14px 16px;
        display: flex;
        align-items: center;
        gap: 8px;
        min-height: auto;
    }

    body.home-page .logo-year-group {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 1;
        min-width: 0;
    }

    body.home-page #tdf-logo {
        position: static;
        left: auto;
        top: auto;
        transform: none;
        width: clamp(64px, 16vw, 86px);
        margin-right: 0;
    }

    body.home-page .top-year-selector {
        order: 1;
        width: auto;
        max-width: 100%;
        min-width: 0;
        margin-right: 0;
        gap: 6px;
        flex-wrap: nowrap;
    }

    body.home-page .toggle-container {
        order: 3;
        margin: 0 0 0 auto;
    }
}

@media (max-width: 480px) {
    body.home-page .tour-logo {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "spacer toggle"
            "group group";
        row-gap: 8px;
        align-items: center;
    }

    body.home-page .logo-year-group {
        grid-area: group;
        width: 100%;
        justify-content: flex-start;
    }

    body.home-page .toggle-container {
        grid-area: toggle;
        justify-self: end;
        margin: 0;
    }

    body.home-page .dropdown-toggle {
        font-size: 28px;
    }

    body.home-page #year-select {
        width: 78px;
    }
}

.dropdown-arrow {
    width: 18px;
    height: 16px;
  }

  .custom-dropdown {
      position: relative;
      display: inline-block;
  }

  #year-select {
    width: 110px;
    display: flex;
    justify-content: flex-start;
  }

  .dropdown-toggle {
      font-family: 'Euclid Circular A', sans-serif;
      padding: 4px 12px;
      font-size: 40px;
      font-weight: 700;
      border-radius: 4px;
      border:none;
      background: var(--background-color);
      color: #ffed00;
      cursor: pointer;
      display: flex;
      justify-content: flex-start;
      align-items: center;
      transition: background .3s ease;
  }

.dropdown-toggle::before {
    content: 'Select a year';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--toggle-btn-background-color);
    color: var(--text-color);
    padding: 5px 10px;
    margin-top: 4px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 300;
    white-space: nowrap;
    opacity: 0;
    transition: opacity .3s ease;
    z-index: 1000;
}

.dropdown-toggle:hover {
    outline: none;
    background: var(--toggle-btn-background-color);
}

  .dropdown-toggle:hover::before {
      opacity: 1;
  }

.dropdown-menu {
    position: absolute;
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--toggle-btn-background-color);
    box-shadow: var(--tooltip-box-shadow);
    border: 1px solid var(--rider-background-color);
    border-radius: 4px;
    margin-top: 4px;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
  }

  .dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

  .dropdown-item {  
      padding: 4px 8px;
      margin: 2px 8px;
      cursor: pointer;
      font-size: 18px;
      font-weight: 700;
  }

  .dropdown-item:hover {
      background: var(--rider-background-color);
      color: var(--text-color);
      border-radius: 4px;    
      outline: none;
      text-decoration: none;
  }

  .dropdown-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.tour-intro {
    width: 420px;
    min-width: 420px;
    max-width: 420px;
    flex: 0 0 420px; /* don't grow, don't shrink, stay at 420px */
    flex-shrink: 0;
    font-size: .82em;
    font-weight: 300;
    margin: 0;
}

.tour-intro a {
    color: var(--text-color);
    position: relative;
    transition: all 0.3s ease;
}

.tour-intro a:hover, .tour-intro a:focus {
    color: #1a1b25;
    background-color: rgba(255, 237, 0, .9); /* Optional: background color inside the box */
}

/* Milestone tooltip links styling - matches tour intro section */
.tooltip-start a,
.tooltip-move a,
.tooltip-lead-change a,
.tooltip-crash a,
.tooltip-mountain03 a,
.tooltip-mountain03-bonus a,
.tooltip-mountain02 a,
.tooltip-mountain02-bonus a,
.tooltip-mountain01 a,
.tooltip-mountain01-bonus a,
.tooltip-mountainHc a,
.tooltip-mountainHc-bonus a,
.tooltip-sprint a,
.tooltip-sprint-bonus a,
.tooltip-finish a,
.tooltip-finish-bonus a,
.tooltip-finish-03 a,
.tooltip-finish-02 a,
.tooltip-finish-01 a,
.tooltip-finish-Hc a {
    color: var(--text-color);
    position: relative;
    transition: all 0.3s ease;
}

.tooltip-start a:hover,
.tooltip-move a:hover,
.tooltip-lead-change a:hover,
.tooltip-crash a:hover,
.tooltip-mountain03 a:hover,
.tooltip-mountain03-bonus a:hover,
.tooltip-mountain02 a:hover,
.tooltip-mountain02-bonus a:hover,
.tooltip-mountain01 a:hover,
.tooltip-mountain01-bonus a:hover,
.tooltip-mountainHc a:hover,
.tooltip-mountainHc-bonus a:hover,
.tooltip-sprint a:hover,
.tooltip-sprint-bonus a:hover,
.tooltip-finish a:hover,
.tooltip-finish-bonus a:hover,
.tooltip-finish-03 a:hover,
.tooltip-finish-02 a:hover,
.tooltip-finish-01 a:hover,
.tooltip-finish-Hc a:hover,
.tooltip-start a:focus,
.tooltip-move a:focus,
.tooltip-lead-change a:focus,
.tooltip-crash a:focus,
.tooltip-mountain03 a:focus,
.tooltip-mountain03-bonus a:focus,
.tooltip-mountain02 a:focus,
.tooltip-mountain02-bonus a:focus,
.tooltip-mountain01 a:focus,
.tooltip-mountain01-bonus a:focus,
.tooltip-mountainHc a:focus,
.tooltip-mountainHc-bonus a:focus,
.tooltip-sprint a:focus,
.tooltip-sprint-bonus a:focus,
.tooltip-finish a:focus,
.tooltip-finish-bonus a:focus,
.tooltip-finish-03 a:focus,
.tooltip-finish-02 a:focus,
.tooltip-finish-01 a:focus,
.tooltip-finish-Hc a:focus {
    color: #1a1b25;
    background-color: rgba(255, 237, 0, .9);
}

.tour-intro h3 {
    font-size: 1em;
    font-weight: 600;
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.tour-intro .icon-text {
    font-weight: 700;
}

.tour-intro .total-distance {
    margin-right: 12px;
}

.tour-intro .flat-stages {
    margin-left: 1em;
}

.tour-intro .avg-speed {
    background-color: var(--toggle-btn-background-color);
    padding: 2px 8px;
    margin-left: 1.5em;
    border-radius: 12px;
}

/* Custom tooltip styling */
.tour-intro-details {
    position: relative;
    margin-right: 1em;
}
.tour-intro-details:last-child {
    margin-right: 0;
}

.tour-intro-details::before {
    position: absolute;
    
    top: -28px;
    background: var(--toggle-btn-background-color);
    color: var(--text-color);
    padding: 5px 10px;
    margin-bottom:2px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 300;
    white-space: nowrap;
    opacity: 0;
    transition: opacity .3s ease;
    pointer-events: none;
}

.tour-intro-details:hover::before {
    opacity: 1;
}

.total-distance::before {
    content: 'Total Distance';
    transform: translateX(-2%);
}

.flat-stages::before {
    content: 'Flat Stages';
    transform: translateX(-30%);
}

.hilly-stages::before {
    content: 'Hilly Stages';
    transform: translateX(-40%);
}

.mountain-stages::before {
    content: 'Mountain Stages';
    transform: translateX(-40%);
}

.time-trial-stages::before {
    content: 'Time Trial Stages';
    transform: translateX(-40%);
}

.avg-speed::before {
    content: 'Average Speed of Winner';
    transform: translateX(-30%);
}

/* Toggle winners & results: circular button with eye icon (matches .legend-trigger) */
.toggle-winners-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    font-family: inherit;
    color: var(--text-color);
    background-color: var(--toggle-btn-background-color);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.toggle-winners-btn::before {
    content: attr(data-tooltip);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--tooltip-background-color);
    color: var(--text-color);
    padding: 5px 10px;
    margin-top: 4px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 300;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1000;
}
.toggle-winners-btn:hover::before,
.toggle-winners-btn:focus::before {
    opacity: 1;
}
.toggle-winners-btn:hover {
    background-color: var(--text-color);
    color: var(--background-color);
}
.toggle-winners-btn:focus {
    outline: 2px solid var(--text-color);
    outline-offset: 2px;
}
.toggle-winners-btn .icon-eye,
.toggle-winners-btn .icon-eye-off {
    width: 18px;
    height: 18px;
    pointer-events: none;
}
.toggle-winners-btn .icon-eye-off {
    display: none;
}
.toggle-winners-btn.winners-hidden .icon-eye {
    display: none;
}
.toggle-winners-btn.winners-hidden .icon-eye-off {
    display: inline-block;
}
.icon-eye {
    display: inline-block;
    width: 24px;
    height: 24px;
    background-color: currentColor;
    mask: url('../assets/icons/eye.svg') center / contain no-repeat;
    -webkit-mask: url('../assets/icons/eye.svg') center / contain no-repeat;
}
.icon-eye-off {
    display: inline-block;
    width: 24px;
    height: 24px;
    background-color: currentColor;
    mask: url('../assets/icons/eye-off.svg') center / contain no-repeat;
    -webkit-mask: url('../assets/icons/eye-off.svg') center / contain no-repeat;
}

.txtnav {
    display: inline-block;
    margin: 0 1px;
    padding: 2px 4px 4px 4px;
    border-radius: 4px;
    min-width: 16px;
    border: 1px solid var(--toggle-btn-background-color);
    font-size: .8em;
    font-weight: 700;
    line-height: normal;
    text-align: center;
}

.txtnav-modifier {
    display: inline-block;
    margin: 0 1px;
    padding: 2px 4px 4px 4px;
    border-radius: 4px;
    border: 1px solid var(--toggle-btn-background-color);
    font-size: 1em;
    font-weight: 400;
    line-height: normal;
    text-align: center;
}

.year-header {
    font-size: 72px;
    font-weight: bold;
    margin: 96px 0 -48px 140px;
    color: rgba(255, 237, 0, 0.5);
}

/* Stage row wrapper */
.stage-layout {
    display: flex;
    align-items: center;
    width: fit-content;
    margin: 50px 0;
}

/* Stage profile block (number + profile + milestones) */
.stage-container {
    display: flex;
    align-items: center;
    height: 240px;
    width: fit-content;
    margin: 0;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

/* Stage number on the left */
.stage-number {
    display: flex;
    justify-content: flex-end;
    align-self: flex-end;
    font-size: 72px;
    font-weight: 700;
    width: 80px;
    color: rgba(255, 237, 0, 0.5);
    flex-shrink: 0;
    text-align: right;
    margin: 0 20px -1px 40px;
}

.stage-profile {
    min-width: 800px;
    display: flex;
    align-self: flex-end;
    margin-bottom: 18px;
}

.milestone-buttons-container {
    max-width: 20px;
}

/* Milestones on the Stage Profiles*/
.milestone {
    position: absolute;
    min-width: 24px;
    min-height: 24px;
    display: flex;
    justify-content: center; /* Center horizontally */
    align-items: center; /* Center vertically */
}

.flag,
.flag-scale {
    width: 24px;
    height: auto;
    opacity: .5;
    transition: opacity 0.5s ease, visibility 0.5s ease; /* Transition effect */
}
        
.flag:hover,
.flag-scale:hover {
    opacity: 1;
    transition: opacity 0.5s ease, visibility 0.5s ease; /* Transition effect */
}

.flag-scale {
    margin-right: 12px;
}

/* Milestone for a key move of the day */
.radiating-circle {
    width: 8px;
    height: 8px;
    background-color: #FBAD28;
    border-radius: 50%;
    position: absolute;
    box-shadow: 0 0 4px rgba(251, 173, 40, 0.7),
                0 0 8px rgba(251, 173, 40, 0.5),
                0 0 12px rgba(251, 173, 40, 0.3);
    animation: pulse 1.5s infinite;
}

/* Enhanced radiating circle for lead changes (two expanding rings) */
.radiating-circle.lead-change::before,
.radiating-circle.lead-change::after {
    content: "";
    position: absolute;
    border: 2px solid rgba(251, 173, 40, 0.9);
    border-radius: 50%;
    inset: -6px;
    opacity: 0;
    animation: leadChangeRing 1.8s infinite;
}

.radiating-circle.lead-change::after {
    inset: -14px;
    animation-delay: 0.4s;
}

/* Pulsating animation */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 4px rgba(251, 173, 40, 0.7), 
                    0 0 8px rgba(251, 173, 40, 0.5),
                    0 0 12px rgba(251, 173, 40, 0.3);
    }
    50% {
        transform: scale(1.5);
        box-shadow: 0 0 6px rgba(251, 173, 40, 0.8), 
                    0 0 12px rgba(251, 173, 40, 0.6),
                    0 0 18px rgba(251, 173, 40, 0.4);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 4px rgba(251, 173, 40, 0.7), 
                    0 0 8px rgba(251, 173, 40, 0.5),
                    0 0 12px rgba(251, 173, 40, 0.3);
    }
}

@keyframes leadChangeRing {
    0% {
        transform: scale(0.7);
        opacity: 0.9;
    }
    60% {
        transform: scale(1.2);
        opacity: 0;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

/* Tooltips for Milestone details*/
.tooltip-start,
.tooltip-move,
.tooltip-lead-change,
.tooltip-crash,
.tooltip-mountain03,
.tooltip-mountain03-bonus,
.tooltip-mountain02,
.tooltip-mountain02-bonus,
.tooltip-mountain01,
.tooltip-mountain01-bonus,
.tooltip-mountainHc,
.tooltip-mountainHc-bonus,
.tooltip-sprint,
.tooltip-sprint-bonus,
.tooltip-finish,
.tooltip-finish-bonus,
.tooltip-finish-03,
.tooltip-finish-02,
.tooltip-finish-01,
.tooltip-finish-Hc {
    opacity: 0; /* Initially hidden */
    visibility: hidden; /* Hidden until hovered */
    transition: opacity 0.5s ease, visibility 0.5s ease; /* Transition effect */
    display: flex;
    flex-direction: row;
    align-items: center; /* Centers the image horizontally */
    position: absolute;
    font-size: 10px;
    width: 320px;
    background-color: var(--tooltip-background-color);
    border-radius: 4px;
    padding: 0 8px;
    text-align: left;
    z-index: 9;
    cursor: default;
    box-shadow: var(--tooltip-box-shadow)
}

.milestone.active .tooltip-start, 
.milestone.active .tooltip-move,
.milestone.active .tooltip-lead-change,
.milestone.active .tooltip-crash,
.milestone.active .tooltip-mountain03,
.milestone.active .tooltip-mountain03-bonus,
.milestone.active .tooltip-mountain02,
.milestone.active .tooltip-mountain02-bonus,
.milestone.active .tooltip-mountain01,
.milestone.active .tooltip-mountain01-bonus,
.milestone.active .tooltip-mountainHc,
.milestone.active .tooltip-mountainHc-bonus,
.milestone.active .tooltip-sprint, 
.milestone.active .tooltip-sprint-bonus,
.milestone.active .tooltip-finish,
.milestone.active .tooltip-finish-bonus,
.milestone.active .tooltip-finish-03,
.milestone.active .tooltip-finish-02,
.milestone.active .tooltip-finish-01,
.milestone.active .tooltip-finish-Hc,
.milestone.active .milestone-tab, 
.milestone.active .flag {
    display: flex;
    z-index: 5;
    opacity: 1; /* Fully visible */
    visibility: visible; /* Tooltip becomes visible */
}

.milestone:hover .tooltip-start, 
.milestone:hover .tooltip-move,
.milestone:hover .tooltip-lead-change,
.milestone:hover .tooltip-crash,
.milestone:hover .tooltip-mountain03,
.milestone:hover .tooltip-mountain03-bonus,
.milestone:hover .tooltip-mountain02, 
.milestone:hover .tooltip-mountain02-bonus,
.milestone:hover .tooltip-mountain01,
.milestone:hover .tooltip-mountain01-bonus,
.milestone:hover .tooltip-mountainHc,
.milestone:hover .tooltip-mountainHc-bonus,
.milestone:hover .tooltip-sprint, 
.milestone:hover .tooltip-sprint-bonus,
.milestone:hover .tooltip-finish,
.milestone:hover .tooltip-finish-bonus,
.milestone:hover .tooltip-finish-03,
.milestone:hover .tooltip-finish-02,
.milestone:hover .tooltip-finish-01,
.milestone:hover .tooltip-finish-Hc, 
.milestone:hover .flag {
    display: flex;
    z-index: 10;
    opacity: 1; /* Fully visible */
    visibility: visible; /* Tooltip becomes visible */
}
      
.tooltip-start {
    border-bottom: 4px solid #0078BC;
}
        
.tooltip-move,
.tooltip-lead-change,
.tooltip-crash {
    border-bottom: 4px solid #FBAD28;
}
 
.tooltip-mountain03,
.tooltip-mountain03-bonus,
.tooltip-mountain02,
.tooltip-mountain02-bonus,
.tooltip-mountain01,
.tooltip-mountain01-bonus,
.tooltip-mountainHc,
.tooltip-mountainHc-bonus,
.tooltip-finish,
.tooltip-finish-bonus,
.tooltip-finish-03,
.tooltip-finish-02,
.tooltip-finish-01,
.tooltip-finish-Hc {
    border-bottom: 4px solid #C30F19;
}
        
.tooltip-sprint,
.tooltip-sprint-bonus {
border-bottom: 4px solid #3BAA31;
}


/* Milestone-tab interaction styles */
.milestone-tab:hover {
    cursor: pointer; /* Changes cursor to indicate interactivity */
    filter: brightness(1.2); /* Optional effect to make it stand out */
    transform: scaleX(1.5) scaleY(1);
    opacity: 1;
}



/* Tooltip for milestone-tab interaction */
.milestone-tab:hover + .milestone .tooltip-start,
.milestone-tab:hover + .milestone .tooltip-move,
.milestone-tab:hover + .milestone .tooltip-crash,
.milestone-tab:hover + .milestone .tooltip-mountain03,
.milestone-tab:hover + .milestone .tooltip-mountain03-bonus,
.milestone-tab:hover + .milestone .tooltip-mountain02,
.milestone-tab:hover + .milestone .tooltip-mountain02-bonus,
.milestone-tab:hover + .milestone .tooltip-mountain01,
.milestone-tab:hover + .milestone .tooltip-mountain01-bonus,
.milestone-tab:hover + .milestone .tooltip-mountainHc,
.milestone-tab:hover + .milestone .tooltip-mountainHc-bonus,
.milestone-tab:hover + .milestone .tooltip-sprint,
.milestone-tab:hover + .milestone .tooltip-sprint-bonus,
.milestone-tab:hover + .milestone .tooltip-finish,
.milestone-tab:hover + .milestone .tooltip-finish-bonus,
.milestone-tab:hover + .milestone .tooltip-finish-03,
.milestone-tab:hover + .milestone .tooltip-finish-02,
.milestone-tab:hover + .milestone .tooltip-finish-01,
.milestone-tab:hover + .milestone .tooltip-finish-Hc,
.milestone-tab:hover + .milestone .flag {
    opacity: 1;
    visibility: visible;
}

/* Base styling for milestone tabs */
.milestone-tab {
    position: absolute; /* Absolute positioning relative to the first parent that isn't static */
    width: 24px;
    height: 4px;
    border-radius: 2px;
    left: 0; /* Align to the left */
    opacity: .4;
    background-color: #ccc; /* Example color, change as needed */
    transition: opactiy 0.3s ease, transform 0.3s ease; /* Smooth scaling effect */
}

/* Use a pseudo-element to expand the hoverable and clickable area */
.milestone-tab::before {
    content: "";             /* Required for pseudo-elements */
    position: absolute;      /* Absolute positioning relative to the parent */
    top: -10px;              /* Expand clickable area above */
    bottom: -4px;           /* Expand clickable area below */
    left: 0px;             /* Expand clickable area to the left */
    right: -24px;            /* Expand clickable area to the right */
    z-index: -1;             /* Keep it behind the actual visual content */
}

.milestone-tab.active {
    transform: scaleX(1.8) scaleY(1);
    filter: brightness(1.2);
    opacity: 1;
    transition: transform 0.3s, filter 0.3s;
}

/* Position each tab with a top value incremented based on its index */
.milestone-tab:last-child {
    top: 218px !important;
}

.stage-container > .milestone-tab:nth-last-child(1) {
    top: 218px;
}

.stage-container > .milestone-tab:nth-last-child(2) {
    top: 218px;
}

.stage-container > .milestone-tab:nth-last-child(3) {
    top: 218px;
}

.stage-container .milestone-tab:nth-last-child(4) {
    top: 218px;
}

.stage-container .milestone-tab:nth-last-child() {
    top: 218px;
}

        
.rider {
    width: 60px;
    height: 60px;
    margin: 8px 0;
    background-color: var(--rider-background-color);
    border-radius: 50px;
    display: block;
    border: var(--rider-border);
}
        
.tooltip-content {
    min-width: 220px;
    margin: 8px; /* Adds space between image and text */
}

.tooltip-start .tooltip-content {
    min-width: 300px;
    margin: 8px; /* Adds space between image and text */
}
        
h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 300;
}
        
h4 {
    margin: 2px 0;
    font-size: 12px;

}

h5 {
    margin: 2px 0;
    font-size: 12px;
    font-weight: 700;
}
        
.tooltip-subtitle {
    line-height: 10px;
    font-size:10px;
    color: var(--text-color);
}

/* Date, weather, temperature, and elevation styling with reduced opacity */
.tooltip-subtitle .date-value,
.tooltip-subtitle .weather-text,
.tooltip-subtitle .temperature-value,
.tooltip-subtitle .elevation-value {
    opacity: 0.6;
}

/* Points value styling for sprint and finish tooltips */
.tooltip-sprint .points-value,
.tooltip-sprint-bonus .points-value,
.tooltip-finish .points-value,
.tooltip-finish-bonus .points-value,
.tooltip-finish-03 .points-value,
.tooltip-finish-02 .points-value,
.tooltip-finish-01 .points-value,
.tooltip-finish-Hc .points-value {
    color: #3BAA31;
    opacity: 1;
    font-weight: 700;
}

/* Bonus value styling for all tooltips */
.tooltip-start .bonus-value,
.tooltip-move .bonus-value,
.tooltip-lead-change .bonus-value,
.tooltip-crash .bonus-value,
.tooltip-mountain03 .bonus-value,
.tooltip-mountain03-bonus .bonus-value,
.tooltip-mountain02 .bonus-value,
.tooltip-mountain02-bonus .bonus-value,
.tooltip-mountain01 .bonus-value,
.tooltip-mountain01-bonus .bonus-value,
.tooltip-mountainHc .bonus-value,
.tooltip-mountainHc-bonus .bonus-value,
.tooltip-sprint .bonus-value,
.tooltip-sprint-bonus .bonus-value,
.tooltip-finish .bonus-value,
.tooltip-finish-bonus .bonus-value,
.tooltip-finish-03 .bonus-value,
.tooltip-finish-02 .bonus-value,
.tooltip-finish-01 .bonus-value,
.tooltip-finish-Hc .bonus-value {
    color: #D4A017;
    opacity: 1;
    font-weight: 700;
}

/* Mountains value styling for all tooltips */
.tooltip-start .mountains-value,
.tooltip-move .mountains-value,
.tooltip-lead-change .mountains-value,
.tooltip-crash .mountains-value,
.tooltip-mountain03 .mountains-value,
.tooltip-mountain03-bonus .mountains-value,
.tooltip-mountain02 .mountains-value,
.tooltip-mountain02-bonus .mountains-value,
.tooltip-mountain01 .mountains-value,
.tooltip-mountain01-bonus .mountains-value,
.tooltip-mountainHc .mountains-value,
.tooltip-mountainHc-bonus .mountains-value,
.tooltip-sprint .mountains-value,
.tooltip-sprint-bonus .mountains-value,
.tooltip-finish .mountains-value,
.tooltip-finish-bonus .mountains-value,
.tooltip-finish-03 .mountains-value,
.tooltip-finish-02 .mountains-value,
.tooltip-finish-01 .mountains-value,
.tooltip-finish-Hc .mountains-value {
    color: #C30F19;
    opacity: 1;
    font-weight: 700;
}
        
.tooltip-start p,
.tooltip-move p,
.tooltip-lead-change p,
.tooltip-crash p,
.tooltip-mountain03 p,
.tooltip-mountain03-bonus p,
.tooltip-mountain02 p,
.tooltip-mountain02-bonus p, 
.tooltip-mountain01 p,
.tooltip-mountain01-bonus p,
.tooltip-mountainHc p,
.tooltip-mountainHc-bonus p,
.tooltip-sprint p,
.tooltip-sprint-bonus p,
.tooltip-finish p,
.tooltip-finish-bonus p,
.tooltip-finish-03 p,
.tooltip-finish-02 p,
.tooltip-finish-01 p,
.tooltip-finish-Hc p {
    margin: 0 0 4px 0;
    align-self: flex-start; /* Aligns text to the top (left by default) */
}

/* Text for distances underneath stage profiles*/
.distance {
    font-size: 12px;
    font-weight: 600;
    color: #FFED00;
    position: absolute;
    white-space: nowrap;
    bottom: 0px;
    transform: translateX(-50%);
}

.distance-scale,
.height-scale {
    font-size: 12px;
    font-weight: 600;
    position: absolute;
    white-space: nowrap;
}

.distance-scale {
    color: #FFED00;
}

.height-scale {
    color: #FBAD28;
    padding: 0px 2px;
    line-height: 1;
    border-radius: 8px;
    background-color: var(--background-color);
}

/* Results tables for general classification, jerseys and stage winners */
.gc-table-section {
    display: flex;
    align-self: flex-end;
    margin-bottom: 18px;
}

.winners-table {
    margin-top: 4px;
}
        
.gc-table, 
.winners-table {
    width: 300px;
    border-collapse: collapse;
}
        
/* GC Table header for jersey links*/
.gc-table th {
    background-color: var(--background-color);
    text-align: left;
    vertical-align: middle;
    padding-left: 8px;
    font-size: 24px;
    transition: background-color 0.5s ease;
}
        
.jersey-link {
    text-decoration: none;
    position: relative;
    display: inline-flex;
    align-items: center;
    opacity: 0.36; /* Default opacity for non-selected jerseys */
    transition: opacity 0.3s ease; /* Smooth transition when changing opacity */
}

.jersey-link:hover {
    opacity: 1; /* Full opacity when selected */
}

.jersey-link.selected {
    opacity: 1; /* Full opacity when selected */
}

/* Custom tooltip styling */
.jersey-link::before {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: -30px;
    background: var(--toggle-btn-background-color);
    color: var(--text-color);
    padding: 5px 10px;
    margin-bottom:2px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 300;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease;
    pointer-events: none;
    z-index: 10;
}

.jersey-link:hover::before,
.jersey-link:focus-visible::before {
    opacity: 1;
    visibility: visible;
}

.yellow-jersey-link {
    color: #FFED00;
}

.green-jersey-link {
    color: #3BAA31;
}

.polka-jersey-link {
    color: #C30F19;
}


/* Table rows for both general classification and winners tables */
.gc-table tr {
    height: 35px;
}

.gc-table td,
.winners-table td {
    padding-top: 4px;
    padding-bottom: 4px;
    vertical-align: middle;
    line-height: 12px;
}

.gc-table td:last-child {
    padding-right: 12px;
}
        
.winners-table .arrow-cell,
.gc-table .arrow-cell {
    width: 14px; /* Fixed width for the arrow column */
}

.winners-table .position,
.gc-table .position {
    width: 14px; /* Fixed width for the position column */
}

.winners-table .rider-flag,
.gc-table .rider-flag {
    width: 30px; /* Fixed width for the flag column */
}

.winners-table .name,
.gc-table .name {
    width: 150px; /* Adjust as needed */
}

.winners-table .time,
.gc-table .time {
    width: 90px; /* Fixed width for the time column */
    text-align: right; /* Ensure time aligns to the right */
}
        
/* Country flag for tables */
.rider-flag img {
    width: 25px;
    height: auto;
    vertical-align: middle;
    font-size: 8px;
}

/* Name and team */
.name {
    font-weight: bold;
    color: var(--text-color);
    font-size: 12px;
    white-space: nowrap;
    width: 150px;
}

.team {
    color: var(--text-color);
    font-size: 10px;
    opacity: .6;
}

/* Time of results */
.time {
    font-size: 12px;
    white-space: nowrap;
    text-align: right; /* Aligns the text to the right */
    width: 90px;
}

/* Arrows for position change */
.arrow {
    display: inline-block;
    vertical-align: middle;
    font-size: 12px;
}

.up-arrow {
    color: #3BAA31;
}

.down-arrow {
    color: #C30F19;
}

/* Row styling */
.gc-table tr:nth-child(odd) {
    background-color: var(--gc-table-odds-background-color);
    transition: background-color 0.5s ease;
}

.gc-table tr:nth-child(even) {
    background-color: var(--background-color);
    transition: background-color 0.5s ease;
}
        
.arrow-cell {
    width: 14px; /* Fixed width for arrow */
    text-align: center; /* Center the arrow in the column */
}

.position {
    padding-right: 2px;
    font-size: 12px;
    text-align: center;
    white-space: nowrap;
    width: 14px;
}

.icon-text {
    font-family: 'icons';
}

.weather-text {
    font-family: 'weathericons';
}

/* Winner section */
.stage-winner {
    display: flex;
    flex-shrink: 0;
    flex-direction: column; /* Stack image, name, and team vertically */
    align-items: center; /* Horizontally center the content */
    justify-content: center; /* Vertically center the content */
    width: 180px; /* Fixed width for the winner section */
    text-align: center;
}

.winner-details {
    display: flex;
    flex-direction: column;
    align-items: center;
}


.tour-winners-title {
    margin: 120px 0 24px;
    font-family: 'Euclid Circular A';
    font-weight: 700;
    font-size: clamp(42px, 7vw, 72px);
    color: rgba(255, 237, 0, 0.5);
    text-align: center;
}

.tour-winners-container {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 24px;
}

.tour-winners-container.is-hidden {
    display: none;
}

.tour-winners {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px; /* Space between the winner divs */
    align-items: start; /* Alignment of items inside individual grid cells */
    justify-items: center; /* Horizontal alignment of items inside individual grid cells */
    justify-content: center; /* Centers the entire grid horizontally */
    align-content: start; /* Centers the entire grid vertically */
    margin: 0 auto; /* Ensures the grid is horizontally centered in its parent container */
}

@media (max-width: 900px) {
    .tour-winners {
        grid-template-columns: 1fr;
        max-width: 260px;
    }
}

.tour-winner-class {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: min(100%, 240px);
    text-align: center;
}

.winner-img,
.tour-winner-img {
    border-radius: 50%; /* Circular profile image */
    margin-bottom: 4px;
    background-color: var(--winner-background-color);
    border: var(--winner-border);
    transition: background-color 0.5s ease, border 0.5s ease;
}

.winner-img {
    width: 60px;
    height: 60px;
}

.tour-winner-img {
    width: 72px;
    height: 72px;
}

.yellow {
    border: 4px solid #ffed00;
    background-color: rgba(255, 237, 0, .10);
}

.green {
    border: 4px solid #3BAA31;
    background-color: rgba(59, 170, 49, .10);
}

.polka {
    border: 4px solid #C30F19;
    background-color: rgba(195, 15, 25, .10);
}


.flag-img {
    height: 10px;
    margin-right: 4px;
}

.winner-name {
    font-weight: bold;
    font-size: 14px;
    line-height: 1.25;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.winner-team {
    font-size: 12px;
    color: var(--text-color);
    opacity: .6;
    font-weight: 300;
    line-height: 1.35;
    margin: 0;
}

.winner-speed {
    font-size: 12px;
    color: var(--text-color);

    padding-top: 4px;
    margin: 0;
}

.winner-icon {
    font-size: 18px;
    color: var(--text-color);
    opacity: .6;
    margin: 0;
}

.winner-time {
    font-size: 14px;
    line-height: 1.25;
    margin: 0;
}

.jersey-img {
    height: 32px;
    margin-top: 4px;
}

#video-links {
    margin: 4px 0 4px 0;
    line-height: 18px;
}

#video-links a {
    color: var(--text-color);
    text-decoration: none; /* Remove underline */
    transition: all 0.3s ease;
}

#video-links a:hover, #video-links a:focus {
    background-color: rgba(255, 237, 0, .9);
    color: #1A1B25;
    text-decoration: none; /* Remove underline */
}

.photo-links {
    margin: 4px 0 4px 0;
    line-height: 18px;
}

.photo-links a {
    color: var(--text-color);
    text-decoration: none; /* Remove underline */
    transition: all 0.3s ease;
}

.photo-links a:hover, #video-links a:focus {
    background-color: rgba(255, 237, 0, .9);
    color: #1A1B25;
    text-decoration: none; /* Remove underline */
}

/* Floating video player in the bottom right */
#video-player-container {
    position: fixed;
    bottom: 10px;
    right: 10px;
    width: 480px; /* Adjust width */
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    user-select: none;
}

#video-player-container.dragging {
    cursor: grabbing;
}

#video-player-container #video-player {
    pointer-events: auto;
    display: block;
}

#video-player-container #close-player {
    pointer-events: auto;
}

.video-player-drag-handle {
    position: absolute;
    top: 25%;
    left: 0;
    width: 32px;
    height: 50%;
    background: rgba(255, 255, 255, 0.05);
    cursor: move;
    z-index: 1001;
    border-radius: 0;
    opacity: 0;
    transition: opacity 0.3s ease, background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 237, 0, 1);
}

.video-player-drag-handle .drag-icon {
    width: 8px;
    height: 12px;
}

#video-player-container:hover .video-player-drag-handle {
    opacity: 1;
}

#video-player-container.dragging .video-player-drag-handle {
    cursor: grabbing;
    background: rgba(255, 255, 255, 0.1);
    opacity: 1;
}

.video-player-drag-handle:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Video element */
#video-player {
    width: 100%;
    height: 270px;
    display: block;
}

/* Hide the video player by default */
.hidden {
    display: none;
}

#photo-viewer-container {
    position: fixed;
    bottom: 10px;
    right: 10px;
    max-width: 480px;
    max-height: 100%;
    background: rgba(26, 27, 37, .9);
    border-radius: 8px;
    overflow: auto;
    object-fit: contain;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    transition: max-width 0.3s ease-in-out, max-height 0.3s ease-in-out;
}

#photo-viewer-container.expanded {
    max-width: 960px; /* Expanded width */
    max-height: 95%; /* Expanded height */
    object-fit: contain;
}

.photo-viewer {
    position: relative;
    width: 100%;
    max-height: auto;
    display: block;
}

#photo-viewer-image {
    width: 100%;
    height: auto;
    border-radius: 8px 8px 0 0;
}

#photo-viewer-caption {
    color: #fff;
    margin: 0 0 2px 0;
    font-size: 12px;
    text-align: center;
}

#expand-photo-viewer {
    position: absolute;
    background-color: transparent;
    top: 4px;
    left: 4px;
    background: transparent;
    opacity: 0;
    color: #ffed00;
    cursor: pointer;
    border: none;
    border-radius: 50%; /* Make the button circular */
    width: 18px;
    height: 18px;
    z-index: 1100; /* Higher z-index to keep above video content */
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#expand-photo-icon {
    width: 18px;
    height: 18px;
}

#close-photo-viewer,
#close-player {
    position: absolute;
    top: 4px;
    right: 4px;
    background: transparent;
    opacity: 0;
    color: #ffed00;
    font-size: 18px;
    cursor: pointer;
    border: none;
    border-radius: 50%; /* Make the button circular */
    width: 28px;
    height: 24px;
    z-index: 1100; /* Higher z-index to keep above video content */
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Hover functionality to show close and expand buttons */
#photo-viewer-container:hover #close-photo-viewer,
#photo-viewer-container:hover #expand-photo-viewer,
#video-player-container:hover #close-player,
#video-player-container:hover #expand-photo-viewer {
    opacity: 1;
}

/* Add hover effect for better user experience */
#close-photo-viewer:hover,
#close-player:hover,
#expand-photo-viewer:hover {
    transform: scale(1.25);
}

/* Video and photo media grid inside the tooltip */
.media-grid {
    display: grid;
    grid-auto-flow: row;
    grid-template-columns: repeat(auto-fill, minmax(44px, max-content));
    gap: 4px;
    padding: 4px 0 0 0;
    justify-items: start; /* Aligns items to the left */
}

/* Media thumbnails (both video and photo) */
.media-thumbnail {
    position: relative;
    cursor: pointer;
    border-radius: 2px;
    overflow: hidden;
    opacity: 1;
    filter: brightness(.9);
    transition: opacity 0.3s ease, filter 0.3s ease; /* Add opacity transition */
    height: 30px;
    width: 44px;
}

.media-thumbnail img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover; /* Ensures the image covers the thumbnail area without stretching */
}

/* Hover effect to adjust opacity */
.media-thumbnail:hover {
    filter: brightness(1.1);
    opacity: 1; /* Lower opacity on hover */
}

/* Play button icon overlay on videos */
.video-thumbnail .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.6);
    padding: 4px;
    border-radius: 50%;
    pointer-events: none;
}

/* The toggle switch */
.toggle-container {
    align-self: center;
}

.toggle-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 42px;  /* Full width of the switch (including 5px border on both sides) */
    height: 26px; /* Height of the switch (including 5px border on top and bottom) */
    -webkit-tap-highlight-color: transparent; /*Control the Default Touch Highlight: On touch devices, browsers provide a default highlight to indicate that an element is being tapped or activated.*/
}

/* Hide the default checkbox */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* Custom tooltip styling */
.switch::before {
    content: 'Toggle scheme';
    position: absolute;
    bottom: -110%;
    left: -10%;
    background: var(--toggle-btn-background-color);
    color: var(--text-color);
    padding: 5px 10px;
    margin-top: 4px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity .3s ease;
}

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

.switch-alt::before {
    content: 'Toggle scheme (new)';
}

.switch-bp::before {
    content: 'Toggle scheme';
}

/* The slider itself */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #1A1B25; /* Default background color */
    transition: background-color 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
    border-radius: 26px; /* Fully rounded */
    border: 5px solid #ffffff; /* 5px border around the slider */
}

/* The circle inside the slider */
.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 28px;
    left: 6px; /* Position adjusted due to the 5px border */
    top: 0;
    bottom: 0;
    background-color: white; /* Circle color */
    transition: transform 0.22s ease, width 0.22s ease, border-radius 0.22s ease, background-color 0.22s ease;
    border-radius: 26px;
}

/* When checked (dark mode), change background and move circle */
input:checked + .slider {
    background-color: #1A1B25; /* Dark mode background */
    border: 5px solid #1A1B25;
}

/* Change the circle's position and color on toggle */
input:checked + .slider:before {
    transform: translateX(8px); /* Circle will move to the right on toggle */
    width: 16px;
    height: 16px;
    background-color: white;
    left: 8px;
    top: 0;
    border-radius: 50%; /* Circle */
}

/* Hover effect for better interactivity */
.slider:hover {
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); /* Slight glow effect on hover */
}

.switch input:focus-visible + .slider {
    box-shadow: 0 0 0 3px rgba(255, 237, 0, 0.55);
}

.slider-alt {
    background: #f2f2f2;
    border: 2px solid #c6c7cc;
}

.slider-alt:before {
    height: 18px;
    width: 18px;
    left: 3px;
    top: 2px;
    border-radius: 50%;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.switch-alt input:checked + .slider-alt {
    background: #101116;
    border-color: #101116;
}

.switch-alt input:checked + .slider-alt:before {
    transform: translateX(17px);
    left: 2px;
    top: 2px;
    width: 18px;
    height: 18px;
    background-color: #ffed00;
}

.switch-bp {
    width: 52px;
    height: 32px;
}

.slider-bp {
    background: #cbd5e1;
    border: 2px solid #94a3b8;
    border-radius: 999px;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.slider-bp:before {
    width: 24px;
    height: 24px;
    left: 3px;
    top: 2px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.slider-bp:after {
    content: "L";
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    font-weight: 700;
    color: #334155;
    transition: color 0.2s ease, right 0.2s ease;
}

.switch-bp input:checked + .slider-bp {
    background: #0f172a;
    border: 2px solid #0f172a;
}

.switch-bp input:checked + .slider-bp:before {
    transform: translateX(20px);
    left: 3px;
    top: 2px;
    width: 24px;
    height: 24px;
    background: #ffed00;
}

.switch-bp input:checked + .slider-bp:after {
    content: "D";
    right: 34px;
    color: #f8fafc;
}

@media (prefers-reduced-motion: reduce) {
    body,
    .slider,
    .slider:before,
    .slider:after {
        transition: none;
    }
}

.tour-speeds {
    margin-left: 140px;
}

.speed-grid {
    display: grid;
    grid-template-columns: repeat(22, 20px);
    gap: 2px;
    margin-bottom: 20px;
}

.speed-cell {
    width: 20px;
    height: 20px;
    border-radius: 2px;
    position: relative;
}

/* Custom tooltip styling */
.speed-cell::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background-color: var(--tooltip-background-color);
    color: var(--text-color);
    font-size: 12px;
    white-space: nowrap;
    border-radius: 4px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 10;
    box-shadow: var(--tooltip-box-shadow);
}

.speed-cell:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Optional: add a small pointer/arrow to the tooltip */
.speed-cell::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--tooltip-background-color);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.speed-cell:hover::before {
    opacity: 1;
    visibility: visible;
}

.speed-legend {
    display: flex;
    gap: 20px;
    margin: 48px 0 0 188px;
}

.legend-item {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 18px;
    height: 24px;
    border-radius: 2px;
}

.legend-red {
    background: #C30F19;
}

.legend-yellow {
    background: #FFED00;
}

.legend-green {
    background: #3BAA31;
}

.year-label {
    font-size: 14px;
    font-weight: 700;
    margin-right: 8px;
    display: flex;
    align-items: center;
}

.winner-label {
    font-size: 12px;
    font-weight: 400;
    margin-right: 12px;
    display: flex;
    align-items: center;
    min-width: 110px;
    color: var(--text-color);
    opacity: .9;
}

.avg-speed-label {
    font-size: 12px;
    font-weight: 400;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 50px;
    color: var(--text-color);
    opacity: .5;
}

.distance-label {
    font-size: 12px;
    font-weight: 400;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 60px;
    color: var(--text-color);
    opacity: .5;
}

.year-label a {
    color: var(--text-color);
    padding: 4px;
    position: relative;
    transition: all 0.3s ease;
    text-decoration: none;
}

.year-label a:hover {
    color: #1a1b25;
    background-color: rgba(255, 237, 0, .9); /* Optional: background color inside the box */
}

.speed-grid-container {
    display: flex;
    align-items: center;
    margin-bottom: 2px;
}


#speedGrid {
    margin: 0px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.speed-grid-header,
.speed-grid-row {
    display: flex;
    align-items: center;
    margin-bottom: 2px;
}

.empty-label,
.year-label {
    width: 40px;
    padding-right: 10px;
    text-align: right;
}

.stage-header {
    width: 20px;
    text-align: center;
    font-size: 14px;
}

.speed-cell {
    width: 16px;
    height: 24px;
    border-radius: 2px;
    position: relative;
    background-color: transparent;
}

.stages-container {
    display: flex;
    gap: 2px;
}

/* Text modal styles */
#textModal {
    display: none;
    position: fixed;
    z-index: 900;
    pointer-events: none; /* Allow clicking through the overlay */
}

#textModal .modal-content {
    position: fixed;
    bottom: 10px;
    right: 10px;
    width: 440px;
    padding: 20px;
    max-height: 80vh;
    overflow-y: auto;
    background: var(--tooltip-background-color);
    border-radius: 8px;
    box-shadow: var(--tooltip-box-shadow);
    pointer-events: auto; /* Re-enable clicking on the modal itself */
}

#textModal .close-text-modal {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    opacity: 0;
    color: #ffed00;
    float: right;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    z-index: 1100;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#textModal:hover .close-text-modal {
    opacity: 1;
}

#textModal .close-text-modal:hover {
    transform: scale(1.25);
}

#textContent {
    white-space: pre-wrap;
    font-family: 'Euclid Circular A', monospace;
    font-size: 14px;
    margin-top: 20px;
    color: var(--text-color);
}

#textContent a {
    color: inherit;
    text-decoration: underline;
    transition: background-color 0.2s ease;
}

#textContent a:hover,
#textContent a:focus {
    background-color: #ffed00;
    color: #1a1b25;
}

#textTitle {
    color: var(--text-color);
    font-size: 16px;
    margin: 0 0 10px 0;
}

/* Intro actions: Hide Winners button + Legend (keyboard) button */
.intro-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Shared circle button for shortcuts (keyboard) and legend (?) triggers */
.overlay-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    font-family: inherit;
    color: var(--text-color);
    background-color: var(--toggle-btn-background-color);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.overlay-trigger::before {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--tooltip-background-color);
    color: var(--text-color);
    padding: 5px 10px;
    margin-top: 4px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 300;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1000;
}
.overlay-trigger:hover::before,
.overlay-trigger:focus::before {
    opacity: 1;
}
.overlay-trigger:hover {
    background-color: var(--text-color);
    color: var(--background-color);
}
.overlay-trigger:focus {
    outline: 2px solid var(--text-color);
    outline-offset: 2px;
}
.shortcuts-trigger::before {
    content: 'Shortcuts';
}
.legend-trigger::before {
    content: 'Legend';
}
/* Reusable keyboard icon: single source of truth is assets/icons/keyboard.svg */
.icon-keyboard {
    display: inline-block;
    width: 24px;
    height: 24px;
    background-color: currentColor;
    mask: url('../assets/icons/keyboard.svg') center / contain no-repeat;
    -webkit-mask: url('../assets/icons/keyboard.svg') center / contain no-repeat;
}
.overlay-trigger .icon-keyboard {
    pointer-events: none;
}
.legend-trigger-icon {
    width: 24px;
    height: 24px;
    pointer-events: none;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
}
.overlay-trigger:hover .legend-trigger-icon,
.overlay-trigger:focus .legend-trigger-icon {
    color: currentColor;
}

/* Legend overlay (full-screen) */

.legend-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}
.legend-overlay.hidden {
    display: none;
}
.legend-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    cursor: pointer;
}
.legend-overlay-content {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--background-color);
    color: var(--text-color);
    border-radius: 8px;
    padding: 2rem 2rem 2rem 2rem;
    font-size: 0.82em;
    font-weight: 300;
    font-family: 'Euclid Circular A', Arial, sans-serif;
}
.legend-overlay-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 44px;
    height: 44px;
    padding: 0;
    background: transparent;
    border: none;
    color: #ffed00;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 50%;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.legend-overlay-close:hover {
    opacity: 0.8;
    transform: scale(1.1);
}
.legend-overlay-title {
    margin: 12px 2.5rem 24px 0;
    font-size: 1.5em;
    font-weight: 600;
}
.legend-overlay-body {
    margin: 0;
    line-height: 1.6;
}
.legend-jerseys {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.legend-jerseys .legend-item {
    margin-bottom: 0;
}
.legend-jerseys .legend-jersey-icon {
    flex-shrink: 0;
    height: 32px;
    width: auto;
    object-fit: contain;
}
.legend-section {
    margin-bottom: 1.5rem;
}
.legend-section:last-child {
    margin-bottom: 0;
}
.legend-section h3 {
    margin: 0 0 12px 0;
    font-size: 1.2em;
    font-weight: 600;
}
.legend-other-intro {
    margin: 0 0 0.75rem 0;
    font-size: 14px;
}
.legend-other-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.legend-other-item.legend-item {
    align-items: flex-start;
}
.legend-other-thumb-wrap {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}
.legend-other-thumb {
    display: block;
    width: 48px;
    height: 27px;
    object-fit: cover;
    border-radius: 4px;
}
/* Play button overlay on video thumb in legend */
.legend-other-thumb-wrap.video-thumbnail .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    color: #fff;
    background: rgba(0, 0, 0, 0.65);
    padding: 3px 3px 3px 4px;
    border-radius: 50%;
    line-height: 1;
}
/* Text thumbnail in legend: same doc-icon as start milestones */
.legend-other-thumb-wrap.text-thumbnail .doc-icon {
    font-size: 18px;
}
.legend-items {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 14px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 12px;
}
.legend-item:last-child {
    margin-bottom: 0;
}
.legend-item-has-desc {
    align-items: flex-start;
}
.legend-item-label {
    font-weight: 600;
}
.legend-item-content {
    display: block;
}
.legend-item-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}
.legend-milestone-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    object-fit: contain;
}
/* Move / lead-change icons: radiating circle with animation in legend */
.legend-radiating-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    position: relative;
    overflow: visible;
}
.legend-overlay .legend-radiating-wrap .radiating-circle {
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -4px;
    margin-top: -4px;
}
/* Larger key indicators in legend overlay for readability */
.legend-overlay .txtnav {
    font-size: 1em;
    padding: 4px 6px;
    min-width: 20px;
}
.legend-overlay .txtnav-modifier {
    font-size: 1.05em;
    padding: 4px 6px;
}
.legend-note {
    margin: 0;
    font-size: inherit;
    line-height: 1.6;
    color: var(--text-color);
    opacity: 0.85;
}
.legend-doping-note {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-color);
}

/* Text thumbnail styles */
.text-thumbnail {
    position: relative;
    cursor: pointer;
}

.text-thumbnail .doc-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: white;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

.text-source {
    color: var(--text-color);
    position: relative;
    margin-top: 10px;
    font-size: 12px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.text-source a {
    color: var(--text-color);
    position: relative;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 12px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.text-source a:hover, 
.text-source a:focus {
    color: #1a1b25;
    background-color: rgba(255, 237, 0, .9);
}

/* Featured Riders Section */
.featured-riders-section {
    margin-bottom: 40px;
}

.featured-riders-carousel {
    position: relative;
    width: 420px;
    height: 300px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 8px;
}

.featured-riders-content {
    display: flex;
    transition: transform 0.3s ease-in-out;
    height: 100%;
    gap: 4px;
}

.featured-riders-slide {
    min-width: calc(50% - 10px);
    position: relative;
}

.featured-riders-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.featured-riders-text {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
}

.featured-riders-text h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 600;
}

.featured-riders-text p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

.featured-riders-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    z-index: 2;
    transition: opacity 0.3s ease, visibility 0.3s ease, background-color 0.2s;
    opacity: 1;
    visibility: visible;
}

.featured-riders-arrow:hover {
    background: rgba(255, 255, 255, 0.9);
}

.featured-riders-prev {
    left: 10px;
}

.featured-riders-next {
    right: 10px;
}

.featured-riders-arrow.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Dark mode support for featured riders */
.dark-mode .featured-riders-arrow {
    background: rgba(26, 27, 37, 0.8);
    color: white;
}

.dark-mode .featured-riders-arrow:hover {
    background: rgba(26, 27, 37, 0.9);
}

/* Historic Climbs Section */
.historic-climbs-section {
    margin-bottom: 40px;
}

.historic-climbs-carousel {
    position: relative;
    width: 540px;
    height: 400px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 8px;
}

.historic-climbs-content {
    display: flex;
    transition: transform 0.3s ease-in-out;
    height: 100%;
    gap: 4px;
}

.historic-climbs-slide {
    min-width: calc(50% - 10px);
    position: relative;
}

.historic-climbs-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.historic-climbs-text {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
}

.historic-climbs-text h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 600;
}

.historic-climbs-text p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

.historic-climbs-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    z-index: 2;
    transition: opacity 0.3s ease, visibility 0.3s ease, background-color 0.2s;
    opacity: 1;
    visibility: visible;
}

.historic-climbs-arrow:hover {
    background: rgba(255, 255, 255, 0.9);
}

.historic-climbs-prev {
    left: 10px;
}

.historic-climbs-next {
    right: 10px;
}

.historic-climbs-arrow.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Dark mode support for historic climbs */
.dark-mode .historic-climbs-arrow {
    background: rgba(26, 27, 37, 0.8);
    color: white;
}

.dark-mode .historic-climbs-arrow:hover {
    background: rgba(26, 27, 37, 0.9);
}

.intro-section {
    display: flex;
    gap: 4rem;
    margin: 0 0 0 140px;
    padding: 0;
    width: fit-content; /* prevent container from forcing child resize */
}

.tour-intro {
    flex: 1;
    min-width: 0; /* Prevents text from overflowing */
}

.tour-map {
    flex: 0 0 auto;
    max-width: 400px;
    align-self: flex-start;
}

.tour-map img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    transition: filter 0.2s ease;
}

.tour-map a:hover img {
    filter: brightness(1.05);
}

@media (max-width: 600px) {
    .toggle-container {
        margin: 0;
    }

    .tour-logo {
    margin: 48px 0 24px 24px;
    }

    .top-year-selector {
        gap: 8px;
    }

    .milestone {
        min-width: 24px;
        min-height: 24px;
    }

    .intro-section {
        margin: 0 0 0 24px !important;
    }

    .tour-intro {
        flex: 1 1 auto;
    }

    .tour-winners-container {
        padding: 0 16px;
    }

    .tour-winners {
        grid-template-columns: 1fr;
        gap: 16px;
        margin: 0 auto;
        justify-content: center;
        max-width: 260px;
    }

    .tour-winners-title {
        margin: 88px 0 20px;
        text-align: center;
    }


    #video-player-container {
        width: 100%;  /* Make the video player take the full width of the mobile screen */
        max-width: 100%; /* Ensure it doesn't exceed the screen width */
        bottom: 0; /* Keep it at the bottom */
        left: 0;
    }

    .bottom-year-selector {

        gap: 15px;
        padding: 15px;
        max-width: 300px;
        margin: 20px auto;
    }

    .year-nav-btn {
        min-width: 40px;
        height: 40px;
        padding: 4px 12px;
        font-size: 20px;
    }

    .bottom-dropdown-toggle {
        padding: 4px 12px;
        font-size: 32px;
    }
}

@media (max-width: 1024px) {
    .intro-section {
        flex-direction: column;
    }
    
    .tour-map {
        max-width: 420px;
    }
}

/* Speed tooltip styles */
.speed-tooltip {
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--tooltip-background-color);
    opacity: 0.95;
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: pre-line;
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-width: 180px;
    text-align: left;
}

/* Bottom Year Selector Styles */
.bottom-year-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 40px 0;
    padding: 20px;
    background: transparent;
    border-radius: 12px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.year-nav-btn {
    background: var(--background-color);
    border: none;
    border-radius: 4px;
    padding: 4px 12px;
    cursor: pointer;
    transition: background .3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    height: 48px;
    font-size: 24px;
    color: #ffed00;
}

.year-nav-btn:hover {
    background: var(--toggle-btn-background-color);
    outline: none;
}

.year-nav-btn:active {
    transform: none;
}

.year-nav-btn:disabled {

    cursor: not-allowed;
    transform: none;
    color: var(--toggle-btn-background-color);
}

.year-nav-btn:disabled:hover {
    background: var(--background-color);
    color: var(--toggle-btn-background-color);
    transform: none;
}

.bottom-dropdown {
    position: relative;
    min-width: 120px;
}

.bottom-dropdown-toggle {
    position: relative;
    font-family: 'Euclid Circular A', sans-serif;
    padding: 4px 12px;
    font-size: 40px;
    font-weight: 700;
    border-radius: 4px;
    border: none;
    background: var(--background-color);
    color: #ffed00;
    cursor: pointer;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    transition: background .3s ease;
    width: 100%;
}

.bottom-dropdown-toggle::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: var(--tooltip-background-color);
    color: var(--text-color);
    padding: 5px 10px;
    margin-bottom: 4px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 300;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.bottom-dropdown-toggle:hover::before,
.bottom-dropdown-toggle:focus::before {
    opacity: 1;
}

.bottom-dropdown-toggle:hover {
    outline: none;
    background: var(--toggle-btn-background-color);
    transform: none;
}

.bottom-dropdown-toggle.active {
    background: var(--toggle-btn-background-color);
    color: #ffed00;
    transform: none;
}

.bottom-dropdown-arrow {
    width: 16px;
    height: 16px;
    margin-left: 12px;
    transition: transform 0.2s ease;
}

.bottom-dropdown-toggle.active .bottom-dropdown-arrow {
    transform: rotate(180deg);
}

.bottom-dropdown-menu {
    position: absolute;
    max-height: 320px;
    overflow-y: auto;
    scrollbar-width: thin;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--toggle-btn-background-color);
    box-shadow: var(--tooltip-box-shadow);
    border: 1px solid var(--rider-background-color);
    border-radius: 4px;
    margin-top: 4px;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.bottom-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.bottom-dropdown-item {
    padding: 4px 8px;
    margin: 2px 8px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    border-bottom: none;
}

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

.bottom-dropdown-item:hover {
    background: var(--rider-background-color);
    color: var(--text-color);
    border-radius: 4px;    
    outline: none;
    text-decoration: none;
}

.bottom-dropdown-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.bottom-dropdown-item.disabled:hover {
    background: transparent;
}

/* Home page specific styles */
.home-intro {
    width: 420px;
    min-width: 420px;
    max-width: 420px;
    flex: 0 0 420px;
    flex-shrink: 0;
    font-size: .82em;
    font-weight: 300;
    margin: 0;
}

.home-intro h1 {
    font-size: 20px;
    font-weight: 600;
    margin: 0px 0 14px 0;
}

.home-intro p {
    margin: 0 0 12px 0;
    line-height: 1.6;
}

.home-intro p:last-of-type {
    margin-bottom: 18px;
}

.home-intro blockquote {
    font-size: 14px;
    font-weight: 200;
    margin: 12px 0;
    padding-left: 24px;
    border-left: 3px solid currentColor;
    border-color: var(--text-color);
}

.home-intro h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 4px 0;
}

.home-intro h2:first-of-type {
    font-size: 32px;
    margin: 2px 0;
}

.home-intro a {
    color: var(--text-color);
    position: relative;
    transition: all 0.3s ease;
}

.home-intro a:hover, .home-intro a:focus {
    color: #1a1b25;
    background-color: rgba(255, 237, 0, .9);
}

.intro-section {
    margin-top: 36px;
}

.speed-legend {
    text-align: center;
    font-size: 12px;
}

.speed-header {
    font-weight: 600;
    font-size: 11px;
    opacity: 0.7;
    text-align: center;
}

/* Home page content alignment */
body.home-page .intro-section {
    margin: 36px auto 12px auto;
    max-width: 1052px;
    width: min(1052px, calc(100% - 32px));
}

body.home-page .home-intro {
    width: min(100%, 620px);
    min-width: 0;
    max-width: 58ch;
    flex: initial;
}

body.home-page .tour-speeds {
    margin: 20px auto 0 auto;
    max-width: 1052px;
    width: min(1052px, calc(100% - 32px));
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Top padding so first row tooltips (positioned above cells) are not clipped by overflow */
    padding-top: 100px;
    margin-top: -80px;
}

body.home-page #speedGrid {
    min-width: max-content;
}

body.home-page .tour-speeds .speed-legend-scale {
    margin: 24px 0 0 314px;
    width: max-content;
    flex-wrap: nowrap;
}

body.home-page .tour-speeds .speed-legend-label {
    text-align: left;
    font-size: 12px;
    margin-left: 314px;
    margin-top: 8px; /* Adjust this value to your desired margin */
    margin-bottom: 0;
    width: max-content;
}

@media (max-width: 768px) {
    body.home-page .intro-section,
    body.home-page .tour-speeds {
        margin-left: 16px;
        margin-right: 16px;
        max-width: none;
        width: auto;
    }

    body.home-page .home-intro {
        max-width: none;
    }

    body.home-page .featured-riders-carousel,
    body.home-page .historic-climbs-carousel {
        width: 100%;
        max-width: 520px;
        height: 280px;
    }
}

@media (max-width: 600px) {
    body.home-page .intro-section {
        margin: 36px 16px 12px 16px;
    }

    body.home-page .tour-speeds {
        margin: 16px;
    }

    body.home-page .featured-riders-carousel,
    body.home-page .historic-climbs-carousel {
        height: 240px;
    }
}

.speed-cell-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 2px;
}

.speed-tooltip-image {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--rider-background-color);
    padding: 2px;
}

.speed-tooltip-icon {
    font-family: 'icons';
    margin-right: 4px;
    font-size: 14px;
}

.speed-tooltip-link {
    color: inherit;
    text-decoration: none;
    display: block;
}

body.home-page .home-footer {
    margin: 64px auto 24px;
    width: min(420px, calc(100% - 32px));
    text-align: center;
    color: var(--text-color);
    opacity: 0.45;
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

body.home-page .home-footer::before {
    content: "";
    display: block;
    width: 100%;
    border-top: 1px solid currentColor;
    opacity: 0.35;
    margin-bottom: 8px;
}

body.year-page .home-footer {
    margin: 64px auto 24px;
    width: min(420px, calc(100% - 32px));
    text-align: center;
    color: var(--text-color);
    opacity: 0.45;
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

body.year-page .home-footer::before {
    content: "";
    display: block;
    width: 100%;
    border-top: 1px solid currentColor;
    opacity: 0.35;
    margin-bottom: 8px;
}

/* Official year-page layout */
body.year-page .tour-logo {
    margin: 0 auto;
    position: static;
    min-height: 64px;
    max-width: 1052px;
    width: min(1052px, calc(100% - 32px));
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-start;
}

body.year-page .logo-year-group {
    position: static;
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

body.year-page .top-year-selector {
    order: 1;
    margin-right: 0;
    z-index: 2;
    max-width: none;
}

body.year-page .top-year-selector .custom-dropdown {
    min-width: 0;
}

body.year-page .logo-year-group > a {
    order: 2;
    flex: 0 0 auto;
}

body.year-page #tdf-logo {
    position: static;
    left: auto;
    top: auto;
    transform: none;
    margin-right: 0;
}

body.year-page .toggle-container {
    order: 3;
    margin-left: auto;
}

body.year-page .switch::before {
    top: calc(100% + 6px);
    left: auto;
    right: 0;
    margin-top: 0;
    z-index: 1200;
}

@media (min-width: 769px) {
    body.year-page .tour-logo {
        position: relative;
        justify-content: space-between;
    }

    body.year-page .logo-year-group {
        gap: 0;
    }

    body.year-page .top-year-selector {
        margin-right: auto;
        max-width: calc(50% - 56px);
    }

    body.year-page #tdf-logo {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
    }

    body.year-page .toggle-container {
        margin-left: 0;
    }
}

body.year-page .intro-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    align-items: start;
    gap: clamp(24px, 4vw, 56px);
    margin: 36px auto 12px auto;
    max-width: 1052px;
    width: min(1052px, calc(100% - 32px));
}

body.year-page .tour-intro {
    width: auto;
    min-width: 0;
    max-width: 58ch;
    flex: initial;
}

body.year-page .tour-intro p {
    line-height: 1.6;
    margin: 0 0 12px 0;
}

body.year-page .tour-intro h3 {
    margin: 0 0 12px 0;
}

body.year-page .tour-map {
    width: 100%;
    max-width: none;
}

body.year-page .tour-map a {
    display: block;
    padding: 8px;
    border-radius: 12px;
    background: var(--toggle-btn-background-color);
}

body.year-page .tour-map img {
    display: block;
    border-radius: 8px;
}

@media (max-width: 1052px) {
    body.year-page .intro-section {
        grid-template-columns: 1fr;
        gap: 16px;
        justify-items: center;
    }

    body.year-page .tour-intro {
        width: 100%;
    }

    body.year-page .tour-map {
        width: 100%;
        max-width: 420px;
        justify-self: center;
    }
}

@media (max-width: 768px) {
    body.year-page .tour-logo {
        margin: 16px 16px 14px 16px;
        display: flex;
        align-items: center;
        gap: 8px;
        min-height: auto;
    }

    body.year-page .logo-year-group {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 1;
        min-width: 0;
    }

    body.year-page #tdf-logo {
        position: static;
        left: auto;
        top: auto;
        transform: none;
        width: clamp(64px, 16vw, 86px);
        margin-right: 0;
    }

    body.year-page .top-year-selector {
        order: 1;
        width: auto;
        max-width: 100%;
        min-width: 0;
        margin-right: 0;
        gap: 6px;
        flex-wrap: nowrap;
    }

    body.year-page .top-year-selector .custom-dropdown {
        min-width: 0;
    }

    body.year-page .toggle-container {
        order: 3;
        margin: 0 0 0 auto;
    }

    body.year-page .intro-section {
        gap: 16px;
        margin: 36px 16px 12px 16px;
    }

    body.year-page .tour-intro {
        max-width: none;
    }

    body.year-page .tour-intro h3 {
        font-size: 0.94em;
        gap: 8px 10px;
    }

    body.year-page .tour-intro .avg-speed {
        margin-left: 0;
    }

    body.year-page .tour-intro p {
        font-size: 0.95em;
    }

    .legend-overlay {
        padding: 2.5rem 1rem;
    }
    .legend-overlay-content {
        font-size: 0.95em;
        max-height: 80vh;
        padding: 1.5rem 1.25rem 2rem;
    }

    body.year-page .tour-map {
        width: 100%;
        max-width: none;
    }

    body.year-page .tour-map a {
        padding: 6px;
    }

    body.year-page .stage-layout {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        margin: 72px 0;
    }

    body.year-page .stage-viewport {
        width: 100%;
        overflow: visible;
        height: 286px;
        position: relative;
        z-index: 20;
    }

    body.year-page .stage-container {
        overflow: visible;
        width: 100%;
        height: 286px;
        position: relative;
        z-index: 20;
    }

    body.year-page .stage-number {
        position: absolute;
        top: 8px;
        left: 24px;
        margin: 0;
        width: auto;
        font-size: 52px;
        line-height: 1;
        justify-content: flex-start;
        text-align: left;
        z-index: 2;
    }

    body.year-page .stage-profile {
        margin-left: 24px;
        min-width: 0;
        width: auto;
    }

    body.year-page .stage-profile img {
        display: block;
        width: 100%;
        height: auto;
        max-width: none;
    }

    body.year-page .stage-winner,
    body.year-page .gc-table-section {
        margin: 20px 0 0 24px;
        align-self: flex-start;
        position: relative;
        z-index: 1;
    }

    body.year-page .stage-winner {
        flex-direction: row;
        justify-content: flex-start;
        gap: 10px;
        width: auto;
        text-align: left;
    }

    body.year-page .stage-winner .winner-img {
        margin-bottom: 0;
    }

    body.year-page .stage-winner .winner-details {
        align-items: flex-start;
    }

    body.year-page .stage-winner .winner-name {
        justify-content: flex-start;
    }

    .tooltip-start,
    .tooltip-move,
    .tooltip-crash,
    .tooltip-mountain03,
    .tooltip-mountain03-bonus,
    .tooltip-mountain02,
    .tooltip-mountain02-bonus,
    .tooltip-mountain01,
    .tooltip-mountain01-bonus,
    .tooltip-mountainHc,
    .tooltip-mountainHc-bonus,
    .tooltip-sprint,
    .tooltip-sprint-bonus,
    .tooltip-finish,
    .tooltip-finish-bonus,
    .tooltip-finish-03,
    .tooltip-finish-02,
    .tooltip-finish-01,
    .tooltip-finish-Hc {
        width: min(320px, calc(100vw - 48px));
        max-width: calc(100vw - 48px);
    }

    .tooltip-content,
    .tooltip-start .tooltip-content {
        min-width: 0;
    }
}

@media (max-width: 480px) {
    body.year-page .tour-logo {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "spacer toggle"
            "group group";
        row-gap: 8px;
        align-items: center;
    }

    body.year-page .logo-year-group {
        grid-area: group;
        width: 100%;
        justify-content: flex-start;
    }

    body.year-page .toggle-container {
        grid-area: toggle;
        justify-self: end;
        margin: 0;
    }

    body.year-page .dropdown-toggle {
        font-size: 28px;
    }

    body.year-page #year-select {
        width: 78px;
    }
}


.speed-header {
    font-weight: 600;
    font-size: 11px;
    opacity: 0.7;
    text-align: center;
}

.speed-cell-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 2px;
}

.speed-tooltip-image {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--rider-background-color);
    padding: 2px;
}

.speed-tooltip-icon {
    font-family: 'icons';
    margin-right: 4px;
    font-size: 14px;
}

.speed-tooltip-link {
    color: inherit;
    text-decoration: none;
    display: block;
}

/* ============================================================================
   SEARCH OVERLAY
   ============================================================================ */

.search-overlay {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 10vh 1rem 1rem;
    box-sizing: border-box;
}

.search-overlay.hidden {
    display: none;
}

.search-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    cursor: pointer;
}

.search-overlay-content {
    position: relative;
    width: 100%;
    max-width: 640px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    background: var(--background-color);
    color: var(--text-color);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
    font-family: 'Euclid Circular A', Arial, sans-serif;
}


.search-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.9rem 1rem 0.9rem 1.1rem;
    border-bottom: 1px solid rgba(128, 128, 128, 0.2);
    flex-shrink: 0;
}

.search-input-icon {
    flex-shrink: 0;
    opacity: 0.45;
    display: flex;
    align-items: center;
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: 'Euclid Circular A', Arial, sans-serif;
    font-size: 1rem;
    font-weight: 300;
    color: var(--text-color);
    min-width: 0;
}

.search-input::placeholder {
    opacity: 0.4;
}

.search-esc-hint {
    flex-shrink: 0;
    font-family: 'Euclid Circular A', Arial, sans-serif;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--text-color);
    opacity: 0.35;
    background: rgba(128, 128, 128, 0.15);
    border: none;
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.search-esc-hint:hover {
    opacity: 0.7;
}

.search-status {
    flex-shrink: 0;
    padding: 0.45rem 1.1rem;
    font-size: 0.72rem;
    font-weight: 300;
    opacity: 0.5;
    min-height: 1.8rem;
    display: flex;
    align-items: center;
}

.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 0 0 0.5rem;
}

.search-year-group {
    padding: 0;
}

.search-year-label {
    padding: 0.5rem 1.1rem 0.3rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.4;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.search-current-badge {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #ffed00;
    background: rgba(255, 237, 0, 0.12);
    border-radius: 3px;
    padding: 1px 5px;
    opacity: 1;
}

.search-result {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1.1rem;
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.82rem;
    font-weight: 300;
    transition: background 0.1s ease;
    cursor: pointer;
    border-left: 2px solid transparent;
}

.search-result:hover,
.search-result:focus {
    background: rgba(255, 237, 0, 0.07);
    border-left-color: #ffed00;
    outline: none;
}

.search-result-profile {
    flex-shrink: 0;
    width: 108px;
    height: 30px;
    object-fit: fill;
    border-radius: 3px;
    opacity: 0.7;
    transition: opacity 0.1s ease;
}

.search-result:hover .search-result-profile,
.search-result:focus .search-result-profile {
    opacity: 1;
}

.search-result-profile-empty {
    display: block;
    width: 108px;
    height: 30px;
}

.search-result-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    min-width: 0;
}

.search-result-stage {
    font-weight: 600;
    white-space: nowrap;
    font-size: 0.82rem;
    min-width: 4.5rem;
}
.search-result-route {
    font-weight: 400;
    font-size: 0.75rem;
    opacity: 0.55;
    margin-left: 0.4em;
}

.search-result-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.search-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 1.1rem 0.3rem calc(1.1rem + 2px);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.35;
    border-bottom: 1px solid rgba(128, 128, 128, 0.15);
    margin-bottom: 0.25rem;
}

.search-results-header-profile {
    display: inline-block;
    width: 108px;
    flex-shrink: 0;
}

.search-result-winner {
    font-size: 0.75rem;
    opacity: 0.55;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    max-width: 200px;
    margin-left: auto;
}

.search-tag {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 3px;
    padding: 2px 5px;
    white-space: nowrap;
}

/* Tour winner synthetic year cards */
.search-year-winner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1.1rem;
    margin: 0 0 2px;
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.8rem;
    border-left: 2px solid transparent;
    transition: background 0.1s ease;
}

.search-year-winner:hover,
.search-year-winner:focus {
    outline: none;
    background: rgba(255, 237, 0, 0.05);
}

.search-year-winner-yellow { border-left-color: #ffed00; }
.search-year-winner-green  { border-left-color: #3cb450; }
.search-year-winner-polka  { border-left-color: #dc3c3c; }

.search-year-winner-label {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    min-width: 7rem;
}

.search-year-winner-yellow .search-year-winner-label { color: #d4b800; }
.search-year-winner-green  .search-year-winner-label { color: #2e9944; }
.search-year-winner-polka  .search-year-winner-label { color: #c03030; }

html.dark-mode .search-year-winner-yellow .search-year-winner-label { color: #ffed00; }
html.dark-mode .search-year-winner-green  .search-year-winner-label { color: #5ddb74; }
html.dark-mode .search-year-winner-polka  .search-year-winner-label { color: #f07070; }

.search-year-winner-name {
    font-weight: 600;
    white-space: nowrap;
}

.search-year-winner-team {
    font-size: 0.72rem;
    opacity: 0.45;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Search suggestion ("Did you mean?" / "Showing results for") */
.search-suggestion {
    padding: 6px 16px 2px;
    font-size: 13px;
    color: #888;
}
.search-suggestion.hidden { display: none; }
.search-suggestion--correction {
    color: #555;
    font-style: italic;
}
.search-suggestion-link {
    color: inherit;
    font-weight: 600;
    font-style: normal;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.search-suggestion-link:hover { color: #222; }
html.dark-mode .search-suggestion          { color: #999; }
html.dark-mode .search-suggestion--correction { color: #bbb; }
html.dark-mode .search-suggestion-link:hover  { color: #fff; }

.tag-tour-winner { background: rgba(255, 237, 0, 0.2); color: #d4b800; }
html.dark-mode .tag-tour-winner { color: #ffed00; }

.tag-winner    { background: rgba(255, 237,   0, 0.18); color: #d4b800; }
.tag-podium    { background: rgba(255, 237,   0, 0.08); color: #b09a00; }
.tag-attack    { background: rgba(240, 140,  20, 0.15); color: #b86800; }
.tag-event     { background: rgba(140, 120, 200, 0.15); color: #6b50b8; }
.tag-sprint    { background: rgba( 60, 180,  80, 0.15); color: #2e9944; }
.tag-milestone { background: rgba(220,  60,  60, 0.15); color: #c03030; }
.tag-yellow    { background: rgba(255, 237,   0, 0.12); color: #c4a800; }
.tag-green     { background: rgba( 60, 180,  80, 0.15); color: #2e9944; }
.tag-polka     { background: rgba(220,  60,  60, 0.15); color: #c03030; }
.tag-prose     { background: rgba(128, 128, 128, 0.12); color: inherit; opacity: 0.7; }
.tag-article   { background: rgba(128, 128, 128, 0.10); color: inherit; opacity: 0.6; }
.tag-location  { background: rgba( 80, 200, 220, 0.15); color: #1a8fa0; }
.tag-finish    { background: rgba(180,  30,  30, 0.85); color: #ffffff; }
.tag-climb     { background: rgba(220,  60,  60, 0.15); color: #c03030; }
.tag-default   { background: rgba(128, 128, 128, 0.12); color: inherit; }

html.dark-mode .tag-winner    { color: #ffed00; }
html.dark-mode .tag-podium    { color: #e0c800; }
html.dark-mode .tag-attack    { color: #f0a030; }
html.dark-mode .tag-event     { color: #a990e8; }
html.dark-mode .tag-milestone { color: #f07070; }
html.dark-mode .tag-yellow    { color: #ffed00; }
html.dark-mode .tag-green     { color: #5ddb74; }
html.dark-mode .tag-sprint    { color: #5ddb74; }
html.dark-mode .tag-polka     { color: #f07070; }
html.dark-mode .tag-location  { color: #50d0e0; }
html.dark-mode .tag-finish    { background: rgba(220, 60, 60, 0.45); color: #ffffff; }
html.dark-mode .tag-climb     { color: #f07070; }

/* Fixed floating search button */
.search-fab {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    max-width: 56px;
    height: 56px;
    padding: 0 20px;
    border-radius: 28px;
    border: none;
    background: var(--toggle-btn-background-color);
    color: var(--text-color);
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    transition: max-width 0.25s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    overflow: hidden;
    white-space: nowrap;
    opacity: 0.72;
}

.search-fab:hover {
    max-width: 180px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
    opacity: 1;
}

.search-fab svg {
    flex-shrink: 0;
}

.search-fab-label,
.search-fab-hint {
    font-family: 'Euclid Circular A', Arial, sans-serif;
    font-weight: 600;
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    transition: opacity 0.15s ease 0.05s, max-width 0.2s ease;
}

.search-fab-label {
    font-size: 0.78rem;
}

.search-fab-hint {
    font-size: 0.62rem;
    opacity: 0;
}

.search-fab:hover .search-fab-label {
    opacity: 1;
    max-width: 60px;
}

.search-fab:hover .search-fab-hint {
    opacity: 0.45;
    max-width: 40px;
}

@media (max-width: 600px) {
    .search-overlay {
        padding: 5vh 0.5rem 0.5rem;
    }
    .search-overlay-content {
        max-height: 88vh;
    }
}
