/* ==========================================================================
   SEO / gallery rework: crawlable tiles, photo pages, topic hubs
   ========================================================================== */

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 10000;
    padding: 0.75rem 1.25rem;
    background: #111;
    color: #fff;
}
.skip-link:focus { left: 0; }

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
}

/* --- Hero ---------------------------------------------------------------- */
.hero-section {
    position: relative;
    height: 60vh;
    min-height: 380px;
    margin-top: 56px;
    overflow: hidden;
    background: #0a0a0a;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hero-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(60%);
}
.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.45) 100%);
}
.hero-content { position: relative; z-index: 1; text-align: center; color: #fff; }
.hero-title {
    font-family: 'Crimson Text', Georgia, serif;
    font-size: clamp(2.25rem, 6vw, 4.5rem);
    font-weight: 700;
    margin-bottom: 0.75rem;
    letter-spacing: -1px;
}
.hero-subtitle { font-size: clamp(0.95rem, 2vw, 1.25rem); font-weight: 300; opacity: 0.92; }

/* --- Page headers and breadcrumbs ---------------------------------------- */
.page-header {
    margin-top: 56px;
    padding: 3rem 0 1.5rem;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}
.page-header h1 {
    font-family: 'Crimson Text', Georgia, serif;
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    color: var(--text-primary);
}
.page-header .lead { color: var(--text-secondary); }

.breadcrumbs { font-size: 0.875rem; margin-bottom: 1rem; color: var(--text-secondary); }
.breadcrumbs a { color: var(--text-secondary); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs .sep { opacity: 0.5; margin: 0 0.25rem; }

/* --- Gallery grid -------------------------------------------------------- */
.gallery-section { padding: 2.5rem 0 4rem; background: var(--gallery-bg); }
.gallery-wrapper {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.15rem;
    max-width: 2000px;
    margin: 0 auto;
}
.gallery-item {
    position: relative;
    display: block;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--bg-tertiary);
    border: 1px solid var(--image-border);
    text-decoration: none;
}
.gallery-item:hover { box-shadow: 0 10px 30px var(--shadow-color); }
.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), filter 0.3s ease;
}
.gallery-item:hover .gallery-image { transform: scale(1.04); filter: grayscale(0%); }
.image-overlay {
    position: absolute;
    inset: auto 0 0 0;
    display: block;
    padding: 1.5rem 0.75rem 0.6rem;
    background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.8) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.image-caption {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #fff;
    font-size: 0.72rem;
    line-height: 1.3;
}
@media (hover: hover) {
    .gallery-item:hover .image-overlay { opacity: 1; }
}

/* --- Pagination ---------------------------------------------------------- */
.gallery-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: center;
    margin-top: 2.5rem;
}
.page-btn {
    min-width: 2.5rem;
    padding: 0.5rem 0.9rem;
    text-align: center;
    text-decoration: none;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    background: var(--bg-primary);
    border-radius: 2px;
}
.page-btn:hover { background: var(--bg-tertiary); }
.page-btn.current { background: var(--text-primary); color: var(--bg-primary); font-weight: 600; }

