html, body {
    height: 100%;
    overflow: hidden;
    overscroll-behavior-y: none;
}

body { 
    margin:0; 
    font-family:'Open Sans', 'Outfit', 'Roboto', 'Source Code Pro', sans-serif;
    display: flex;
    flex-direction: column;
    height: 100%;
}
#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(0, 34, 62, 0.92);
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
}
#loading-screen.visible {
    display: flex;
}
#loading-screen i {
    font-size: 1.75rem;
    animation: loading-spin 0.8s linear infinite;
}
@keyframes loading-spin {
    to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    #loading-screen i { animation: none; }
}
body > header {
    background-color: #00223e;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding:6px 24px;
    max-height: 50px;
    overflow: hidden;
    flex: 0 0 auto;
}
body > header * {
    color:white;
}
body > header > .logo {
    flex:0;
}
body > header > .logo * {
    height: 50px;
}
body > header > h1 {
    white-space: nowrap;
    flex:0;
    margin:0 20px;
}
.header-search {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    max-width: 480px;
    margin: 0 20px;
    padding: 0 12px;
    height: 34px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 17px;
    transition: background 0.15s ease-in-out, border-color 0.15s ease-in-out;
}
.header-search.searching {
    background: rgba(255, 255, 255, 0.22);
    border-color: #7ec5ff;
    box-shadow: 0 0 0 2px rgba(126, 197, 255, 0.35);
}
.header-search i {
    color: #b9d4ee;
    font-size: 0.9rem;
}
.header-search input {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    border: none;
    background: transparent;
    color: white;
    font-size: 0.9rem;
    outline: none;
}
.header-search input::placeholder {
    color: #b9d4ee;
}
#search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    background: transparent;
    border: none;
    color: #b9d4ee;
    font-size: 0.85rem;
    padding: 4px;
    cursor: pointer;
}
#search-clear:hover {
    color: white;
}
#search-clear[hidden] {
    display: none;
}
#camera-search-button {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    background: transparent;
    border: none;
    color: #b9d4ee;
    font-size: 0.85rem;
    padding: 4px;
    cursor: pointer;
}
#camera-search-button:hover {
    color: white;
}
#search-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    padding: 10px 16px;
    background: #dcebfa;
    color: #00223e;
    border-bottom: 1px solid #b9d4ee;
    font-size: 0.85rem;
}
#search-status button {
    flex: 0 0 auto;
    background: #00223e;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}
#search-status[hidden] {
    display: none;
}
#filter-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    padding: 10px 16px;
    background: #dcebfa;
    color: #00223e;
    border-bottom: 1px solid #b9d4ee;
    font-size: 0.85rem;
}
#filter-status button {
    flex: 0 0 auto;
    background: #00223e;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}
#filter-status[hidden] {
    display: none;
}
#nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    padding: 8px;
    cursor: pointer;
}

body > footer {
    background-color: #00223e;
    color: #7ec5ff;
    text-shadow: 0px 0px 2px black;
    text-align: center;
    height:24px;
    display:none;
    flex-direction:row;
    align-items:center;
    justify-content:flex-end;
    font-size: 0.7rem;
    line-height: 1rem;
    padding:0 32px;
    flex: 0 0 auto;
}
@media (min-width: 1024px) {
    body > footer {
        display: flex;
    }
}

main {    
    position: relative;
    margin: 0;
    padding: 0;
    width: 100vw;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    background: #EEE;
    background-attachment: fixed;
}
#pull-refresh {
    position: absolute;
    top: 0;
    left: 50%;
    width: 36px;
    height: 36px;
    margin-top: -40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    color: #00223e;
    transform: translate(-50%, 0);
    transition: transform 0.2s ease-out, opacity 0.2s ease-out;
    opacity: 0;
    pointer-events: none;
    z-index: 10;
}
#pull-refresh.visible {
    opacity: 1;
}
#pull-refresh i {
    transition: transform 0.15s ease-out;
}
#pull-refresh.ready i {
    transform: rotate(180deg);
}
#pull-refresh.refreshing i {
    animation: loading-spin 0.8s linear infinite;
}
main > h1 {
    margin:0;
}
main > section {
    padding: 12px;
}

