/* photo.longwalkhome.net
   Editorial, light, generous. Photos lead, type recedes.
   Cormorant Garamond for display, Inconsolata for metadata.
   ----------------------------------------------------------- */

/* --- Tokens ------------------------------------------------- */

:root {
  --bg: #fafaf7;
  --bg-elev: #ffffff;
  --ink: #1a1a1a;
  --ink-soft: #555555;
  --ink-faint: #8a8a8a;
  --rule: #e6e4dd;
  --accent: #1a1a1a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);

  --font-display: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --font-mono: "Inconsolata", ui-monospace, "SF Mono", Menlo, Monaco, monospace;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;

  --measure: 64ch;
  --gap-grid: 1.5rem;
  --gap-grid-tight: 0.75rem;

  --panel-w: 380px;

  --t-fast: 160ms;
  --t-med: 280ms;
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
}

@media (max-width: 720px) {
  :root {
    --panel-w: 100vw;
    --gap-grid: 0.75rem;
    --gap-grid-tight: 0.5rem;
  }
}

/* --- Reset / base ------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-fast) var(--ease);
}

a:hover {
  border-bottom-color: var(--ink);
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

/* --- Layout primitives -------------------------------------- */

.shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}

@media (max-width: 720px) {
  .shell {
    padding: 1.25rem 1rem 3rem;
  }
}

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 1.5rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--rule);
}

.site-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  letter-spacing: 0.005em;
  margin: 0;
}

.site-title a {
  border-bottom: 0;
}

.site-nav {
  display: flex;
  gap: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  text-transform: lowercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}

.site-nav a:hover {
  color: var(--ink);
}

/* On phones, drop the nav onto its own line below the site title.
   Both stay left-aligned, tighter vertical rhythm so the header
   doesn't dominate the viewport. flex-wrap on the nav itself is a
   safety net if the link set ever grows past one mobile row. */
@media (max-width: 720px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
  }

  .site-nav {
    gap: 1rem;
    flex-wrap: wrap;
  }
}

.site-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-faint);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* --- Type styles -------------------------------------------- */

.display {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.15;
  letter-spacing: -0.005em;
  margin: 0 0 0.5rem;
}

.lede {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: var(--measure);
  margin: 0 0 2.5rem;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  margin: 0 0 1rem;
}

/* --- Photo grid (home, collection, camera) ------------------
   Masonry via CSS multi-column. Photos display at their natural
   aspect ratio. Items flow column-by-column. On mobile (one
   column) this collapses to a vertical stack, which is the
   ideal reading experience.
   ----------------------------------------------------------- */

.photo-grid {
  columns: 320px;
  column-gap: var(--gap-grid);
  list-style: none;
  margin: 0;
  padding: 0;
}

.photo-grid--dense {
  columns: 240px;
  column-gap: var(--gap-grid-tight);
}

.photo-tile {
  break-inside: avoid;
  position: relative;
  overflow: hidden;
  background: var(--bg-elev);
  margin: 0 0 var(--gap-grid);
  display: block;
}

.photo-grid--dense .photo-tile {
  margin-bottom: var(--gap-grid-tight);
}

.photo-tile a {
  display: block;
  border: 0;
  position: relative;
  overflow: hidden;
}

.photo-tile img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform var(--t-med) var(--ease), opacity var(--t-med) var(--ease);
}

.photo-tile a:hover img {
  transform: scale(1.02);
}

.photo-tile__caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 0.625rem 0.75rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  opacity: 0;
  transition: opacity var(--t-med) var(--ease);
}

.photo-tile a:hover .photo-tile__caption {
  opacity: 1;
}

/* Infinite-scroll sentinel: zero-height marker the IntersectionObserver
   in /assets/home-infinite.js watches. Lives inside the masonry as a
   final <li> so the column flow stays uninterrupted; takes no space. */
.photo-grid__sentinel {
  break-inside: avoid;
  height: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  pointer-events: none;
}

/* --- Collections index -------------------------------------- */

.collection-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem 1.5rem;
}

/* Section heading used on the gear page (Cameras / Lenses) and the
   <hr> that separates them. The heading uses the display face for
   continuity with the page lede; the rule is a thin neutral line. */
.gear-section-heading {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.75rem;
  line-height: 1.2;
  margin: 0 0 1.25rem;
}

