/* Structural styles only — colors live in theme.css so the admin
   color settings can change the look without touching this file. */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--pg-bg);
  color: var(--pg-ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img { max-width: 100%; display: block; }

.wrap {
  max-width: var(--pg-page-width, 1140px);
  margin: 0 auto;
  padding-left: 28px;
  padding-right: 28px;
}

/* ---- Top nav (every public page) ---- */
.top-nav {
  background: var(--pg-bg-raised);
  border-bottom: 1px solid var(--pg-line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.top-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  padding-bottom: 12px;
  gap: 16px;
}
.top-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--pg-ink);
  min-width: 0;
}
.top-nav-logo { width: 30px; height: 30px; flex: 0 0 auto; }
.top-nav-wordmark {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-nav-tld { font-weight: 500; color: var(--pg-ink-dim); font-size: 0.9em; }
.top-nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--pg-line);
  border-radius: 6px;
  background: none;
  cursor: pointer;
  flex: 0 0 auto;
}
.top-nav-toggle span { display: block; width: 16px; height: 2px; background: var(--pg-ink); margin: 0 auto; }
.top-nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
}
.top-nav-links a {
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--pg-ink-dim);
  transition: color 0.15s ease;
}
.top-nav-links a:hover { color: var(--pg-accent); }

@media (max-width: 640px) {
  .top-nav-wordmark { font-size: 0.95rem; max-width: 45vw; }
  .top-nav-toggle { display: flex; }
  .top-nav-links {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    background: var(--pg-bg-raised);
    border-bottom: 1px solid var(--pg-line);
    padding: 8px 18px 14px;
  }
  .top-nav-links.is-open { display: flex; }
  .top-nav-links a { padding: 8px 0; width: 100%; }
  .top-nav-inner { position: relative; }
}

/* ---- Header ---- */
.site-header {
  padding: 32px 0 20px;
}
.site-header--compact { padding: 18px 0; }
.site-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: clamp(2rem, 4.5vw, 3rem);
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.site-tagline {
  color: var(--pg-ink-dim);
  font-size: 1.02rem;
  margin: 0;
}
.back-link {
  text-decoration: none;
  font-size: 0.9rem;
  color: var(--pg-ink-dim);
  font-weight: 500;
  transition: color 0.15s ease;
}
.back-link.is-disabled { opacity: 0.4; cursor: not-allowed; }

.category-view-toggle {
  display: flex;
  gap: 24px;
  margin-top: 20px;
  border-bottom: 1px solid var(--pg-line);
}
.category-view-tab {
  padding: 10px 2px 12px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--pg-ink-dim);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.category-view-tab:hover { color: var(--pg-ink); }
.category-view-tab.is-active { color: var(--pg-accent); border-bottom-color: var(--pg-accent); font-weight: 600; }

.album-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.album-jump select {
  font-family: 'Inter', sans-serif;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--pg-ink-dim);
  background: var(--pg-bg-raised);
  border: 1px solid var(--pg-line);
  border-radius: 6px;
  padding: 6px 10px;
  max-width: 240px;
  cursor: pointer;
}
.album-jump select:hover { color: var(--pg-accent); }
.back-link:hover { color: var(--pg-accent); }

/* ---- Album grid (contact sheet of albums) ---- */
.section-heading {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--pg-ink);
  margin: 48px 0 20px;
  padding-top: 32px;
  border-top: 1px solid var(--pg-line);
}
/* First heading on a page (e.g. homepage "Featured work") — no divider to echo, so skip the top border/gap. */
.section-heading--flush {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 26px;
  padding: 24px 0 80px;
}
.album-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--pg-ink);
  border-radius: 10px;
  overflow: hidden;
  background: var(--pg-bg-raised);
  border: 1px solid var(--pg-line);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.album-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(0,0,0,0.08);
}
.album-thumb {
  display: block;
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--pg-line);
  overflow: hidden;
}
.album-card-badge {
  display: block;
  padding: 6px 18px;
  background: var(--pg-accent, #2f5233);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
}
.album-updated-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  padding: 4px 10px;
  border-radius: 999px;
  background: #d64545;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.album-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.album-card:hover .album-thumb img { transform: scale(1.04); }
.album-thumb-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pg-ink-dim);
  font-size: 0.85rem;
}
.album-info {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.album-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 1.15rem;
}
.album-count {
  font-size: 0.82rem;
  color: var(--pg-ink-dim);
}

.empty-state {
  padding: 100px 20px;
  text-align: center;
}
.empty-title { font-family: 'Fraunces', Georgia, serif; font-size: 1.4rem; margin: 0 0 8px; }
.empty-sub { color: var(--pg-ink-dim); margin: 0; }

