/* SEA SAR / AIR SAR map pages. The map fills the screen under the header. */
.map-page { block-size: 100vh; block-size: 100dvh; overflow: hidden; }
.map-page main { padding: 0; min-block-size: 0; position: relative; }
.map-wrap { position: absolute; inset: 0; }
.map { position: absolute; inset: 0; background: var(--field); }

.map-panel {
    position: absolute; z-index: 5; inset-block-start: 16px; inset-inline-start: 16px;
    inline-size: 348px; max-block-size: calc(100% - 32px); overflow-y: auto; overscroll-behavior: contain;
    padding: 20px; border-radius: 18px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    -webkit-backdrop-filter: saturate(1.8) blur(20px); backdrop-filter: saturate(1.8) blur(20px);
    box-shadow: 0 0 0 1px var(--line), var(--pop-shadow);
}
.map-panel__title { font-size: 1.15rem; letter-spacing: -0.015em; line-height: 1.2; }
.map-panel__switch { display: flex; gap: 16px; margin: 8px 0 16px; font-size: 0.88rem; }
.map-panel__switch a { color: var(--text-3); }
.map-panel__switch a[aria-current] { color: var(--text); font-weight: 600; }
.map-position { display: grid; gap: 10px; }
.map-position input { inline-size: 100%; border: 0; background: var(--field); border-radius: 10px; padding: 11px 14px; font-family: var(--font-mono); font-size: 0.95rem; letter-spacing: 0; }
.map-position input::placeholder { font-family: var(--font); color: var(--text-3); }
.map-position input:focus { outline: 2px solid var(--button); }
.map-position input[aria-invalid="true"] { outline: 2px solid #ff3b30; }
.map-position .btn { justify-self: start; padding: 9px 18px; font-size: 0.95rem; }
.map-panel__help, .map-panel__licence { margin: 10px 0 0; font-size: 0.75rem; line-height: 1.4; color: var(--text-3); }
.map-panel__mine { margin: 10px 0 0; }
.map-panel__mine .btn { font-size: 0.9rem; gap: 5px; }

.map-result:empty { display: none; }
.map-result { margin-block-start: 18px; }
.map-zone { padding-block: 16px; border-block-start: 1px solid var(--line); }
.map-zone__pos { margin: 0 0 4px; font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: 0; color: var(--text-3); }
.map-zone__name { font-size: 1rem; letter-spacing: -0.01em; line-height: 1.25; }
.map-zone__note { margin: 4px 0 0; font-size: 0.85rem; color: var(--text-3); }
.map-zone__note--alert { color: #d70015; }
:root[data-theme="dark"] .map-zone__note--alert { color: #ff6961; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .map-zone__note--alert { color: #ff6961; } }
.map-centre { margin-block-start: 14px; }
.map-centre__head { display: flex; align-items: center; gap: 10px; }
.map-centre__head img { flex: none; inline-size: 27px; block-size: 18px; object-fit: cover; border-radius: 2px; }
.map-centre__name { font-weight: 600; font-size: 1.05rem; line-height: 1.2; margin: 0; }
.map-centre__sub { margin: 2px 0 0; font-size: 0.82rem; color: var(--text-3); }
.map-centre .btn--call { inline-size: 100%; justify-content: flex-start; margin-block-start: 12px; padding: 9px 20px; }
.map-centre .btn--call .btn__value { font-size: 1.15rem; }
.map-centre__links { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 10px 0 0; font-size: 0.92rem; }

.map-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 18px 0 0; padding: 14px 0 0; border-block-start: 1px solid var(--line); font-size: 0.75rem; color: var(--text-3); }
.map-legend li { display: inline-flex; align-items: center; gap: 6px; }
.map-dot { inline-size: 9px; block-size: 9px; border-radius: 50%; background: #8e8e93; }
.map-dot--mrcc { background: #ff7f0e; }
.map-dot--mrsc { background: #ffc233; }
.map-dot--jrcc { background: #ff3b30; }
.map-dot--jrsc { background: #34c759; }
.map-dot--arcc { background: #0a84ff; }
.map-dot--arsc { background: #64d2ff; }
.map-noscript { position: absolute; inset-block-end: 16px; inset-inline: 0; text-align: center; }

.map-pin { inline-size: 18px; block-size: 18px; border-radius: 50%; background: var(--button); border: 3px solid #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4); }

/* MapLibre controls, kept quiet. */
.maplibregl-ctrl-group { border-radius: 10px !important; box-shadow: 0 0 0 1px var(--line) !important; overflow: hidden; }
.maplibregl-ctrl-attrib { font-size: 10px; }
:root[data-theme="dark"] .maplibregl-ctrl-group { background: #1c1c1e; }
:root[data-theme="dark"] .maplibregl-ctrl-group button + button { border-top-color: rgba(255, 255, 255, 0.16); }
:root[data-theme="dark"] .maplibregl-ctrl-icon { filter: invert(1); }
:root[data-theme="dark"] .maplibregl-ctrl-attrib { background: rgba(0, 0, 0, 0.6); color: #c7c7cc; }
:root[data-theme="dark"] .maplibregl-ctrl-attrib a { color: #c7c7cc; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .maplibregl-ctrl-group { background: #1c1c1e; }
    :root:not([data-theme="light"]) .maplibregl-ctrl-group button + button { border-top-color: rgba(255, 255, 255, 0.16); }
    :root:not([data-theme="light"]) .maplibregl-ctrl-icon { filter: invert(1); }
    :root:not([data-theme="light"]) .maplibregl-ctrl-attrib { background: rgba(0, 0, 0, 0.6); color: #c7c7cc; }
    :root:not([data-theme="light"]) .maplibregl-ctrl-attrib a { color: #c7c7cc; }
}

/* Phone: the panel becomes a sheet at the bottom of the map. */
@media (max-width: 720px) {
    .map-panel {
        inset-block-start: auto; inset-block-end: 0; inset-inline: 0; inline-size: auto;
        max-block-size: 62%; border-radius: 18px 18px 0 0; padding: 16px 18px max(16px, env(safe-area-inset-bottom));
    }
    .map-panel__title { font-size: 1rem; }
    .map-panel__switch { margin-block: 4px 12px; }
    .map-panel__help, .map-panel__licence, .map-legend { display: none; }
    .map-position { grid-template-columns: 1fr auto; }
    .map-position input { font-size: 1rem; }
    .map-position .btn { padding: 11px 16px; }
    .maplibregl-ctrl-top-right { display: none; }
}

/* Centre bubble, attached to its point on the map. */
.map-bubble .maplibregl-popup-content {
    padding: 18px 18px 16px; border-radius: 20px; inline-size: 300px; font: inherit; color: var(--text);
    background: color-mix(in srgb, var(--bg) 90%, transparent);
    -webkit-backdrop-filter: saturate(1.8) blur(20px); backdrop-filter: saturate(1.8) blur(20px);
    box-shadow: 0 0 0 1px var(--line), var(--pop-shadow);
    animation: gsh-bubble 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes gsh-bubble { from { opacity: 0; transform: translateY(6px) scale(0.97); } }
.map-bubble .maplibregl-popup-tip { display: none; }
.map-bubble .map-centre { margin: 0; }
.map-bubble .map-centre__head { padding-inline-end: 26px; }
.map-bubble .maplibregl-popup-close-button {
    inset-block-start: 12px; inset-inline-end: 12px; right: auto; inline-size: 26px; block-size: 26px; border-radius: 50%;
    background: var(--field); color: var(--text-2); font-size: 17px; line-height: 1; padding: 0 0 2px;
}
[dir="ltr"] .map-bubble .maplibregl-popup-close-button { right: 12px; }
.map-bubble .maplibregl-popup-close-button:hover { background: var(--field); color: var(--text); }
.map-tip .maplibregl-popup-content { padding: 5px 11px; border-radius: 980px; background: var(--text); color: var(--bg); font: 500 0.8rem var(--font); box-shadow: none; white-space: nowrap; }
.map-tip .maplibregl-popup-tip { display: none; }
.map-tip { pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .map-bubble .maplibregl-popup-content { animation: none; } }
.map-bubble, .map-bubble .maplibregl-popup-content { font-family: var(--font); font-size: 1rem; line-height: 1.47; letter-spacing: -0.011em; }

/* Call action inside the map panel and bubbles. */
.map-centre .btn--call { inline-size: auto; padding: 0; margin-block-start: 14px; }
.map-centre .btn--call::before { inline-size: 42px; block-size: 42px; background-size: 19px; }
.map-centre .btn--call .btn__value { font-size: 1.3rem; }
.map-zone + .map-zone .map-zone__note:first-child { margin-block-end: 6px; }

/* Reaching a centre from the map panel and bubbles. */
.map-centre .reach { margin-block-start: 14px; }
.map-centre .call { font-size: 1.1rem; padding: 12px 14px; }
.map-centre .acts { margin-block-start: 14px; gap: 6px 20px; }
.map-centre .act__c { inline-size: 46px; block-size: 46px; }
.map-centre .act__c .icon { inline-size: 19px; block-size: 19px; }
.map-bubble .call { flex-wrap: nowrap; white-space: nowrap; font-size: 1.05rem; padding-inline: 10px; }
.map-centre .acts { gap: 6px 14px; }
.map-centre .act { min-inline-size: 48px; }
/* The quick card keeps its actions on one line. */
.map-centre .acts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.map-centre .act { min-inline-size: 0; font-size: 0.72rem; }
.map-centre .act__c { inline-size: 44px; block-size: 44px; }

/* Key to the dots: a quiet line at the bottom of the map, outside the panel. */
.map-wrap > .map-legend {
    position: absolute; z-index: 4; inset-block-end: 14px; inset-inline-start: 16px; margin: 0; padding: 6px 14px; border: 0;
    border-radius: 980px; background: color-mix(in srgb, var(--bg) 82%, transparent);
    -webkit-backdrop-filter: saturate(1.8) blur(16px); backdrop-filter: saturate(1.8) blur(16px);
    font-size: 0.72rem; color: var(--text-2); gap: 4px 14px;
}
.map-panel { max-block-size: calc(100% - 76px); }
.map-result { margin-block-end: -4px; }
@media (max-width: 720px) { .map-wrap > .map-legend { display: none; } .map-panel { max-block-size: 62%; } }

/* Quick card alignment: everything starts on the same left edge.
   The flag moves to the right of the name, the actions start flush left. */
.map-centre__head { flex-direction: row-reverse; justify-content: space-between; align-items: flex-start; gap: 12px; }
.map-centre__head img { margin-block-start: 4px; }
.map-centre .acts { display: flex; flex-wrap: wrap; gap: 6px 10px; }
.map-centre .act { inline-size: 52px; min-inline-size: 0; font-size: 0.72rem; }
.map-centre .act__c { inline-size: 46px; block-size: 46px; }
.map-centre .acts .act:first-child { justify-items: start; inline-size: 49px; }
.map-centre .acts .act:first-child { text-align: start; }
.map-bubble .maplibregl-popup-content { inline-size: 324px; }
.map-bubble .map-centre__head { padding-inline-end: 30px; }
.map-bubble .map-centre .acts { gap: 6px; }
@media (max-width: 1000px) { .map-wrap > .map-legend { display: none; } }

/* A full row of five actions spreads to the width of the call button above it. */
.map-centre .acts:has(.act:nth-child(5)) { flex-wrap: nowrap; justify-content: space-between; gap: 0; }
.map-centre .acts:has(.act:nth-child(5)) .act:last-child { justify-items: end; inline-size: 49px; text-align: end; }

/* ==========================================================================
   Phone layout, second pass: more map, a compact sheet, controls on the map.
   ========================================================================== */
.map-float { display: none; }
.map-position .btn .icon { display: none; }
@media (max-width: 720px) {
    /* One-line header on the map page: the directory search stays in the menu pages. */
    .map-page .search--header { display: none; }
    .map-page .site-header__inner { padding-block: 0; }

    .map-float { display: flex; position: absolute; z-index: 5; margin: 0; border: 0;
        background: color-mix(in srgb, var(--bg) 86%, transparent);
        -webkit-backdrop-filter: saturate(1.8) blur(18px); backdrop-filter: saturate(1.8) blur(18px);
        box-shadow: 0 0 0 1px var(--line), 0 4px 16px rgba(0, 0, 0, 0.12); }
    .map-float--switch { inset-block-start: 12px; inset-inline-start: 50%; transform: translateX(-50%); padding: 3px; gap: 2px; border-radius: 980px; font-size: 0.82rem; }
    [dir="rtl"] .map-float--switch { transform: translateX(50%); }
    .map-float--switch a { padding: 6px 14px; border-radius: 980px; color: var(--text-2); white-space: nowrap; }
    .map-float--switch a[aria-current] { background: var(--text); color: var(--bg); font-weight: 600; }
    .map-float--switch a:hover { text-decoration: none; }
    .map-float--locate { inset-block-start: 12px; inset-inline-end: 12px; inline-size: 40px; block-size: 40px; border-radius: 50%; align-items: center; justify-content: center; color: var(--link); cursor: pointer; }
    .map-float--locate .icon { inline-size: 20px; block-size: 20px; }

    .map-panel { max-block-size: 60%; padding: 22px 16px max(14px, env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; }
    .map-panel::before { content: ""; position: absolute; inset-block-start: 8px; inset-inline-start: 50%; inline-size: 36px; block-size: 5px; margin-inline-start: -18px; border-radius: 3px; background: var(--line); }
    .map-panel__title { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .map-panel__switch, .map-panel__mine, .map-panel__help { display: none; }

    .map-position { grid-template-columns: 1fr auto; gap: 8px; }
    .map-position input { padding: 12px 14px; font-size: 1rem; border-radius: 12px; }
    .map-position .btn { inline-size: 46px; block-size: 46px; padding: 0; border-radius: 12px; justify-content: center; }
    .map-position .btn span { display: none; }
    .map-position .btn .icon { display: block; inline-size: 20px; block-size: 20px; }

    .map-result { margin-block-start: 6px; }
    .map-zone { padding-block: 14px 4px; border-block-start: 0; }
    .map-zone + .map-zone { border-block-start: 1px solid var(--line); margin-block-start: 12px; }
    .map-zone__pos { font-size: 0.8rem; }
    .map-centre { margin-block-start: 10px; }
    .map-centre__name { font-size: 1.25rem; letter-spacing: -0.015em; }
    .map-centre .call { font-size: 1.2rem; padding: 14px; }
    .map-centre .acts { justify-content: space-between; flex-wrap: nowrap; gap: 0; margin-block-start: 16px; }
    .map-centre .act, .map-centre .acts .act:first-child, .map-centre .acts:has(.act:nth-child(5)) .act:last-child { inline-size: 58px; justify-items: center; text-align: center; font-size: 0.74rem; }
    .map-centre .act__c { inline-size: 50px; block-size: 50px; }
    .map-centre .acts:not(:has(.act:nth-child(4))) { justify-content: flex-start; gap: 18px; }
}
.map-centre + .map-centre { margin-block-start: 20px; padding-block-start: 18px; border-block-start: 1px solid var(--line); }

/* Legend signs follow the shapes drawn on the map: discs (maritime), triangles (aeronautical), squares (joint). */
.map-dot--jrcc, .map-dot--jrsc { border-radius: 1px; }
.map-dot--arcc, .map-dot--arsc { border-radius: 0; inline-size: 11px; block-size: 10px; clip-path: polygon(50% 0, 100% 100%, 0 100%); }

/* Position under the cursor: bottom left corner, above the key to the signs. */
.map-cursor {
    position: absolute; z-index: 4; inset-block-end: 52px; inset-inline-start: 16px; margin: 0; padding: 9px 14px;
    display: grid; gap: 2px; border-radius: 14px; pointer-events: none;
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    -webkit-backdrop-filter: saturate(1.8) blur(16px); backdrop-filter: saturate(1.8) blur(16px);
    box-shadow: 0 0 0 1px var(--line);
    font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0; line-height: 1.5; font-variant-numeric: tabular-nums;
}
.map-cursor > div { display: grid; grid-template-columns: 2.6em auto; gap: 10px; }
.map-cursor dt { color: var(--text-3); }
.map-cursor dd { margin: 0; color: var(--text); white-space: pre; direction: ltr; }
@media (max-width: 1000px) { .map-cursor { inset-block-end: 14px; } }
@media (max-width: 720px), (hover: none) { .map-cursor { display: none; } }

/* ==========================================================================
   Position entry: format switch, one field per part, hemisphere buttons
   ========================================================================== */
.pos { display: grid; gap: 10px; }
.pos__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pos__title { font-size: 0.85rem; color: var(--text-2); }
.pos__formats, .pos__hem { display: inline-flex; gap: 2px; padding: 2px; background: var(--field); border-radius: 9px; }
.pos__formats button, .pos__hem button { border: 0; background: none; padding: 5px 10px; border-radius: 7px; font-size: 0.8rem; color: var(--text-2); cursor: pointer; font-variant-numeric: tabular-nums; }
.pos__formats button[aria-pressed="true"], .pos__hem button[aria-pressed="true"] { background: var(--bg); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16); }
.pos__axis { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; align-items: center; }
.pos__name { grid-column: 1 / -1; font-size: 0.75rem; color: var(--text-3); margin-block-end: -3px; }
.pos__f { position: relative; display: block; }
.pos__f input { inline-size: 100%; min-inline-size: 0; border: 0; background: var(--field); border-radius: 10px; padding: 10px 22px 10px 12px; font-family: var(--font-mono); font-size: 1rem; letter-spacing: 0; text-align: end; }
.pos__f input:focus { outline: 2px solid var(--button); }
.pos__f input[aria-invalid="true"] { outline: 2px solid #ff3b30; }
.pos__f i { position: absolute; inset-inline-end: 9px; inset-block-start: 50%; transform: translateY(-50%); font-style: normal; color: var(--text-3); pointer-events: none; }
.pos__hem button { padding: 8px 11px; font-size: 0.9rem; }
.pos__f--sec { display: none; }
.pos[data-format="dms"] .pos__axis { grid-template-columns: 1fr 1fr 1fr auto; }
.pos[data-format="dms"] .pos__f--sec { display: block; }
.pos[data-format="dms"] .pos__f input { padding-inline: 8px 18px; }
.pos[data-format="dd"] .pos__axis { grid-template-columns: 1fr auto; }
.pos[data-format="dd"] .pos__f--min { display: none; }
.pos__echo { margin: 0; min-block-size: 1.3em; font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: 0; color: var(--text-2); direction: ltr; white-space: pre-wrap; }
.pos__echo.is-bad { font-family: var(--font); color: #d70015; white-space: normal; }
:root[data-theme="dark"] .pos__echo.is-bad { color: #ff6961; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pos__echo.is-bad { color: #ff6961; } }
.pos .btn--primary { justify-self: start; padding: 9px 18px; font-size: 0.95rem; }
[dir="rtl"] .pos__axis { direction: ltr; }
@media (max-width: 720px) {
    .pos { gap: 8px; }
    .pos__title { display: none; }
    .pos__top { justify-content: flex-start; }
    .pos__name { display: none; }
    .pos__f input { padding-block: 11px; }
    .pos .btn--primary { justify-self: stretch; justify-content: center; padding: 12px; border-radius: 12px; }
    .pos__echo:empty { display: none; }
}
.pos__f input::placeholder { font-family: var(--font); color: var(--text-3); opacity: 0.8; }

/* Folded panel: an answer is on screen, the entry form steps aside. */
.map-panel__reopen { display: none; margin: 0; }
.map-panel__reopen .btn { font-size: 0.9rem; gap: 6px; }
.map-panel.is-folded .pos, .map-panel.is-folded .map-panel__help, .map-panel.is-folded .map-panel__mine { display: none; }
.map-panel.is-folded .map-panel__reopen { display: block; }

/* Words and country links of the page itself, under the position form: quiet, and out of the way once an answer is shown. */
.map-about { margin-block-start: 14px; font-size: 0.75rem; line-height: 1.4; color: var(--text-3); }
.map-about p { margin: 0; }
.map-about details { margin-block-start: 8px; }
.map-about summary { inline-size: fit-content; color: var(--link); cursor: pointer; }
.map-about ul { list-style: none; margin: 8px 0 0; padding: 0; columns: 2; column-gap: 16px; }
.map-about li { padding-block: 3px; break-inside: avoid; overflow-wrap: anywhere; }
.map-panel.is-folded .map-about { display: none; }
/* Phone: the sheet stays compact. Two lines of the text, all of it once the list is opened. */
@media (max-width: 720px) {
    .map-about { margin-block-start: 10px; }
    .map-about p { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
    .map-about:has(details[open]) p { display: block; }
    .map-about details { margin-block-start: 6px; }
    .map-about li { padding-block: 6px; }
}
.map-panel.is-folded .map-result { margin-block-start: 12px; }
.map-panel.is-folded .map-zone:first-child { border-block-start: 1px solid var(--line); }
@media (max-width: 720px) { .map-panel.is-folded .map-panel__reopen { margin-block-start: 2px; } .map-panel.is-folded .map-zone:first-child { border-block-start: 0; } }

/* Quick card actions: every label centred under its round, first and last rounds flush with the edges. */
.map-centre .acts .act, .map-centre .acts .act:first-child, .map-centre .acts:has(.act:nth-child(5)) .act:last-child {
    inline-size: 46px; min-inline-size: 0; justify-items: center; text-align: center; white-space: nowrap;
}
.map-centre .acts { column-gap: 18px; }
.map-centre .acts:has(.act:nth-child(5)) { column-gap: 0; }
@media (max-width: 720px) {
    .map-centre .act, .map-centre .acts .act:first-child, .map-centre .acts:has(.act:nth-child(5)) .act:last-child { inline-size: 50px; }
}
