/* ==========================================================================
   NYIFF - Dark Theme Styles
   ========================================================================== */

/* CSS Variables for Dark Theme */
:root {
    /* Colors */
    --bg-primary: #0d0d0d;
    --bg-secondary: #1f1f1f;
    --bg-tertiary: #2e2e2e;
    --bg-nav: #1f1f1f;
    --bg-dropdown: #1f1f1f;
    --bg-container: #1f1f1f;
    --bg-thumbnail: #1f1f1f;
    --bg-tag-name: #4d4d4d;
    --bg-tag-count: #333;
    --bg-caption: #404040;
    --bg-pagination-current: #262626;
    --bg-pagination-hover: #333;
    --bg-sort: #1a1a1a;
    --bg-sort-current: #2e2e2e;
    --bg-sort-hover: #333;
    --bg-reader-bar: #383838;
    --bg-reader-hover: #525252;
    
    /* Text Colors */
    --text-primary: #d9d9d9;
    --text-secondary: #999;
    --text-muted: #666;
    --text-tag-count: grey;
    
    /* Borders */
    --border-color: #333;
    
    /* Accent Colors */
    --accent-primary: #ed2553;
    --accent-hover: #f15478;
    --accent-disabled: #be546c;
    
    /* Shadows */
    --shadow-dropdown: 0 0 30px rgba(0, 0, 0, .5);
    --shadow-caption: 0 10px 20px hsla(0, 0%, 3%, 0.5);
    
    /* Typography */
    --font-family: Noto Sans, sans-serif;
    --font-size-base: 14px;
    --line-height-base: 1.42857143;
}

/* ==========================================================================
   CSS Reset & Base Styles
   ========================================================================== */

* {
    box-sizing: border-box;
}

html {
    line-height: 1.15;
    -webkit-text-size-adjust: 100%;
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    height: 100%;
    margin: 0;
    text-align: center;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    font-family: var(--font-family);
    height: 100%;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
}

h1 { font-size: 2em; margin: .67em 0; }
h2 { font-size: 1.6em; }
h3 { font-size: 1.4em; }

/* Links */
a {
    color: var(--text-primary);
    background-color: transparent;
    text-decoration: none;
}

a:hover {
    color: var(--accent-primary);
    text-decoration: none;
}

a .count { color: var(--text-secondary); }
a.bold { font-weight: 700; }

