.trail-group-title {
    width: 100%;
    max-width: 1200px;
    margin: 2rem auto 0;
    padding: 0 2rem;
    box-sizing: border-box;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 2rem;
    margin: 0 auto;
    width: 100%;
    max-width: 1200px;
    position: relative;
    box-sizing: border-box;
}

@media screen and (max-width: 768px) {
    .card-grid {
        grid-template-columns: repeat(1, 1fr);
        margin: 0;
    }
}

.card {
    --card-80: color-mix(in srgb, var(--card-color) 80%, transparent);
    --card-50: color-mix(in srgb, var(--card-color) 50%, transparent);
    --card-30: color-mix(in srgb, var(--card-color) 30%, transparent);

    --card-light: color-mix(in srgb, var(--card-color) 80%, white);
    --card-dark: color-mix(in srgb, var(--card-color) 70%, black);

    perspective: 100px;
    cursor: pointer;
}

.card-border {
    background-color: var(--card-50);
    height: 100%;
    border-radius: calc(1rem + 2px);
    position: relative;
    transform: none;
    animation: card-perspective-out ease-out 0.3s forwards;
    box-shadow: 0 0 12px var(--card-30);
}

.card-border:hover {
    animation: card-perspective ease-out 0.3s forwards;
}

@keyframes card-perspective {
    from {
        transform: none;
    }

    to {
        transform: rotateX(var(--perspective-x)) rotateY(var(--perspective-y));
    }
}

@keyframes card-perspective-out {
    from {
        transform: rotateX(var(--perspective-x)) rotateY(var(--perspective-y));
    }

    to {
        transform: none;
    }
}

.card-border::before {
    border-radius: inherit;
    background: radial-gradient(300px circle at var(--mouse-x) var(--mouse-y),
            rgba(255, 255, 255, 0.18),
            transparent 40%);
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0px;
    left: 0px;
    content: "";
    opacity: 0;
    transition: opacity 500ms;
}

.card-grid:hover .card-border::before {
    opacity: 1;
}

.card-inside {
    background: linear-gradient(0deg, #191919d0 60%, var(--card-light) 100%);
    width: calc(100% - 4px);
    height: calc(100% - 4px);
    border-radius: 1rem;
    position: relative;
    top: 2px;
    left: 2px;
    box-sizing: border-box;
    overflow: hidden;
    max-height: 450px;
}

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

.card-inside::before {
    border-radius: inherit;
    background: radial-gradient(600px circle at var(--mouse-x) var(--mouse-y),
            rgba(255, 255, 255, 0.06),
            transparent 40%);
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0px;
    left: 0px;
    content: "";
    opacity: 0;
    transition: opacity 500ms;
}

.card *, .modal * {
    color: #ffffffee;
    margin: 0;
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
}

.info {
    display: flex;
    flex-direction: column;
}

.card-inside .info h1 {
    font-size: 2rem;
}

.info .difficulty {
    font-size: 1rem;
    color: #ffffffaa;
}

.stats {
    display: flex;
    gap: 1rem;
    justify-content: space-evenly;
}

.stats .divider {
    width: 1px;
    background: #ffffff44;
}

.stats>div {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stats>div>h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.stats>div>p {
    font-size: 0.875rem;
    color: #ffffffaa;
}

.description>* {
    font-size: 1rem;
    color: #ffffffcc;
}

.card-inside>img {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Modal */
.backdrop {
    position: fixed;
    inset: 0;
    background: #00000040;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.backdrop.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    display: none;
    background: var(--glass-bg);
    border: var(--glass-border);
    backdrop-filter: brightness(0.4) blur(20px);
    border-radius: 2rem;
    margin: 2rem;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    box-sizing: border-box;
    overflow-y: auto;
    position: relative;
    animation: modal-in 0.5s ease;
}

.modal.active {
    display: block;
}

@keyframes modal-in {
    0% {
        transform: scale(0.95);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    height: 2.5rem;
    width: 2.5rem;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease;
    border-radius: 100px;
}

.modal-close:hover {
    background-color: #00000040;
}

.modal-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 2rem;
}

.modal h1 {
    font-size: 2.5rem;
}

.modal-image {
    width: 100%;
    object-fit: cover;
    max-height: 300px;
}

.modal-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: center;
}

.modal-description {
    color: var(--text-color);
    line-height: 1.6;
}

.difficulty-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.difficulty-dot {
    --difficulty-color-light: color-mix(in srgb, var(--difficulty-color) 90%, white);
    width: 12px;
    height: 12px;
    border-radius: 100px;
    background-color: var(--difficulty-color-light);
    box-shadow: 0 0 5px var(--difficulty-color-light);
    border: 2px solid #ffffff40;
}

@media screen and (max-width: 768px) {
    .modal {
        padding: 1.5rem;
        margin: 1rem;
        max-height: none
    }

    .modal-top {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
    }
}