.gear-section-rule {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 3rem 0 2.5rem;
}

.collection-card a {
  display: block;
  border: 0;
}

.collection-card__cover {
  aspect-ratio: 3 / 2;
  background: var(--bg-elev);
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.collection-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--t-med) var(--ease);
}

.collection-card a:hover .collection-card__cover img {
  transform: scale(1.02);
}

.collection-card__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  margin: 0 0 0.125rem;
  line-height: 1.2;
}

.collection-card__meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
}

.collection-card__desc {
  margin: 0.375rem 0 0;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  line-height: 1.5;
  max-width: 50ch;
}

/* --- Photo detail page -------------------------------------- */

.photo-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2.5rem 2rem 1.5rem;
}

@media (max-width: 720px) {
  .photo-shell {
    padding: 1.25rem 1rem 0.75rem;
  }
}

.photo-page {
  display: grid;
  grid-template-columns: 1fr var(--panel-w);
}

@media (max-width: 900px) {
  .photo-page {
    grid-template-columns: 1fr;
  }
}

.photo-stage {
  padding: 2rem 2.5rem;
  background: var(--bg);
  text-align: center;
}

@media (max-width: 720px) {
  .photo-stage {
    padding: 0.5rem 1rem 1rem;
  }
}

/* Block + margin auto + explicit width/height auto with both max
   constraints. Avoids iOS Safari's known issue with auto-sized
   <img> in flex containers (which can distort aspect ratio when
   max-height kicks in). */
.photo-stage img {
  display: block;
  margin: 0 auto;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 8rem);
  box-shadow: var(--shadow);
}

@media (max-width: 720px) {
  .photo-stage img {
    max-height: 75vh;
  }
}

.photo-meta {
  border-left: 1px solid var(--rule);
  background: var(--bg-elev);
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  overflow-y: auto;
}

@media (max-width: 900px) {
  .photo-meta {
    border-left: 0;
    border-top: 1px solid var(--rule);
    padding: 2rem 1.25rem;
  }
}

.photo-meta__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.5rem;
  line-height: 1.25;
  margin: 0;
}

.photo-meta__caption {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  line-height: 1.55;
  max-width: 38ch;
}

.exif {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--ink);
  display: grid;
  grid-template-columns: 7em 1fr;
  gap: 0 1rem;
}

.exif dt {
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.6875rem;
  align-self: center;
}

.exif dd {
  margin: 0;
  color: var(--ink);
}

.photo-nav {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

.photo-nav a:hover {
  color: var(--ink);
}

.photo-nav__placeholder {
  color: var(--ink-faint);
  opacity: 0.4;
}

.photo-back {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  margin-bottom: 0.5rem;
  display: inline-block;
}

.photo-back:hover {
  color: var(--ink);
}

/* --- Prose (about page) ------------------------------------- */

.prose {
  max-width: var(--measure);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--ink);
}

.prose p {
  margin: 0 0 1.25em;
}

/* --- Map page ----------------------------------------------- */

.shell--map-head {
  padding-bottom: 1.5rem;
}

.photo-map {
  height: 70vh;
  min-height: 420px;
  width: 100%;
  background: var(--bg-elev);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

@media (max-width: 720px) {
  .photo-map {
    height: 60vh;
    min-height: 360px;
  }
}

/* Leaflet popup contents (photo thumbnail + meta) */
.map-popup {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 0;
}

.map-popup img {
  width: 100%;
  max-width: 220px;
  height: auto;
  display: block;
  margin-bottom: 0.5rem;
}

.map-popup__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.3;
  margin-bottom: 0.125rem;
  color: var(--ink);
}

.map-popup__location {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

/* Tweak Leaflet's default popup chrome to fit the editorial vibe */
.leaflet-popup-content-wrapper {
  border-radius: 0;
  box-shadow: var(--shadow);
}

.leaflet-popup-content {
  margin: 0.75rem 0.875rem;
  font-family: var(--font-body);
}

.leaflet-container a {
  color: var(--ink);
}

/* --- Lightbox metadata panel -------------------------------- */

/* Outer shell is a transparent positioning layer. Pointer events fall
   through to the photo by default; only the toggle button and inner
   content panel opt in. This way the gradient/content can collapse
   without dragging the toggle button along with it. */
.pswp-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1050;
  pointer-events: none;
  color: #f5f5f3;
}