/* ---- Album view ---- */
.album-view { padding: 24px 0 90px; }
.album-header { margin-bottom: 24px; }
.album-page-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.8rem, 3.6vw, 2.6rem);
  margin: 0 0 16px;
}
.album-description { font-size: 1.05rem; color: var(--pg-ink); line-height: 1.65; }
.album-description p { margin: 0 0 1em; }
.album-description h1, .album-description h2, .album-description h3,
.album-description h4, .album-description h5, .album-description h6 {
  font-family: 'Fraunces', Georgia, serif;
  margin: 1em 0 0.5em;
}
.album-description img { max-width: 100%; height: auto; border-radius: 6px; margin: 0.5em 0; }
.album-description a { color: var(--pg-accent); }
.album-description .ql-size-small { font-size: 0.75em; }
.album-description .ql-size-large { font-size: 1.5em; }
.album-description .ql-size-huge { font-size: 2.5em; }

/* ---- Project page "newspaper" lead: description on the left, a few
   images floated right that the text wraps around; once the text runs
   out, the rest of the photos flow full-width below. ---- */
.project-lead {
  overflow: hidden; /* clearfix — stretches to contain the floated image column */
  margin-bottom: 32px;
}
.project-lead-images {
  float: right;
  width: 42%;
  max-width: 420px;
  margin: 0 0 20px 32px;
}
.project-lead-images .photo-cell-wrap {
  margin-bottom: 16px;
}
.project-lead-images .photo-cell-wrap:last-child {
  margin-bottom: 0;
}
@media (max-width: 720px) {
  .project-lead-images {
    float: none;
    width: 100%;
    max-width: none;
    margin: 0 0 20px;
  }
}

/* A project write-up built from admin-authored paragraph+image blocks
   (see project-blocks-list in admin/edit-project.php) — same wrap effect
   as .project-lead, but each block can pick its own image and side. */
.project-block {
  overflow: hidden; /* clearfix */
  margin-bottom: 32px;
}
.project-block-image {
  width: 42%;
  max-width: 420px;
}
.project-block--right .project-block-image {
  float: right;
  margin: 0 0 20px 32px;
}
.project-block--left .project-block-image {
  float: left;
  margin: 0 32px 20px 0;
}
@media (max-width: 720px) {
  .project-block-image {
    float: none !important;
    width: 100%;
    max-width: none;
    margin: 0 0 20px !important;
  }
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(var(--pg-grid-columns, 4), 1fr);
  gap: 14px;
}
.photo-grid--featured { grid-template-columns: repeat(5, 1fr); }
.photo-cell {
  all: unset;
  cursor: zoom-in;
  display: block;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  overflow: hidden;
  background: var(--pg-line);
}
.photo-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.photo-cell:hover img { transform: scale(1.05); }

/* ---- Photo collage (homepage Featured Work, Current Projects cards) ---- */
.photo-collage {
  display: grid;
  gap: 4px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--pg-line);
}
.photo-collage-item {
  all: unset;
  display: block;
  overflow: hidden;
  aspect-ratio: auto;
  cursor: zoom-in;
}
.photo-collage-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}
.photo-collage-item:hover img { transform: scale(1.05); }

.photo-collage--1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.photo-collage--2 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.photo-collage--3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.photo-collage--3 .photo-collage-item:first-child { grid-row: 1 / 3; }
.photo-collage--4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }

.album-thumb .photo-collage {
  width: 100%;
  height: 100%;
  border-radius: 0;
}

.photo-cell-wrap { display: flex; flex-direction: column; gap: 6px; }
.photo-cell-caption {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--pg-ink-dim);
}

.not-found { padding: 100px 0; text-align: center; }