/* Form Elements */
button, input, textarea {
    font-family: inherit;
    font-size: 100%;
    line-height: 1.15;
    margin: 0;
    border: none;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

button, input { overflow: visible; }
button, select { text-transform: none; }

/* Utility Classes */
.invisible {
    z-index: -1;
    visibility: hidden;
}

.hidden { display: none !important; }
.nobold { font-weight: 400; }

/* ==========================================================================
   Navigation
   ========================================================================== */

nav {
    position: relative;
    min-height: 50px;
    background: var(--bg-nav);
    padding-left: 76px;
}

nav a, nav a:hover { color: #fff; }
nav .btn { margin: 5px; }

/* Logo */
nav .logo {
    float: left;
    display: inline-block;
    height: 50px;
    padding: 10px;
    margin-left: -76px;
}

nav .logo:hover { background-color: var(--bg-tertiary); }

/* Search */
nav .search {
    float: left;
    display: flex;
    align-items: center;
    height: 50px;
}

nav .search input {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: none;
    outline: none;
    border-radius: 3px 0 0 3px;
    padding: 0 .1em 0 1em;
    font-size: 1em;
    width: 220px;
    height: 40px;
    margin-top: 0;
}

nav .search input:hover {
    background: var(--bg-caption);
}

nav .search input::placeholder {
    color: var(--text-secondary);
    opacity: 1;
}

nav .search .btn.btn-primary.btn-square {
    border-radius: 0;
    margin: 0;
}

/* Give search button rounded corners when dropdown is hidden */
@media (min-width: 1401px) {
    nav .search .btn.btn-primary.btn-square {
        border-radius: 0 3px 3px 0;
    }
}

@media (max-width: 644px) {
    nav .search .btn.btn-primary.btn-square {
        border-radius: 0 3px 3px 0;
    }
}

nav .search .btn-dropdown {
    border-radius: 0 3px 3px 0;
    min-height: 40px;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
}

/* Menu */
nav .menu {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

nav .menu.left { float: left; }


nav .menu li, nav .menu li a { display: inline-block; }

nav .menu li a {
    padding-left: 10px;
    padding-right: 10px;
    height: 50px;
    line-height: 50px;
}

nav .menu li:hover > a { background-color: var(--bg-tertiary); }
nav .menu li.active > a { background-color: var(--accent-primary); color: #fff; }
nav .menu li.active > a:hover { background-color: var(--accent-hover); }

nav .menu li img {
    vertical-align: middle;
    border-radius: 100%;
}



/* Hamburger Menu */
nav #hamburger {
    float: right;
    margin-right: -45px;
}

nav #hamburger .line {
    display: block;
    width: 100%;
    height: 2px;
    background-color: #fff;
    border-radius: 1px;
    margin-top: 5px;
    margin-bottom: 5px;
}

/* Username */
.username {
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    vertical-align: top;
    margin-left: 8px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-block;
    vertical-align: middle;
    font-weight: 700;
    cursor: pointer;
    padding: 0 12px;
    color: #fff;
    border: 0;
    border-radius: 3px;
    outline: 0;
    font-size: 100%;
    height: 40px;
    line-height: 40px;
    margin: 3px;
    -webkit-font-smoothing: antialiased;
}

.btn:hover {
    color: #fff;
    background: var(--accent-hover);
}

.btn.btn-unstyled {
    color: inherit;
    padding: 0;
    margin: 0;
    background: none;
    cursor: pointer;
    border: none;
    font-weight: 400;
    line-height: 1;
    height: auto;
}

.btn.btn-thin {
    margin-top: 5px;
    margin-bottom: 10px;
    padding: 5px 6px;
    font-weight: 400;
    line-height: 1;
    height: auto;
}

.btn.btn-primary { background-color: var(--accent-primary); }
.btn.btn-primary:active, .btn.btn-primary:focus, .btn.btn-primary:hover {
    color: #fff;
    background: var(--accent-hover);
}
.btn.btn-primary.disabled, .btn.btn-primary:disabled {
    cursor: default;
    background-color: var(--accent-disabled);
}

.btn.btn-secondary { background-color: var(--bg-tertiary); }
.btn.btn-secondary:active, .btn.btn-secondary:focus, .btn.btn-secondary:hover {
    background: var(--bg-sort-hover);
}
.btn.btn-secondary.disabled, .btn.btn-secondary:disabled {
    cursor: default;
    background-color: var(--bg-sort);
}

.btn.btn-square {
    width: 40px;
    height: 40px;
    margin: 5px;
    vertical-align: middle;
}



/* ==========================================================================
   Containers & Layout
   ========================================================================== */

.container {
    display: block;
    clear: both;
    margin: 10px auto;
    padding: 10px;
    border-radius: 5px;
    background-color: var(--bg-container);
    width: 100%;
    max-width: 1200px;
}

.container.left { text-align: left; }
.container.right { text-align: right; }
.container.padded { padding: 3em; }

/* ==========================================================================
   Gallery & Thumbnails
   ========================================================================== */

.gallery, .gallery-favorite, .thumb-container {
    display: inline-block;
    vertical-align: top;
}

.gallery-favorite img, .gallery img, .thumb-container img {
    display: block;
    border-radius: .3em;
    max-width: 100%;
    height: auto;
}

.gallery {
    position: relative;
    margin-bottom: 3em;
    width: 100%;
    max-width: 320px;
    aspect-ratio: 7/10;
    display: inline-block;
    vertical-align: top;
    background: none;
}

.gallery a {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0 !important;
}

.gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: .3em;
    display: block;
}

.caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    width: 100%;
    max-height: 50px;
    padding: 8px 3px 8px 3px;
    background-color: var(--bg-caption);
    font-weight: 700;
    display: block;
    text-align: center;
    text-decoration: none;
    color: var(--text-primary);
    border-bottom-left-radius: .3em;
    border-bottom-right-radius: .3em;
    overflow: hidden;
}

.gallery:hover .caption {
    max-height: 100%;
    box-shadow: var(--shadow-caption);
}

/* Responsive: let grid wrap, but keep max-width */
@media screen and (min-width: 980px) {
    .gallery, .gallery-favorite, .thumb-container {
        width: 19%;
        min-width: 180px;
        max-width: 320px;
        margin: 3px;
    }
}

@media screen and (max-width: 979px) {
    .gallery, .gallery-favorite, .thumb-container {
        width: 24%;
        min-width: 140px;
        max-width: 240px;
        margin: 2px;
    }
}

