/* Twinned cities map — homepage section */
.tm-section {
    --tm-gold: var(--theme__color1, #CE9F4D);
    --tm-gold-soft: #F1D08A;
    --tm-ink: #1D2C3C;
    --tm-panel: #17253A;
    --tm-line: rgba(255, 255, 255, .09);
    position: relative;
    padding: 88px 0 96px;
    background: var(--theme__color3, #1D2C3C);
    color: #fff;
    overflow: hidden;
}

/* Faint eight-point star pattern, echoing the council section */
.tm-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72'%3E%3Cpath d='M36 22l3 8 8-3-3 8 8 3-8 3 3 8-8-3-3 8-3-8-8 3 3-8-8-3 8-3-3-8 8 3z' fill='none' stroke='%23CE9F4D' stroke-width='.7'/%3E%3C/svg%3E");
    background-size: 72px 72px;
    opacity: .05;
    pointer-events: none;
}

.tm-section .container { position: relative; }

.tm-sr {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ── Heading ── */
.tm-head { text-align: center; max-width: 740px; margin: 0 auto 40px; }
.tm-head__ornament { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 16px; color: var(--tm-gold); }
.tm-head__bar { width: 52px; height: 1px; background: currentColor; opacity: .7; }
.tm-head__star { width: 15px; height: 15px; }
.tm-head__label { font-family: var(--elMessiri); font-size: 13px; font-weight: 600; letter-spacing: .18em; color: var(--tm-gold); margin: 0 0 10px; }
.tm-head__title { font-family: var(--elMessiri); font-size: clamp(26px, 3.6vw, 40px); font-weight: 700; margin: 0 0 14px; line-height: 1.25; }
.tm-head__desc { font-size: 15px; line-height: 1.85; color: rgba(255, 255, 255, .82); margin: 0 auto 26px; max-width: 620px; }

.tm-stats { display: inline-flex; flex-wrap: wrap; justify-content: center; margin: 0; border: 1px solid rgba(206, 159, 77, .45); border-radius: 16px; background: rgba(0, 0, 0, .12); }
.tm-stats__item { display: flex; flex-direction: column-reverse; align-items: center; padding: 10px 28px; min-width: 120px; }
.tm-stats__item + .tm-stats__item { border-inline-start: 1px solid rgba(206, 159, 77, .35); }
.tm-stats dd { margin: 0; font-size: 30px; font-weight: 700; color: var(--tm-gold); line-height: 1.1; font-variant-numeric: tabular-nums; }
.tm-stats dt { font-size: 13px; font-weight: 500; color: rgba(255, 255, 255, .8); margin-top: 2px; }

/* ── Layout ── */
.tm-layout { display: flex; flex-wrap: wrap; gap: 20px; align-items: stretch; }
.tm-map-card {
    flex: 999 1 600px;
    min-width: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    background: var(--tm-panel);
    border: 1px solid var(--tm-line);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
}
.tm-panel {
    flex: 1 1 270px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    max-height: 620px;
    padding: 18px 14px 12px;
    background: var(--tm-panel);
    border: 1px solid var(--tm-line);
    border-radius: 16px;
}

/* Side by side, the map card sets the row height and the country list scrolls within it */
@media (min-width: 992px) {
    .tm-panel { contain: size; max-height: none; }
}

/* ── Toolbar ── */
.tm-toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.tm-chip {
    min-height: 40px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .18);
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background .2s, border-color .2s, color .2s;
}
.tm-chip:hover, .tm-chip:focus-visible { border-color: var(--tm-gold); outline: none; }
.tm-chip.is-active { background: var(--tm-gold); border-color: var(--tm-gold); color: var(--tm-ink); }

/* ── Map ── */
.tm-map {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: radial-gradient(ellipse at 59% 28%, #24395A 0%, #172638 65%, #132131 100%);
    outline: none;
}
.tm-map:focus-visible { box-shadow: 0 0 0 2px var(--tm-gold); }
.tm-svg {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1000 / 487;
    touch-action: pan-x pan-y;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}
.tm-section.is-dragging .tm-svg { cursor: grabbing; }

.tm-land path { fill: #2A3F57; stroke: #3B5572; stroke-width: .5; vector-effect: non-scaling-stroke; opacity: 0; transition: fill .4s, opacity .8s; }
.tm-section.is-land-ready .tm-land path { opacity: 1; }
.tm-land path.is-partner { fill: #5B4B32; stroke: #8C7349; }
.tm-land path.is-partner.is-active { fill: #94763F; }
.tm-land path.is-home { fill: var(--tm-gold); stroke: var(--tm-gold-soft); }

.tm-arc {
    fill: none;
    stroke: var(--tm-gold);
    stroke-width: calc(var(--k, 1) * 1px);
    stroke-opacity: .32;
    stroke-linecap: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    transition: stroke-dashoffset 1.6s cubic-bezier(.22, .61, .36, 1), stroke-opacity .3s, stroke-width .3s;
}
.tm-section.is-revealed .tm-arc { stroke-dashoffset: 0; }
.tm-section.has-focus .tm-arc { stroke-opacity: .07; }
.tm-section .tm-arc.is-active { stroke-opacity: .9; stroke-width: calc(var(--k, 1) * 1.6px); }
.tm-section .tm-arc.is-selected { stroke-opacity: 1; stroke-width: calc(var(--k, 1) * 2.4px); stroke: var(--tm-gold-soft); }

.tm-city { cursor: pointer; outline: none; opacity: 0; transition: opacity .5s ease var(--tm-delay, 0ms); }
.tm-section.is-revealed .tm-city { opacity: 1; }
.tm-city__hit { fill: transparent; }
.tm-city__dot { fill: var(--tm-gold-soft); stroke: var(--tm-ink); stroke-width: calc(var(--k, 1) * 1px); transition: fill .2s, fill-opacity .2s; }
.tm-section.has-focus .tm-city__dot, .tm-section.has-search .tm-city__dot { fill-opacity: .22; }
.tm-section .tm-city.is-active .tm-city__dot,
.tm-section .tm-city.is-match .tm-city__dot,
.tm-section .tm-city.is-hover .tm-city__dot,
.tm-city:focus-visible .tm-city__dot { fill: #fff; fill-opacity: 1; }
.tm-city:focus-visible .tm-city__dot { stroke: var(--tm-gold); stroke-width: calc(var(--k, 1) * 2.5px); }
.tm-section .tm-city.is-selected .tm-city__dot { fill: #fff; fill-opacity: 1; stroke: var(--tm-gold); stroke-width: calc(var(--k, 1) * 2.5px); }

.tm-home__star { fill: var(--tm-gold); stroke: #fff; stroke-width: .12; }
.tm-home__glow { transform-box: fill-box; transform-origin: center; animation: tm-glow 2.8s ease-out infinite; }
.tm-home__label { fill: #fff; font-family: var(--elMessiri); font-weight: 700; paint-order: stroke; stroke: var(--tm-ink); stroke-linejoin: round; pointer-events: none; }
@keyframes tm-glow { 0% { transform: scale(.7); opacity: .9; } 100% { transform: scale(2.2); opacity: 0; } }

/* Tooltip, gesture hint */
.tm-tooltip {
    position: absolute;
    z-index: 4;
    padding: 5px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, .96);
    color: var(--tm-ink);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    pointer-events: none;
    transform: translate(-50%, calc(-100% - 12px));
    opacity: 0;
    transition: opacity .15s;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}
.tm-tooltip.is-visible { opacity: 1; }
.tm-hint {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(19, 33, 49, .6);
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity .25s;
}
.tm-hint.is-visible { opacity: 1; }
.tm-hint__wheel, .tm-hint__touch { display: none; }
.tm-hint[data-kind="wheel"] .tm-hint__wheel, .tm-hint[data-kind="touch"] .tm-hint__touch { display: inline; }

/* Zoom controls and legend */
.tm-zoom {
    position: absolute;
    z-index: 2;
    bottom: 14px;
    inset-inline-end: 14px;
    display: flex;
    flex-direction: column;
    background: rgba(23, 37, 58, .92);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .3);
}
.tm-zoom__btn { width: 42px; height: 42px; border: 0; background: transparent; color: #fff; font-size: 16px; cursor: pointer; transition: background .2s, color .2s; }
.tm-zoom__btn + .tm-zoom__btn { border-top: 1px solid rgba(255, 255, 255, .1); }
.tm-zoom__btn:hover, .tm-zoom__btn:focus-visible { background: var(--tm-gold); color: var(--tm-ink); outline: none; }
.tm-section:not(.is-enhanced) .tm-zoom, .tm-section:not(.is-enhanced) .tm-toolbar { display: none; }

.tm-legend {
    position: absolute;
    z-index: 2;
    bottom: 14px;
    inset-inline-start: 14px;
    margin: 0;
    padding: 10px 14px;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(23, 37, 58, .88);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 10px;
    font-size: 12px;
    color: rgba(255, 255, 255, .85);
}
.tm-legend li { display: flex; align-items: center; gap: 8px; }
.tm-legend__star { width: 12px; height: 12px; background: var(--tm-gold); clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.tm-legend__dot { width: 9px; height: 9px; margin: 0 1.5px; border-radius: 50%; background: var(--tm-gold-soft); box-shadow: 0 0 0 1.5px var(--tm-ink); }
.tm-legend__land { width: 14px; height: 9px; border-radius: 2px; background: #5B4B32; border: 1px solid #8C7349; }

/* ── City card ── */
.tm-card {
    position: relative;
    padding: 16px 18px 14px;
    background: #fff;
    color: var(--tm-ink);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
}
.tm-card[hidden] { display: none; }
.tm-card.is-floating { position: absolute; z-index: 6; width: 260px; transform: translate(-50%, calc(-100% - 18px)); animation: tm-pop .22s ease-out; }
.tm-card.is-floating.is-below { transform: translate(-50%, 18px); }
.tm-card.is-floating::after { content: ''; position: absolute; left: 50%; bottom: -7px; width: 14px; height: 14px; background: #fff; transform: translateX(-50%) rotate(45deg); }
.tm-card.is-floating.is-below::after { bottom: auto; top: -7px; }
.tm-card.is-offscreen { opacity: 0; pointer-events: none; }
@keyframes tm-pop { from { opacity: 0; margin-top: 6px; } to { opacity: 1; margin-top: 0; } }

.tm-card__close { position: absolute; top: 8px; inset-inline-end: 8px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: #7C8796; font-size: 15px; cursor: pointer; }
.tm-card__close:hover, .tm-card__close:focus-visible { background: #F1F3F6; color: var(--tm-ink); outline: none; }
.tm-card__country { margin: 0 0 2px; font-size: 12px; font-weight: 700; letter-spacing: .04em; color: #94702C; }
.tm-card__city { margin: 0 0 6px; padding-inline-end: 28px; font-family: var(--elMessiri); font-size: 21px; font-weight: 700; line-height: 1.3; }
.tm-card__distance { margin: 0 0 12px; font-size: 13px; color: #5B6675; display: flex; align-items: center; gap: 6px; }
.tm-card__distance i { color: #94702C; }
.tm-card__actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; border-top: 1px solid #ECEEF2; }
.tm-card__link { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; font-size: 13px; font-weight: 700; color: var(--tm-ink); }
.tm-card__link:hover, .tm-card__link:focus-visible { color: #94702C; }
.tm-card__link[hidden] { display: none; }
.tm-card__nav { display: inline-flex; align-items: center; gap: 4px; margin-inline-start: auto; }
.tm-card__nav[hidden] { display: none; }
.tm-card__position { font-size: 12px; color: #7C8796; min-width: 48px; text-align: center; font-variant-numeric: tabular-nums; }
.tm-card__step { width: 34px; height: 34px; border: 1px solid #E1E5EA; border-radius: 50%; background: #fff; color: var(--tm-ink); font-size: 12px; cursor: pointer; }
.tm-card__step:hover, .tm-card__step:focus-visible { border-color: var(--tm-gold); color: #94702C; outline: none; }

/* ── Panel ── */
.tm-panel__head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.tm-panel__title { font-family: var(--elMessiri); font-size: 17px; font-weight: 700; margin: 0 4px; }
.tm-search { position: relative; display: block; margin: 0; }
.tm-search i { position: absolute; top: 50%; inset-inline-start: 14px; transform: translateY(-50%); color: rgba(255, 255, 255, .5); font-size: 14px; pointer-events: none; }
.tm-search__input {
    width: 100%;
    height: 44px;
    padding-inline: 40px 14px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 10px;
    background: rgba(0, 0, 0, .18);
    color: #fff;
    font: inherit;
    font-size: 14px;
}
.tm-search__input::placeholder { color: rgba(255, 255, 255, .5); opacity: 1; }
.tm-search__input:focus { border-color: var(--tm-gold); outline: none; }

.tm-panel__list { flex: 1; min-height: 0; overflow-y: auto; padding-inline-end: 4px; scrollbar-width: thin; scrollbar-color: rgba(206, 159, 77, .5) transparent; }
.tm-panel__empty { margin: 18px 6px; font-size: 14px; color: rgba(255, 255, 255, .6); text-align: center; }
.tm-country + .tm-country { margin-top: 4px; }
.tm-country[hidden] { display: none; }
.tm-country__summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 46px;
    padding: 0 12px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background .2s, color .2s;
}
.tm-country__summary::-webkit-details-marker { display: none; }
.tm-country__summary:hover, .tm-country__summary:focus-visible { background: rgba(255, 255, 255, .06); outline: none; }
.tm-country__summary:focus-visible { box-shadow: inset 0 0 0 1px var(--tm-gold); }
.tm-country[open] > .tm-country__summary { background: rgba(206, 159, 77, .16); color: var(--tm-gold); }
.tm-country__count { min-width: 30px; height: 24px; padding: 0 8px; border-radius: 999px; background: rgba(255, 255, 255, .1); font-size: 12px; display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.tm-country[open] .tm-country__count { background: var(--tm-gold); color: var(--tm-ink); }
.tm-country__cities { margin: 6px 0 10px; padding: 0 12px; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.tm-country__cities li[hidden] { display: none; }
.tm-country__cities a, .tm-country__cities span {
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    color: rgba(255, 255, 255, .86);
    border-inline-start: 2px solid rgba(206, 159, 77, .35);
    transition: background .2s, color .2s, border-color .2s;
}
.tm-country__cities a:hover, .tm-country__cities a:focus-visible { color: #fff; background: rgba(255, 255, 255, .06); border-inline-start-color: var(--tm-gold); outline: none; }

/* ── Call to action ── */
.tm-cta {
    margin-top: 28px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 18px 28px;
    padding: 22px 28px;
    border: 1px solid rgba(206, 159, 77, .4);
    border-radius: 16px;
    background: linear-gradient(90deg, rgba(206, 159, 77, .14), rgba(206, 159, 77, .04));
}
.tm-cta__text { flex: 1 1 360px; }
.tm-cta h3 { font-family: var(--elMessiri); font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.tm-cta p { margin: 0; font-size: 14px; line-height: 1.7; color: rgba(255, 255, 255, .8); }
.tm-cta__button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 0 24px;
    border-radius: 999px;
    background: var(--tm-gold);
    color: var(--tm-ink);
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
    transition: background .2s, transform .2s;
}
.tm-cta__button:hover, .tm-cta__button:focus-visible { background: var(--tm-gold-soft); color: var(--tm-ink); transform: translateY(-2px); outline: none; }

/* ── Full screen (native API or fixed-overlay fallback) ── */
.tm-section.is-fullscreen .tm-map-card { position: fixed; inset: 0; z-index: 1000; border-radius: 0; border: 0; padding: 12px; }
.tm-map-card:fullscreen { padding: 12px; border-radius: 0; background: var(--tm-panel); }
.tm-section.is-fullscreen .tm-map { flex: 1; min-height: 0; }
.tm-section.is-fullscreen .tm-svg { height: 100%; aspect-ratio: auto; touch-action: none; }
.tm-section.is-fullscreen .tm-card:not(.is-floating) { position: absolute; z-index: 6; inset-inline: 12px; bottom: 12px; }
html.tm-no-scroll, html.tm-no-scroll body { overflow: hidden; }

/* ── Phones ── */
@media (max-width: 767px) {
    .tm-section { padding: 60px 0 68px; }
    .tm-head { margin-bottom: 28px; }
    .tm-stats__item { min-width: 0; padding: 8px 18px; }
    .tm-stats dd { font-size: 24px; }
    .tm-map-card { padding: 10px; border-radius: 14px; }
    .tm-svg { aspect-ratio: 4 / 3.4; }
    .tm-toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .tm-chip { min-height: 44px; flex-shrink: 0; font-size: 13px; padding: 0 14px; }
    .tm-zoom { bottom: 10px; inset-inline-end: 10px; }
    .tm-zoom__btn { width: 44px; height: 44px; }
    .tm-legend { display: none; }
    .tm-card { margin-top: 2px; }
    .tm-panel { max-height: 440px; }
    .tm-cta { padding: 20px; text-align: center; justify-content: center; }
    .tm-cta__button { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    .tm-home__glow { animation: none; opacity: .5; }
    .tm-arc, .tm-city, .tm-land path, .tm-card.is-floating { transition: none; animation: none; }
    .tm-arc { stroke-dashoffset: 0; }
    .tm-city { opacity: 1; }
}

/* Without JavaScript the arcs and cities are not drawn at all; keep the list usable */
.tm-section:not(.is-enhanced) .tm-map { display: none; }

/* City card "twinned since" line and the call-to-action button pair */
.tm-card__since { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: #94702C; display: flex; align-items: center; gap: 6px; }
.tm-card__since[hidden] { display: none; }
.tm-cta__buttons { display: flex; flex-wrap: wrap; gap: 12px; }
.tm-cta__button--ghost { background: transparent; color: #fff; border: 1px solid rgba(206, 159, 77, .7); }
.tm-cta__button--ghost:hover, .tm-cta__button--ghost:focus-visible { background: rgba(206, 159, 77, .16); color: #fff; }
@media (max-width: 767px) {
    .tm-cta__buttons { width: 100%; }
}
