/* =========================================================
   Base Variables
   ========================================================= */
:root {
    --color-bg-dark: #101010;
    --color-bg-light: #ffffff;
    --color-text: #aaa;
    --color-heading: #555;
    --color-accent: #00D3B7;
    --color-border: #ccc;

    --sidebar-width: 360px;
    --transition-fast: 0.25s ease;
    --transition-medium: 0.5s ease;
    --transition-slow: 0.75s ease;

    --radius: 4px;
    --font-main: "Oswald", Helvetica, sans-serif;
}

/* =========================================================
   Modern Reset
   ========================================================= */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

img {
    max-width: 100%;
    display: block;
}

button, input, select, textarea {
    font: inherit;
}
html {
    font-size: 16px;
    background-color: var(--color-bg-dark);
}

@media (max-width: 1680px) {
    html { font-size: 14px; }
}

body {
    background-color: var(--color-bg-light);
    color: var(--color-text);
    font-family: var(--font-main);
    font-weight: 300;
    line-height: 1.65;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted currentColor;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

a:hover {
    color: var(--color-accent);
    border-bottom-color: transparent;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--color-heading);
    font-weight: 400;
    margin: 0 0 0.5em;
    line-height: 1.25;
}

h2 { font-size: 2.25em; }
h3 { font-size: 1em; }
h4 { font-size: 0.9em; }

p {
    margin: 0;
}

ul,
ol {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

.button,
button,
input[type="button"],
input[type="submit"],
input[type="reset"] {
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-heading);
    padding: 0.75em 1.5em;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.button:hover,
button:hover,
input:hover {
    color: var(--color-accent);
    border-color: var(--color-accent);
    background-color: color-mix(in srgb, var(--color-accent) 15%, transparent);
}

.button:disabled,
button:disabled {
    opacity: 0.4;
    pointer-events: none;
}

#main {
    position: fixed;
    right: 0;
    top: 0;
    height: 100%;
    width: var(--sidebar-width);
    background: var(--color-bg-light);
    overflow-y: auto;
    text-align: right;
    transition: opacity var(--transition-slow), transform var(--transition-slow);
    z-index: 10000;
}

body.fullscreen #main {
    transform: translateX(100%);
    visibility: hidden;
}

@media (max-width: 980px) {
    #main {
        background: rgba(255,255,255,0.93);
    }
}

@media (max-width: 480px) {
    #main {
        width: 100%;
        text-align: center;
    }

}

#thumbnails {
    display: flex;
    flex-wrap: wrap;
    padding: 0 1em;
}

#thumbnails article {
    width: 50%;
    position: relative;
}

.thumbnail {
    display: block;
    border: none;
}

.thumbnail::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 3px solid var(--color-border);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

article.active .thumbnail::before {
    opacity: 1;
}

@media (max-width: 480px) {
    .thumbnail::before {
        display: none;
    }
}


#viewer {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: calc(100% - var(--sidebar-width));
    transition: opacity var(--transition-slow), width var(--transition-slow);
}

body.fullscreen #viewer {
    width: 100%;
}

@media (max-width: 980px) {
    #viewer {
        width: 100%;
    }
}
@media (max-width: 480px) {
    .button,
    button,
    input[type="button"],
    input[type="submit"] {
        padding: 0.875em 1.5em;  /* or more */
        min-height: 44px;
    }
}
.slide {
    position: absolute;
    inset: 0;
    opacity: 1;
    transition: opacity var(--transition-medium);
}

.slide .image {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity var(--transition-medium);
}

.slide.active .image {
    opacity: 1;
}



@keyframes spin {
    to { transform: rotate(360deg); }
}

.slide.loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3em;
    height: 3em;
    background: url("images/spinner.svg") center / contain no-repeat;
    transform: translate(-50%, -50%);
    animation: spin 1s linear infinite;
}

/* Show full image on smaller screens */
@media (max-width: 768px) {
    #viewer {
        position: relative;
        width: 100%;
        height: auto;
    }

    .slide {
        position: relative;
        min-height: 60vh;        /* tweak to taste */
    }

    .slide .image {
        background-size: contain;    /* show full image */
        background-repeat: no-repeat;
        background-position: center center;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}
/* Hidden by default */
/* Hidden by default */
#viewer .toggle {
    display: none;
    position: absolute;
    top: 1rem;
    right: 1rem;          /* moved from left to right */
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    cursor: pointer;
    z-index: 10001;
}

/* X icon */
#viewer .toggle::before,
#viewer .toggle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60%;
    height: 2px;
    background: #fff;
    transform-origin: center;
}
#viewer .toggle::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

#viewer .toggle::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* Show only when fullscreen is active (image clicked / main hidden) */
body.fullscreen #viewer .toggle {
    display: block;
}

@media (max-width: 768px) {
    #main > .toggle {
        display: none;
    }
}