/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */
.nav-logo {
    width: 32px;
    height: 32px;
}

/* Theme toggle button */
.theme-toggle {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    color: inherit !important;
    padding: var(--pico-nav-link-spacing-vertical)
        var(--pico-nav-link-spacing-horizontal) !important;
    margin: 0 !important;
    line-height: 1;
    cursor: pointer;
}

.theme-toggle .icon-moon {
    display: none;
}
html[data-theme="light"] .theme-toggle .icon-sun {
    display: none;
}
html[data-theme="light"] .theme-toggle .icon-moon {
    display: inline;
}

aside > nav li a {
    display: block;
    font-family: var(--pico-font-family-header);
    text-transform: uppercase;
    padding: calc(var(--pico-nav-link-spacing-vertical) * 1.5)
        var(--pico-nav-link-spacing-horizontal);
    border-radius: var(--pico-border-radius);
    border-right: 4px solid transparent;
    transition:
        background-color var(--pico-transition),
        color var(--pico-transition);
}

aside > nav li a:hover,
aside > nav li a:focus {
    background-color: var(--pico-dropdown-hover-background-color);
    color: var(--pico-dropdown-hover-color);
    text-decoration: none;
}

aside > nav li a.active {
    color: var(--pico-dropdown-hover-color);
    text-decoration: none;
}

table tbody tr {
    transition: background-color var(--pico-transition);
}

table tbody tr:hover td,
table tbody tr:hover th {
    background-color: var(--pico-dropdown-hover-background-color) !important;
}

table tbody tr td:first-child {
    border-left: 4px solid transparent;
    transition: border-color var(--pico-transition);
}

table tbody tr:hover td:first-child {
    border-left-color: var(--pico-primary-hover);
}

.grid.grid-sidebar {
    display: grid;
    gap: var(--pico-spacing);
}

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: min(24rem, calc(100vw - 2rem));
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: var(--pico-spacing);
    border-radius: var(--pico-border-radius);
    pointer-events: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0;
    opacity: 0.7;
    color: inherit;
    margin: 0;
    width: auto;
}

.toast-close:hover {
    opacity: 1;
}

.toast-success {
    border: 1px solid var(--pico-form-element-valid-border-color);
    background-color: var(
        --pico-card-background-color,
        var(--pico-background-color)
    );
    color: var(--pico-form-element-valid-border-color);
}

.toast-error {
    border: 1px solid var(--pico-form-element-invalid-border-color);
    background-color: var(
        --pico-card-background-color,
        var(--pico-background-color)
    );
    color: var(--pico-form-element-invalid-border-color);
}

@keyframes toast-fade-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-0.5rem);
    }
}

.toast-hiding {
    animation: toast-fade-out 0.3s ease-in forwards;
}

[role="group"] > form {
    display: contents;
}

/* ── Footer ── */
.site-footer {
    margin-top: 4rem;
    border-top: var(--pico-border-width) solid var(--pico-muted-border-color);
    padding: 2.5rem 0 1.5rem;
    color: var(--pico-muted-color);
}

.site-footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.site-footer-brand {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.site-footer-brand a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--pico-color);
}

.site-footer-brand p {
    margin: 0;
    font-size: var(--pico-small-font-size);
}

.site-footer-nav {
    display: flex;
    gap: 3rem;
    flex-wrap: wrap;
}

.site-footer-nav > div {
    text-align: right;
}

.site-footer-nav ul {
    list-style: none;
    padding: 0;
    margin: 0.4rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    align-items: flex-end;
}

.site-footer-nav li {
    padding: 0 !important;
}

.site-footer-nav a {
    font-size: var(--pico-small-font-size);
    color: var(--pico-muted-color);
    text-decoration: none;
    padding: 0 !important;
    margin: 0 !important;
}

.site-footer-nav a:hover {
    color: var(--pico-color);
}

.site-footer-bottom {
    border-top: var(--pico-border-width) solid var(--pico-muted-border-color);
    padding-top: 1rem;
}

/* ── Hamburger menu ── */
.nav-hamburger {
    display: none;
}

.nav-hamburger details > summary::after,
.nav-hamburger details > summary::marker,
.nav-hamburger details > summary::-webkit-details-marker {
    display: none;
    content: none;
}

.nav-hamburger details > summary {
    list-style: none;
    display: flex;
    align-items: center;
}

@media (max-width: 768px) {
    .nav-desktop-link {
        display: none;
    }
    .nav-hamburger {
        display: flex;
        align-items: center;
    }
}

/* ── Landing page ── */
.text-selection {
    background-color: var(--pico-primary-background);
    color: var(--pico-primary-inverse);
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
    padding: 0.05em 0.15em;
    border-radius: 2px;
}

