.trail-detail-page {
    background: #f8f7f1;
}

.trail-hero {
    position: relative;
    min-height: 620px;
    color: #fff;
    background:
        linear-gradient(180deg, rgba(7, 18, 12, 0.18), rgba(7, 18, 12, 0.82)),
        linear-gradient(90deg, rgba(7, 18, 12, 0.72), rgba(7, 18, 12, 0.18)),
        var(--trail-hero-image) center / cover;
}

.trail-hero__inner {
    display: flex;
    flex-direction: column;
    min-height: 620px;
    padding-block: 32px 44px;
}

.trail-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    color: inherit;
    font-size: 0.88rem;
    font-weight: 850;
}

.trail-hero__content {
    width: min(780px, 100%);
    margin-top: auto;
}

.trail-difficulty {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 13px;
    margin-bottom: 14px;
    color: #fafff6;
    background: rgba(31, 122, 58, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.trail-difficulty--moderate {
    background: rgba(201, 126, 36, 0.94);
}

.trail-difficulty--hard,
.trail-difficulty--advanced {
    background: rgba(202, 76, 59, 0.94);
}

.trail-hero h1 {
    max-width: 760px;
    margin: 0;
    font-size: clamp(2.8rem, 7vw, 5.8rem);
    line-height: 0.94;
    letter-spacing: 0;
}

.trail-hero p {
    max-width: 700px;
    margin: 18px 0 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: clamp(1.05rem, 1.7vw, 1.32rem);
    line-height: 1.45;
}

.trail-hero__meta,
.trail-chip-row,
.trail-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.trail-hero__meta {
    margin-top: 18px;
}

.trail-hero__meta span,
.trail-chip-row span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.13);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    backdrop-filter: blur(12px);
    font-size: 0.86rem;
    font-weight: 800;
}

.trail-hero__stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    width: min(820px, 100%);
    margin-top: 24px;
}

.trail-hero__stats div {
    min-height: 82px;
    padding: 14px 15px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 18px;
    backdrop-filter: blur(14px);
}

.trail-hero__stats svg {
    color: #d7f2d0;
}

.trail-hero__stats span,
.trail-hero__stats strong {
    display: block;
}

.trail-hero__stats span {
    margin-top: 8px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.72rem;
    font-weight: 850;
    text-transform: uppercase;
}

.trail-hero__stats strong {
    margin-top: 3px;
    color: #fff;
    font-size: 1.02rem;
}

.trail-chip-row {
    margin-top: 14px;
}

.trail-chip-row span {
    min-height: 30px;
    color: #f6fff0;
    background: rgba(15, 51, 28, 0.46);
}

.trail-hero__actions {
    margin-top: 24px;
}

.trail-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 46px;
    padding: 0 18px;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 999px;
    font: inherit;
    font-size: 0.94rem;
    font-weight: 900;
    cursor: pointer;
    backdrop-filter: blur(14px);
}

.trail-button--primary {
    color: var(--color-forest-700);
    background: #fff;
}

.trail-tabs {
    position: sticky;
    top: 76px;
    z-index: 20;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid rgba(17, 32, 22, 0.09);
    backdrop-filter: blur(16px);
}

.trail-tabs .container {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-block: 10px;
}

.trail-tabs a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 14px;
    color: var(--color-muted);
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 850;
    white-space: nowrap;
}

.trail-tabs a:hover,
.trail-tabs a:focus-visible {
    color: var(--color-forest-700);
    background: var(--color-mint);
}

.trail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(330px, 390px);
    gap: 24px;
    padding-block: 28px 54px;
    align-items: start;
}

.trail-main,
.trail-sidebar {
    display: grid;
    gap: 18px;
}

.trail-sidebar {
    position: sticky;
    top: 138px;
}

.trail-section,
.trail-side-card,
.trail-empty-panel {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(17, 32, 22, 0.1);
    border-radius: 22px;
    box-shadow: 0 18px 44px rgba(13, 35, 22, 0.07);
}

.trail-section {
    padding: 24px;
}

.trail-section > header,
.trail-side-card > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 14px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(17, 32, 22, 0.08);
}

.trail-section > header {
    justify-content: flex-start;
}

.trail-section--map > header {
    justify-content: space-between;
}

.trail-section--map > header h2 {
    margin-right: auto;
}

.trail-section--map > header a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--color-forest-700);
    font-size: 0.82rem;
    font-weight: 900;
}

.trail-section > header span {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    color: var(--color-forest-700);
    background: var(--color-mint);
    border-radius: 50%;
}

.trail-section h2,
.trail-side-card h2 {
    margin: 0;
    font-size: 1.2rem;
    letter-spacing: 0;
}