/* ---- Pagination ---- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 20px;
  margin: 36px auto 0;
  font-size: 0.9rem;
  text-align: center;
}
.btn-pagination {
  text-decoration: none;
  color: var(--pg-ink);
  border: 1px solid var(--pg-line);
  border-radius: 6px;
  padding: 8px 16px;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.btn-pagination:hover { border-color: var(--pg-accent); color: var(--pg-accent); }
.btn-pagination.is-disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
.home-cta { display: inline-block; margin-top: 8px; }
.pagination-status { color: var(--pg-ink-dim); font-size: 0.82rem; }
.pagination-status--solo { text-align: center; margin-top: 1.5rem; }

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--pg-line);
  padding: 24px 0;
  color: var(--pg-ink-dim);
  font-size: 0.85rem;
}

/* ---- Lightbox ---- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 15, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 40px;
}
.lightbox.is-open { display: flex; }
.lightbox.has-filmstrip { flex-direction: column; gap: 16px; }

.lightbox-stage {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}
.lightbox-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; cursor: pointer; }

.lightbox-caption {
  flex-shrink: 0;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 12px;
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  line-height: 1.5;
}

.lightbox-counter-row {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding-top: 8px;
}
.lightbox-counter {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
}
.lightbox-filmstrip-toggle {
  display: inline-block;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
}
.lightbox-filmstrip-toggle:hover { border-color: rgba(255, 255, 255, 0.7); color: #fff; }
.lightbox.filmstrip-hidden .lightbox-filmstrip-row { display: none; }

.lightbox-filmstrip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  max-width: 100%;
}
.lightbox-filmstrip-nav {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 1.6rem;
  padding: 4px 6px;
  opacity: 0.7;
  line-height: 1;
}
.lightbox-filmstrip-nav:hover { opacity: 1; }
.lightbox-filmstrip {
  display: flex;
  flex-shrink: 1;
  flex-direction: row;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  scrollbar-width: none;     /* Firefox */
  -ms-overflow-style: none;  /* old Edge */
  max-width: 100%;
  max-height: 90px;
  padding-bottom: 4px;
  gap: 8px;
}
.lightbox-filmstrip::-webkit-scrollbar { display: none; }  /* Chrome/Safari */
.lightbox-filmstrip-thumb {
  border: none;
  padding: 0;
  cursor: pointer;
  background: none;
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 4px;
  overflow: hidden;
  opacity: 0.5;
  outline: 2px solid transparent;
  outline-offset: -2px;
  transition: opacity 0.15s ease, outline-color 0.15s ease;
}
.lightbox-filmstrip-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lightbox-filmstrip-thumb:hover { opacity: 0.8; }
.lightbox-filmstrip-thumb.is-active { opacity: 1; outline-color: #fff; }

.lightbox-close, .lightbox-nav {
  position: absolute;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
}
.lightbox-close { top: 20px; right: 24px; font-size: 0.95rem; z-index: 3; }
.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.2rem;
  padding: 10px 16px;
  opacity: 0.75;
  z-index: 2;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.lightbox-nav:hover { opacity: 1; }
.lightbox-prev { left: 10px; }
.lightbox-next { right: 10px; }

/* Opt-in via the "wide click zones" setting — spans the full height instead
   of just the small arrow icon, with the width set inline from that setting. */
.lightbox-nav--wide {
  top: 0;
  bottom: 0;
  height: 100%;
  transform: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
}
.lightbox-nav--wide:hover { opacity: 1; background: rgba(255, 255, 255, 0.06); }
.lightbox-nav--wide.lightbox-prev { left: 0; }
.lightbox-nav--wide.lightbox-next { right: 0; }
.lightbox-next { right: 0; }

@media (max-width: 640px), (max-height: 500px) {
  .lightbox-filmstrip-thumb { width: 56px; height: 56px; }
  .lightbox { padding: 16px; }
  .lightbox-close { top: 10px; right: 12px; }
  .lightbox-nav { font-size: 1.8rem; }
  .lightbox-nav--wide { width: 56px !important; }
}

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--pg-accent);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .wrap { padding-left: 18px; padding-right: 18px; }
  .site-header { padding: 34px 0 24px; }
  .photo-grid { grid-template-columns: repeat(min(2, var(--pg-grid-columns, 4)), 1fr); }
  .photo-grid--featured { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 641px) and (max-width: 900px) {
  .photo-grid--featured { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---- Contact form ---- */
.contact-form-wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 0 90px;
}
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.contact-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--pg-ink-dim);
}
.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--pg-line);
  background: var(--pg-bg-raised);
  color: var(--pg-ink);
}
.contact-form textarea { resize: vertical; }
.contact-form input:focus, .contact-form textarea:focus {
  outline: none;
  border-color: var(--pg-accent);
}
.contact-form-submit {
  align-self: flex-start;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: var(--pg-accent);
  border: 1px solid var(--pg-accent);
  border-radius: 6px;
  padding: 10px 20px;
  transition: opacity 0.15s ease;
}
.contact-form-submit:hover { opacity: 0.88; }
.contact-form-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.contact-form-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.form-alert {
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 0.9rem;
  margin-bottom: 18px;
}
.form-alert--ok { background: rgba(70, 160, 100, 0.15); color: #2f7a4d; }
.form-alert--error { background: rgba(200, 70, 70, 0.15); color: #a83c3c; }

/* ---- Message thread (contact form conversations) ---- */
.thread { display: flex; flex-direction: column; gap: 7px; }
.thread-message {
  max-width: 90%;
  padding: 7px 11px;
  border-radius: 8px;
  background: var(--pg-bg-raised);
  border: 1px solid var(--pg-line);
}
.thread-message--admin {
  align-self: flex-end;
  background: var(--pg-accent);
  border-color: var(--pg-accent);
  color: #fff;
}
.thread-message--admin .thread-message-meta { color: rgba(255, 255, 255, 0.75); }
.thread-message-meta {
  font-size: 0.68rem;
  color: var(--pg-ink-dim);
  margin-bottom: 2px;
}
.thread-message-body { font-size: 0.86rem; line-height: 1.4; }
.thread-message-body p { margin: 0.3em 0; }
.thread-message-body p:first-child { margin-top: 0; }
.thread-message-body p:last-child { margin-bottom: 0; }
