/*
Theme Name: Aaron Photography
Author: Aaron F. Stone
Description: Custom theme for Aaron F. Stone Photography Portfolio.
Version: 2.0
License: GNU General Public License v2 or later
Text Domain: aaron-photography
*/

/* ── Design tokens ───────────────────────────── */
:root {
  --bg:           #0d1220;
  --surface:      #151b26;
  --surface-2:    #181c25;
  --btn:          #212634;
  --btn-hover:    #10131b;
  --text:         #e6e6e6;
  --text-muted:   #e4e9fc;
  --text-dim:     #7d8ca6;
  --accent:       #4a9eff;
  --radius:       1rem;
  --radius-sm:    0.5rem;
  --radius-pill:  1.5rem;
  --wrap:         1400px;
  --wrap-narrow:  1000px;
  --gap:          1.5rem;
}

/* ── Reset ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Utility ─────────────────────────────────── */
.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gap);
}
.wrap--narrow { max-width: var(--wrap-narrow); }
.screen-reader-text {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* ── Admin bar offset ────────────────────────── */
.admin-bar .site-header { top: 32px; }
@media screen and (max-width: 782px) {
  .admin-bar .site-header { top: 46px; }
}

/* ── Header ──────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg);
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 1rem;
}

/* Logo */
.site-logo {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  color: var(--text) !important;
  text-decoration: none !important;
  flex-shrink: 0;
}
.logo-name {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.logo-sub {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

/* Nav */
.site-nav { display: flex; align-items: center; gap: 0.25rem; }
.nav-menu { display: flex; align-items: center; list-style: none; gap: 0.1rem; }
.nav-menu a {
  display: block;
  padding: 0.45rem 0.9rem;
  color: var(--text);
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}
.nav-menu a:hover,
.nav-menu .current-menu-item > a,
.nav-menu .current_page_item > a {
  color: var(--accent);
  background: rgba(74,158,255,0.08);
  text-decoration: none;
}
.nav-menu .menu-item-has-children > a::after { content: ' ▾'; font-size: 0.7em; }

/* ── Dropdown sub-menus ──────────────────────── */
.nav-menu li { position: relative; }
.nav-menu .sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  margin: 0;
  padding: 0.4rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  z-index: 200;
}
.nav-menu .sub-menu a { white-space: nowrap; }
/* Reveal on hover (desktop) or when JS marks the item open (touch) */
.nav-menu .menu-item-has-children:hover > .sub-menu,
.nav-menu .menu-item-has-children.is-open > .sub-menu { display: block; }

/* Search button */
.nav-search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  flex-shrink: 0;
}
.nav-search-btn:hover { background: var(--btn); }
.nav-search-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  order: 1;
}
.nav-toggle span { display: block; width: 24px; height: 2px; background: var(--text); border-radius: 2px; transition: 0.2s; }

/* Search overlay */
.search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(13,18,32,0.94);
  align-items: flex-start;
  justify-content: center;
  padding-top: 20vh;
}
.search-overlay.is-open { display: flex; }
.search-overlay form { display: flex; gap: 0.5rem; width: min(600px, 90vw); }
.search-overlay input[type="search"] {
  flex: 1;
  padding: 0.85rem 1.25rem;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1.2rem;
  outline: none;
}
.search-overlay input[type="search"]::placeholder { color: var(--text-dim); }
.search-overlay button[type="submit"] {
  padding: 0.85rem 1.5rem;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}
.search-overlay-close {
  position: absolute;
  top: 1.5rem; right: 1.5rem;
  background: none; border: none;
  color: var(--text); font-size: 2rem;
  cursor: pointer; line-height: 1;
}

/* ── Main ────────────────────────────────────── */
.site-main { flex: 1; padding-block: 2rem; }

/* ── Generic page / post content ─────────────── */
.entry-content { line-height: 1.75; }
.entry-content h1, .entry-content h2, .entry-content h3 { margin-block: 1.5rem 0.75rem; }
.entry-content p { margin-bottom: 1rem; }
.entry-content a { color: var(--accent); }
.page-title {
  font-size: 2rem;
  text-align: center;
  margin: 1.5rem 0 2rem;
}

/* ── Archive / listing pages ─────────────────── */
.page-heading {
  font-size: 2.4rem;
  text-align: center;
  margin: 2.5rem 0 1.5rem;
}
.archive-intro {
  text-align: center;
  max-width: 60ch;
  margin: -0.5rem auto 2rem;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.6;
}
.photo-related {
  margin: 3rem auto 1rem;
}
.photo-related h2 {
  font-size: 1.4rem;
  text-align: center;
  margin: 0 0 1.25rem;
}
.term-badge {
  background: var(--surface);
  border-radius: var(--radius);
  color: var(--text-muted);
  display: inline-block;
  font-weight: 500;
  margin-left: 0.5rem;
  padding: 0.4rem 1rem;
}
.back-link { text-align: center; margin-bottom: 2rem; }
.back-link a {
  display: inline-block;
  background: var(--surface);
  color: var(--text-muted);
  border-radius: var(--radius-pill);
  padding: 0.5rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  transition: background 0.18s, color 0.18s;
}
.back-link a:hover { background: var(--text-muted); color: var(--surface); text-decoration: none; }

