:root {
  --forest: #2F4A3D;
  --stone: #A9A28C;
  --leaf: #6B9B5E;
  --cream: #F6F2E9;
  --rose: #C9707D;
  --ink: #2B2A25;
}

* { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font-family: 'Nunito', sans-serif;
  background-color: var(--cream);
  background-image: linear-gradient(rgba(246,242,233,0.92), rgba(246,242,233,0.92)), url('/img/woodcreek-entrance.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Every page follows the same shape: header, one content wrapper, footer
   (plus the occasional trailing <script> tag, which takes no layout space
   anyway) - so the content wrapper can be targeted generically here rather
   than adding a class to every view. Header/footer stay put; the content
   in between gets whatever room is left and scrolls internally. */
body > .site-header,
body > .site-footer {
  flex: 0 0 auto;
}
body > :not(.site-header):not(.site-footer):not(script) {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

h1, h2, h3, .logo__text, .btn {
  font-family: 'Baloo 2', 'Nunito', sans-serif;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

a { color: var(--forest); }

/* Header - a nav bar sitting on the Woodcreek entrance photo. */
.site-header {
  background-image: linear-gradient(rgba(21,32,25,0.5), rgba(21,32,25,0.62)), url('/img/header-background.png');
  background-size: cover;
  background-position: center 38%;
  color: var(--cream);
  border-bottom: 6px solid var(--stone);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 38px 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--cream);
}
.logo__mark { width: 44px; height: 44px; }
.logo__text {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
}
.logo__text small {
  display: block;
  font-family: 'Nunito', sans-serif;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--stone);
}
.site-nav { display: flex; align-items: center; gap: 16px; }
.site-nav a { color: var(--cream); text-decoration: none; font-weight: 600; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}
.btn--cta { background: var(--rose); color: white; }
.btn--cta:hover { background: #B15964; }
.btn--secondary { background: var(--stone); color: var(--ink); }
.btn--danger { background: #A6433F; color: white; }
.btn--outline { background: transparent; border: 2px solid var(--forest); color: var(--forest); }

/* Map frame */
.map-frame {
  position: relative;
  max-width: 1100px;
  margin: 20px auto;
  padding: 14px;
  background: var(--stone);
  border: 6px solid var(--forest);
  border-radius: 20px;
  box-shadow: 0 8px 0 rgba(47,74,61,0.18);
}
.map-frame .leaflet-container {
  border-radius: 12px;
  border: 3px solid var(--cream);
}
#map { width: 100%; height: 560px; }
#form-map { width: 100%; height: 420px; }
/* Woodcreek's real footprint is roughly as tall as it is wide - a squarer
   box here (instead of the page's full wide banner width) keeps the map
   from having to show neighboring areas just to fill extra side space. */
.map-frame--neighborhood { max-width: 760px; height: 100%; }
.map-frame--neighborhood #map { height: 100%; }
.leaflet-tile-pane {
  filter: grayscale(0.35) saturate(0.75) brightness(1.05);
}
.popup-thumb { display: block; max-width: 100%; max-height: 60px; width: auto; height: auto; object-fit: contain; border-radius: 6px; margin: 0 auto 6px; }
.marker-highlight {
  filter: drop-shadow(0 0 4px #C9707D) drop-shadow(0 0 8px #C9707D);
}
.tree-doodle { position: absolute; width: 46px; height: 46px; opacity: 0.9; }
.tree-doodle--tl { top: -18px; left: -18px; }
.tree-doodle--br { bottom: -18px; right: -18px; transform: scaleX(-1); }

/* Directory: business list on the left, map on the right. The whole row
   fills the page's available height exactly (no scroll of its own) so the
   map is always fully visible - align-items: stretch makes both the
   sidebar and the map match that full height, and only the business list
   (inside the sidebar) scrolls internally for overflow. */
.directory-layout {
  display: flex;
  align-items: stretch;
  gap: 24px;
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  padding: 16px 20px;
  /* The sidebar's own .business-list scrolls internally, and everything
     else here stretches to fit the space exactly - this row shouldn't
     also scroll itself, which would just duplicate that scrollbar. */
  overflow-y: hidden;
}
.directory-sidebar {
  width: 380px;
  flex-shrink: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.directory-sidebar h2 { margin: 0; }
.business-count { font-weight: 400; font-size: 0.85em; color: var(--stone); }
.directory-map { flex: 1; min-width: 0; height: 100%; }
.directory-map .map-frame { margin: 0 auto; height: 100%; }

.directory-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 0 0 auto;
}
.directory-controls input, .directory-controls select {
  padding: 10px 14px;
  border-radius: 10px;
  border: 2px solid var(--stone);
  font-family: inherit;
  font-size: 1rem;
  background: white;
  width: 100%;
}

.business-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.business-list-item {
  display: flex;
  gap: 12px;
  background: white;
  border: 2px solid var(--stone);
  border-radius: 12px;
  padding: 10px;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.1s ease, border-color 0.1s ease;
}
.business-list-item:hover { transform: translateX(2px); border-color: var(--rose); }
.business-list-item__thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--cream);
}
.business-list-item__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.business-list-item__thumb--fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: url('/img/pin.svg');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 26px;
  opacity: 0.4;
}
.business-list-item__body { min-width: 0; }
.business-list-item__body h3 { margin: 0; font-size: 1rem; }
.business-list-item__contact { display: block; font-size: 0.78rem; font-weight: 600; color: var(--forest); margin-bottom: 3px; }
.business-list-item__body p { margin: 0; font-size: 0.85rem; color: #6B6A5C; line-height: 1.35; }

@media (max-width: 860px) {
  /* Stacked instead of side-by-side, so the "stretch to fill height"
     sizing that keeps the map fully visible on desktop doesn't apply here -
     the whole column scrolls together instead, with the map at a fixed,
     reasonable height. */
  .directory-layout { flex-direction: column; overflow-y: auto; }
  .directory-sidebar { width: 100%; min-height: 0; flex: 0 0 auto; }
  .business-list { flex: 0 0 auto; overflow-y: visible; max-height: none; }
  .directory-map, .map-frame--neighborhood, .map-frame--neighborhood #map { height: 420px; }
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  padding: 16px 20px 40px;
  max-width: 1100px;
  margin: 0 auto;
}
.card {
  background: white;
  border: 2px solid var(--stone);
  border-radius: 16px;
  padding: 16px;
  text-decoration: none;
  color: var(--ink);
  display: block;
  transition: transform 0.1s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--rose); }
.card__thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
  background: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
}
/* A logo (not a photo) shouldn't fill/crop to the box - shown at half size,
   centered, so it reads as a badge rather than a stretched banner. */
.card__thumb img { width: 50%; height: 50%; object-fit: contain; display: block; }
.card__thumb--fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: url('/img/pin.svg');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 40px;
  opacity: 0.35;
}
.card__category {
  display: inline-block;
  background: var(--leaf);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.card h3 { margin: 0 0 6px; }
.card p { margin: 0; color: #6B6A5C; font-size: 0.95rem; }
.empty-state { text-align: center; padding: 40px 20px; color: #6B6A5C; }

/* Forms */
.form-page { max-width: 640px; margin: 0 auto; padding: 0 20px 60px; }
.form-card {
  background: white;
  border: 3px solid var(--stone);
  border-radius: 20px;
  padding: 28px;
}
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; }
.field .hint { font-weight: 400; font-size: 0.85rem; color: #6B6A5C; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid var(--stone);
  font-family: inherit;
  font-size: 1rem;
}
.field textarea { min-height: 120px; resize: vertical; }
.field input[type="file"] {
  border: 2px dashed var(--stone);
  background: var(--cream);
  padding: 14px 12px;
}
.existing-thumb { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.existing-thumb img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 2px solid var(--stone); }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.gallery-grid__item {
  background: var(--cream);
  border: 2px solid var(--stone);
  border-radius: 10px;
  padding: 6px;
  text-align: center;
}
.gallery-grid__item img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 6px; display: block; margin-bottom: 6px; }
.gallery-photo {
  cursor: zoom-in;
  transition: transform 0.1s ease, opacity 0.1s ease;
}
.gallery-photo:hover, .gallery-photo:focus-visible {
  transform: scale(1.03);
  opacity: 0.92;
}

/* Photo lightbox - click a gallery photo to see it full-size. */
.lightbox-dialog {
  position: relative;
  border: none;
  border-radius: 16px;
  padding: 0;
  background: transparent;
  max-width: min(70vw, 700px);
  max-height: 75vh;
}
.lightbox-dialog::backdrop {
  background: rgba(21,32,25,0.75);
}
.lightbox-dialog img {
  display: block;
  max-width: min(70vw, 700px);
  max-height: 75vh;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.4);
}
.lightbox-dialog__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(21,32,25,0.7);
  color: white;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-dialog__close:hover {
  background: rgba(21,32,25,0.9);
}
.gallery-grid--view { max-width: 1100px; margin: 0 auto; padding: 0; }
.btn--small { padding: 5px 10px; font-size: 0.8rem; }
.business-detail__logo {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 14px;
  border: 3px solid var(--stone);
  flex-shrink: 0;
  background: white;
}
.business-detail__logo--fallback {
  background-color: var(--cream);
  background-image: url('/img/pin.svg');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 44px;
  opacity: 0.4;
}
.errors {
  background: #FBEAE8;
  border: 2px solid #A6433F;
  color: #7A2F2B;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.errors ul { margin: 4px 0 0; padding-left: 20px; }
.pin-status { font-weight: 700; margin-top: 8px; }
.pin-status--unset { color: #A6433F; }
.pin-status--set { color: var(--leaf); }

/* Confirmation - the outer page wrapper is what stretches to fill the
   header/footer gap and scrolls if needed; the box itself just centers
   inside it and sizes to its own content instead of stretching tall. */
.confirmation-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.confirmation-box {
  background: white;
  border: 3px dashed var(--leaf);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  max-width: 560px;
}
.edit-link-box {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}
.edit-link-box input {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 2px solid var(--stone);
  font-family: monospace;
}
.warning-note {
  background: #FBEEEF;
  border: 2px solid var(--rose);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.9rem;
  margin-top: 14px;
}

/* Danger zone - deleting your own listing */
.danger-zone {
  max-width: 640px;
  margin: 24px auto 0;
  background: #FBEAE8;
  border: 3px solid #A6433F;
  border-radius: 20px;
  padding: 24px 28px;
}
.danger-zone h2 { margin: 0 0 6px; color: #7A2F2B; }
.danger-zone p { margin: 0 0 14px; color: #7A2F2B; }

/* Native <dialog>-based confirmation, styled to match the site instead of
   relying on the browser's plain confirm(). */
.confirm-dialog {
  border: none;
  border-radius: 20px;
  padding: 28px;
  max-width: 440px;
  width: calc(100% - 40px);
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.confirm-dialog::backdrop {
  background: rgba(21,32,25,0.55);
}
.confirm-dialog h2 { margin: 0 0 10px; color: var(--ink); }
.confirm-dialog p { margin: 0 0 20px; color: #6B6A5C; line-height: 1.5; }
.confirm-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* About */
.about-page { max-width: 1200px; margin: 0 auto; padding: 20px 20px 60px; }
@media (max-width: 600px) {
  .about-page { padding-right: 28px; }
}
.about-card {
  background: white;
  border: 3px solid var(--stone);
  border-radius: 20px;
  padding: 32px;
}
.about-card h1 { margin-top: 0; }
.about-card h2 { margin-bottom: 6px; }
.about-card p { line-height: 1.5; color: #4A4940; }
.about-card p:last-child { margin-bottom: 0; }
.about-card__row {
  display: flex;
  align-items: center;
  gap: 20px;
}
.about-card__row p { flex: 1; margin: 0; }
.about-card__row .btn { flex-shrink: 0; white-space: nowrap; }
@media (max-width: 600px) {
  .about-card__row { flex-direction: column; align-items: stretch; }
  /* "Request a Vendor Account" kept on one line (nowrap, for the desktop
     side-by-side layout) can be wider than a narrow phone screen, which
     flexbox won't shrink below on its own - let it wrap here instead. */
  .about-card__row .btn { white-space: normal; text-align: center; }
}
.about-card__credit {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 3px solid #f6c945;
}
.about-card__credit-logo { height: 30px; width: auto; flex-shrink: 0; }
.about-card__credit p { margin: 0; font-size: 0.92rem; color: #6B6A5C; }

/* Business detail */
.business-detail { max-width: 960px; margin: 0 auto; padding: 20px 20px 60px; }
.business-detail h1 { margin: 0 0 4px; }
.business-detail__header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}
.business-detail__heading { min-width: 0; }
.business-detail__contact-name { margin: 2px 0 0; color: #6B6A5C; font-weight: 600; }
.business-detail__body {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}
.business-detail__main { flex: 1.2; min-width: 0; }
.business-detail__map { flex: 1; min-width: 0; }
.business-detail__map .map-frame { margin: 0; }
@media (max-width: 760px) {
  /* align-items controls the cross-axis, which flips from vertical to
     horizontal once flex-direction becomes column - the row layout's
     "flex-start" (fine for top-aligning two side-by-side columns) instead
     shrink-wraps each stacked child to its own content width here, which
     collapses the map (no intrinsic content) down to almost nothing. */
  .business-detail__body { flex-direction: column; align-items: stretch; }
  .business-detail__header { flex-wrap: wrap; }
}
.contact-list { list-style: none; padding: 0; }
.contact-list li { margin-bottom: 6px; }

/* Admin */
.admin-page { max-width: 1200px; margin: 0 auto; padding: 0 20px 60px; }
.admin-table { width: 100%; border-collapse: collapse; background: white; border-radius: 12px; overflow: hidden; }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #E4DFCD; font-size: 0.92rem; }
.admin-table th { background: var(--forest); color: white; }
.admin-table tbody tr:nth-child(even) { background: var(--cream); }
.admin-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.admin-actions form { display: inline; }
.admin-actions .btn { padding: 6px 12px; font-size: 0.85rem; }
/* Edit/Delete are icon-only buttons - keeps the Actions column narrow
   enough that they stay side by side instead of wrapping, even next to the
   longer text buttons (Approve/Publish/etc.) in the same cell. */
.btn--icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
}
.btn--icon svg { width: 17px; height: 17px; }
.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;
}
.login-box {
  max-width: 380px;
  margin: 80px auto;
  background: white;
  border: 3px solid var(--stone);
  border-radius: 20px;
  padding: 28px;
}
.footer, .site-footer {
  position: relative;
  background: var(--forest);
  color: var(--cream);
  text-align: center;
  padding: 15px;
}
.site-footer__version {
  position: absolute;
  right: 10px;
  bottom: 4px;
  font-size: 0.68rem;
  color: rgba(246,242,233,0.35);
  user-select: none;
}
.site-footer a { color: var(--stone); }
.site-footer__logos {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.site-footer__logo {
  height: 30px;
  width: auto;
}
/* This logo's wordmark art is smaller relative to its frame than Data
   Honey's, so it needs extra height to stay legible at footer scale. */
.site-footer__logo--holly {
  height: 44px;
}
.site-footer__links {
  margin: 0;
  font-size: 0.82rem;
}
.site-footer__links a {
  color: white;
}
.not-found { text-align: center; padding: 80px 20px; }
