:root {
    font-size: 16px;

    --font-size: 16px;
    --font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    --lumo-font-family: var(--font-family);

    --brand: #0052a5; /* hsl(210, 100%, 32%) / rgb(0, 82, 165) */
    --on-brand: #fff;

    --lumo-primary-color: var(--brand); /* hsl(210, 100%, 32%) */
    --lumo-primary-color-50pct: hsl(from var(--brand) h s l / 0.5);
    --lumo-primary-color-10pct: hsl(from var(--brand) h s l / 0.1);
    --lumo-primary-contrast-color: var(--on-brand);
    --lumo-primary-text-color: hsl(from var(--brand) h s calc(l - 8));

    --lumo-base-color-gp: #f5f5f5;
    --home-bg-img: url('../images/geoportal/bg-light.jpg');

    /* navbar */
    --app-navbar-height: 72px;
    --app-navbar-bg: var(--lumo-primary-color-10pct);
    --app-navbar-text: #333;
    --app-logo-height: 56px;
    --app-logo-margin-top: 12px;
    --app-title-fs: 1.25rem;
    --app-title-fw: 700;

    color-scheme: light dark;
}

:root[theme='light'] {
    color-scheme: light;
}

:root[theme~='dark'] {
    color: var(--lumo-body-text-color);
    background-color: var(--lumo-base-color-gp);
    color-scheme: dark;

    --lumo-base-color: hsl(210, 80%, 10%);
    --lumo-base-color-gp: hsl(214, 35%, 21%);
    --lumo-base-color-gp: hsl(210, 80%, 10%);
    --home-bg-img: url('../images/geoportal/bg-dark.jpg');

    /* navbar */
    --app-navbar-bg: hsl(from var(--brand) h s calc(l - 35) / 0.25);
    --app-navbar-text: #fff;
    --app-logo-filter: saturate(0) brightness(2);
}

:root[theme~='dark'] {
    --brand: #0052a5;
    --lumo-primary-color: var(--brand); /* hsl(210, 100%, 32%) */
    --lumo-primary-color-50pct: hsl(from var(--brand) h s l / 0.5);
    --lumo-primary-color-10pct: hsl(from var(--brand) h s l / 0.1);
    --lumo-primary-contrast-color: var(--on-brand);
    --lumo-primary-text-color: hsl(210, 100%, 72.5%);
}

@view-transition {
    navigation: auto;
}

@media (prefers-reduced-motion: no-preference) {
    ::view-transition-group(root) {
        animation-duration: 0.333s;
    }

    /* ::view-transition-old(root) {
        animation-duration: 0.333s;
        animation-timing-function: ease-out;
    } */

    /* ::view-transition-new(root) {
        animation-duration: 0.333s;
        animation-timing-function: ease-in;
    } */
}

@media (prefers-reduced-motion: reduce) {
    ::view-transition-group(*),
    ::view-transition-image-pair(*),
    ::view-transition-old(*),
    ::view-transition-new(*) {
        animation: none !important;
    }
}