.landing-hero {
    text-align: center;
    padding: 5rem 1rem 4.5rem;
    background-image:
        linear-gradient(
            to bottom,
            var(--pico-background-color) 0%,
            transparent 25%,
            transparent 75%,
            var(--pico-background-color) 100%
        ),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='150'%3E%3Cpath d='M0,15 Q150,0 300,18 T600,15' fill='none' stroke='%23FFC107' stroke-width='1.5' opacity='0.12'/%3E%3Cpath d='M0,45 Q120,30 300,47 T600,45' fill='none' stroke='%23FFC107' stroke-width='1' opacity='0.08'/%3E%3Cpath d='M0,75 Q180,60 300,77 T600,75' fill='none' stroke='%23FFC107' stroke-width='1.5' opacity='0.12'/%3E%3Cpath d='M0,105 Q140,90 300,108 T600,105' fill='none' stroke='%23FFC107' stroke-width='1' opacity='0.08'/%3E%3Cpath d='M0,135 Q165,120 300,138 T600,135' fill='none' stroke='%23FFC107' stroke-width='1.5' opacity='0.12'/%3E%3C/svg%3E");
    background-size:
        100% 100%,
        600px 150px;
    background-repeat: no-repeat, repeat;
}

html[data-theme="light"] .landing-hero {
    background-image:
        linear-gradient(
            to bottom,
            var(--pico-background-color) 0%,
            transparent 25%,
            transparent 75%,
            var(--pico-background-color) 100%
        ),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='150'%3E%3Cpath d='M0,15 Q150,0 300,18 T600,15' fill='none' stroke='%23775500' stroke-width='1.5' opacity='0.18'/%3E%3Cpath d='M0,45 Q120,30 300,47 T600,45' fill='none' stroke='%23775500' stroke-width='1' opacity='0.12'/%3E%3Cpath d='M0,75 Q180,60 300,77 T600,75' fill='none' stroke='%23775500' stroke-width='1.5' opacity='0.18'/%3E%3Cpath d='M0,105 Q140,90 300,108 T600,105' fill='none' stroke='%23775500' stroke-width='1' opacity='0.12'/%3E%3Cpath d='M0,135 Q165,120 300,138 T600,135' fill='none' stroke='%23775500' stroke-width='1.5' opacity='0.18'/%3E%3C/svg%3E");
}

.landing-hero h1 {
    font-size: clamp(2.2rem, 6vw, 4rem);
    line-height: 1.1;
    margin-bottom: 1rem;
}

.landing-hero hgroup p {
    font-size: 1.1rem;
    color: var(--pico-muted-color);
    max-width: 38rem;
    margin: 0 auto 2rem;
    animation: fade-up 0.7s ease-out 0.15s both;
}

.landing-hero-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    animation: fade-up 0.7s ease-out 0.3s both;
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(1.75rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .landing-hero h1,
    .landing-hero hgroup p,
    .landing-hero-actions {
        animation: none;
    }
}

.feature-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background-color: var(--pico-primary-background);
    color: var(--pico-primary-inverse);
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.feature-icon svg {
    width: 1.375rem;
    height: 1.375rem;
}

.landing-features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--pico-spacing);
    margin: 2rem 0;
}

@media (max-width: 600px) {
    .landing-features {
        grid-template-columns: 1fr;
    }
}

/* ── About / Contact pages ── */
.about-page {
    max-width: 48rem;
    margin: 0 auto;
}

.about-page hgroup {
    margin-bottom: 2rem;
}

.about-page section {
    margin-bottom: 2rem;
}

/* ── Login split layout ── */
.login-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: stretch;
    min-height: 44rem;
}

.login-form {
    max-width: 26rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem 0;
}

.login-image {
    border-radius: var(--pico-border-radius);
    overflow: hidden;
}

.login-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: left;
    display: block;
}

@media (max-width: 768px) {
    .login-split {
        grid-template-columns: 1fr;
        min-height: unset;
        gap: 0;
    }

    .login-image {
        display: none;
    }
}

.avatar-wrap {
    position: relative;
    border-radius: 50% !important;
    width: 6rem !important;
    height: 6rem !important;
    min-height: unset !important;
    padding: 0 !important;
    overflow: hidden;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border: var(--pico-border-width) solid var(--pico-muted-border-color) !important;
    box-shadow: none !important;
    cursor: pointer;
}

.avatar-wrap--large {
    width: 7rem !important;
    height: 7rem !important;
    cursor: default;
}

.avatar-camera-overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--pico-transition);
    pointer-events: none;
}

button.avatar-wrap:hover .avatar-camera-overlay {
    opacity: 1;
}

/* Touch devices: no hover, show a small badge in the corner instead */
@media (hover: none) {
    .avatar-camera-overlay {
        inset: auto;
        bottom: 0;
        right: 0;
        width: 1.8rem;
        height: 1.8rem;
        opacity: 1;
        background: var(--pico-primary-background);
    }

    .avatar-camera-overlay svg {
        width: 14px;
        height: 14px;
    }
}

.gpx-details {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.4rem var(--pico-spacing);
    margin: 0;
}

.gpx-details dt {
    color: var(--pico-muted-color);
    font-size: var(--pico-small-font-size);
    align-self: center;
}

