/*
Theme Name: Pics Gallery
Author: HomeLab
Description: Minimal, responsive nine-photo gallery with a keyboard-accessible lightbox. Preserves WordPress posts and legacy permalinks.
Version: 1.1.0
Requires at least: 6.0
Requires PHP: 8.0
Text Domain: pics-gallery
*/
:root {
  color-scheme: light;
  --bg: #f9f8f5;
  --surface: #eeece7;
  --text: #282723;
  --muted: #77746d;
  --line: #e4e1da;
  --accent: #b47d4b;
  --content-width: 1240px;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; line-height: 1.5; }
body.pics-modal-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
a:hover { color: #89613d; }
button, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; top: -100px; left: 20px; padding: 12px 18px; background: #fff; z-index: 10000; }
.skip-link:focus { top: 20px; }
.site-shell { min-height: 100vh; display: flex; flex-direction: column; }
.site-header { max-width: var(--content-width); width: calc(100% - 80px); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 40px 0 30px; border-bottom: 1px solid var(--line); }
.brand { letter-spacing: -.065em; font-weight: 760; font-size: clamp(2.2rem, 4vw, 3.2rem); line-height: .9; }
.brand-dot { color: var(--accent); }
.main-nav { display: flex; align-items: center; gap: 38px; font-size: .88rem; letter-spacing: .045em; }
.main-nav a { padding: 10px 0; color: var(--muted); }
.main-nav a:hover, .main-nav a[aria-current] { color: var(--text); }
.main-nav a[aria-current] { border-bottom: 1px solid var(--accent); }
.site-main { width: calc(100% - 80px); max-width: var(--content-width); margin: 0 auto; flex: 1; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 30px; padding: 64px 0 45px; }
.intro-simple { padding-bottom: 35px; }
.eyebrow { display: block; text-transform: uppercase; font-weight: 650; font-size: .69rem; color: var(--accent); letter-spacing: .2em; margin-bottom: 14px; }
.intro h1, .single-heading h1 { font-size: clamp(2.35rem, 5vw, 4.75rem); line-height: 1.07; letter-spacing: -.07em; font-weight: 620; margin: 0; }
.intro p { font-size: .98rem; color: var(--muted); margin: 19px 0 0; }
.archive-shortcut { font-size: .85rem; border-bottom: 1px solid var(--text); padding: 6px 0; white-space: nowrap; }
.archive-shortcut span { margin-left: 9px; }
.gallery-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 22px; row-gap: 41px; }
.photo-card { min-width: 0; }
.photo-link { position: relative; display: block; overflow: hidden; aspect-ratio: 4 / 3; background: var(--surface); border-radius: 3px; }
.gallery-image { width: 100%; height: 100%; display: block; object-fit: cover; object-position: center; transition: transform .5s cubic-bezier(.2,.75,.2,1), filter .35s; }
.photo-link:hover .gallery-image, .photo-link:focus-visible .gallery-image { transform: scale(1.045); filter: brightness(.8); }
.photo-overlay { position: absolute; right: 14px; bottom: 14px; color: white; font-size: .79rem; font-weight: 550; opacity: 0; transform: translateY(5px); transition: all .2s; background: rgba(0,0,0,.35); padding: 8px 11px; border-radius: 3px; }
.photo-link:hover .photo-overlay, .photo-link:focus-visible .photo-overlay { opacity: 1; transform: none; }
.photo-placeholder { display: grid; place-items: center; color: var(--muted); }
.photo-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-top: 13px; }
.photo-title { font-size: .94rem; font-weight: 590; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-meta time { font-size: .74rem; color: var(--muted); white-space: nowrap; }
.gallery-pagination { padding: 60px 0 70px; }
.gallery-pagination .nav-links { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 9px; }
.gallery-pagination .page-numbers { display: grid; place-items: center; min-width: 39px; height: 39px; padding: 0 12px; font-size: .86rem; color: var(--muted); border: 1px solid transparent; border-radius: 3px; }
.gallery-pagination a.page-numbers:hover, .gallery-pagination .page-numbers.current { color: var(--text); border-color: var(--line); background: #fff; }
.gallery-pagination .prev, .gallery-pagination .next { padding: 0 15px; color: var(--text); }
.empty-message { padding: 60px 0; color: var(--muted); }
.site-footer { width: calc(100% - 80px); max-width: var(--content-width); margin: 0 auto; border-top: 1px solid var(--line); padding: 28px 0 40px; display: flex; justify-content: space-between; gap: 15px; color: var(--muted); font-size: .76rem; }
/* Single photographs */
.single-main { max-width: 1050px; }
.breadcrumb { margin-top: 40px; color: var(--muted); font-size: .86rem; }
.single-heading { padding: 50px 0 35px; }
.single-photo { display: grid; position: relative; place-items: center; min-height: 380px; background: var(--surface); padding: 15px; }
.detail-image { max-height: min(76vh, 950px); width: auto; height: auto; object-fit: contain; display: block; }
.single-zoom { position: absolute; bottom: 20px; right: 20px; background: rgba(255,255,255,.9); padding: 9px 13px; font-size: .82rem; }
.single-description { color: var(--muted); max-width: 700px; padding: 22px 0 0; }
.single-description p { margin-top: 0; }
.post-neighbors { display: flex; justify-content: space-between; gap: 20px; margin: 58px 0 75px; border-top: 1px solid var(--line); padding-top: 23px; font-size: .89rem; }
/* Archive page and generic pages */
.archive-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 0 0 85px; }
.archive-panel { border: 1px solid var(--line); background: #fff; padding: clamp(24px, 4vw, 45px); min-width: 0; }
.archive-panel h2 { margin: 0; font-weight: 600; font-size: 1.6rem; letter-spacing: -.04em; }
.archive-panel p { color: var(--muted); font-size: .88rem; margin: 9px 0 20px; }
.archive-select { width: 100%; padding: 12px 15px; background: var(--bg); border: 1px solid var(--line); color: var(--text); }
.archive-months { columns: 2; column-gap: 20px; padding: 16px 0 0; margin: 0; list-style: none; }
.archive-months li { break-inside: avoid; padding: 8px 0; color: var(--muted); font-size: .88rem; }
.archive-months li a { color: var(--text); }
.archive-months li a:hover { color: var(--accent); }
.text-main { max-width: 1000px; }
.page-body { max-width: 750px; margin-bottom: 80px; }
.page-body a { text-decoration: underline; text-underline-offset: 3px; }
.page-body img { height: auto; }
.primary-link { display: inline-block; padding: 14px 19px; background: var(--text); color: white; }
.primary-link:hover { color: white; background: #4f483f; }
/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; padding: 50px 70px 30px; color: white; background: rgba(10,10,10,.97); }
.lightbox-top { position: absolute; top: 17px; left: 26px; right: 26px; display: flex; justify-content: space-between; align-items: center; }
.lightbox-counter { color: #bcbcbc; font-size: .78rem; }
.lightbox-close, .lightbox-arrow { color: #f5f5f5; background: transparent; border: 0; }
.lightbox-close { font-size: 2.2rem; width: 45px; height: 45px; line-height: 1; }
.lightbox-arrow { position: absolute; top: 50%; font-size: 1.7rem; width: 58px; height: 58px; transform: translateY(-50%); border-radius: 50%; }
.lightbox-arrow:hover, .lightbox-close:hover { background: rgba(255,255,255,.12); }
.lightbox-prev { left: 9px; }
.lightbox-next { right: 9px; }
.lightbox-figure { width: min(100%, 1500px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 13px; margin: 0; }
#pics-lightbox-img { display: block; width: auto; height: auto; max-width: 100%; max-height: calc(100dvh - 155px); object-fit: contain; }
.lightbox-caption { width: 100%; display: flex; justify-content: space-between; gap: 30px; align-items: center; font-size: .8rem; color: #c9c9c9; }
.lightbox-caption strong { color: white; font-weight: 570; margin-right: 15px; }
.lightbox-caption a { text-decoration: underline; text-underline-offset: 3px; color: #e2e2e2; white-space: nowrap; }
.lightbox-caption a:hover { color: white; }
@media (max-width: 980px) {
  .gallery-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .photo-meta { flex-direction: column; gap: 3px; }
  .site-header, .site-main, .site-footer { width: calc(100% - 52px); }
}
@media (max-width: 600px) {
  .site-header, .site-main, .site-footer { width: calc(100% - 32px); }
  .site-header { padding: 26px 0 22px; }
  .brand { font-size: 2.5rem; }
  .main-nav { gap: 20px; font-size: .82rem; }
  .intro { display: block; padding: 45px 0 27px; }
  .intro h1 { font-size: clamp(2.4rem, 9vw, 3.7rem); }
  .archive-shortcut { display: inline-block; margin-top: 23px; }
  .gallery-grid { column-gap: 11px; row-gap: 28px; }
  .photo-link { aspect-ratio: 3 / 4; }
  .photo-title { font-size: .85rem; }
  .photo-meta time { font-size: .7rem; }
  .photo-overlay { display: none; }
  .gallery-pagination { padding: 45px 0; }
  .gallery-pagination .page-numbers { min-width: 32px; height: 35px; padding: 0 6px; }
  .site-footer { padding-bottom: 28px; flex-wrap: wrap; }
  .single-heading { padding: 30px 0 25px; }
  .single-photo { min-height: 200px; padding: 7px; }
  .archive-columns { grid-template-columns: 1fr; gap: 16px; }
  .archive-months { columns: 1; }
  .lightbox { padding: 66px 8px 64px; }
  .lightbox-arrow { top: auto; bottom: 4px; transform: none; font-size: 1.35rem; }
  .lightbox-prev { left: 25px; }
  .lightbox-next { right: 25px; }
  .lightbox-top { left: 15px; right: 15px; top: 8px; }
  #pics-lightbox-img { max-height: calc(100dvh - 200px); }
  .lightbox-caption { display: block; padding: 0 12px; text-align: center; font-size: .74rem; }
  .lightbox-caption strong { display: block; margin: 0 0 3px; }
  .lightbox-caption a { display: inline-block; margin-top: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* v1.1: chronological archive, grouped into compact annual galleries. */
.year-navigation { display: flex; flex-wrap: wrap; gap: 9px; padding: 0 0 25px; }
.year-chip { display: inline-flex; align-items: center; gap: 13px; padding: 10px 14px; border-radius: 3px; background: #fff; border: 1px solid var(--line); font-size: .91rem; font-weight: 630; }
.year-chip:hover, .year-chip:focus-visible { border-color: var(--accent); }
.year-chip span { color: var(--muted); font-size: .76rem; font-weight: 450; }
.year-section { padding: 28px 0 45px; scroll-margin-top: 24px; border-top: 1px solid var(--line); }
.year-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; padding-bottom: 22px; }
.year-heading-text { display: flex; align-items: baseline; gap: 17px; }
.year-heading h2 { font-size: clamp(1.75rem, 3vw, 2.6rem); line-height: 1.1; letter-spacing: -.05em; font-weight: 600; margin: 0; }
.year-heading-text span { color: var(--muted); font-size: .81rem; }
.year-heading > a, .archive-back a { font-size: .82rem; color: var(--muted); border-bottom: 1px solid var(--line); }
.year-gallery-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 23px 13px; }
.year-gallery-single { padding-bottom: 45px; }
.archive-photo-card { min-width: 0; }
.archive-photo-link { display: block; aspect-ratio: 1 / 1; background: var(--surface); overflow: hidden; border-radius: 3px; }
.archive-image { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease, filter .35s ease; }
.archive-photo-link:hover .archive-image, .archive-photo-link:focus-visible .archive-image { transform: scale(1.045); filter: brightness(.9); }
.archive-photo-empty { display: grid; place-items: center; font-size: .75rem; color: var(--muted); }
.archive-photo-title { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .76rem; color: var(--muted); margin-top: 8px; }
.archive-photo-title:hover { color: var(--text); }
.archive-back { padding: 15px 0 70px; }
.archive-categories { padding: 32px 0 65px; border-top: 1px solid var(--line); }
.archive-categories h2 { margin: 0 0 15px; font-size: 1.14rem; font-weight: 600; }
.category-links { display: flex; gap: 8px; flex-wrap: wrap; }
.category-links a { display: inline-flex; align-items: center; gap: 10px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 3px; font-size: .82rem; }
.category-links span { color: var(--muted); font-size: .73rem; }
@media (max-width: 980px) {
  .year-gallery-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
}
@media (max-width: 600px) {
  .year-gallery-grid { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 17px 9px; }
  .year-heading { align-items: start; }
  .year-heading-text { flex-direction: column; gap: 4px; }
  .year-heading > a { font-size: .74rem; }
  .archive-photo-title { font-size: .72rem; }
}
@media (max-width: 390px) {
  .year-gallery-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
