@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&display=swap");

:root {
  --cream: #f8f2e4;
  --sand: #ead9b6;
  --ink: #1e2a2f;
  --copper: #b8513f;
  --sea: #2f6f7e;
  --card: #fffaf0;
  --shadow: 0 18px 40px rgba(33, 25, 12, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Fraunces", "Georgia", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 12%, rgba(184, 81, 63, 0.25) 0, transparent 40%),
    radial-gradient(circle at 87% 82%, rgba(47, 111, 126, 0.3) 0, transparent 38%),
    var(--cream);
  min-height: 100vh;
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
}

.brand {
  color: var(--ink);
  text-decoration: none;
  font-size: 1.35rem;
  font-weight: 700;
}

.page-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}

.page-header h1,
.page-header h2 {
  margin-bottom: 0.3rem;
}

.page-header p {
  margin-top: 0;
  color: rgba(30, 42, 47, 0.8);
}

.slideshow-card,
.detail-card,
.visit-form {
  background: var(--card);
  border: 1px solid rgba(30, 42, 47, 0.1);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.slideshow-track {
  position: relative;
  min-height: 460px;
}

.slide {
  display: none;
  grid-template-columns: 1.1fr 1fr;
  gap: 1rem;
}

.slide.is-active {
  display: grid;
  animation: fade-in 0.35s ease-out;
}

.slide-media {
  position: relative;
  min-height: 390px;
  border-radius: 16px;
  overflow: hidden;
  background: #d8e4e6;
}

.slide-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slide-photo-cluster {
  position: relative;
  height: 100%;
  isolation: isolate;
}

.cluster-photo {
  position: absolute;
  margin: 0;
  border-radius: 14px;
  border: 5px solid rgba(255, 250, 240, 0.96);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.cluster-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slide-photo-cluster.photo-count-1 .cluster-photo-1 {
  inset: 0;
  transform: rotate(-1deg);
}

.slide-photo-cluster.photo-count-2 .cluster-photo-1 {
  top: 7%;
  left: 6%;
  width: 58%;
  height: 86%;
  transform: rotate(-4deg);
  z-index: 2;
}

.slide-photo-cluster.photo-count-2 .cluster-photo-2 {
  top: 7%;
  right: 6%;
  width: 54%;
  height: 86%;
  transform: rotate(4deg);
  z-index: 1;
}

.slide-photo-cluster.photo-count-3 .cluster-photo-1 {
  top: 4%;
  left: 5%;
  width: 54%;
  height: 56%;
  transform: rotate(-5deg);
  z-index: 3;
}

.slide-photo-cluster.photo-count-3 .cluster-photo-2 {
  top: 8%;
  right: 5%;
  width: 52%;
  height: 50%;
  transform: rotate(4deg);
  z-index: 2;
}

.slide-photo-cluster.photo-count-3 .cluster-photo-3 {
  bottom: 5%;
  left: 18%;
  width: 64%;
  height: 52%;
  transform: rotate(1deg);
  z-index: 1;
}

.slide-photo-cluster.photo-count-4 .cluster-photo-1 {
  top: 3%;
  left: 4%;
  width: 47%;
  height: 45%;
  transform: rotate(-4deg);
}

.slide-photo-cluster.photo-count-4 .cluster-photo-2 {
  top: 6%;
  right: 5%;
  width: 47%;
  height: 45%;
  transform: rotate(5deg);
}

.slide-photo-cluster.photo-count-4 .cluster-photo-3 {
  bottom: 6%;
  left: 8%;
  width: 45%;
  height: 48%;
  transform: rotate(3deg);
}

.slide-photo-cluster.photo-count-4 .cluster-photo-4 {
  bottom: 3%;
  right: 8%;
  width: 45%;
  height: 48%;
  transform: rotate(-3deg);
}

.cluster-extra {
  position: absolute;
  right: 0.8rem;
  bottom: 0.8rem;
  background: rgba(30, 42, 47, 0.83);
  color: #fff;
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  font-size: 0.82rem;
  z-index: 4;
}

.media-placeholder,
.visit-thumb-empty {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 240px;
  color: rgba(30, 42, 47, 0.68);
  font-style: italic;
}

.slide-body {
  align-self: center;
}

.slide-kicker {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: var(--sea);
}

.visit-meta {
  font-weight: 700;
}

.slide-controls {
  margin-top: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 2.5rem;
}

.visit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}

.visit-card {
  background: var(--card);
  border-radius: 14px;
  border: 1px solid rgba(30, 42, 47, 0.14);
  padding: 0.8rem;
  box-shadow: var(--shadow);
}

.visit-thumb-wrap {
  position: relative;
}

.visit-thumb {
  width: 100%;
  height: 170px;
  object-fit: cover;
  border-radius: 10px;
  background: #d8e4e6;
}

.photo-count-pill {
  position: absolute;
  right: 0.45rem;
  bottom: 0.45rem;
  margin: 0;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: rgba(30, 42, 47, 0.85);
  color: #fff;
  font-size: 0.75rem;
}

.button,
button,
input[type="submit"] {
  display: inline-block;
  border: 1px solid transparent;
  background: var(--copper);
  color: #fff;
  text-decoration: none;
  border-radius: 999px;
  padding: 0.5rem 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.button-ghost {
  background: transparent;
  color: var(--ink);
  border-color: rgba(30, 42, 47, 0.2);
}

.button-danger {
  background: #91221d;
}

.button-small {
  padding: 0.32rem 0.65rem;
  font-size: 0.8rem;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field.full {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.6rem;
  border-radius: 10px;
  border: 1px solid rgba(30, 42, 47, 0.25);
  font: inherit;
  background: #fff;
}

textarea {
  resize: vertical;
}

.form-actions,
.page-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.form-errors {
  border-radius: 10px;
  border: 1px solid #b54d41;
  background: #fae8e5;
  padding: 0.8rem;
}

.visit-details {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 0.5rem;
}

.visit-details dt {
  font-weight: 700;
}

.photo-collage {
  column-count: 3;
  column-gap: 0.8rem;
}

.photo-collage .photo-tile {
  margin: 0 0 0.8rem;
  background: var(--card);
  border-radius: 12px;
  border: 4px solid rgba(255, 250, 240, 0.9);
  overflow: hidden;
  box-shadow: var(--shadow);
  break-inside: avoid;
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.2s ease-out;
}

.photo-collage .photo-tile:hover {
  transform: rotate(0deg) scale(1.02);
}

.photo-collage .photo-tile img {
  width: 100%;
  height: auto;
  display: block;
}

.photo-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0.45rem 0.55rem 0.55rem;
}

.inline-form {
  margin: 0;
}

.move-photo-form {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.move-photo-form select {
  width: auto;
  min-width: 170px;
  padding: 0.36rem 0.42rem;
  font-size: 0.82rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.flash {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.5rem 1rem;
  border-radius: 10px;
}

.flash-notice {
  background: #dcedf1;
}

.flash-alert {
  background: #fbe4df;
}

.empty-state,
.hint {
  color: rgba(30, 42, 47, 0.72);
}

.empty-state-block {
  text-align: center;
  padding: 2.2rem 1rem;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 860px) {
  .slide,
  .slide.is-active {
    grid-template-columns: 1fr;
  }

  .slideshow-track {
    min-height: 0;
  }

  .slide-media {
    min-height: 280px;
  }

  .slide-photo-cluster {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
    padding: 0.6rem;
  }

  .slide-photo-cluster.photo-count-1 {
    grid-template-columns: 1fr;
  }

  .slide-photo-cluster .cluster-photo {
    position: relative;
    inset: auto;
    width: auto;
    height: 160px;
    transform: none;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .visit-details {
    grid-template-columns: 1fr;
  }

  .photo-collage {
    column-count: 2;
  }

  .photo-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .move-photo-form {
    width: 100%;
    flex-direction: column;
  }

  .move-photo-form select {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 560px) {
  .photo-collage {
    column-count: 1;
  }
}
