/**
 * Country destination pages (maldives, seychelles, mauritius).
 */

:root {
    --jana-destination-topbar-height: 4.75rem;
}

/* Fixed topbar — sticky breaks when html/body use overflow-x (see @media below). */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

body:has(> header.topbar) {
    padding-top: var(--jana-destination-topbar-height);
}

/* Weather table: fixed labels + scrollable months (reliable on mobile) */
.weather-guide-card {
    overflow: visible;
    padding: 0.45rem 0.55rem;
}

.weather-table-split {
    display: flex;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    border-radius: 10px;
    overflow: hidden;
}

.weather-table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.78rem;
    color: #2e4f54;
}

.weather-table th,
.weather-table td {
    padding: 0.36rem 0.5rem;
    text-align: center;
    white-space: nowrap;
    border-bottom: 1px solid rgba(0, 139, 139, 0.1);
    line-height: 1.35;
    vertical-align: middle;
}

.weather-table--labels {
    flex: 0 0 6.85rem;
    width: 6.85rem;
    min-width: 0;
    max-width: 6.85rem;
    margin: 0;
    background-color: #e8fafc;
    border-right: 1px solid rgba(0, 139, 139, 0.2);
    box-shadow: 5px 0 12px -4px rgba(0, 70, 70, 0.18);
    position: relative;
    z-index: 2;
}

.weather-table--labels th {
    text-align: left;
    font-weight: 700;
    color: #1f6168;
    background-color: #e8fafc;
}

.weather-table--labels thead th {
    color: #2a6d73;
    background-color: #f2feff;
}

.weather-table-scroll {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    background-color: #f4feff;
    overscroll-behavior-x: contain;
}

.weather-table--months {
    width: max-content;
    min-width: 100%;
}

/* Override page inline `.weather-table { min-width: 620px }` */
.weather-table.weather-table--labels {
    min-width: 0;
    width: 6.85rem;
}

.weather-table--months thead th {
    font-weight: 700;
    color: #2a6d73;
    background-color: rgba(255, 255, 255, 0.72);
}

.weather-table--months tbody td {
    background-color: rgba(255, 255, 255, 0.55);
}

.weather-table tbody tr:last-child th,
.weather-table tbody tr:last-child td,
.weather-table thead tr:last-child th {
    border-bottom: none;
}

/* Mobile layout — keeps images and tables within the phone viewport */
@media (max-width: 980px) {
    :root {
        --jana-destination-topbar-height: 4.15rem;
    }

    html {
        overflow-x: hidden;
        width: 100%;
    }

    body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
        background: linear-gradient(180deg, #f6ffff 0%, #eff9f8 100%);
    }

    html {
        background: #f6ffff;
    }

    .topbar {
        padding: 0.65rem max(0.85rem, env(safe-area-inset-left, 0px))
            0.65rem max(0.85rem, env(safe-area-inset-right, 0px));
        grid-template-columns: minmax(0, auto) minmax(0, 1fr) minmax(0, auto);
        gap: 0.35rem;
    }

    .back-link {
        margin-left: 0;
        padding: 0.4rem 0.65rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .brand {
        min-width: 0;
        justify-self: center;
    }

    .brand-text {
        font-size: clamp(0.95rem, 4vw, 1.15rem);
    }

    .brand img {
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }

    .topbar-spacer {
        width: 44px;
    }

    .wrap {
        width: 100%;
        max-width: 100%;
        padding: 1.15rem max(0.85rem, env(safe-area-inset-left, 0px)) 2.25rem
            max(0.85rem, env(safe-area-inset-right, 0px));
    }

    .flow-row,
    .flow-row.reverse {
        grid-template-columns: 1fr !important;
        gap: 1rem;
        margin-bottom: 1.5rem;
        min-width: 0;
    }

    .flow-row.reverse .flow-copy,
    .flow-row.reverse .flow-media {
        order: initial !important;
    }

    .flow-copy,
    .flow-media,
    .travel-mode-card,
    .travel-mode-media,
    .map-end,
    .map-end-layout,
    .map-center,
    .map-facts,
    .area-item {
        min-width: 0;
        max-width: 100%;
    }

    .flow-copy h1 {
        font-size: clamp(1.45rem, 6.5vw, 1.9rem);
    }

    .flow-copy h2 {
        font-size: clamp(1.1rem, 4.8vw, 1.35rem);
    }

    .flow-media,
    .travel-mode-media {
        width: 100%;
        max-width: 100%;
    }

    .flow-media img,
    .travel-mode-card img {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 0;
        max-height: min(56vw, 260px);
        aspect-ratio: 4 / 3;
        object-fit: cover;
    }

    .travel-modes {
        margin: 2rem 0 2.25rem;
        padding: 0.5rem 0 1rem;
    }

    .travel-modes-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 0.45rem;
        align-items: start;
    }

    .travel-mode-card {
        min-width: 0;
    }

    .travel-mode-media {
        border-radius: 8px;
    }

    .travel-modes .travel-mode-card img {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 0;
        max-height: none;
        aspect-ratio: 1 / 1;
        object-fit: cover;
    }

    .travel-mode-card h3 {
        font-size: clamp(0.62rem, 2.8vw, 0.78rem);
        margin-top: 0.35rem;
        line-height: 1.2;
        padding: 0 0.05rem;
    }

    .map-end-layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem;
        width: 100%;
        max-width: 100%;
        grid-template-columns: none !important;
    }

    .map-center,
    .map-end-layout > img,
    .area-left,
    .area-right,
    .map-facts {
        grid-column: auto !important;
        grid-row: auto !important;
        width: 100%;
        max-width: 100%;
    }

    .map-center {
        order: -1;
    }

    .map-end img,
    .map-center img {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        object-fit: contain;
    }

    .weather-guide {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .weather-guide-card {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: 0.4rem 0.45rem;
    }

    .weather-table-split {
        max-width: 100%;
    }

    .weather-table--labels {
        flex: 0 0 6.35rem;
        width: 6.35rem;
    }

    .weather-table-scroll {
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .weather-table-scroll::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
    }

    .weather-table {
        font-size: 0.7rem;
    }

    .weather-table.weather-table--months {
        min-width: 520px;
    }

    .weather-table th,
    .weather-table td {
        padding: 0.34rem 0.44rem;
    }
}

@media (max-width: 480px) {
    .flow-media img {
        max-height: min(62vw, 220px);
    }

    .travel-modes-grid {
        gap: 0.35rem;
    }

    .travel-mode-card h3 {
        font-size: clamp(0.58rem, 2.6vw, 0.72rem);
    }

    .weather-table--labels {
        flex: 0 0 5.9rem;
        width: 5.9rem;
    }

    .weather-table.weather-table--months {
        min-width: 460px;
    }

    .weather-table {
        font-size: 0.66rem;
    }

    .weather-table th,
    .weather-table td {
        padding: 0.3rem 0.38rem;
    }
}