.pswp-meta__inner {
  pointer-events: auto;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.7) 60%, rgba(0, 0, 0, 0) 100%);
  padding: 2.5rem 1.75rem 1.5rem;
  max-width: 100%;
  transform: translateY(0);
  opacity: 1;
  transition: transform 240ms ease, opacity 240ms ease;
}

.pswp-meta__inner > * {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.pswp-meta--collapsed .pswp-meta__inner {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}

/* Toggle button. Sits at bottom-right, stays visible whether the
   panel is expanded or collapsed. Chevron icon rotates to telegraph
   the next action (down = will collapse, up = will expand). */
.pswp-meta__toggle {
  pointer-events: auto;
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 20, 20, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  padding: 0;
  z-index: 2;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.pswp-meta__toggle:hover,
.pswp-meta__toggle:focus-visible {
  background: rgba(20, 20, 20, 0.85);
  border-color: rgba(255, 255, 255, 0.4);
  outline: none;
}

.pswp-meta__chevron {
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 220ms ease;
}

.pswp-meta--collapsed .pswp-meta__chevron {
  transform: translateY(2px) rotate(-135deg);
}

.pswp-meta__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.375rem;
  line-height: 1.25;
  margin-bottom: 0.25rem;
  color: #fff;
}

.pswp-meta__caption {
  font-family: var(--font-body);
  font-size: 0.875rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.78);
  margin-bottom: 0.5rem;
  max-width: 60ch;
}

.pswp-meta__row {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.875rem;
}

.pswp-meta__row span {
  position: relative;
}

.pswp-meta__row span:not(:last-child)::after {
  content: "·";
  margin-left: 0.875rem;
  color: rgba(255, 255, 255, 0.4);
}

.pswp-meta__permalink {
  display: inline-block;
  margin-top: 0.625rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  border-bottom: 0;
}

.pswp-meta__permalink:hover {
  color: #fff;
}

/* When PhotoSwipe's chrome is tap-hidden (mobile) or otherwise toggled,
   fade out our toggle button alongside it. The inner panel also fades
   on small viewports so a tap on the photo clears for clean viewing. */
.pswp--ui-hidden .pswp-meta__toggle {
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

@media (max-width: 720px) {
  .pswp-meta__inner {
    padding: 1.75rem 1rem 1rem;
  }

  .pswp-meta__title {
    font-size: 1.1rem;
  }

  .pswp-meta__caption {
    font-size: 0.8125rem;
  }

  .pswp--ui-hidden .pswp-meta__inner {
    opacity: 0;
    transform: translateY(0.5rem);
    pointer-events: none;
  }
}

/* --- Stats (about page) ------------------------------------- */

.stats {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  max-width: var(--measure);
}

.section-label--sub {
  margin-top: 2rem;
}

.stats-summary,
.stats-cameras {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.125rem 1.5rem;
  margin: 0;
}

.stats-summary dt,
.stats-cameras dt {
  color: var(--ink-soft);
  font-weight: 400;
  border-bottom: 1px dotted var(--rule);
  padding-bottom: 0.125rem;
}

.stats-summary dd,
.stats-cameras dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  border-bottom: 1px dotted var(--rule);
  padding-bottom: 0.125rem;
}

.stats-cameras dt a {
  color: inherit;
  border-bottom: 0;
}

.stats-cameras dt a:hover {
  color: var(--ink);
}

.stats-faint,
.stats-faint a {
  color: var(--ink-faint) !important;
}

.stats-note {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--ink-faint);
  margin: 0.5rem 0 0.75rem;
}

.stats-scatter {
  margin: 0;
  padding: 0;
}

.stats-scatter svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  overflow: visible;
}

.stats-scatter-dot circle {
  fill: var(--ink);
  fill-opacity: 0.4;
  transition: fill-opacity var(--t-fast) var(--ease), r var(--t-fast) var(--ease);
  cursor: pointer;
}

.stats-scatter-dot:hover circle,
.stats-scatter-dot:focus circle {
  fill-opacity: 1;
  r: 5;
}

.stats-scatter-dot:focus {
  outline: none;
}

/* --- Empty state -------------------------------------------- */

.empty {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--ink-faint);
  padding: 4rem 0;
  text-align: center;
}