/* --- Long-form sections -------------------------------------------------- */
.about-section, .prose-page {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.prose-page { margin-top: 56px; padding: 3rem 0 4rem; }
.prose-page h1 {
    font-family: 'Crimson Text', Georgia, serif;
    font-size: clamp(1.9rem, 4vw, 2.75rem);
    color: var(--text-primary);
    margin-bottom: 1rem;
}
.about-section h2, .prose-page h2 {
    font-family: 'Crimson Text', Georgia, serif;
    font-size: clamp(1.4rem, 3vw, 2rem);
    color: var(--text-primary);
    margin: 2rem 0 1rem;
}
.about-section p, .prose-page p { line-height: 1.8; margin-bottom: 1.25rem; }

.topic-grid { list-style: none; padding: 0; display: grid; gap: 0.5rem;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.topic-grid a {
    display: flex;
    justify-content: space-between;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 2px;
}
.topic-grid a:hover { background: var(--bg-tertiary); }
.topic-grid span { opacity: 0.6; }

.licence-note {
    padding: 1rem 1.25rem;
    border-left: 3px solid var(--text-primary);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* --- Photo page ---------------------------------------------------------- */
.photo-page { margin-top: 56px; padding: 2rem 0 4rem; background: var(--bg-primary); }
.photo-title {
    font-family: 'Crimson Text', Georgia, serif;
    font-size: clamp(1.5rem, 3.5vw, 2.4rem);
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}
.photo-figure { margin: 0 0 1.5rem; }
.photo-main {
    display: block;
    width: 100%;
    height: auto;
    max-height: 78vh;
    object-fit: contain;
    background: #0a0a0a;
}
.photo-figure figcaption {
    margin-top: 0.75rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-style: italic;
}
.photo-meta { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; }
.photo-meta dt { font-weight: 600; color: var(--text-primary); }
.photo-meta dd { margin: 0; color: var(--text-secondary); }

.photo-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin: 3rem 0 2rem;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
}
.photo-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 48%;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
}
.photo-nav-link.next { margin-left: auto; text-align: right; }
.photo-nav-link img { width: 80px; height: 80px; object-fit: cover; flex: 0 0 auto; }
.photo-nav-link small { display: block; opacity: 0.6; text-transform: uppercase;
    letter-spacing: 0.05em; font-size: 0.7rem; }
.photo-nav-link:hover { text-decoration: underline; }

.related-photos { margin-top: 2rem; }
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.4rem;
    margin-top: 1rem;
}
.related-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; filter: grayscale(100%);
    transition: filter 0.3s ease; }
.related-grid a:hover img { filter: grayscale(0%); }

/* --- Lightbox ------------------------------------------------------------ */
.lightbox {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg, rgba(0,0,0,0.95));
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.lightbox.active { display: flex; }
.lightbox-content { max-width: 92vw; max-height: 88vh; }
.lightbox-content img { max-width: 100%; max-height: 88vh; object-fit: contain; }
.lightbox-close, .lightbox-nav {
    position: absolute;
    width: 48px; height: 48px;
    background: rgba(255,255,255,0.12);
    border: 2px solid rgba(255,255,255,0.35);
    color: #fff;
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}
.lightbox-close { top: 1.5rem; right: 1.5rem; }
.lightbox-nav { top: 50%; transform: translateY(-50%); }
.lightbox-prev { left: 1.5rem; }
.lightbox-next { right: 1.5rem; }
.lightbox-permalink {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    background: rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.3);
    padding: 0.5rem 1.1rem;
    border-radius: 2px;
    text-decoration: none;
    font-size: 0.9rem;
}
.lightbox-permalink:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* --- Footer -------------------------------------------------------------- */
.footer-muted { color: #adb5bd; }
.footer-links { margin: 0; }
.footer-links li { margin-bottom: 0.4rem; }
.footer-links a { color: #adb5bd; text-decoration: none; font-size: 0.925rem; }
.footer-links a:hover { color: #fff; text-decoration: underline; }

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 1600px) { .gallery-wrapper { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 1400px) { .gallery-wrapper { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 992px)  { .gallery-wrapper { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) {
    .gallery-wrapper { grid-template-columns: repeat(2, 1fr); }
    .gallery-item .image-overlay { opacity: 1; }
    .photo-nav { flex-direction: column; }
    .photo-nav-link, .photo-nav-link.next { max-width: 100%; margin-left: 0; text-align: left; }
    .photo-nav-link.next { flex-direction: row-reverse; justify-content: flex-end; }
    .lightbox-close, .lightbox-nav { width: 44px; height: 44px; }
    .lightbox-prev { left: 0.5rem; }
    .lightbox-next { right: 0.5rem; }
}