.trail-section p {
    margin: 0;
    color: #334238;
    font-size: 1rem;
    line-height: 1.7;
}

.trail-data-note,
.trail-card-note {
    margin-top: 12px;
    color: var(--color-muted);
    font-size: 0.86rem;
}

.trail-facts-grid,
.trail-highlight-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.trail-facts-grid div,
.trail-highlight-grid article {
    min-width: 0;
    padding: 15px;
    background: #fbfaf6;
    border: 1px solid rgba(17, 32, 22, 0.08);
    border-radius: 16px;
}

.trail-facts-grid svg,
.trail-highlight-grid svg {
    color: var(--color-forest-700);
}

.trail-facts-grid span,
.trail-facts-grid strong,
.trail-highlight-grid strong,
.trail-highlight-grid span {
    display: block;
}

.trail-facts-grid span,
.trail-highlight-grid span {
    margin-top: 8px;
    color: var(--color-muted);
    font-size: 0.78rem;
    font-weight: 750;
}

.trail-facts-grid strong,
.trail-highlight-grid strong {
    margin-top: 3px;
    color: var(--color-ink);
    font-size: 0.95rem;
}

.trail-highlight-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.trail-photo-strip {
    display: grid;
    grid-template-columns: 1fr 1fr 180px;
    gap: 10px;
}

.trail-photo-strip img,
.trail-photo-empty {
    width: 100%;
    height: 190px;
    border-radius: 16px;
}

.trail-photo-strip img {
    object-fit: cover;
}

.trail-photo-empty {
    display: grid;
    place-items: center;
    padding: 18px;
    color: var(--color-forest-700);
    text-align: center;
    background: #f7f4eb;
    border: 1px dashed rgba(31, 122, 58, 0.24);
}

.trail-photo-empty strong,
.trail-photo-empty span {
    display: block;
}

.trail-photo-empty span {
    color: var(--color-muted);
    font-size: 0.82rem;
}

.trail-rating-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.trail-rating-summary strong {
    color: var(--color-forest-700);
    font-size: 2rem;
}

.trail-rating-summary span {
    color: var(--color-forest-700);
    letter-spacing: 0.08em;
}

.trail-rating-summary small {
    color: var(--color-muted);
    font-weight: 700;
}

.trail-review-list {
    display: grid;
    gap: 10px;
}

.trail-review-list article {
    padding: 14px;
    background: #fbfaf6;
    border-radius: 16px;
}

.trail-side-card {
    padding: 18px;
}

.trail-side-card header a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--color-forest-700);
    font-size: 0.8rem;
    font-weight: 900;
}

.trail-map-wrap {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
}

.map--trail-detail {
    position: relative;
    height: 320px;
    overflow: hidden;
}

.trail-section--map .map--trail-detail {
    height: 430px;
}

.trail-sidebar .community-preview-card {
    margin-top: 0;
}

.trail-map-controls {
    position: absolute;
    right: 18px;
    bottom: 18px;
    z-index: 660;
    display: grid;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--color-line);
    border-radius: 16px;
    box-shadow: 0 12px 28px rgba(17, 32, 22, 0.16);
}

.trail-map-controls button {
    display: grid;
    width: 46px;
    height: 44px;
    place-items: center;
    color: var(--color-ink);
    background: #fff;
    border: 0;
    border-bottom: 1px solid var(--color-line);
    cursor: pointer;
    font-size: 1.45rem;
    font-weight: 550;
}

.trail-map-controls button:last-child {
    border-bottom: 0;
}

.trail-map-controls svg {
    width: 17px;
    height: 17px;
}

.trail-elevation {
    display: grid;
    gap: 10px;
}

