:root {
    --primary: #4CAF50;
    --primary-light: #81C784;
    --primary-dark: #388E3C;
    /* Green text on white: --primary is 2.8:1 and --primary-dark 4.1:1, both under 4.5:1. */
    --primary-text: #2E7D32;
    /* Text on a coloured background must reach the 4.5:1 WCAG asks of text. A button takes black
       text on its light colour: black on the green gradient is 7.6:1 to 5.1:1, white only 2.8:1 to
       4.1:1, and a dark grey is not enough (#333 is 3.1:1 on --primary-dark). A small badge or pill
       keeps white text on the dark shade of its colour: --secondary-dark and --danger-dark are
       4.6:1 and 5.0:1, their -darker hover shades more. */
    --on-primary: #000;
    --secondary: #2196F3;
    --secondary-light: #64B5F6;
    --secondary-mid: #1E88E5;
    --secondary-dark: #1976D2;
    --secondary-darker: #1565C0;
    --on-secondary: #000;
    --accent-blue-light: #7AB5E0;
    /* The crosshair and the highlight on the elevation profile (ADR-0033): a blue that reads
       against every slope colour, where the site's green would sit on the greens of the fill. */
    --profile-hover: #1a4dff;
    --danger: #f14668;
    --danger-dark: #D32F2F;
    --danger-darker: #B71C1C;
    --background: #FFFFFF;
    --foreground: #333333;
    --gray-light: #F5F5F5;
    --gray: #E0E0E0;
    --gray-dark: #757575;

    /* Semantic feedback colours (align with Bulma hardcoded values already in use) */
    --success: #48c774;
    --warning: #ffdd57;
    --info:    #3e8ed0;

    /* Climb category scale — Tour de France style (Cat 4 → Cat 1 → HC) */
    --difficulty-cat4: #2ecc71;
    --difficulty-cat3: #f1c40f;
    --difficulty-cat2: #e67e22;
    --difficulty-cat1: #e74c3c;
    --difficulty-hc:   #8e44ad;

    /* Transparent colour tints (derived from primary/secondary/danger) */
    --primary-tint:   rgba(76, 175, 80, 0.1);
    --secondary-tint: rgba(33, 150, 243, 0.1);
    --danger-tint:    rgba(241, 70, 104, 0.1);
    --warning-tint:   rgba(255, 193, 7, 0.1);

    --radius: 8px;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;

    /* Override Bulma's font family to use Albert Sans everywhere */
    --bulma-family-primary: 'Albert Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;

    /* Form element sizing */
    --checkbox-size: 22px;
    --checkbox-dot-size: 10px;
    --checkbox-checkmark-left: 6px;
    --checkbox-checkmark-top: 2px;
    --checkbox-checkmark-width: 6px;
    --checkbox-checkmark-height: 11px;
    --radio-dot-offset: 4px;
    --icon-container-size: 36px;
    --form-border-radius: 12px;
    --icon-border-radius: 10px;
    --card-border-radius: 16px;
}

html, body {
    font-family: 'Albert Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    margin: 0;
    padding: 0;
}

.navbar.is-spaced {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    border-radius: 50px;
}

/* The active entry is marked server-side by its own href (helpers.Urls.isCurrent). This carries
   the mark up to the closed dropdown, so the reader sees which menu holds the page they are on
   without opening it. A browser without :has() simply does not bold the parent. */
.navbar-item.has-dropdown:has(.navbar-dropdown .navbar-item.is-active) .navbar-link {
    font-weight: 700;
}

.nice-box {
    height: 250px;
    background-position: center center;
    background-size: cover;
    border-radius: 50px;
    background-repeat: no-repeat;
    margin: 5px;
}

.nice-box-small {
    height: 70px;
    background-position: center center;
    background-size: cover;
    border-radius: 50px;
    background-repeat: no-repeat;
    margin: 5px;
}

.fixed-width-label-50 {
    display: inline-block;
    width: 50px;
}

.fixed-width-label-100 {
    display: inline-block;
    width: 100px;
}

.fixed-width-label-200 {
    display: inline-block;
    width: 200px;
}

.bordered {
    border-radius: var(--radius);
    border: 1px solid var(--gray);
    padding: 5px 5px 5px 5px;
}

/* Tooltip container */
.tooltip {
    position: relative;
    display: inline-block;
    /*border-bottom: 1px dotted black; !* If you want dots under the hoverable text *!*/
}