nav { 
    display: flex; 
    flex: 0 0 auto;
    padding:8px;
    background: #CCCCCC;
    background: linear-gradient(45deg,rgba(204, 204, 204, 1) 0%, rgba(153, 153, 153, 1) 85%);
    border-bottom:1px solid #666;
    box-shadow: 0px 2px 4px rgba(0,0,0,0.5);
}
nav > ul {
    display: flex;
    flex-direction: row;
    list-style-type: none;
    margin: 0;
    padding: 0;
}
nav > ul > li {
    gap: 6px;
    display: flex;
}
nav > ul > li > a {
    display: flex;
    align-items: center;
    padding: 10px;
    text-shadow: 0px 0px 2px black;
    text-decoration: none;
    color:white;
    background:#064171;
    border-radius: 6px;
    transition: background 0.2s ease-in-out;
    font-weight:600;
}   
nav > ul > li > a:hover {
    background:#0a5aa1;
    transition: background 0.2s ease-in-out;
}
nav > ul > li > a.active {
    background:#0a5aa1;
}



#data-output {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
#data-output > article {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    gap: 4px 8px;
    overflow: hidden;
    border: 1px solid #BBB;
    border-radius: 6px;
    background: white;
    /* height: 180px; */
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.25);
    padding: 6px;
    box-sizing: border-box;
}
#data-output .itemTitle {
    position: relative;
    grid-column: span 2 / span 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
}
#data-output .itemTitle sup {
    position: static;
    display: inline-block;
    background: #eef2f5;
    color: #00223e;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #BBB;
}
#data-output .itemTitle sup.itemBadge {
    position: absolute;
    top: 0;
    right: 0;
    background: #f5c6c6;
    color: #7a0000;
    border: 1px solid #e39a9a;
}
#data-output .itemTitle span {
    width: 100%;
    font-size: 1.4rem;
    font-weight: 800;
    color: #00223e;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#data-output .itemImage {
    grid-row-start: 2;
    width: 100px;
    border: 1px solid #BBB;
    height: 100px;
    margin: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 6px;
    padding: 8px;
}
#data-output .itemDetails {
    grid-row-start: 2;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 4px 4px 0;
}
#data-output .itemDetails > div {
    font-size: 1rem;
}
#data-output .itemDetails > span {
    font-size: 0.875rem;
    margin-left: 6px;
}
#data-output .itemDetails sub {
    align-self: flex-end;
    margin-top: auto;
}
.field-filter {
    cursor: pointer;
    text-decoration: underline dotted;
    text-underline-offset: 3px;
}
.field-filter:hover,
.field-filter:focus-visible {
    color: #0a5aa1;
}

/* #data-output > article > div:first-child {
    flex: 0 0 42%;
}
#data-output > article > div:last-child {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
} */
#data-output > article img {
    display: block;
    max-width: 100px;
    max-height: 100px;
}
#data-output > article .itemImage > i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #8895a0;
    font-size: 2rem;
}
#data-output > article header {
    color: #00223e;
    font-size: 1.1rem;
    font-weight: 700;
}
#data-output > article sub {
    position: static;
    color: #555;
    font-size: 0.8rem;
}
@media (max-width: 640px) {
    #data-output > article {
        max-width: none;
    }
}

@media (max-width: 768px) {
    body > header {
        padding: 6px 12px;
    }
    body > header > h1 {
        margin: 0 10px;
        font-size: 1rem;
    }
    #nav-toggle {
        display: flex;
    }
    .header-search {
        margin: 0 8px;
        max-width: none;
    }
    .header-search > i {
        display: none;
    }
    nav {
        position: fixed;
        top: 50px;
        left: 0;
        right: 0;
        z-index: 999;
        padding: 0;
        max-height: 0;
        overflow: hidden;
        border-bottom: none;
        box-shadow: none;
        transition: max-height 0.25s ease-in-out;
    }
    nav.open {
        max-height: 60vh;
        overflow-y: auto;
        border-bottom: 1px solid #666;
        box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.5);
    }
    nav > ul {
        flex-direction: column;
        padding: 8px;
        gap: 8px;
    }
    nav > ul > li {
        flex-direction: column;
        gap: 8px;
    }
    nav > ul > li > a {
        width: 100%;
        box-sizing: border-box;
    }
    #data-output {
        grid-template-columns: 1fr;
    }
    #data-output > article {
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-rows: auto auto;
        height: auto;
        align-items: center;
        padding: 8px;
        gap: 4px 12px;
    }
    #data-output .itemImage {
        grid-column: 1;
        grid-row: 1 / span 2;
        width: 64px;
        height: 64px;
        margin: 0;
    }
    #data-output .itemTitle {
        grid-column: 2;
        grid-row: 1;
    }
    #data-output .itemDetails {
        grid-column: 2;
        grid-row: 2;
        padding: 0;
        gap: 0;
    }
    #data-output .itemDetails span,
    #data-output .itemDetails sub {
        display: none;
    }
}