html,
body {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html * {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    font-family: var(--font-family, sans-serif);
    line-height: 1.5;
    -moz-osx-font-smoothing: grayscale;
    -webkit-font-smoothing: antialiased;
}

a,
a:link,
a:visited {
    color: var(--lumo-primary-text-color, #000);
    outline-color: var(--lumo-primary-text-color, #000);
}

a:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

hr {
    width: 100%;
    height: 1px;
    background-color: hsl(from currentColor h s l / 0.125);
    border: none;
}

.separator {
    height: 48px;
}

svg.icon {
    width: var(--icon-size, 24px);
    height: var(--icon-size, 24px);
}

body {
    display: flex;
    flex-direction: column;
    justify-content: space-between;

    color: var(--lumo-body-text-color, #333);
    background-color: var(--lumo-base-color-gp, #fefefe);
}

body.home {
    background-image: var(--home-bg-img, url('../images/start/start-bg.png'));
    background-repeat: no-repeat;
    background-size: cover;
}

header,
footer,
main {
    margin-inline: auto;
    padding-block: 1rem;
    padding-inline: 1rem;
    width: 100%;
    box-sizing: border-box;
}

body > main {
    padding-block: var(--main-padding-vertical) 0;
    flex: 1;
    container: main_content / inline-size;
}

body > main.home {
    display: flex;
    flex-direction: column;
    justify-content: center;

    --main-padding-vertical: 3rem;
}

/* flex */
.d-flex {
    display: flex;
}

.justify-content-center {
    justify-content: center;
}

.justify-content-between {
    justify-content: space-between;
}

.align-items-center {
    align-items: center;
}

/* containers */
.container,
.container-fluid,
.container-lg,
.container-md,
.container-sm,
.container-xl,
.container-xxl {
    --bs-gutter-x: 1.5rem;
    --bs-gutter-y: 0;
    width: 100%;
    padding-right: calc(var(--bs-gutter-x) * 0.5);
    padding-left: calc(var(--bs-gutter-x) * 0.5);
    margin-right: auto;
    margin-left: auto;
    box-sizing: border-box;
}

@media (min-width: 576px) {
    .container,
    .container-sm {
        max-width: 537px;
    }
}

@media (min-width: 768px) {
    .container,
    .container-md,
    .container-sm {
        max-width: 720px;
    }
}

@media (min-width: 992px) {
    .container,
    .container-lg,
    .container-md,
    .container-sm {
        max-width: 960px;
    }
}

@media (min-width: 1200px) {
    .container,
    .container-lg,
    .container-md,
    .container-sm,
    .container-xl {
        max-width: 1140px;
    }
}

@media (min-width: 1400px) {
    .container,
    .container-lg,
    .container-md,
    .container-sm,
    .container-xl,
    .container-xxl {
        max-width: 1320px;
    }
}

header {
    display: flex;
    padding-block: 0;
    height: var(--app-navbar-height, 96px);
    color: var(--app-navbar-text, #fff);
    background-color: var(--app-navbar-bg, #0080b0);
}

.svgdefs {
    display: none;
    height: 0;
    width: 0;
}

.branding {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-inline: auto;
}

.branding .logo {
    margin-block-start: var(--app-logo-margin-top);
    height: var(--app-logo-height, var(--app-navbar-height, 96px));
    filter: var(--app-logo-filter);
}

.branding h1 {
    margin: 0;
    font-size: var(--app-title-fs, 1.5rem);
    font-weight: var(--app-title-fw, 400);
}

.branding h1 a {
    color: currentColor;
    outline-color: currentColor;
    text-decoration: none;
}

.branding nav {
    margin-inline-start: auto;
}
.branding nav ul {
    list-style: none;
    display: flex;

    a {
        display: block;
        padding: 0.2em 0.5em;
        color: currentColor;
        border-radius: 0.25em;
    }
    a.json,
    a.json:link {
        margin-inline: 1em;
        padding: 0.35em 0.5em;
        font-size: 0.875em;
        border-radius: 0.25em;
        color: var(--lumo-primary-contrast-color);
        background-color: var(--lumo-primary-color-50pct);
        text-decoration: none;
    }
    a.json.disabled,
    a.json[disabled] {
        color: hsl(from var(--lumo-primary-contrast-color) h s l / 0.8);
        background-color: var(--lumo-tint-20pct);
        cursor: default;
    }
    a.json:last-child {
        margin-inline-end: 0;
    }
}

footer {
    padding: 0;
    margin-block: 1em;
    /* position: fixed; */
    /* bottom: 0; */
    /* left: 0; */
}

@media screen and (max-width: 810px) {
    footer {
        margin-block-start: 2rem;
    }
}

@media screen and (max-height: 900px) {
    footer {
        margin-block-start: 2rem;
    }
}

footer .links {
    display: flex;
    gap: 1rem;
}

footer .links a {
    color: currentColor;
    /* text-decoration: none; */
    text-decoration-color: rgba(0, 0, 0, 0.125);
    text-decoration-thickness: 0.125em;
}

footer .links a:hover {
    text-decoration-color: currentColor;
    text-decoration-thickness: 0.2em;
}

/* page heading */
.page-heading {
    margin-block: 2rem;

    * {
        margin-block: 0;
    }
    
    p:has(~ h1) {
        font-size: var(--lumo-font-size-s);
        color: var(--lumo-secondary-text-color);
    }
    
    h1 {
        line-height: 1.5;
    }
}

/* :has(.page-item) .page-heading,
:has(.page-items) .page-heading {
    margin-block-end: 1rem;
} */

/* page links */
.map-container ~ .page-links {
    margin-block-start: var(--lumo-space-m);
}
.page-links {
    display: flex;
    gap: 1em;

    /* a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5em;
        padding: 0.35em 0.5em;
        width: max-content;

        color: var(--lumo-contrast);
        background-color: hsl(from currentColor h s l / 0.05);
        border-radius: 0.25em;
        text-decoration: none;
    } */

    /* a.primary {
        color: var(--lumo-primary-contrast-color);
        background-color: var(--lumo-primary-color);
    } */

    .icon {
        fill: var(--lumo-primary-text-color);
    }
}

/* list paging */
.items-paging {

    .-next:only-child {
        margin-inline-start: auto;
    }
}

.breadcrumbs {
    list-style: none;
    margin: 1em 0;
    padding: 0;
    display: flex;
    gap: var(--spacing);
    font-size: var(--lumo-font-size-s);

    --spacing: 0.25em;

    a,
    a:link {
        color: var(--lumo-primary-text-color);
        text-decoration: none;

        &:hover {
            text-decoration: underline;
        }
    }

    li {
        display: block;
    }

    li:has(a):after {
        content: '>';
        display: inline-block;
        margin-inline-start: var(--spacing);
        color: var(--lumo-primary-text-color);
    }
}

.map-container {
    width: 640px;
    max-width: 100%;
    height: auto;
    max-height: 480px;
    margin-block: 0 var(--lumo-space-l);
    aspect-ratio: 4 / 3;
    /* margin-block: var(--lumo-space-m) var(--lumo-space-l); */
    background: var(--lumo-shade-10pct);

    /* @container main_content (width < 960px) {
        width: 100%;
        max-height: auto;
        aspect-ratio: 16 / 9;
    } */
}
@media (width < 1024px) {
    .map-container {
        width: 100%;
        max-height: auto;
        aspect-ratio: 16 / 9;
    }
}

.leaflet-container {
    background: var(--lumo-shade-5pct) !important;
}

/* cards */

.cards-grid {
    display: grid;
    grid-template-columns: var(--cards-grid-columns, repeat(auto-fill, minmax(300px, 1fr)));
    gap: 2rem;
    margin-block: 3rem;
}
@media (width < 993px) {
    :root {
        --cards-grid-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}
.home .cards-grid {
    --cards-grid-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background-color: hsl(from var(--lumo-base-color, #fff) h s calc(l + 5));
    border-radius: 0.5rem;

    /* parts */
    .header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        line-height: normal;

        > * {
            margin: 0;
        }

        a,
        a:link {
            padding: 0.35em 0.5em;
            font-size: 0.875em;
            border-radius: 0.25em;
            background-color: var(--lumo-primary-color-10pct);
            text-decoration: none;
        }
        a:hover {
            text-decoration: underline;
        }
    }
    .heading {
        display: flex;
        align-items: center;
        justify-content: space-between;

        padding: 0.5rem 1rem;
        margin-block-start: -1rem;
        margin-inline: -1rem;

        /* height: 32px; */
        /* line-height: 32px; */

        /* background-color: #fafafa; */
        background-color: light-dark(var(--lumo-shade-10pct), var(--lumo-tint-5pct));
        border-radius: 0.5rem 0.5rem 0 0;

        a,
        a:link {
            font-weight: 700;
            text-decoration: none;
        }
        a:hover {
            text-decoration: underline;
        }
        a.json,
        a.json:link {
            padding: 0.35em 0.5em;
            font-size: 0.875em;
            font-weight: 400;
            border-radius: 0.25em;
            background-color: var(--lumo-primary-color-10pct);
            text-decoration: none;
        }
    }
    .content {
        flex: 1;
        min-height: 3lh;
    }
    .footer {
        > * {
            margin: 0;
        }

        a,
        a:link {
            padding: 0.35em 0.5em;
            font-size: 0.875em;
            border-radius: 0.25em;
            background-color: var(--lumo-primary-color-10pct);
            text-decoration: none;
        }
        a:hover {
            text-decoration: underline;
        }
    }
}

.page-heading ~ .keywords {
    margin-block-start: -1rem;
}
.keywords {
    --badge: true;
    /* display: flex; */
    /* flex-flow: wrap; */
    /* gap: 0.5em; */
    /* margin-block-end: 2rem; */
    /* font-size: 0.875rem; */
}
.keywords:not(:has(:last-child)) {
    display: none;
}
/* .keywords > * {
    padding: 0.25em 0.35em;
    font-size: 0.875em;
    font-weight: 400;
    border-radius: 0.25em;
    color: var(--lumo-primary-contrast-color);
    background-color: var(--lumo-primary-color);
} */

.collections-grid {
    list-style: none;
    margin: 0;
    padding: 0;

    display: grid;
    grid-template-columns: 1fr;
    gap: var(--lumo-space-l);
}

.card-collection {
    overflow: clip;
    --devkl: true;
}

.collection {
    --map-width: 400px;
    display: grid;
    grid-template-columns: 1fr var(--map-width);
    gap: 1rem;

    .data {
        display: flex;
        flex-direction: column;
        gap: var(--lumo-space-m);

        padding: 0;
        /* color: #000; */
        /* background-color: #fff9; */
    }

    .map-container {
        margin-block: -1rem;
        width: var(--map-width);
        height: auto;
        aspect-ratio: 4 / 3;
        background: var(--lumo-tint-10pct);
        transform: translateX(1rem);
    }

    .links {
        display: flex;
        gap: 1em;
    }
    .links a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5em;
        padding: 0.35em 0.5em;
        width: max-content;

        color: var(--lumo-contrast);
        background-color: hsl(from currentColor h s l / 0.05);
        border-radius: 0.25em;
        text-decoration: none;
    }
    .links a.primary {
        color: var(--lumo-primary-contrast-color);
        background-color: var(--lumo-primary-color);
    }

    .icon {
        fill: var(--lumo-primary-text-color);
    }
}

.items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(8, 1fr);

    li {
        position: relative;
        display: grid;
        grid-template-columns: subgrid;
        grid-column: 1 / -1;
        padding: 0.25em 0.5em;
        background-color: hsl(from currentColor h s l / 0.05);
    }

    li:not(:last-child) {
        margin-block-end: 0.5em;
    }

    a {
        grid-column: 1 / -1;
        display: block;
        padding-block: 0.25rem;
        /* padding-inline: 0.25rem 1rem; */
        text-decoration-color: hsl(from currentColor h s l / 0.5);
        /* background-color: hsl(from currentColor h s l / 0.05); */
        /* text-decoration-color: hsl(from currentColor h s l / 0.5); */
    }
    a:after {
        display: block;
        content: "";
        position: absolute;
        inset: 0;
    }
    li:hover a {
        text-decoration-color: hsl(from currentColor h s l / 1);
    }

    li .props {
        grid-column: 1 / -1;
        display: flex;
        flex-direction: column;
        gap: 0.125em;
        font-size: var(--lumo-font-size-xs);
    }
}

table.item {
    border-collapse: collapse;
    empty-cells: hide;
    border: 1px solid var(--border-color);

    --border-color: var(--lumo-contrast-10pct);

    thead {
        border-bottom: 2px solid var(--border-color);

        th {
            padding-block: 0.5em;
        }
    }

    th, td {
        padding-block: 0.25em;
        padding-inline: 0.5em;
    }

    th {
        text-align: left;
    }

    td {
        vertical-align: top;
        border-bottom: 1px solid var(--border-color);
    }

    td:first-child {
        font-weight: 550;
    }

    /* td.key {} */
    /* td.value {} */

    td.value a ~ a {   
        display: block;
    }

    th:not(:last-child),
    td:not(:last-child) {
        padding-inline-end: 1rem;
        border-inline-end: 1px solid var(--border-color);
    }
}

.conformance-grid {
    list-style: none;
    margin: 0;
    padding: 0;

    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--lumo-space-l);

    li a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1em;

        /* color: #000; */
        /* background-color: #fff9; */
        color: var(--lumo-contrast);
        background-color: hsl(from currentColor h s l / 0.05);
        text-decoration: none;
        border-radius: 0.5rem;
    }

    .icon {
        fill: var(--lumo-primary-text-color);
    }
}

gp-theme {
    position: relative;
}

#color-theme-select {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.color-theme-icon {
    width: 32px;
    height: 32px;
    border-radius: 0.25rem;
    display: grid;
    place-items: center;
}
gp-theme:focus-within .color-theme-icon {
    outline: 2px solid currentColor;
    outline-offset: 1px;
}

.color-theme-icon svg {
    display: none;
}

[theme='light'] .color-theme-icon .lucide-sun,
[theme='dark'] .color-theme-icon .lucide-moon,
[theme*='system'] .color-theme-icon .lucide-contrast {
    display: block;
}

@media (scripting: none), (scripting: initial-only), print {
    #color-theme-select,
    label[for='color-theme-select'] {
        display: none;
    }
}

.skip-link {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    word-wrap: normal !important;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    overflow: hidden;
}

.skip-link:focus {
    display: block;
    clip: auto;
    clip-path: none;
    inset-block-start: 0.25rem;
    inset-inline-start: 0.25rem;
    width: max-content;
    height: auto;
    padding: 0.5rem;
    margin: 0.5rem;
    color: var(--lumo-body-text-color);
    background-color: var(--lumo-base-color);
    border: 3px solid light-dark(#fff, #000);
    outline: 2px solid var(--lumo-contrast);
    outline-offset: 1px;
    z-index: 100;
}

.sr-only,
.visually-hidden,
.visually-hidden-focusable:not(:focus) {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    word-wrap: normal !important;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    overflow: hidden;
}

.debug {
    color: var(--lumo-warning-text-color);
}