/* Tooltip text */
.tooltip .tooltiptext {
    visibility: hidden;
    width: 300px;
    background-color: var(--bulma-text-80);
    color: #fff;
    text-align: left;
    padding: 5px;
    margin-left: 2em;
    border-radius: 6px;

    /* Position the tooltip text - see examples below! */
    position: absolute;
    z-index: 1;
}

/* Show the tooltip text when you mouse over the tooltip container */
.tooltip:hover .tooltiptext {
    visibility: visible;
}

figure.image.is-256x256 {
    max-width: 256px;
    width: 256px;
}

figure.image.is-256x256 img {
    width: 100%;
    height: auto;
}

.navbar-item > img {
    max-height: 5.5rem;
}

.site-title {
    font-size: 22px;
    font-weight: bold;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.profile-card {
    background-color: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
    border: 2px solid var(--gray);
    display: flex;
    flex-direction: column;
}

.profile-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.elevation-card {
    border-top: 4px solid var(--primary);
}

.speed-card {
    border-top: 4px solid var(--secondary);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 10px;
}

.card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
}

.elevation-icon {
    width: 24px;
    height: 24px;
    background-image:
            url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='icon'%3E%3Cpath d='m18 9-6-6-6 6'%3E%3C/path%3E%3Cpath d='M12 3v14'%3E%3C/path%3E%3Cpath d='M5 21h14'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}

.speed-icon {
    width: 24px;
    height: 24px;
    background-image:
            url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='icon'%3E%3Cpath d='m12 14 4-4'%3E%3C/path%3E%3Cpath d='M3.34 19a10 10 0 1 1 17.32 0'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}

.elevation-card .card-icon {
    background-color: var(--primary);
}

.speed-card .card-icon {
    background-color: var(--secondary);
}

.card-title {
    font-size: 20px;
    font-weight: 600;
}

.speed-card .card-title {
    color: var(--secondary-dark);
}

.card-description {
    padding: 0 20px 20px;
    color: var(--gray-dark);
}

.card-diagram {
    height: 160px;
    margin: 0 20px;
    border-radius: var(--radius);
    background-color: var(--gray-light);
}

