/*
GeoRankle Country Passport 1.0

Passport launcher, collection gallery, country cards and stamp toast.
*/

body.passport-open {
    overflow: hidden;
}

/* =========================================================
   Passport launcher
   ========================================================= */

.passport-button {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 11px;

    width: 100%;
    min-height: 52px;
    margin: 0 0 18px;
    padding: 9px 13px;

    border: 1px solid #bfdbfe;
    border-radius: 16px;

    appearance: none;
    -webkit-appearance: none;

    background:
        linear-gradient(
            135deg,
            #ffffff,
            #eaf5ff
        );

    color: #1f2937;
    cursor: pointer;

    font: inherit;
    text-align: left;

    box-shadow:
        0 8px 20px rgba(37, 99, 235, 0.09),
        inset 0 1px 0 #ffffff;

    transition:
        transform 0.17s ease,
        border-color 0.17s ease,
        box-shadow 0.17s ease;
}

.passport-button:hover {
    border-color: #60a5fa;
    transform: translateY(-2px);

    box-shadow:
        0 12px 25px rgba(37, 99, 235, 0.14),
        inset 0 1px 0 #ffffff;
}

.passport-button:active {
    transform: translateY(0);
}

.passport-button:focus-visible {
    outline: 3px solid rgba(18, 146, 242, 0.3);
    outline-offset: 3px;
}

.passport-button-icon {
    grid-column: 1;
    grid-row: 1 / span 2;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 38px;
    height: 38px;

    border: 1px solid #bfdbfe;
    border-radius: 12px;

    background: #ffffff;

    font-size: 21px;
    line-height: 1;

    box-shadow:
        0 5px 12px rgba(37, 99, 235, 0.1),
        inset 0 1px 0 #ffffff;
}

.passport-button-title {
    grid-column: 2;
    grid-row: 1;

    align-self: end;

    font-size: 13px;
    font-weight: 900;
    line-height: 1.2;
}

.passport-button-subtitle {
    grid-column: 2;
    grid-row: 2;

    align-self: start;

    color: #64748b;

    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
}

.passport-button-progress {
    grid-column: 3;
    grid-row: 1;

    color: #155e9b;

    font-size: 13px;
    font-weight: 900;
    line-height: 1.2;
}

.passport-button-progress-track {
    grid-column: 3;
    grid-row: 2;

    display: block;

    width: 76px;
    height: 6px;

    overflow: hidden;

    border-radius: 999px;

    background: #dbeafe;
}

.passport-button-progress-fill {
    display: block;

    width: 0;
    height: 100%;

    border-radius: inherit;

    background:
        linear-gradient(
            90deg,
            #38bdf8,
            #2563eb
        );

    transition: width 0.32s ease;
}

/* =========================================================
   Passport overlay and modal
   ========================================================= */

.passport-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;

    display: none;
    align-items: center;
    justify-content: center;

    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px;

    overflow-x: hidden;
    overflow-y: auto;

    background:
        radial-gradient(
            circle at 50% 10%,
            rgba(56, 189, 248, 0.24),
            transparent 40%
        ),
        rgba(15, 23, 42, 0.72);

    opacity: 0;

    -webkit-backdrop-filter: blur(11px);
    backdrop-filter: blur(11px);

    overscroll-behavior: contain;

    transition: opacity 0.18s ease;
}

.passport-overlay.is-visible {
    display: flex;
    opacity: 1;
}

.passport-overlay[hidden] {
    display: none !important;
}

.passport-modal {
    position: relative;

    width: min(920px, 100%);
    max-height: calc(100dvh - 48px);
    margin: auto;
    padding: 30px;

    overflow-x: hidden;
    overflow-y: auto;

    border: 1px solid rgba(255, 255, 255, 0.92);
    border-radius: 30px;

    background:
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.998),
            rgba(239, 248, 255, 0.992)
        );

    color: #111827;

    box-shadow:
        0 36px 96px rgba(15, 23, 42, 0.46),
        0 12px 34px rgba(15, 23, 42, 0.18),
        inset 0 1px 0 #ffffff;

    scrollbar-width: thin;
    scrollbar-color: #bfdbfe transparent;

    animation:
        geoRanklePassportEnter
        0.32s
        cubic-bezier(0.18, 1.16, 0.35, 1)
        both;
}