/* ── Photo grid ──────────────────────────────── */
/* Uniform 16:9 cards, same footprint as the Locations/Cameras tiles. */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0 3rem;
}
/* Scoped to anchors so it only styles gallery thumbnails — the
   [random_attachment_tags] shortcode reuses the .photo-card class on a <div>. */
a.photo-card {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: 0 2px 20px rgba(0,0,0,0.2);
  transition: transform 0.2s cubic-bezier(.4,2,.5,1), box-shadow 0.2s;
  background: var(--btn);
}
a.photo-card:hover { transform: scale(1.02); box-shadow: 0 6px 30px rgba(0,0,0,0.3); text-decoration: none; }
a.photo-card img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }

/* ── Entry content block spacing ─────────────── */
/* Adds breathing room between the hero image and the gallery below it */
.entry-content > * + * { margin-top: 2.5rem; }
.entry-content > *:first-child { margin-top: 0; }

/* Hide stray empty blocks (e.g. a leftover empty columns block) and empty
   paragraphs that WordPress' auto-formatting can leave behind — these are the
   usual cause of unexplained vertical gaps on block-editor pages. */
.entry-content p:empty { display: none; }
.entry-content .wp-block-columns:has(> .wp-block-column:only-child:empty) { display: none; }
.entry-content .wp-block-column:empty { display: none; }