@media screen and (max-width: 772px) {
    .gallery, .gallery-favorite, .thumb-container {
        width: 32%;
        min-width: 120px;
        max-width: 180px;
        margin: 1.5px;
    }
}

@media screen and (max-width: 500px) {
    .gallery, .gallery-favorite, .thumb-container {
        width: 49%;
        min-width: 100px;
        max-width: 140px;
        margin: .5px;
    }
}

/* ==========================================================================
   Tags
   ========================================================================== */

.tag {
    color: #fff;
    font-size: 1em;
    vertical-align: middle;
    display: inline-flex;
    margin: .13em;
    flex-direction: row;
    justify-content: center;
}

.tag > :first-child {
    border-top-left-radius: .3em;
    border-bottom-left-radius: .3em;
}

.tag > :last-child {
    border-top-right-radius: .3em;
    border-bottom-right-radius: .3em;
}

.tag .count, .tag .name {
    display: flex;
    padding: .13em .39em;
    align-items: center;
}

.tag .name { background: var(--bg-tag-name); }

.tag .count {
    font-size: .9em;
    color: var(--text-tag-count);
    font-weight: 400;
    padding: .13em .26em;
    background: var(--bg-tag-count);
    box-shadow: inset 0 0 .4em #2b2b2b;
}

.tag:hover {
    color: #fff;
}

.tag:hover .name { background: #595959; }
.tag:hover .count { background: #404040; }

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination {
    font-size: 1.3em;
    margin-bottom: 2em;
    margin-top: 2em;
}

.pagination .first, .pagination .last, .pagination .next, .pagination .page, .pagination .previous {
    display: inline-block;
    min-width: 35px;
    padding: 5px;
}

.pagination .first.current, .pagination .last.current, .pagination .next.current, .pagination .page.current, .pagination .previous.current {
    font-weight: 700;
    border-radius: 100%;
    background-color: var(--bg-pagination-current);
}

.pagination .first:hover, .pagination .last:hover, .pagination .next:hover, .pagination .page:hover, .pagination .previous:hover {
    border-radius: 100%;
    background-color: var(--bg-pagination-hover);
}

/* Alphabetical Pagination (Tags Page) */
.alphabetical-pagination {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
    list-style: none;
    padding: 0;
    margin: 24px auto 24px auto;
    max-width: 1200px;
    width: 100%;
}

.alphabetical-pagination li {
    display: flex;
}

.alphabetical-pagination a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    min-height: 30px;
    border-radius: 50%;
    background: none;
    color: var(--text-primary);
    font-weight: 400;
    font-size: 1.1em;
    transition: background 0.2s;
}

.alphabetical-pagination a.current {
    background: var(--bg-tertiary);
    color: #fff;
    font-weight: 700;
}

/* ==========================================================================
   Reader Styles
   ========================================================================== */

html.reader, html.reader #content, html.reader body { height: 100%; }
html.reader body { padding-top: 50px; }
html.reader #content { margin-top: 0; }
html.reader nav { margin-top: -50px; }

html.reader.nav-hidden body { padding-top: 0; }
html.reader.nav-hidden nav { display: none; }

/* Reader Bar */
html.reader .reader-bar {
    background-color: var(--bg-reader-bar);
    color: #fff;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
}

html.reader .reader-bar > * { display: flex-item; }

html.reader .reader-bar .box, html.reader .reader-bar a, html.reader .reader-bar button {
    color: #fff;
    line-height: 20px;
    padding: 10px;
    min-width: 40px;
    min-height: 100%;
    border-radius: 0;
}

html.reader .reader-bar a:hover, html.reader .reader-bar button:hover {
    background-color: var(--bg-reader-hover);
}

/* Reader Navigation */
html.reader .reader-bar .reader-buttons-left {
    display: flex;
    align-self: flex-start;
}

html.reader .reader-bar .reader-pagination {
    display: flex;
    align-self: flex-center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

html.reader .reader-bar .reader-pagination .page-number {
    vertical-align: top;
    min-width: 65px;
}

html.reader .reader-bar .reader-pagination .page-number .current, html.reader .reader-bar .reader-pagination .page-number .num-pages {
    font-weight: 700;
}

html.reader .reader-bar .reader-buttons-right {
    display: flex;
    align-self: flex-end;
}

html.reader .reader-bar .reader-buttons-right .zoom-buttons {
    display: flex;
}

html.reader .reader-bar .reader-buttons-right .zoom-buttons .zoom-level {
    font-size: .9em;
    user-select: none;
}

/* Reader Image Container */
html.reader #image-container {
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0);
    text-align: center;
    height: 100%;
    outline: 0;
    overflow-x: auto;
    overflow-y: visible;
    max-width: 100%;
    height: auto;
    min-height: 300px;
}