.trail-elevation svg {
    width: 100%;
    min-height: 150px;
    background: linear-gradient(180deg, #fbfaf6, #eef4f6);
    border-radius: 16px;
}

.trail-elevation p,
.trail-card-note {
    margin: 0;
    color: var(--color-muted);
    font-size: 0.86rem;
}

.trail-detail-list {
    display: grid;
    gap: 0;
    margin: 0;
}

.trail-detail-list div {
    display: grid;
    grid-template-columns: minmax(110px, 0.75fr) minmax(0, 1fr);
    gap: 12px;
    padding-block: 11px;
    border-bottom: 1px solid rgba(17, 32, 22, 0.08);
}

.trail-detail-list div:last-child {
    border-bottom: 0;
}

.trail-detail-list dt {
    color: var(--color-muted);
    font-size: 0.78rem;
    font-weight: 850;
    text-transform: uppercase;
}

.trail-detail-list dd {
    margin: 0;
    color: var(--color-ink);
    font-size: 0.9rem;
    font-weight: 760;
}

.trail-nearby-list {
    display: grid;
    gap: 10px;
}

.trail-nearby-list a {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    min-height: 68px;
    color: var(--color-ink);
}

.trail-nearby-list img {
    width: 58px;
    height: 58px;
    object-fit: cover;
    border-radius: 13px;
}

.trail-nearby-list strong,
.trail-nearby-list small {
    display: block;
}

.trail-nearby-list small {
    margin-top: 3px;
    color: var(--color-muted);
    font-size: 0.8rem;
}

.trail-empty-row {
    display: grid;
    gap: 14px;
    padding-top: 2px;
}

.trail-empty-row p {
    margin: 0;
    color: var(--color-muted);
}

.trail-empty-row a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: fit-content;
    color: var(--color-forest-700);
    font-weight: 900;
}

.trail-empty-row--compact {
    gap: 10px;
}

.trail-not-found {
    padding-block: 80px;
}

.trail-empty-panel {
    display: grid;
    gap: 12px;
    justify-items: start;
    max-width: 620px;
    padding: 34px;
    margin-top: 18px;
}

.trail-empty-panel svg {
    color: var(--color-forest-700);
}

.trail-empty-panel h1 {
    margin: 0;
    font-size: 2rem;
}

.trail-empty-panel p {
    margin: 0;
    color: var(--color-muted);
}

.trail-empty-panel a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--color-forest-700);
    font-weight: 900;
}

@media (max-width: 1040px) {
    .trail-hero,
    .trail-hero__inner {
        min-height: 560px;
    }

    .trail-tabs {
        top: 68px;
    }

    .trail-layout {
        grid-template-columns: 1fr;
    }

    .trail-sidebar {
        position: static;
    }
}

@media (max-width: 760px) {
    .trail-hero,
    .trail-hero__inner {
        min-height: 540px;
    }

    .trail-hero__inner {
        padding-block: 22px 30px;
    }

    .trail-hero__stats,
    .trail-facts-grid,
    .trail-highlight-grid,
    .trail-photo-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .trail-hero__stats {
        display: flex;
        max-width: 100%;
        overflow: auto hidden;
        padding-bottom: 4px;
    }

    .trail-hero__stats div {
        flex: 0 0 175px;
    }

    .trail-button {
        flex: 1 1 150px;
    }

    .trail-section,
    .trail-side-card {
        padding: 18px;
        border-radius: 18px;
    }

    .trail-photo-empty {
        grid-column: 1 / -1;
        height: auto;
        min-height: 128px;
    }
}

@media (max-width: 520px) {
    .trail-hero h1 {
        font-size: 2.55rem;
    }

    .trail-hero p {
        font-size: 1rem;
    }

    .trail-layout {
        padding-block: 18px 42px;
    }

    .trail-highlight-grid,
    .trail-photo-strip {
        grid-template-columns: 1fr;
    }

    .trail-detail-list div {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .map--trail-detail {
        height: 280px;
    }

    .trail-section--map .map--trail-detail {
        height: 320px;
    }
}

/* Detail-page cleanup */
.trail-detail-page .trail-hero h1 { color: #fff; font-size: clamp(2.2rem, 4.5vw, 4rem); line-height: 1.08; }
.trail-detail-page .trail-hero,
.trail-detail-page .trail-hero__inner { min-height: 0; }
.trail-hero__content { margin-top: 22px; }
.trail-hero__stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.trail-detail-page .trail-tabs { top: var(--detail-header-height, 77px); }
.trail-tabs a.is-active { color: var(--color-forest-700); background: var(--color-mint); }
.trail-sidebar { position: static; }
.trail-detail-page [id] { scroll-margin-top: var(--detail-scroll-offset, 150px); }
.trail-description-more summary { cursor: pointer; color: var(--color-forest-700); font-weight: 700; padding-block: 10px; }
.trail-elevation { padding: 0; }
@media (max-width: 760px) {
    .trail-hero__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
    .trail-hero__stats div { min-width: 0; padding: 12px; }
    .trail-hero__actions .trail-button { flex: 1 1 auto; min-height: 44px; }
}
.trail-difficulty--difficulty-not-listed { background: #34483b; }
@media (max-width: 760px) {
    .trail-hero__stats div { display: grid; grid-template-columns: 20px minmax(0, 1fr); align-content: center; column-gap: 8px; min-height: 74px; }
    .trail-hero__stats svg { grid-row: span 2; align-self: center; }
    .trail-hero__stats span { margin: 0; }
}