/* ── Tag cloud ───────────────────────────────── */
.tag-cloud-section {
  text-align: center;
  padding: 0.5rem 0 1.5rem;
}
.tag-cloud-section h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 1.25rem; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.tag-pill {
  display: inline-block;
  padding: 0.3rem 0.9rem;
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 20px;
  font-size: 0.93rem;
  transition: background 0.15s, color 0.15s;
}
.tag-pill:hover { background: var(--btn-hover); color: #fff; text-decoration: none; }

/* ── Single photo page ───────────────────────── */
.single-photo-wrap { max-width: 1200px; margin: 0 auto; padding: 0 var(--gap); }
.photo-title { font-size: 2.1rem; text-align: center; margin: 2rem 0 1.5rem; font-weight: 700; }
.photo-main-image { text-align: center; margin-bottom: 1.5rem; }
.photo-main-image img {
  max-width: 100%;
  /* Cap height so tall portraits don't dominate the page; landscapes are
     unaffected (still limited by width). */
  max-height: 80vh;
  width: auto;
  height: auto;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  margin-inline: auto;
}

/* Nav row */
.photo-nav-row {
  max-width: 950px;
  margin: 0 auto 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.4rem;
  flex-wrap: wrap;
}
.photo-nav-btn {
  display: inline-block;
  padding: 0.75em 1.75em;
  font-family: inherit;   /* <button> doesn't inherit the site font by default */
  font-size: 1rem;
  line-height: 1.2;
  min-width: 140px;
  background: var(--btn);
  color: var(--text);
  border: none;
  border-radius: var(--radius);
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: background 0.18s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  -webkit-appearance: none;
  appearance: none;
}
.photo-nav-btn:hover { background: var(--btn-hover); color: #fff; text-decoration: none; }

/* Description */
.photo-description {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 2.5rem;
  text-align: center;
  font-size: 1.1rem;
  line-height: 1.65;
  color: var(--text-muted);
}
.photo-description strong { display: block; margin-bottom: 0.75rem; }

/* Series thumbnails */
.photo-series { text-align: center; margin-bottom: 2.5rem; }
.photo-series p { font-size: 1.1rem; margin-bottom: 1rem; }
.series-thumbs { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.85rem; }
.series-thumb { display: inline-block; border-radius: var(--radius-sm); overflow: hidden; transition: transform 0.15s, box-shadow 0.15s; }
.series-thumb img { display: block; width: 110px; border-radius: var(--radius-sm); }
a.series-thumb:hover { transform: scale(1.05); }
/* Current photo: larger + accent ring so the viewer can see where they are */
.series-thumb--current {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 18px rgba(74,158,255,0.35);
}
.series-thumb--current img { width: 168px; }

/* Map + EXIF */
.photo-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-bottom: 2.5rem;
  justify-content: center;
}
/* Left column = map + location caption beneath it */
.photo-map-col {
  flex: 1 1 48%;
  min-width: 300px;
  display: flex;
  flex-direction: column;
}
.photo-map-wrap {
  width: 100%;
  background: var(--surface-2);
  border-radius: var(--radius);
  overflow: hidden;
  height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  /* Contain Leaflet's internal high z-indexes so the map can't render
     over the sticky header when scrolling. */
  position: relative;
  z-index: 0;
  isolation: isolate;
}
#photo-map { width: 100%; height: 100%; }
.photo-exif {
  flex: 1 1 48%;
  min-width: 220px;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 2rem;
  color: var(--text);
  font-size: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.exif-camera { font-size: 1.45rem; font-weight: 700; margin-bottom: 0.25rem; }
.photo-exif a { color: var(--text); text-decoration: underline; }

/* Tags */
.photo-tags {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 2.5rem;
  text-align: center;
  color: var(--text-muted);
}
.photo-tags strong { display: block; margin-bottom: 0.75rem; }

/* Location caption beneath the map — rounded box, centered white text links */
.photo-location {
  margin: 0.85rem 0 0;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  text-align: center;
  font-size: 1.05rem;
  line-height: 1.5;
  color: #fff;
}
.photo-location-text a { color: #fff; text-decoration: none; }
.photo-location-text a:hover { text-decoration: underline; }
.photo-location-text span { color: #fff; }
.photo-location-gmaps {
  display: inline-block;
  margin-top: 0.7rem;
  padding: 0.45rem 1.1rem;
  background: var(--btn);
  border-radius: 20px;
  color: #fff !important;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background 0.15s;
}
.photo-location-gmaps:hover { background: var(--btn-hover); color: #fff; text-decoration: none; }

/* GLightbox overrides */
.glightbox-container { background: rgba(13,18,32,0.9) !important; }
.glightbox-clean .gclose {
  font-size: 2.5rem !important;
  color: #23232a !important;
  opacity: 1 !important;
  width: 3.5rem !important; height: 3.1rem !important;
  background: #fff !important;
  border-radius: var(--radius) !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.13);
  display: flex !important;
  align-items: center; justify-content: center;
  right: 30px !important; top: 26px !important;
  border: none !important;
  z-index: 99999 !important;
}
.glightbox-clean .gclose:after {
  content: 'X' !important;
  font-size: 2.2rem !important;
  color: #23232a !important;
  display: block !important;
  width: 100%; text-align: center !important;
  line-height: 3.1rem !important;
}
.glightbox-description { display: none !important; }

/* ── Footer ──────────────────────────────────── */
.site-footer {
  background: var(--bg);
  border-top: 1px solid rgba(255,255,255,0.07);
  padding: 2rem 0;
  font-size: 0.875rem;
  color: var(--text-dim);
}
.footer-inner { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; flex-wrap: wrap; }
.footer-left p { margin-bottom: 0.3rem; }
.footer-left a { color: var(--accent); }
.footer-version { font-size: 0.78rem; margin-top: 0.4rem !important; color: var(--btn); }
.footer-social { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.footer-social a { display: flex; align-items: center; gap: 0.4rem; color: var(--text-dim); font-size: 0.88rem; transition: color 0.15s; }
.footer-social a:hover { color: var(--text); text-decoration: none; }
.footer-social svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ── 404 ─────────────────────────────────────── */
.not-found { text-align: center; padding: 6rem var(--gap); }
.not-found h1 { font-size: 3rem; margin-bottom: 1rem; }
.not-found p { font-size: 1.2rem; color: var(--text-dim); margin-bottom: 2rem; }
.not-found a {
  display: inline-block;
  padding: 0.75rem 2rem;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
}
.not-found a:hover { text-decoration: none; opacity: 0.9; }

/* ── Responsive ──────────────────────────────── */
@media (max-width: 768px) {
  .nav-toggle { display: flex; }

  .site-nav {
    position: relative;
  }
  .site-nav .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--surface);
    flex-direction: column;
    padding: 0.75rem;
    gap: 0.15rem;
    border-radius: var(--radius);
    border: 1px solid rgba(255,255,255,0.07);
    min-width: 180px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  }
  .site-nav .nav-menu.is-open { display: flex; }
  .site-nav .nav-menu a { padding: 0.6rem 1rem; }

  /* Sub-menus render inline (indented) inside the mobile panel, not floating */
  .site-nav .nav-menu .sub-menu {
    position: static;
    display: none;
    border: none;
    box-shadow: none;
    background: transparent;
    padding: 0 0 0 1rem;
    min-width: 0;
  }
  .site-nav .nav-menu .menu-item-has-children.is-open > .sub-menu { display: block; }

  .photo-nav-btn { min-width: unset; width: 100%; max-width: 380px; }
  .photo-nav-row { gap: 0.75rem; }
  .photo-meta-row { flex-direction: column; }
  .photo-map-col, .photo-exif { flex: unset; min-width: unset; width: 100%; }

  .footer-inner { flex-direction: column; align-items: flex-start; }
  .page-heading { font-size: 1.8rem; }
}
