/* Subtle interaction layer */
html { scroll-behavior: smooth; }

/* Current section in the primary navigation */
nav a.active,
nav a[aria-current="page"] {
  color: var(--accent-dark);
  background: rgba(95, 111, 82, 0.11);
  opacity: 1;
  border-radius: 999px;
  padding: 5px 9px;
  margin: -5px -9px;
  font-weight: 650;
}

.card,
.photo-grid figure {
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.card:hover,
.card:focus-within,
.photo-grid figure:hover,
.photo-grid figure:focus-within {
  transform: translateY(-2px);
  border-color: rgba(95, 111, 82, 0.42);
  box-shadow: 0 12px 30px rgba(31, 41, 51, 0.08);
}

.back-to-top {
  position: fixed;
  right: max(18px, calc((100vw - 1080px) / 2 + 18px));
  bottom: 22px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(56, 70, 47, 0.22);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--accent-dark);
  box-shadow: 0 8px 24px rgba(31, 41, 51, 0.10);
  font-size: 20px;
  line-height: 1;
  text-decoration: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease, background-color 160ms ease;
  backdrop-filter: blur(8px);
}

.back-to-top.is-visible {
  opacity: 0.78;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover,
.back-to-top:focus-visible {
  opacity: 1;
  background: #fff;
  border-bottom-color: rgba(56, 70, 47, 0.22);
}

.back-to-top:focus-visible {
  outline: 3px solid rgba(95, 111, 82, 0.20);
  outline-offset: 3px;
}

@media (max-width: 820px) {
  nav a.active,
  nav a[aria-current="page"] {
    padding: 8px 10px;
    margin: 0;
    background: rgba(95, 111, 82, 0.18);
  }

  .back-to-top {
    right: 16px;
    bottom: 16px;
    width: 40px;
    height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card,
  .photo-grid figure,
  .back-to-top { transition: none; }
  .card:hover,
  .card:focus-within,
  .photo-grid figure:hover,
  .photo-grid figure:focus-within { transform: none; }
}
