/* Regions page — concept «Регионы и страны» (adaptation over the site backend).
 * kit.css loads after this file and carries generic .find/.mosaic/.seg rules:
 * the «Adaptation» section at the end re-wins with higher specificity. */

/* ---------- head & search bar ---------- */
.rg-head { margin-bottom: 20px; }
.rg-head .lead { margin-top: 8px; color: var(--ink-2); }
.rg-head #rg-total-routes { white-space: nowrap; font-variant-numeric: tabular-nums; }

.rg-bar { position: sticky; top: 68px; z-index: 40; padding: 8px 0; background: var(--bg); transition: box-shadow 200ms; }
.rg-bar.is-stuck { box-shadow: 0 1px 0 var(--line), 0 10px 20px -16px var(--shade-25); }
.rg-bar__in { display: flex; align-items: center; gap: 12px 16px; }
.rg-find { flex: 1; max-width: none; margin: 0; padding-right: 8px; }
.rg-find input { font-size: var(--fs-body); }
.rg-find input::-webkit-search-cancel-button { display: none; }
.rg-clear { display: grid; flex: none; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--bg-soft); color: var(--ink-2); cursor: pointer; }
.rg-clear:hover { background: var(--line); color: var(--ink); }
.rg-clear .icon { width: 18px; height: 18px; }
.rg-seg { flex: none; padding: 4px; }
.rg-seg a { min-height: 44px; padding: 0 16px; font-size: var(--fs-button); }
.seg__n { color: var(--quiet); font-weight: var(--fw-button); font-variant-numeric: tabular-nums; }
.seg [aria-pressed="true"] .seg__n { color: var(--link); }
.is-searching .rg-hide-on-search { display: none; }

/* ---------- featured mosaic ---------- */
.rg-feat { margin-top: 40px; }
.rg-feat .head { margin-bottom: 24px; }

/* ---------- directory ---------- */
.rg-dir { margin-top: 96px; scroll-margin-top: 160px; }
.is-searching .rg-dir { margin-top: 24px; }
.rg-dir + .rg-dir { margin-top: 96px; }
.dir-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px 24px; margin-bottom: 16px; }
.dir-head p { max-width: 42em; margin-top: 8px; }
.dir-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.dir { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; row-gap: 16px; }
.dir__head { grid-column: 1 / -1; margin: 40px 0 0; padding-bottom: 8px; display: flex; align-items: baseline; gap: 12px; color: var(--ink); font-family: var(--font-display); font-size: var(--fs-h4); font-weight: var(--fw-title); letter-spacing: var(--ls-heading); line-height: var(--lh-h4); }
.dir__head:first-child { margin-top: 0; }
.dir__head small { color: var(--quiet); font-family: var(--font-text); font-size: var(--fs-small); font-weight: var(--fw-ui); letter-spacing: 0; }
.reg__name { display: block; color: var(--ink); font-family: var(--font-display); font-size: var(--fs-body); font-weight: var(--fw-title); letter-spacing: var(--ls-heading); line-height: var(--lh-h4); }
.reg__meta { display: block; margin-top: 2px; overflow: hidden; color: var(--quiet); font-size: var(--fs-caption); white-space: nowrap; text-overflow: ellipsis; }
.reg__meta:empty { display: none; }
.reg__tag + .reg__tag::before { content: ' · '; }
.reg__hit { display: block; margin-top: 4px; overflow: hidden; color: var(--copy); font-size: var(--fs-caption); white-space: nowrap; text-overflow: ellipsis; }
.reg mark, .rg-dir mark { padding: 0 1px; border-radius: 3px; background: var(--orange-soft); color: var(--ink); box-shadow: 0 0 0 1px color-mix(in srgb, var(--orange) 35%, transparent); }
.rg-empty { padding: 44px 20px; }
.rg-empty b { color: var(--ink); font-family: var(--font-display); font-size: var(--fs-h4); font-weight: var(--fw-title); letter-spacing: var(--ls-heading); line-height: var(--lh-h4); }
.rg-empty p { max-width: 30em; }

/* ---------- tiles ---------- */
.mosaic { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 240px; gap: 16px; }
.tile { position: relative; display: block; overflow: hidden; border-radius: 20px; background: var(--ink-fixed); color: var(--on-accent); isolation: isolate; }
.tile--big { grid-column: span 2; grid-row: span 2; }
.tile img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; transition: transform 700ms var(--ease-out); }
.tile::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(0deg, var(--scrim-80) 0%, var(--scrim-38) 42%, var(--scrim-00) 72%); }
.tile:hover::before { background: linear-gradient(0deg, var(--scrim-80) 0%, var(--scrim-45) 46%, var(--scrim-00) 76%); }
.tile__n { position: absolute; top: 12px; left: 12px; padding: 4px 8px; border-radius: 999px; background: var(--glass-95); color: var(--ink-fixed); font-size: var(--fs-caption); font-weight: var(--fw-button); font-variant-numeric: tabular-nums; }
.tile__body { position: absolute; left: 16px; right: 16px; bottom: 14px; display: grid; justify-items: start; gap: 4px; }
.tile__name { font-family: var(--font-display); font-size: var(--fs-h4); font-weight: var(--fw-heading); letter-spacing: var(--ls-heading); line-height: var(--lh-h4); text-wrap: balance; }
.tile--big .tile__body { left: 22px; right: 22px; bottom: 20px; }
.tile--big .tile__name { max-width: 15em; font-size: var(--fs-h2); line-height: var(--lh-h2); letter-spacing: var(--ls-display); }
.tile:hover .tile__name { text-decoration: underline; text-decoration-color: var(--orange); text-decoration-thickness: 2px; text-underline-offset: 4px; }

