/* Colors taken from kolumber.pl (css/site.css) */
:root {
    --bg: #ffffff;
    --surface: #f0faff;       /* light blue panels / inputs */
    --surface-2: #e1f3fb;     /* hover */
    --border: #aedbf0;        /* light blue borders */
    --text: #505c52;          /* grey-green body text */
    --heading: #05577f;       /* dark navy */
    --muted: #7d8a80;
    --accent: #12b1ff;        /* bright sky blue */
    --accent-dark: #0e9de3;
    --link: #0367e1;
    --link-hover: #005a83;
    --footer-bg: #efefef;
    --footer-border: #d9d9d9;
    --radius: 10px;
    --header-h: 64px;
    --footer-h: 64px;
    --gap: 6px;
}

html {
    scroll-padding-top: var(--header-h);
}

body {
    background-color: var(--bg);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
}

a {
    color: var(--link);
}

    a:hover {
        color: var(--link-hover);
    }

/* Bootstrap buttons in kolumber blue */
.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--accent);
    --bs-btn-border-color: var(--accent);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--accent-dark);
    --bs-btn-hover-border-color: var(--accent-dark);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--link-hover);
    --bs-btn-active-border-color: var(--link-hover);
    --bs-btn-focus-shadow-rgb: 18, 177, 255;
}

.btn-outline-primary {
    --bs-btn-color: var(--heading);
    --bs-btn-border-color: var(--border);
    --bs-btn-bg: #fff;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--accent);
    --bs-btn-hover-border-color: var(--accent);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--link-hover);
    --bs-btn-active-border-color: var(--link-hover);
    --bs-btn-focus-shadow-rgb: 18, 177, 255;
}

/* ---------------------------------------------------------------- header */

.app-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 3px solid var(--accent);
    box-shadow: 0 2px 10px rgba(5, 87, 127, 0.08);
    padding-top: env(safe-area-inset-top);
}

.app-header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: var(--header-h);
}

/* "Kolumber.pl" -> main site, "GALERIA" -> gallery home */
.brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    line-height: 1;
    flex-shrink: 0;
}

    .brand a {
        text-decoration: none;
    }

    .brand-name {
        font-weight: 700;
        font-size: 1.15rem;
        letter-spacing: -0.01em;
        color: var(--heading);
    }

        .brand-name:hover {
            color: var(--link-hover);
        }

    .brand-sub {
        font-size: 0.7rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.18em;
        color: var(--accent);
    }

        .brand-sub:hover {
            color: var(--link-hover);
        }

/* ---------------------------------------------------------------- search */

.search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    max-width: 760px;
    margin: 0 auto;
}

    .search-icon {
        position: absolute;
        left: 14px;
        color: var(--heading);
        pointer-events: none;
    }

    .search .form-control {
        height: 44px;
        padding-left: 44px;
        border-radius: 999px;
        background-color: var(--surface);
        border-color: var(--border);
        color: var(--text);
        font-size: 1rem;  /* >= 16px: no zoom on iOS focus */
    }

        .search .form-control::placeholder {
            color: var(--muted);
        }

        .search .form-control:focus {
            background-color: #fff;
            border-color: var(--accent);
            box-shadow: 0 0 0 3px rgba(18, 177, 255, 0.25);
        }

    .search .btn {
        height: 44px;
        min-width: 44px;
        border-radius: 999px;
        padding: 0 18px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

.autocomplete {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 1040;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(5, 87, 127, 0.18);
    max-height: min(60vh, 420px);
    overflow-y: auto;
}

    .autocomplete li {
        padding: 10px 14px;
        border-radius: 6px;
        cursor: pointer;
        color: var(--muted);
    }

        .autocomplete li mark {
            padding: 0;
            background: none;
            color: var(--heading);
            font-weight: 600;
        }

        .autocomplete li:hover,
        .autocomplete li.active {
            background: var(--surface);
            color: var(--text);
        }

/* ---------------------------------------------------------------- results */

.app-main {
    padding-top: 12px;
    padding-bottom: 16px;
}

/* ---------------------------------------------------------------- page heading */

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 4px;
}

    .breadcrumbs a {
        text-decoration: none;
    }

        .breadcrumbs a:hover {
            text-decoration: underline;
        }

.page-title {
    color: var(--heading);
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 12px;
}

    .page-title small {
        color: var(--muted);
        font-size: 0.9rem;
        font-weight: 400;
        margin-left: 8px;
    }

#page-header[hidden],
.popular[hidden] {
    display: none;
}

/* Popular phrases on the home page */
.popular {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.chip {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--heading);
    font-size: 0.85rem;
    text-decoration: none;
    white-space: nowrap;
}

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

    .chip-more {
        background: #fff;
        color: var(--link);
    }

.empty,
.not-found {
    color: var(--muted);
    padding: 24px 0;
}

/* /tagi/: all phrases in columns */
.tag-section {
    margin-bottom: 28px;
}

    .tag-section h2 {
        color: var(--heading);
        font-size: 1.2rem;
        font-weight: 600;
        border-bottom: 2px solid var(--accent);
        padding-bottom: 4px;
        margin-bottom: 10px;
    }

        .tag-section h2 small {
            color: var(--muted);
            font-size: 0.85rem;
            font-weight: 400;
        }

.tag-list {
    columns: 220px;
    column-gap: 24px;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.9rem;
}

    .tag-list li {
        break-inside: avoid;
        padding: 2px 0;
    }

    .tag-list a {
        text-decoration: none;
    }

        .tag-list a:hover {
            text-decoration: underline;
        }

    .tag-list .count {
        color: var(--muted);
        font-size: 0.8rem;
    }

/* ---------------------------------------------------------------- footer */

