:root {
    --site-bg: #0c0c0d;
    --site-fg: #e8e6e3;
    --site-muted: #8a8884;
    --site-line: #1f1f21;

    --bs-body-bg: var(--site-bg);
    --bs-body-color: var(--site-fg);
    --bs-secondary-color: var(--site-muted);
    --bs-border-color: var(--site-line);
    --bs-link-color-rgb: 232, 230, 227;
    --bs-link-hover-color-rgb: 255, 255, 255;
}

body {
    background: var(--site-bg);
    color: var(--site-fg);
    font-family: "Helvetica Neue", "Segoe UI", system-ui, -apple-system, sans-serif;
    font-weight: 300;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1 0 auto;
}

h1, h2, h3, .navbar-brand {
    font-weight: 300;
    letter-spacing: 0.04em;
}

a {
    text-decoration: none;
}

.site-header {
    border-bottom: 1px solid var(--site-line);
}

.site-header .navbar-brand {
    font-size: 1.15rem;
    letter-spacing: 0.18em;
    text-transform: lowercase;
}

.site-header .nav-link {
    color: var(--site-muted);
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.site-header .nav-link:hover,
.site-header .nav-link.active {
    color: var(--site-fg);
}

.lang-switch .nav-link {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.site-footer {
    border-top: 1px solid var(--site-line);
    color: var(--site-muted);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    padding: 1.5rem 0;
}

.hero {
    padding-top: 6rem;
    padding-bottom: 6rem;
}

.hero h1 {
    font-size: clamp(2.25rem, 6vw, 4rem);
}

.login-card {
    padding-top: 5rem;
}

.form-control {
    background-color: transparent;
    border-color: #2c2c2f;
}

.form-control:focus {
    background-color: transparent;
    border-color: #6b6b70;
    box-shadow: none;
}

.admin-section {
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.admin-menu .list-group-item {
    background: transparent;
    border-color: var(--site-line);
    color: var(--site-fg);
}

.upload-box {
    border: 1px dashed #2c2c2f;
    padding: 1.25rem;
}

.admin-thumb img {
    background: #151517;
    width: 100%;
    height: auto;
}

.admin-thumb {
    position: relative;
}

.thumb-select {
    position: absolute;
    top: 0.4rem;
    left: 0.4rem;
    z-index: 1;
    margin: 0;
}

.edit-preview {
    background: #151517;
    width: 100%;
    height: auto;
}

.status-dot {
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    margin-right: 0.4rem;
}

.status-none { background: #4a4a4f; }
.status-draft { background: #d4a24c; }
.status-published { background: #5fae7a; }

textarea.form-control {
    background-color: transparent;
    border-color: #2c2c2f;
}

textarea.form-control:focus {
    background-color: transparent;
    border-color: #6b6b70;
    box-shadow: none;
}

.gallery-list li {
    border-bottom: 1px solid var(--site-line);
}

.gallery-cover {
    width: 5.5rem;
    height: 3.75rem;
    flex: none;
    background: #151517;
}

.gallery-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb-order {
    position: absolute;
    top: 0.4rem;
    left: 0.4rem;
    z-index: 1;
    min-width: 1.4rem;
    padding: 0 0.35rem;
    border-radius: 0.7rem;
    background: rgba(12, 12, 13, 0.75);
    color: var(--site-fg);
    font-size: 0.75rem;
    text-align: center;
}

.admin-thumb img.is-cover {
    outline: 2px solid var(--site-fg);
    outline-offset: -2px;
}

.pick-thumb {
    cursor: pointer;
}

.pick-thumb:has(input:checked) img {
    outline: 2px solid var(--site-fg);
    outline-offset: -2px;
}

/* ---------- Public site ---------- */

.intro {
    padding-top: 4.5rem;
    padding-bottom: 2.5rem;
}

.intro h1 {
    font-size: clamp(2rem, 5vw, 3.25rem);
    margin-bottom: 0.25rem;
}

.intro p {
    margin: 0;
    color: var(--site-muted);
    letter-spacing: 0.22em;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.page-head {
    padding-top: 2.5rem;
    padding-bottom: 2rem;
}

.page-head h1 {
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    margin: 0.75rem 0 0.5rem;
}

.page-lead {
    max-width: 42rem;
    color: var(--site-muted);
    margin: 0;
}

.back-link {
    color: var(--site-muted);
    font-size: 0.85rem;
    letter-spacing: 0.08em;
}

.back-link:hover {
    color: var(--site-fg);
}

.nav-search input {
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--site-line);
    color: var(--site-fg);
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    padding: 0.25rem 0.25rem;
    width: 7.5rem;
    transition: width 0.2s, border-color 0.2s;
}

.nav-search input:focus {
    outline: 0;
    border-color: #6b6b70;
    width: 11rem;
}

.nav-search input::placeholder {
    color: var(--site-muted);
    text-transform: uppercase;
}

/* One cover per gallery. */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
    gap: 2.25rem 1.5rem;
}

.gallery-card {
    display: block;
    color: var(--site-fg);
}

.gallery-card-image {
    aspect-ratio: 3 / 2;
    overflow: hidden;
    background: #151517;
}

.gallery-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease, opacity 0.3s;
}

.gallery-card:hover .gallery-card-image img {
    transform: scale(1.03);
}

.gallery-card-title {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-top: 0.75rem;
    letter-spacing: 0.06em;
}

.gallery-card-count {
    color: var(--site-muted);
    font-size: 0.8rem;
}

/* Rows of equal height that keep every photo's proportions, in the photographer's order. */
.photo-grid {
    --row-height: 15rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.photo-grid::after {
    content: "";
    flex-grow: 1000000;
}

.photo-tile {
    display: block;
    flex-grow: calc(var(--ar) * 100);
    flex-basis: calc(var(--ar) * var(--row-height));
    background: #151517;
    overflow: hidden;
}

.photo-tile img {
    display: block;
    width: 100%;
    height: auto;
    transition: opacity 0.25s;
}

.photo-tile:hover img {
    opacity: 0.85;
}

/* Single photo. */
.viewer {
    padding-top: 1.5rem;
    padding-bottom: 4rem;
}

.viewer-bar {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1.25rem;
}

.viewer-nav {
    display: flex;
    gap: 1rem;
    align-items: baseline;
    color: var(--site-muted);
    font-size: 0.9rem;
}

.viewer-nav a {
    color: var(--site-fg);
    font-size: 1.15rem;
}

.viewer-nav .disabled {
    opacity: 0.3;
    font-size: 1.15rem;
}

.viewer-figure {
    margin: 0;
}

.viewer-image {
    display: block;
    max-width: 100%;
    max-height: 74vh;
    width: auto;
    height: auto;
    margin: 0 auto;
}

.viewer-figure figcaption {
    max-width: 46rem;
    margin: 1.5rem auto 0;
}

.viewer-caption {
    font-size: 1.1rem;
    margin: 0 0 0.35rem;
}

.viewer-facts {
    color: var(--site-fg);
    opacity: 0.75;
    font-size: 0.9rem;
    margin: 0 0 0.75rem;
}

.viewer-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.9rem;
    margin: 0 0 0.75rem;
    font-size: 0.8rem;
}

.viewer-keywords a {
    color: var(--site-muted);
}

.viewer-keywords a:hover {
    color: var(--site-fg);
}

.viewer-exif {
    color: var(--site-muted);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    margin: 0;
}

.search-form {
    display: flex;
    gap: 0.5rem;
    max-width: 32rem;
    margin-top: 1.25rem;
}

@media (max-width: 575.98px) {
    .photo-grid {
        --row-height: 9rem;
    }
}

/* ---------- Films ---------- */

.film-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr));
    gap: 2.5rem 1.75rem;
}

.film-card {
    min-width: 0;
}

.film-play,
.film-player {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}

/* YouTube's fallback thumbnail is 4:3 with black bars; cropping to 16:9 removes them. */
.film-play img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s, transform 0.6s ease;
}

.film-play:hover img {
    opacity: 0.8;
    transform: scale(1.02);
}

.film-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4.25rem;
    height: 4.25rem;
    margin: -2.125rem 0 0 -2.125rem;
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    background: rgba(12, 12, 13, 0.45);
}

.film-play-icon::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -0.7rem 0 0 -0.4rem;
    border-style: solid;
    border-width: 0.7rem 0 0.7rem 1.15rem;
    border-color: transparent transparent transparent rgba(255, 255, 255, 0.95);
}

.film-frame {
    width: 100%;
    height: 100%;
    border: 0;
}

.film-title {
    font-size: 1.15rem;
    margin: 0.9rem 0 0.25rem;
}

.film-description {
    color: var(--site-muted);
    font-size: 0.9rem;
    margin: 0 0 0.6rem;
}

.film-thumb {
    aspect-ratio: 16 / 9;
    object-fit: cover;
}
