.region-community {
    position: relative;
    isolation: isolate;
    padding: 23px 28px 18px;
    overflow: visible;
    border: 1px solid #e9edf2;
    border-radius: 31px;
    background: #fff;
    box-shadow: 0 12px 38px rgba(31, 47, 68, .055);
}

.region-community::before {
    position: absolute;
    z-index: -1;
    inset: 0 0 auto;
    height: 245px;
    border-radius: inherit;
    background: url('../../img/community/community-mountains.webp') center 40% / cover no-repeat;
    content: '';
    opacity: .24;
    pointer-events: none;
}

.region-community__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 28px;
    min-height: 135px;
    padding: 0 7px;
}

.region-community__heading { max-width: 500px; }
.region-community__eyebrow {
    margin: 0 0 5px;
    color: #a65d2e;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .005em;
}
.region-community__heading h2 {
    margin: 0;
    color: #202934;
    font-size: clamp(25px, 2.5vw, 35px);
    font-weight: 850;
    letter-spacing: -.03em;
    line-height: 1.12;
}
.region-community__heading > p:last-child {
    max-width: 460px;
    margin: 6px 0 0;
    color: #636d7a;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
}
.region-community__action {
    display: flex;
    width: 425px;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: flex-end;
    gap: 20px;
    padding: 1px 4px 0 0;
}
.region-community__adventure {
    display: block;
    width: 300px;
    height: 48px;
    margin-right: 180px;
    object-fit: contain;
}
.region-community__ranking { position: relative; z-index: 4; }
.region-community__ranking summary {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    gap: 13px;
    padding: 0 14px 0 18px;
    border: 1px solid #edf0f4;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 5px 14px rgba(32, 45, 65, .08);
    color: #a66034;
    cursor: pointer;
    font-size: 12px;
    font-weight: 750;
    list-style: none;
    white-space: nowrap;
}
.region-community__ranking summary::-webkit-details-marker { display: none; }
.region-community__ranking summary::marker { content: ''; }
.region-community__ranking summary:hover { border-color: #e8c8b2; background: #fffaf6; }
.region-community__ranking summary:focus-visible,
.region-community__card:focus-visible,
.region-community__ranking-panel a:focus-visible {
    outline: 3px solid #ea8853;
    outline-offset: 3px;
}
.region-community__ranking summary img { width: 17px; height: 17px; filter: invert(46%) sepia(54%) saturate(606%) hue-rotate(338deg); }
.region-community__ranking-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(400px, calc(100vw - 55px));
    max-height: 390px;
    padding: 18px;
    overflow-y: auto;
    border: 1px solid #e5eaf1;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 18px 48px rgba(27, 40, 55, .16);
}
.region-community__ranking-panel > strong { color: #202934; font-size: 16px; font-weight: 800; }
.region-community__ranking-panel > p { margin: 3px 0 12px; color: #697584; font-size: 12px; }
.region-community__ranking-panel ol { display: grid; gap: 3px; margin: 0; padding: 0; list-style: none; }
.region-community__ranking-panel a {
    display: flex;
    min-height: 41px;
    align-items: center;
    gap: 9px;
    padding: 5px 7px;
    border-radius: 10px;
    color: #24303e;
    font-size: 12px;
    text-decoration: none;
}
.region-community__ranking-panel a:hover { background: #fff2e9; }
.region-community__ranking-panel a > span { width: 20px; color: #b0673a; font-weight: 800; }
.region-community__ranking-panel a > strong { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.region-community__ranking-panel a > small { color: #73808c; white-space: nowrap; }

.region-community__cards {
    display: grid;
    grid-template-columns: 1.22fr repeat(3, 1fr);
    gap: 14px;
}
.region-community__card {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 193px;
    flex-direction: column;
    justify-content: space-between;
    padding: 35px 14px 14px;
    border: 1px solid #e6eaf0;
    border-radius: 17px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 8px 23px rgba(46, 63, 82, .045);
    color: #202934;
    text-decoration: none;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.region-community__card:hover {
    transform: translateY(-3px);
    border-color: #e6b78b;
    box-shadow: 0 12px 25px rgba(66, 54, 46, .1);
}
.region-community__card--first {
    border-color: #efcdad;
    background: rgba(255, 253, 251, .95);
    box-shadow: 0 9px 26px rgba(198, 124, 63, .11);
}
.region-community__rank {
    position: absolute;
    z-index: 1;
    top: 8px;
    left: 11px;
    width: 29px;
    height: 31px;
    object-fit: contain;
}
.region-community__card--first .region-community__rank { top: -8px; left: 15px; width: 52px; height: 44px; }
.region-community__leader-mountains {
    position: absolute;
    top: 30px;
    right: 0;
    width: 55%;
    height: 85px;
    object-fit: cover;
    object-position: right center;
    pointer-events: none;
}
.region-community__person {
    position: relative;
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 9px;
}
.region-community__avatar-stack {
    display: flex;
    width: 86px;
    flex: 0 0 86px;
    align-items: center;
    flex-direction: column;
    gap: 4px;
}
.region-community__avatar {
    display: block;
    width: 64px;
    height: 64px;
    flex: 0 0 64px;
    border-radius: 50%;
    object-fit: cover;
}
.region-community__avatar--fallback {
    display: grid;
    place-items: center;
    background: #202936;
    color: #fff;
    font-size: 19px;
    font-weight: 700;
}
.region-community__identity { display: block; min-width: 0; }
.region-community__name,
.region-community__bio { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.region-community__name { color: #202934; font-size: 14px; font-weight: 800; line-height: 1.3; }
.region-community__level { display: block; max-width: 86px; color: #a36035; font-size: 10px; font-weight: 700; line-height: 1.15; text-align: center; }
.region-community__bio { margin-top: 3px; color: #68727d; font-size: 10px; font-weight: 500; }
.region-community__metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 15px; }
.region-community__metric {
    display: flex;
    min-width: 0;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    border-right: 1px solid #e8ebef;
}
.region-community__metric:last-child { border-right: 0; }
.region-community__metric-main { display: inline-flex; min-height: 24px; align-items: center; gap: 6px; }
.region-community__metric-main img { width: 18px; height: 18px; object-fit: contain; }
.region-community__metric-main strong { color: #1f2935; font-size: 15px; font-weight: 800; line-height: 1; }
.region-community__metric small { color: #64707d; font-size: 9px; font-weight: 500; line-height: 1.2; }
.region-community__footer { display: flex; min-height: 39px; align-items: end; justify-content: space-between; gap: 18px; }
.region-community__count { display: inline-flex; align-items: center; gap: 5px; color: #66727d; font-size: 10px; }
.region-community__count img { width: 14px; height: 14px; }
.region-community__living { display: inline-flex; align-items: center; gap: 6px; }
.region-community__living img:first-child { width: 142px; height: 34px; object-fit: contain; }
.region-community__living img:last-child { width: 18px; height: 18px; }

@media (max-width: 1120px) {
    .region-community__cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .region-community__action { width: 315px; }
    .region-community__adventure { width: 220px; margin-right: 90px; }
}
@media (max-width: 700px) {
    .region-community { padding: 22px 17px 14px; border-radius: 24px; }
    .region-community::before { height: 230px; background-image: url('../../img/community/community-mountains-1024.webp'); }
    .region-community__header { min-height: 0; flex-direction: column; gap: 12px; padding: 0 2px; }
    .region-community__heading h2 { font-size: 27px; }
    .region-community__heading > p:last-child { font-size: 12px; }
    .region-community__action { width: 100%; align-items: flex-start; padding: 0; }
    .region-community__adventure { display: none; }
    .region-community__ranking-panel { right: auto; left: 0; width: calc(100vw - 56px); max-width: none; }
    .region-community__cards { grid-template-columns: 1fr; gap: 12px; margin-top: 20px; }
    .region-community__card { min-height: 168px; padding: 33px 15px 13px; }
    .region-community__metrics { padding-right: 38px; }
    .region-community__footer { min-height: 45px; align-items: center; }
    .region-community__living { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .region-community__card { transition: none; }
}
html[data-theme="dark"] .region-community { border-color: #354254; background: #182331; }
html[data-theme="dark"] .region-community::before { opacity: .1; }
html[data-theme="dark"] .region-community__heading h2,
html[data-theme="dark"] .region-community__name,
html[data-theme="dark"] .region-community__metric-main strong { color: #f1f4f8; }
html[data-theme="dark"] .region-community__heading > p:last-child,
html[data-theme="dark"] .region-community__bio,
html[data-theme="dark"] .region-community__count { color: #b5bfca; }
html[data-theme="dark"] .region-community__card,
html[data-theme="dark"] .region-community__card--first { border-color: #3c4a5d; background: rgba(31, 43, 58, .95); }
html[data-theme="dark"] .region-community__ranking summary,
html[data-theme="dark"] .region-community__ranking-panel { border-color: #3c4a5d; background: #202c3b; }
html[data-theme="dark"] .region-community__ranking-panel > strong,
html[data-theme="dark"] .region-community__ranking-panel a { color: #f1f4f8; }
html[data-theme="dark"] .region-community__ranking-panel a:hover { background: #2e3b4b; }