html.reader #image-container img {
    vertical-align: bottom;
    height: auto;
    max-width: 100%;
    user-select: none;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Navigation Responsive */
@media (max-width: 95em) { nav .username { max-width: 150px; } }
@media (max-width: 90em) { nav .username { max-width: 100px; } }
@media (max-width: 85em) { nav .username { max-width: 50px; } }
@media (max-width: 75em) { nav .username { max-width: 200px; } }
@media (max-width: 65em) { nav .username { max-width: 50px; } }
@media (max-width: 644px) { nav .username { max-width: 250px; } }

@media (min-width: 1401px) {
    nav form { margin-right: 10px; width: 25%; }
    nav #hamburger, nav .menu .dropdown { display: none; }
}

@media (min-width: 645px) and (max-width: 1400px) {
    nav form { width: 35%; }
    nav #hamburger, nav .menu .desktop, nav .menu .dropdown-menu { display: none; }
    
    nav .dropdown { position: relative; }
    
    nav .dropdown .dropdown-menu.open {
        display: inline-block;
        position: absolute;
        left: 0;
        top: 100%;
        border-radius: 3px;
        padding-left: 0;
        text-align: left;
        background-color: var(--bg-dropdown);
        z-index: 3;
        box-shadow: var(--shadow-dropdown);
    }
    
    nav .dropdown .dropdown-menu.open:before {
        position: absolute;
        content: "";
        pointer-events: none;
        bottom: 100%;
        left: 15px;
        border: 10px solid transparent;
        border-bottom-color: var(--bg-dropdown);
        height: 0;
        width: 0;
    }
    
    nav .dropdown .dropdown-menu.open li { width: 100%; }
    
    nav .dropdown .dropdown-menu.open li a {
        line-height: 2;
        height: auto;
        width: 100%;
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    nav .dropdown .dropdown-menu.open li:first-of-type a {
        border-top-right-radius: 3px;
        border-top-left-radius: 3px;
    }
    
    nav .dropdown .dropdown-menu.open li:last-of-type a {
        border-bottom-right-radius: 3px;
        border-bottom-left-radius: 3px;
    }
}

@media (max-width: 644px) {
    nav { padding-right: 50px; }
    nav form { width: 100%; }
    
    nav .collapse {
        display: block;
        width: 100%;
        overflow: hidden;
        max-height: 0;
        transition: max-height .5s;
    }
    
    nav .collapse.open { max-height: 500px; }
    
    nav .collapse .menu.left { float: none; }
    nav .collapse .menu .dropdown { display: none; }
    nav .collapse .menu li { display: block; }
    
    nav .collapse .menu li a {
        width: 100%;
        height: 35px;
        line-height: 35px;
    }
}

/* Reader Responsive */
@media screen and (max-width: 310px) {
    html.reader .reader-bar .reader-pagination .first, html.reader .reader-bar .reader-pagination .last {
        display: none;
    }
}

@media screen and (max-width: 640px) {
    html.reader .reader-bar .reader-buttons-right .zoom-buttons .zoom-level {
        display: none;
    }
}

@media screen and (max-width: 550px) {
    html.reader .reader-bar .reader-buttons-right .zoom-buttons {
        display: none;
    }
}

/* Container Responsive */
@media screen and (max-width: 1200px) {
    .container { border-radius: 0; }
}

@media screen and (orientation: landscape) {
    .container {
        padding-left: calc(5px + constant(safe-area-inset-left));
        padding-right: calc(5px + constant(safe-area-inset-right));
    }
}

/* ==========================================================================
   Specific Page Components
   ========================================================================== */

/* Gallery Page */
#bigcontainer {
    margin-bottom: 25px;
    padding: 30px 20px;
}

#bigcontainer form { display: inline-block; }

#bigcontainer #cover img, #bigcontainer #info-block img { max-width: 100%; }