.passport-modal::-webkit-scrollbar {
    width: 8px;
}

.passport-modal::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: #bfdbfe;
    background-clip: padding-box;
}

.passport-close {
    position: absolute;
    top: 14px;
    right: 16px;
    z-index: 5;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;

    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 999px;

    appearance: none;
    -webkit-appearance: none;

    background: rgba(226, 232, 240, 0.78);
    color: #475569;

    font: inherit;
    font-size: 27px;
    font-weight: 800;
    line-height: 1;

    cursor: pointer;

    transition:
        transform 0.16s ease,
        background-color 0.16s ease,
        color 0.16s ease;
}

.passport-close:hover {
    background: #dbeafe;
    color: #1d4ed8;
    transform: rotate(4deg) scale(1.04);
}

.passport-close:focus-visible,
.passport-done:focus-visible,
.passport-filter-button:focus-visible,
.passport-search:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.34);
    outline-offset: 3px;
}

/* =========================================================
   Passport header
   ========================================================= */

.passport-header {
    display: flex;
    flex-direction: column;
    align-items: center;

    margin: 0 44px 21px;

    text-align: center;
}

.passport-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 64px;
    height: 64px;
    margin-bottom: 10px;

    border: 1px solid #bfdbfe;
    border-radius: 20px;

    background:
        linear-gradient(
            180deg,
            #f0f9ff,
            #cdeaff
        );

    font-size: 33px;

    box-shadow:
        0 13px 27px rgba(37, 99, 235, 0.18),
        inset 0 1px 0 #ffffff;
}

.passport-title {
    margin: 0;

    font-size: 31px;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.passport-introduction {
    margin: 7px 0 0;

    color: #64748b;

    font-size: 14px;
    font-weight: 700;
    line-height: 1.45;
}

/* =========================================================
   Passport summary
   ========================================================= */

.passport-summary {
    margin: 0 0 17px;
    padding: 15px;

    border: 1px solid #bfdbfe;
    border-radius: 18px;

    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.96),
            rgba(224, 242, 254, 0.92)
        );

    box-shadow:
        0 7px 18px rgba(37, 99, 235, 0.07),
        inset 0 1px 0 #ffffff;
}

.passport-summary-main {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    align-items: center;
    gap: 13px;

    margin-bottom: 13px;
}

.passport-summary-stamp {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 56px;
    height: 56px;

    border: 2px dashed #60a5fa;
    border-radius: 18px;

    background: rgba(255, 255, 255, 0.8);

    font-size: 28px;

    transform: rotate(-4deg);
}

.passport-summary-content {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: end;
    gap: 2px 9px;

    min-width: 0;
}

.passport-summary-value {
    color: #155e9b;

    font-size: 25px;
    font-weight: 900;
    line-height: 1;
}

.passport-summary-label {
    color: #64748b;

    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
}

.passport-summary-progress-track {
    grid-column: 1 / -1;

    display: block;

    width: 100%;
    height: 9px;
    margin-top: 6px;

    overflow: hidden;

    border-radius: 999px;

    background: #dbeafe;
}

.passport-summary-progress-fill {
    display: block;

    width: 0;
    height: 100%;

    border-radius: inherit;

    background:
        linear-gradient(
            90deg,
            #38bdf8,
            #2563eb
        );

    transition: width 0.35s ease;
}

.passport-continent-progress {
    display: grid;
    grid-template-columns:
        repeat(6, minmax(0, 1fr));
    gap: 7px;
}