/* Same glass bar as the header, stuck to the bottom of the screen */
.app-footer {
    position: sticky;
    bottom: 0;
    z-index: 1020;
    background: rgba(239, 239, 239, 0.92);
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    border-top: 1px solid var(--footer-border);
    padding-bottom: env(safe-area-inset-bottom);
}

/* credit | result count (centered) | Top button */
.app-footer-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    min-height: var(--footer-h);
    font-size: 0.85rem;
    color: var(--muted);
}

    /* Copyright + cookie notice: wraps instead of being cut off, so the
       "polityki cookie" link is always visible */
    .footer-text {
        grid-column: 1;
        justify-self: start;
        min-width: 0;
        max-width: 100%;
        font-size: 0.78rem;
        line-height: 1.35;
    }

    .app-footer a {
        color: var(--accent);
        text-decoration: none;
    }

        .app-footer a:hover {
            color: var(--link-hover);
        }

    .results-info {
        grid-column: 2;
        max-width: 50vw;
        color: var(--text);
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

        .results-info .info-short {
            display: none;
        }

    #back-to-top {
        grid-column: 3;
        justify-self: end;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        border-radius: 999px;
        padding: 4px 12px;
        flex-shrink: 0;
    }

        #back-to-top[hidden] {
            display: none;
        }

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--gap);
    transition: opacity 150ms;
}

    .photo-grid.loading {
        opacity: 0.45;
        pointer-events: none;
    }

.tile {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 8px;
    background: var(--surface);
    aspect-ratio: 4 / 3;
    outline-offset: 2px;
}

    .tile img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        transition: transform 300ms ease, filter 300ms ease;
    }

    .tile-caption {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        padding: 28px 10px 8px;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent);
        color: #fff;
        font-size: 0.8rem;
        font-weight: 600;
        line-height: 1.3;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        opacity: 0;
        transform: translateY(6px);
        transition: opacity 200ms, transform 200ms;
    }

    .tile-caption:empty {
        display: none;
    }

/* Mouse: reveal caption and zoom slightly on hover */
@media (hover: hover) {
    .tile:hover img,
    .tile:focus-visible img {
        transform: scale(1.04);
    }

    .tile:hover .tile-caption,
    .tile:focus-visible .tile-caption {
        opacity: 1;
        transform: none;
    }
}

/* Touch: no hover, so always show the caption */
@media (hover: none) {
    .tile-caption {
        opacity: 1;
        transform: none;
    }
}

.load-more-wrap {
    text-align: center;
    margin: 20px 0;
}

#load-more {
    display: none;
    border-radius: 999px;
    padding: 8px 24px;
}

/* ---------------------------------------------------------------- preview */

.preview {
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--surface);
    border-radius: 8px;
    overflow: hidden;
}

    /* Whole photo visible without scrolling, never upscaled */
    .preview-img {
        display: block;
        max-width: 100%;
        max-height: calc(100vh - 13rem);
        max-height: calc(100dvh - 13rem);
        width: auto;
        height: auto;
        object-fit: contain;
    }

.photo-description {
    margin: 10px 0 0;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text);
    overflow-wrap: anywhere;
}

    .photo-description[hidden] {
        display: none;
    }

#photo-modal .modal-content {
    background: #fff;
    border-color: var(--border);
}

#photo-modal .modal-header {
    border-bottom: 3px solid var(--accent);
}

/* Title with "author · date" next to it; the date drops below on narrow screens */
.modal-title-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 12px;
    row-gap: 2px;
    min-width: 0;
    flex: 1;
}

#photo-modal .modal-title {
    color: var(--heading);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    max-width: 100%;
}

.photo-meta {
    color: var(--muted);
    font-size: 0.8rem;
    font-style: italic;
    white-space: nowrap;
}


/* Link to kolumber.pl above the photo: always visible without scrolling */
.photo-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

    /* "Europa → Francja → Paryż" on the left, button stays on the right */
    .photo-place {
        min-width: 0;
        font-size: 0.875rem;
        color: var(--muted);
    }

        .photo-place a {
            text-decoration: none;
        }

            .photo-place a:hover {
                text-decoration: underline;
            }

    .photo-actions .photo-link {
        flex-shrink: 0;
        margin-left: auto;
    }

.photo-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 5px 14px;
}



/* ---------------------------------------------------------------- phones */

@media (max-width: 575.98px) {
    :root {
        --header-h: 60px;
        --gap: 4px;
    }

    /* Footer: result count + Top button in the first row,
       cookie notice centered in a second row */
    .app-footer-inner {
        grid-template-columns: 44px 1fr 44px;
        row-gap: 2px;
        padding-top: 6px;
        padding-bottom: 6px;
    }

    .footer-text {
        grid-row: 2;
        grid-column: 1 / -1;
        justify-self: center;
        text-align: center;
        font-size: 0.7rem;
    }

    .results-info .info-long {
        display: none;
    }

    .results-info {
        max-width: none;
    }

        .results-info .info-short {
            display: inline;
        }

    .app-header-inner {
        gap: 10px;
        padding-left: 10px;
        padding-right: 10px;
    }

    .brand-name {
        font-size: 1rem;
    }

    .brand-sub {
        font-size: 0.65rem;
        letter-spacing: 0.12em;
    }

    .search .btn {
        padding: 0;
        width: 44px;
    }

    .app-main {
        padding-left: 4px;
        padding-right: 4px;
    }


    /* Two columns on phones */
    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .tile {
        border-radius: 4px;
    }

    .preview {
        border-radius: 0;
    }

    .preview-img {
        max-height: calc(100vh - 11rem);
        max-height: calc(100dvh - 11rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tile img,
    .tile-caption,
    .photo-grid {
        transition: none;
    }
}