.gpx-details dd {
    margin: 0;
}

@media (min-width: 768px) {
    .grid.grid-sidebar {
        grid-template-columns: 1fr 4fr;
    }

    .hide-on-desktop {
        display: none;
    }
}

@media (max-width: 768px) {
    .hide-on-mobile {
        display: none;
    }
}

.groups-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--pico-spacing);
}

.groups-grid a > article {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    border-bottom: 4px solid transparent;
    transition:
        background-color var(--pico-transition),
        border-color var(--pico-transition);
}

.groups-grid a:hover > article {
    background-color: var(--pico-dropdown-hover-background-color);
    border-bottom-color: var(--pico-primary-hover);
}

.groups-grid a > article img {
    width: 100%;
    display: block;
    object-fit: cover;
    flex-shrink: 0;
}

.groups-grid .card-body {
    padding: var(--pico-spacing);
}

@media (max-width: 900px) {
    .groups-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .groups-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Cookie Consent Popup ── */
.cookie-popup {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 9999;
    width: 360px;
    background-color: var(--pico-card-background-color);
    border: var(--pico-border-width) solid var(--pico-muted-border-color);
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.cookie-popup-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1.1rem 1.25rem 0.6rem;
    color: var(--pico-primary);
}

.cookie-popup-header strong {
    font-size: 1rem;
}

.cookie-popup-body {
    padding: 0 1.25rem 1.25rem;
}

.cookie-popup-body p {
    font-size: var(--pico-small-font-size);
    color: var(--pico-muted-color);
    margin-bottom: 0.4rem;
    line-height: 1.5;
}

.cookie-popup-body > small {
    display: block;
    color: var(--pico-muted-color);
    margin-bottom: 1rem;
}

.cookie-popup-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.cookie-popup-actions button {
    margin: 0;
    width: 100%;
}

.cookie-manage-link {
    font-size: var(--pico-small-font-size) !important;
    padding-top: 0.35rem !important;
    padding-bottom: 0.35rem !important;
}

.cookie-fieldset {
    border: none;
    padding: 0;
    margin: 0 0 0.5rem;
}

.cookie-category {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: var(--pico-border-width) solid var(--pico-muted-border-color);
    cursor: pointer;
    margin: 0;
}

.cookie-category:last-child {
    border-bottom: none;
}

.cookie-category-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.cookie-category-info strong {
    font-size: var(--pico-small-font-size);
}

.cookie-category-info small {
    color: var(--pico-muted-color);
    line-height: 1.4;
}

.cookie-category input[type="checkbox"] {
    flex-shrink: 0;
    margin: 0;
}

@media (max-width: 480px) {
    .cookie-popup {
        left: 0.75rem;
        right: 0.75rem;
        bottom: 0.75rem;
        width: auto;
    }
}

/* ── MapLibre popup theming ── */
:root {
    --map-popup-bg: #2d2d2d;
    --map-popup-color: #f0f0f0;
}

html[data-theme="light"] {
    --map-popup-bg: #ffffff;
    --map-popup-color: #333333;
}

@media (prefers-color-scheme: light) {
    html:not([data-theme]) {
        --map-popup-bg: #ffffff;
        --map-popup-color: #333333;
    }
}

[data-controller~="featured-map"] .maplibregl-canvas {
    cursor: default !important;
}

.maplibregl-popup-content {
    background-color: var(--map-popup-bg) !important;
    color: var(--map-popup-color) !important;
}

.maplibregl-popup-anchor-bottom .maplibregl-popup-tip {
    border-top-color: var(--map-popup-bg) !important;
}
.maplibregl-popup-anchor-top .maplibregl-popup-tip {
    border-bottom-color: var(--map-popup-bg) !important;
}
.maplibregl-popup-anchor-left .maplibregl-popup-tip {
    border-right-color: var(--map-popup-bg) !important;
}
.maplibregl-popup-anchor-right .maplibregl-popup-tip {
    border-left-color: var(--map-popup-bg) !important;
}
.maplibregl-popup-anchor-top-left .maplibregl-popup-tip {
    border-bottom-color: var(--map-popup-bg) !important;
}
.maplibregl-popup-anchor-top-right .maplibregl-popup-tip {
    border-bottom-color: var(--map-popup-bg) !important;
}
.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip {
    border-top-color: var(--map-popup-bg) !important;
}
.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {
    border-top-color: var(--map-popup-bg) !important;
}

/* ── Elevation Profile Chart ── */
.elevation-profile-wrap {
    margin-top: 1rem;
    border-radius: var(--pico-border-radius);
    background: var(--pico-card-background-color);
    border: var(--pico-border-width) solid var(--pico-muted-border-color);
    padding: 0.5rem 0.25rem 0.25rem;
    overflow: hidden;
}

.elevation-profile-wrap svg {
    display: block;
    width: 100%;
    height: auto;
    cursor: crosshair;
}