.passport-continent-card {
    display: flex;
    align-items: center;
    gap: 7px;

    min-width: 0;
    padding: 8px;

    border: 1px solid rgba(191, 219, 254, 0.72);
    border-radius: 12px;

    background: rgba(255, 255, 255, 0.75);
}

.passport-continent-icon {
    flex: 0 0 auto;

    font-size: 17px;
    line-height: 1;
}

.passport-continent-card-content {
    display: flex;
    flex-direction: column;

    min-width: 0;
}

.passport-continent-name {
    overflow: hidden;

    font-size: 9px;
    font-weight: 900;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.passport-continent-value {
    color: #64748b;

    font-size: 9px;
    font-weight: 800;
    line-height: 1.2;
}

/* =========================================================
   Filters and search
   ========================================================= */

.passport-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    align-items: center;
    gap: 12px;

    margin-bottom: 10px;
}

.passport-filters {
    display: flex;
    align-items: center;
    gap: 6px;

    min-width: 0;
    padding: 3px;

    overflow-x: auto;

    scrollbar-width: none;
}

.passport-filters::-webkit-scrollbar {
    display: none;
}

.passport-filter-button {
    display: inline-flex;
    align-items: center;
    gap: 5px;

    flex: 0 0 auto;

    min-height: 34px;
    padding: 7px 10px;

    border: 1px solid #dbeafe;
    border-radius: 11px;

    appearance: none;
    -webkit-appearance: none;

    background: #ffffff;
    color: #475569;

    font: inherit;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;

    cursor: pointer;

    transition:
        border-color 0.15s ease,
        background-color 0.15s ease,
        color 0.15s ease,
        transform 0.15s ease;
}

.passport-filter-button:hover {
    border-color: #93c5fd;
    transform: translateY(-1px);
}

.passport-filter-button.is-active {
    border-color: #60a5fa;
    background: #dbeafe;
    color: #1e40af;
}

.passport-filter-icon {
    font-size: 14px;
    line-height: 1;
}

.passport-search-wrapper {
    position: relative;

    min-width: 0;
}

.passport-search-icon {
    position: absolute;
    top: 50%;
    left: 12px;

    z-index: 2;

    font-size: 14px;
    line-height: 1;

    pointer-events: none;

    transform: translateY(-50%);
}