.elevation-diagram {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 100'%3E%3Cpath d='M0,80 L20,70 L40,60 L60,40 L80,30 L100,20 L120,25 L140,40 L160,35 L180,50 L200,45 L220,30 L240,35 L260,50 L280,60 L300,80' fill='none' stroke='%234CAF50' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M0,80 L20,70 L40,60 L60,40 L80,30 L100,20 L120,25 L140,40 L160,35 L180,50 L200,45 L220,30 L240,35 L260,50 L280,60 L300,80 L300,100 L0,100 Z' fill='rgba(76, 175, 80, 0.2)'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.speed-diagram {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 100'%3E%3Cpath d='M0,80 L20,60 L40,40 L60,30 L80,50 L100,70 L120,50 L140,30 L160,40 L180,60 L200,50 L220,30 L240,50 L260,70 L280,60 L300,80' fill='none' stroke='%232196F3' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M0,80 L20,60 L40,40 L60,30 L80,50 L100,70 L120,50 L140,30 L160,40 L180,60 L200,50 L220,30 L240,50 L260,70 L280,60 L300,80 L300,100 L0,100 Z' fill='rgba(33, 150, 243, 0.2)'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.card-link {
    display: block;
    text-align: center;
    padding: 12px;
    margin: 20px;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    color: white;
    transition: var(--transition);
}

.elevation-card .card-link {
    background-color: var(--primary);
}

.elevation-card .card-link:hover {
    background-color: var(--primary-dark);
}

.speed-card .card-link {
    background-color: var(--secondary);
}

.speed-card .card-link:hover {
    background-color: var(--secondary-dark);
}

.loading-spinner,
.loading-spinner div,
.loading-spinner div:after {
    box-sizing: border-box;
}
.loading-spinner {
    color: currentColor;
    display: inline-block;
    position: relative;
    width: 80px;
    height: 80px;
}
.loading-spinner div {
    transform-origin: 40px 40px;
    animation: loading-spinner 1.2s linear infinite;
}
.loading-spinner div:after {
    content: " ";
    display: block;
    position: absolute;
    top: 3.2px;
    left: 36.8px;
    width: 6.4px;
    height: 17.6px;
    border-radius: 20%;
    background: currentColor;
}
.loading-spinner div:nth-child(1) {
    transform: rotate(0deg);
    animation-delay: -1.1s;
}
.loading-spinner div:nth-child(2) {
    transform: rotate(30deg);
    animation-delay: -1s;
}
.loading-spinner div:nth-child(3) {
    transform: rotate(60deg);
    animation-delay: -0.9s;
}
.loading-spinner div:nth-child(4) {
    transform: rotate(90deg);
    animation-delay: -0.8s;
}
.loading-spinner div:nth-child(5) {
    transform: rotate(120deg);
    animation-delay: -0.7s;
}
.loading-spinner div:nth-child(6) {
    transform: rotate(150deg);
    animation-delay: -0.6s;
}
.loading-spinner div:nth-child(7) {
    transform: rotate(180deg);
    animation-delay: -0.5s;
}
.loading-spinner div:nth-child(8) {
    transform: rotate(210deg);
    animation-delay: -0.4s;
}
.loading-spinner div:nth-child(9) {
    transform: rotate(240deg);
    animation-delay: -0.3s;
}
.loading-spinner div:nth-child(10) {
    transform: rotate(270deg);
    animation-delay: -0.2s;
}
.loading-spinner div:nth-child(11) {
    transform: rotate(300deg);
    animation-delay: -0.1s;
}
.loading-spinner div:nth-child(12) {
    transform: rotate(330deg);
    animation-delay: 0s;
}
@keyframes loading-spinner {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* To hide an element */
.hidden {
    display: none;
}

.nico-hidden {
    display: none !important;
}

.footer {
    border-radius: var(--card-border-radius);
    padding: 1rem 1.5rem;
    margin: 0 1rem;
}

/* On a phone Bulma stacks a level's items one per line: two columns halve the footer's height, set
   flush left like the data credit below them. */
@media screen and (max-width: 768px) {
    .footer-links {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.25rem 1rem;
        width: 100%;
    }

    .footer-links .level-item {
        justify-content: flex-start;
        margin-bottom: 0;
        min-width: 0;
    }

    /* No side padding, so the labels start where the credit does; a label too long for its column
       wraps inside it rather than running into its neighbour, which takes the shrink Bulma denies a
       navbar-item. */
    .footer-links .navbar-item {
        padding-left: 0;
        padding-right: 0;
        min-width: 0;
        flex-shrink: 1;
        white-space: normal;
        text-align: left;
    }
}

/* To hide an element with fade */
.fade-hidden {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* ------------------------------------------------------------------ */
/* Global async notification (profile generation result overlay)      */
/* ------------------------------------------------------------------ */
.global-async-notification {
    position: fixed;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 100vw;
    height: 33.333vh;
    z-index: 10000;
    background-color: var(--background);
    color: var(--foreground);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border-radius: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.global-async-notification.is-success {
    border-top-color: var(--success);
    border-bottom-color: var(--success);
}

.global-async-notification.is-danger {
    border-top-color: var(--danger);
    border-bottom-color: var(--danger);
}

.global-async-notification.is-warning {
    border-top-color: var(--warning);
    border-bottom-color: var(--warning);
}

.global-async-notification.is-info {
    border-top-color: var(--info);
    border-bottom-color: var(--info);
}

.global-async-notification__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.global-async-notification__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 720px;
    width: 100%;
}

.global-async-notification__icon {
    font-size: 5rem;
    margin-bottom: 1.5rem;
}

.global-async-notification__icon.is-success {
    color: var(--success);
}

.global-async-notification__icon.is-danger {
    color: var(--danger);
}

.global-async-notification__icon.is-warning {
    color: var(--warning);
}

.global-async-notification__icon.is-info {
    color: var(--info);
}

.global-async-notification__title {
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.global-async-notification__message {
    font-size: 1.1rem;
}

/* ===== Bot protection ===== */
/* Honeypot field: visually hidden from real users, invisible to screen readers */
.honeypot-field {
    position: absolute;
    left: -9999px;
    visibility: hidden;
}

/* Bulma's primary is the site's green, not Bulma's default turquoise, which nobody chose and which
   stood beside the green everywhere else: the home page's sign-up buttons, the GPX file box, the
   track page's publishing button. --primary (#4CAF50) as hue, saturation and lightness, so every
   shade Bulma derives from it (light boxes, text, borders) is that green too. */
:root {
    --bulma-primary-h: 122deg;
    --bulma-primary-s: 39%;
    --bulma-primary-l: 49%;
}

/* A primary button looks like the site's own .btn-primary: the same gradient and black text, so
   there is one green button and not two. Hover settles on the darker end, never darker than that,
   where black text would fall below 4.5:1. */
.button.is-primary,
.file.is-primary .file-cta {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: transparent;
    color: var(--on-primary);
}

.button.is-primary:hover,
.button.is-primary:focus-visible,
.file.is-primary:hover .file-cta {
    background: var(--primary-dark);
    border-color: transparent;
    color: var(--on-primary);
}