@media screen and (min-width: 768px) {
    #bigcontainer #cover, #bigcontainer #info-block {
        display: inline-block;
        width: 48%;
        vertical-align: top;
    }
}

@media screen and (max-width: 500px) {
    #bigcontainer #cover, #bigcontainer #info-block {
        width: 100%;
        margin: .5px;
    }
}

/* Info Container */
#info-container {
    height: auto;
    padding: 10px 40px 20px;
    text-align: left;
}

#info-container section.text {
    padding-top: 10px;
    padding-bottom: 10px;
}

#info-container section:not(:last-of-type) {
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

#info-container h1 { font-size: 2em; }
#info-container h2 { font-size: 1.6em; }
#info-container h3 { font-size: 1.4em; }
#info-container li { margin: 5px; }
#info-container a { color: var(--accent-primary); }
#info-container #thanks { margin-top: 20px; text-align: center; }

/* Info Block */
#info {
    height: auto;
    padding: 10px;
    text-align: left;
}

#info .title .pretty { color: var(--text-primary); }
#info .title .after, #info .title .before { color: var(--text-secondary); }
#info h1 { font-size: 20px; }
#info h2 { font-size: 17px; margin-top: 10px; margin-bottom: 20px; }
#info #gallery_id { font-size: 15px; cursor: pointer; }
#info #gallery_id .hash { color: var(--text-muted); }
#info .field-name { font-weight: 700; }

#info a { font-weight: 700; }

/* Thumbnail Container */
#thumbnail-container {
    margin-bottom: 25px;
    padding: 15px;
    text-align: center;
    background-color: var(--bg-thumbnail);
}

#thumbnail-container .gallerythumb {
    display: inline-block;
    margin-bottom: 3px;
    vertical-align: middle;
}

#thumbnail-container .gallerythumb a { display: inline-block; }

#thumbnail-container .gallerythumb img:hover {
    -webkit-filter: brightness(110%);
    -moz-filter: brightness(110%);
}

@media screen and (max-width: 980px) {
    #thumbnail-container {
        padding: 10px 5px 5px;
        border-radius: 0;
    }
}

@media screen and (max-width: 980px) and (orientation: landscape) {
    #thumbnail-container {
        padding-left: constant(safe-area-inset-left);
        padding-right: constant(safe-area-inset-right);
    }
}

/* Related Container */
#related-container {
    margin-bottom: 25px;
    padding-bottom: 20px;
}

/* Sort */
.sort {
    margin-top: -15px;
    font-size: 20px;
}

.sort:before {
    content: "";
    display: block;
    clear: both;
    margin-top: 1em;
}

.sort .sort-type {
    overflow: hidden;
    display: inline-block;
    border-radius: 5px;
    margin: 10px;
    background-color: var(--bg-sort);
}

.sort .sort-type > .sort-name, .sort .sort-type > a {
    display: inline-block;
    padding: .5em;
}

.sort .sort-type > a:hover { background-color: var(--bg-sort-hover); }
.sort .sort-type > a.current {
    font-weight: 700;
    background-color: var(--bg-sort-current);
}

.sort + .container { margin-top: 0; }

@media screen and (max-width: 550px) {
    .sort { font-size: 16px; }
}

/* ==========================================================================
   Additional Components
   ========================================================================== */



/* Footer */
#footer-container {
    margin-top: 15px;
    margin-bottom: 6px;
    background-color: inherit;
}

#footer-container .footer-item a {
    margin: 10px;
    color: #5e7980;
}

/* Color Icon */
.color-icon { color: var(--accent-primary); }

#search-dropdown-menu {
    background: var(--bg-dropdown, #1f1f1f);
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    min-width: 180px;
    padding: 8px 0;
    margin: 0;
    list-style: none;
    font-size: 1.1em;
    z-index: 1000;
}
#search-dropdown-menu li {
    width: 100%;
}
#search-dropdown-menu li a {
    display: block;
    width: 100%;
    padding: 10px 24px 10px 20px;
    color: #fff;
    text-align: left;
    background: none;
    border: none;
    text-decoration: none;
    transition: background 0.2s;
}
#search-dropdown-menu li a:hover {
    background: #333;
    color: var(--accent-primary, #ed2553);
}
#search-dropdown-menu li:last-child a {
    border-bottom: none;
}

@media (min-width: 1401px), (max-width: 644px) {
    .btn-dropdown,
    #search-dropdown-menu {
        display: none !important;
    }
} 