/* ---------- directory cards ---------- */
.reg__a { display: grid; grid-template-columns: 64px minmax(0, 1fr) 18px; gap: 16px; align-items: center; height: 100%; padding: 8px 16px 8px 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); transition: border-color 160ms, box-shadow 160ms; }
.reg__a:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.reg__img { width: 64px; height: 64px; border-radius: 12px; background: var(--bg-soft); object-fit: cover; }
.reg__body { min-width: 0; }
.reg__a:hover .reg__name { text-decoration: underline; text-decoration-color: var(--orange); text-underline-offset: 3px; }
.reg__n { display: block; margin-top: 2px; color: var(--ink-2); font-size: var(--fs-caption); font-weight: var(--fw-button); font-variant-numeric: tabular-nums; }
.reg__go { width: 18px; height: 18px; color: var(--quiet); transition: transform 200ms var(--ease-out), color 160ms; }
.reg__a:hover .reg__go { color: var(--cta); transform: translateX(3px); }

@media (pointer: coarse) {
    .rg-find input { min-height: 44px; }
    .rg-clear { width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) { .tile img, .reg__go { transition: none; } }
@media (max-width: 1180px) {
    .dir { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
    .mosaic { grid-auto-rows: 196px; }
}
@media (max-width: 767px) {
    .rg-head { margin-bottom: 12px; }
    .rg-bar { position: static; padding: 8px 0 4px; }
    .rg-bar__in { flex-direction: column; align-items: stretch; gap: 8px; }
    .rg-seg { display: grid; grid-template-columns: 1fr 1fr; }
    .rg-seg a { justify-content: center; }
    .rg-feat { margin-top: 28px; }
    .rg-dir { margin-top: 56px; }
    .rg-dir + .rg-dir { margin-top: 56px; }
    .dir { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .dir-tools { width: 100%; justify-content: space-between; }
    .mosaic { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 158px; gap: 8px; }
    .tile { border-radius: 16px; }
    .tile__body { left: 12px; right: 12px; bottom: 11px; }
    .tile__name { font-size: var(--fs-body); }
    .tile__n { top: 8px; left: 8px; font-size: var(--fs-caption-tight); }
    .tile--big .tile__body { left: 14px; right: 14px; bottom: 14px; }
    .tile--big .tile__name { font-size: var(--fs-h3); line-height: var(--lh-h3); }
    .reg__a { grid-template-columns: 56px minmax(0, 1fr) 18px; gap: 12px; }
    .reg__img { width: 56px; height: 56px; }
}

/* ---------- Adaptation: re-win over later generic kit.css / typography.css ---------- */
body.page-regions-index main.page .wrap { max-width: calc(1520px + var(--edge) * 2); }
body.page-regions-index main.page { padding-bottom: 16px; }

.rg-find.find { max-width: none; margin: 0; padding-right: 8px; }
.rg-feat .mosaic { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 240px; gap: 16px; }
@media (max-width: 1023px) {
    .rg-feat .mosaic { grid-auto-rows: 196px; }
}
@media (max-width: 767px) {
    .rg-feat .mosaic { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 158px; gap: 8px; }
}
.dir-tools .seg button { min-height: 44px; }

/* typography.css trims main h2/h3 on this page group — restore the concept scale */
body.page-regions-index main h2.h2 { font-size: var(--fs-h2) !important; line-height: var(--lh-h2) !important; letter-spacing: var(--ls-heading); }
body.page-regions-index main .rg-head h1.h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); letter-spacing: var(--ls-display); }
body.page-regions-index main .dir__head { font-size: var(--fs-h4) !important; line-height: var(--lh-h4) !important; }

.regions-directory { padding-bottom: 80px; }
.regions-directory__search { max-width: 640px; margin: 24px 0 16px; }
.regions-directory__nav { display: inline-flex; }
.regions-directory .rg-dir { margin-top: 48px; }
.regions-directory .reg[hidden], .regions-directory .rg-dir[hidden] { display: none; }

.reg__img--placeholder { display: grid; place-items: center; color: var(--quiet); flex-shrink: 0; }
.reg__img--placeholder .icon { width: 24px; height: 24px; }

/* Featured destinations use the entire phone width without sacrificing text insets. */
@media (max-width: 767px) {
    .rg-feat .mosaic { margin-inline:-16px; }
    .rg-feat .tile--big { border-radius:0; }
    .dir__head, .reg__name { overflow-wrap:anywhere; }
}