.passport-search {
    width: 100%;
    height: 40px;
    padding: 0 13px 0 36px;

    border: 1px solid #bfdbfe;
    border-radius: 12px;

    appearance: none;
    -webkit-appearance: none;

    background: #ffffff;
    color: #1f2937;

    font: inherit;
    font-size: 12px;
    font-weight: 700;

    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

.passport-search::placeholder {
    color: #94a3b8;
}

.passport-result-count {
    margin: 0 0 8px;

    color: #64748b;

    font-size: 10px;
    font-weight: 800;
    line-height: 1.2;
}

/* =========================================================
   Country collection
   ========================================================= */

.passport-country-grid {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
    gap: 9px;
}

.passport-country-card {
    position: relative;

    display: grid;
    grid-template-columns: 47px minmax(0, 1fr);
    align-items: center;
    gap: 9px;

    min-width: 0;
    min-height: 70px;
    padding: 10px;

    border: 1px solid #e2e8f0;
    border-radius: 15px;

    background: #ffffff;

    box-shadow:
        0 5px 13px rgba(15, 23, 42, 0.045),
        inset 0 1px 0 #ffffff;

    transition:
        transform 0.17s ease,
        border-color 0.17s ease,
        box-shadow 0.17s ease;
}

.passport-country-card.is-discovered {
    border-color: #93c5fd;

    background:
        linear-gradient(
            145deg,
            #ffffff,
            #eff8ff
        );

    box-shadow:
        0 7px 17px rgba(37, 99, 235, 0.1),
        inset 0 1px 0 #ffffff;
}

.passport-country-card.is-discovered:hover {
    border-color: #60a5fa;
    transform: translateY(-2px);

    box-shadow:
        0 11px 22px rgba(37, 99, 235, 0.14),
        inset 0 1px 0 #ffffff;
}

.passport-country-card.is-locked {
    background: rgba(248, 250, 252, 0.86);
}

.passport-country-visual {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 47px;
    height: 39px;

    overflow: hidden;

    border: 1px solid #e2e8f0;
    border-radius: 10px;

    background: #f1f5f9;

    box-shadow:
        0 4px 10px rgba(15, 23, 42, 0.08),
        inset 0 1px 0 #ffffff;
}

.passport-country-card.is-discovered
    .passport-country-visual {
    border-color: #bfdbfe;
    background: #ffffff;
}

.passport-country-flag {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;
}

.passport-country-lock {
    opacity: 0.62;

    font-size: 17px;
    line-height: 1;
}

.passport-country-content {
    display: flex;
    flex-direction: column;
    gap: 3px;

    min-width: 0;
}

.passport-country-name {
    margin: 0;

    overflow: hidden;

    color: #334155;

    font-size: 11px;
    font-weight: 900;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.passport-country-card.is-locked
    .passport-country-name {
    color: #64748b;
}

.passport-country-meta {
    margin: 0;

    overflow: hidden;

    color: #64748b;

    font-size: 8px;
    font-weight: 700;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.passport-country-stamp {
    position: absolute;
    top: 5px;
    right: 5px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 18px;
    height: 18px;

    border: 2px solid #ffffff;
    border-radius: 999px;

    background: #22c55e;
    color: #ffffff;

    font-size: 10px;
    font-weight: 900;
    line-height: 1;

    box-shadow: 0 3px 8px rgba(22, 101, 52, 0.2);
}

.passport-empty {
    grid-column: 1 / -1;

    margin: 0;
    padding: 30px 18px;

    border: 1px dashed #bfdbfe;
    border-radius: 16px;

    background: rgba(255, 255, 255, 0.65);
    color: #64748b;

    font-size: 13px;
    font-weight: 800;
    line-height: 1.4;
    text-align: center;
}

.passport-note {
    margin: 16px 0 0;

    color: #64748b;

    font-size: 11px;
    font-weight: 800;
    line-height: 1.4;
    text-align: center;
}

.passport-done {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    min-height: 51px;
    margin: 15px 0 0;
    padding: 12px 20px;

    border: 1px solid #38a5ee;
    border-radius: 15px;

    appearance: none;
    -webkit-appearance: none;

    background:
        linear-gradient(
            180deg,
            #74cfff,
            #1292f2 62%,
            #087ad2
        );

    color: #ffffff;

    font: inherit;
    font-size: 15px;
    font-weight: 900;
    line-height: 1.2;

    cursor: pointer;

    text-shadow: 0 1px 1px rgba(0, 60, 110, 0.2);

    box-shadow:
        0 10px 21px rgba(18, 146, 242, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.55);

    transition:
        transform 0.17s ease,
        box-shadow 0.17s ease,
        filter 0.17s ease;
}

.passport-done:hover {
    filter: brightness(1.03);
    transform: translateY(-2px);

    box-shadow:
        0 14px 26px rgba(18, 146, 242, 0.31),
        inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

.passport-done:active {
    transform:
        translateY(0)
        scale(0.985);
}

/* =========================================================
   Discovery toast
   ========================================================= */

.passport-toast-region {
    position: fixed;
    top: 20px;
    left: 50%;
    z-index: 121000;

    width: min(410px, calc(100% - 28px));

    pointer-events: none;

    transform: translateX(-50%);
}

.passport-toast {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    align-items: center;
    gap: 13px;

    width: 100%;
    padding: 12px 15px;

    border: 1px solid rgba(147, 197, 253, 0.96);
    border-radius: 18px;

    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.99),
            rgba(224, 242, 254, 0.99)
        );

    opacity: 0;

    box-shadow:
        0 20px 44px rgba(15, 23, 42, 0.28),
        0 5px 15px rgba(37, 99, 235, 0.17),
        inset 0 1px 0 #ffffff;

    transform:
        translateY(-18px)
        scale(0.96);

    transition:
        opacity 0.22s ease,
        transform 0.28s cubic-bezier(0.18, 1.16, 0.35, 1);
}

.passport-toast.is-visible {
    opacity: 1;

    transform:
        translateY(0)
        scale(1);
}

.passport-toast-visual {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 58px;
    height: 43px;

    overflow: hidden;

    border: 1px solid #bfdbfe;
    border-radius: 11px;

    background: #ffffff;

    font-size: 25px;

    box-shadow:
        0 6px 14px rgba(37, 99, 235, 0.14),
        inset 0 1px 0 #ffffff;
}

.passport-toast-flag {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;
}

.passport-toast-content {
    display: flex;
    flex-direction: column;
    gap: 1px;

    min-width: 0;
}

.passport-toast-eyebrow {
    color: #1d4ed8;

    font-size: 10px;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: 0.7px;
    text-transform: uppercase;
}

.passport-toast-title {
    overflow: hidden;

    color: #1f2937;

    font-size: 16px;
    font-weight: 900;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.passport-toast-progress {
    color: #64748b;

    font-size: 10px;
    font-weight: 800;
    line-height: 1.3;
}

@keyframes geoRanklePassportEnter {
    from {
        opacity: 0;
        transform:
            translateY(12px)
            scale(0.975);
    }

    to {
        opacity: 1;
        transform:
            translateY(0)
            scale(1);
    }
}

/* =========================================================
   Responsive layout
   ========================================================= */

@media (max-width: 900px) {
    .passport-continent-progress {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }

    .passport-country-grid {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .passport-overlay {
        padding: 14px;
    }

    .passport-modal {
        max-height: calc(100dvh - 28px);
        padding: 27px 20px 21px;

        border-radius: 24px;
    }

    .passport-controls {
        grid-template-columns:
            minmax(0, 1fr);
        gap: 8px;
    }

    .passport-search-wrapper {
        width: 100%;
    }

    .passport-country-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 500px) {
    .passport-overlay {
        align-items: flex-start;
        padding: 9px;
    }

    .passport-modal {
        width: 100%;
        max-height: calc(100dvh - 18px);
        margin: auto 0;
        padding: 23px 14px 17px;

        border-radius: 20px;
    }

    .passport-close {
        top: 10px;
        right: 10px;

        width: 36px;
        height: 36px;

        font-size: 24px;
    }

    .passport-header {
        margin: 0 38px 18px;
    }

    .passport-header-icon {
        width: 55px;
        height: 55px;

        border-radius: 17px;

        font-size: 28px;
    }

    .passport-title {
        font-size: 27px;
    }

    .passport-continent-progress {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .passport-country-grid {
        grid-template-columns:
            minmax(0, 1fr);
    }

    .passport-country-card {
        min-height: 65px;
    }
}

@media (max-width: 420px) {
    .passport-button {
        grid-template-columns: 36px minmax(0, 1fr) auto;
        column-gap: 9px;

        min-height: 49px;
        padding: 8px 10px;
    }

    .passport-button-icon {
        width: 36px;
        height: 36px;

        font-size: 19px;
    }

    .passport-button-progress-track {
        width: 58px;
    }

    .passport-button-subtitle {
        display: none;
    }

    .passport-button-title,
    .passport-button-progress {
        grid-row: 1 / span 2;
        align-self: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .passport-button,
    .passport-button-progress-fill,
    .passport-overlay,
    .passport-modal,
    .passport-close,
    .passport-summary-progress-fill,
    .passport-filter-button,
    .passport-country-card,
    .passport-done,
    .passport-toast {
        animation: none;
        transition: none;
    }
}
