:root {
  --green-dark: #2d5016;
  --green: #4a7c59;
  --green-light: #e8f0e3;
  --earth: #c9a876;
  --cream: #faf8f3;
  --text: #2b2b26;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--cream);
  line-height: 1.6;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  background: var(--green-dark);
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
  transition: transform 0.25s ease, box-shadow 0.2s ease;
}

.site-header.scrolled {
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.site-header.hide-header {
  transform: translateY(-100%);
}

.header-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  padding: 20px 24px;
}

.logo {
  font-weight: 700;
  font-size: 2.2rem;
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-img {
  height: 96px;
  width: 96px;
  border-radius: 50%;
}

nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
}

nav a {
  color: white;
  text-decoration: none;
  font-size: 0.95rem;
}

nav a:hover { text-decoration: underline; }

/* Hero */
.hero {
  background:
    linear-gradient(135deg, rgba(45,80,22,0.85) 0%, rgba(74,124,89,0.75) 100%),
    url("images/hero-bg.jpg") center 25% / cover no-repeat;
  color: white;
  padding: 100px 0;
  text-align: center;
}

.hero h1 {
  font-size: 2.4rem;
  margin-bottom: 16px;
}

.hero p {
  font-size: 1.15rem;
  max-width: 600px;
  margin: 0 auto 32px;
  opacity: 0.95;
}

.hero-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Sections */
.section {
  padding: 64px 0;
}

.section.alt {
  background: var(--green-light);
}

.section h2 {
  font-size: 1.8rem;
  color: var(--green-dark);
  margin-bottom: 12px;
}

.section-intro {
  max-width: 650px;
  margin-bottom: 32px;
  color: #4a4a44;
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.card {
  background: white;
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.card h3 {
  color: var(--green-dark);
  margin-bottom: 10px;
}

.card p {
  margin-bottom: 20px;
  color: #4a4a44;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: opacity 0.15s ease;
}

.btn:hover { opacity: 0.85; }

.btn-primary {
  background: var(--green);
  color: white;
}

.btn-secondary {
  background: var(--earth);
  color: white;
}

/* Growing list */
.growing-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.growing-list li {
  background: white;
  padding: 16px 20px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.photo-carousel {
  position: relative;
}

.photo-gallery {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 4px 4px 14px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
}

.photo-gallery-item {
  position: relative;
  flex: 0 0 240px;
  aspect-ratio: 3 / 4;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  scroll-snap-align: start;
}

.photo-gallery-item img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-gallery-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 32px 16px 14px;
  background: linear-gradient(to top, rgba(20,30,15,0.85) 0%, rgba(20,30,15,0.45) 55%, transparent 100%);
}

.photo-gallery-date {
  display: block;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.8);
  margin-bottom: 4px;
}

.photo-gallery-caption p {
  color: white;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.photo-carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: white;
  color: var(--green-dark);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-carousel-arrow:hover {
  background: var(--green-light);
}

.photo-carousel-arrow.left {
  left: -14px;
}

.photo-carousel-arrow.right {
  right: -14px;
}

@media (max-width: 600px) {
  .photo-carousel-arrow.left { left: -6px; }
  .photo-carousel-arrow.right { right: -6px; }
}

/* Footer */
.site-footer {
  background: var(--green-dark);
  color: white;
  text-align: center;
  padding: 48px 0;
}

.site-footer a {
  color: var(--earth);
}

.footer-note {
  margin-top: 16px;
  opacity: 0.8;
  font-size: 0.9rem;
}

/* Garden Map */
.garden-canvas-wrap {
  max-width: 520px;
  margin: 0 auto;
}

.garden-section {
  position: relative;
  width: 100%;
  aspect-ratio: 58 / 113;
  background: #f4f6f1;
  border: 1px solid #dde3d6;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  overflow: hidden;
}

.garden-shape {
  position: absolute;
  transform: translate(-50%, -50%);
  background: rgba(255,255,255,0.9);
  border: 2px solid var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  user-select: none;
  min-width: 14px;
  min-height: 14px;
}

.garden-shape.circle {
  border-radius: 50%;
}

.garden-shape.rect {
  border-radius: 4px;
  background: rgba(255,255,255,0.75);
  border-color: var(--earth);
}

.shape-icon {
  width: 65%;
  height: 65%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shape-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.shape-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--green-dark);
  text-align: center;
  padding: 2px;
  line-height: 1.2;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.shape-photo {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: fill;
  display: block;
  pointer-events: none;
}

.garden-shape.circle .shape-photo {
  border-radius: 50%;
}

.garden-shape.photo-cover .shape-photo {
  object-fit: cover;
}

.garden-shape.is-new::after {
  content: 'NEW';
  position: absolute;
  top: -7px;
  right: -7px;
  background: #e0a030;
  color: white;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 2px 5px;
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  z-index: 6;
  pointer-events: none;
}

.garden-shape.rect .shape-photo {
  border-radius: 4px;
}

.shape-icon-inline {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-block;
}

.shape-icon-inline svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: currentColor;
}

.legend-icon {
  width: 14px;
  height: 14px;
  display: inline-block;
  vertical-align: -2px;
  margin-right: 4px;
}

.legend-icon svg {
  width: 14px;
  height: 14px;
  display: block;
  fill: currentColor;
}

.garden-shape.editable {
  cursor: grab;
}

.garden-shape.editable:active {
  cursor: grabbing;
}

.garden-shape.locked {
  opacity: 0.45;
  cursor: default;
}

.resize-handle {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 12px;
  height: 12px;
  background: var(--green-dark);
  border: 2px solid white;
  border-radius: 3px;
  cursor: nwse-resize;
}

.resize-handle.circle-handle {
  border-radius: 50%;
}

.garden-shape.selected {
  outline: 3px solid #2b7fff;
  outline-offset: 1px;
  z-index: 4 !important;
}

.selection-box {
  position: absolute;
  border: 2px dashed #2b7fff;
  background: rgba(43,127,255,0.12);
  pointer-events: none;
  z-index: 10;
}

.selection-count {
  font-weight: 600;
  color: var(--green-dark);
}

.measure-overlay {
  position: absolute;
  inset: 0;
  cursor: crosshair;
  z-index: 6;
}

.measure-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2b7fff;
  border: 2px solid white;
  transform: translate(-50%, -50%);
  z-index: 7;
}

.measure-label {
  position: absolute;
  transform: translate(-50%, -50%);
  background: white;
  border: 1px solid #2b7fff;
  color: #2b7fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  pointer-events: none;
  z-index: 7;
  white-space: nowrap;
}

.btn.active {
  outline: 3px solid #2b7fff;
}

/* Category-specific looks so hardscape reads as part of the ground, not a floating UI card */
.garden-shape.hardscape {
  z-index: 1;
  box-shadow: none;
}

.garden-shape.paths-layer {
  z-index: 0;
}

.garden-shape:not(.hardscape) {
  z-index: 2;
}

.garden-shape .resize-handle {
  z-index: 3;
}

.garden-shape[data-category="Paving & Paths"] {
  background: #cbb896;
  border: 1px solid #b8a37c;
}

.garden-shape[data-category="Walls & Fences & Doors"] {
  background: transparent;
  border: 2px dashed #8a8a3d;
  pointer-events: none;
}

.garden-shape[data-category="Walls & Fences & Doors"].editable {
  pointer-events: auto;
}

.garden-shape[data-category="Ground Cover"].rect {
  background: #a9714a;
  border: 1px solid #8f5f3e;
}

.garden-shape[data-category="Ground Cover"].rect .shape-label {
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* Photo markers fill their shape edge-to-edge with no frame around them */
.garden-shape.has-photo {
  background: none;
  border: none;
  box-shadow: none;
}

.garden-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  justify-content: center;
  margin: 24px 0;
}

.garden-legend span {
  background: white;
  border: 1px solid #e4e8de;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  color: #4a4a44;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

/* Modal */
#garden-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

#garden-modal.open {
  display: flex;
}

.modal-card {
  background: white;
  border-radius: 12px;
  padding: 28px;
  max-width: 400px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
}

.modal-card h3 {
  color: var(--green-dark);
  margin-bottom: 6px;
}

.modal-category {
  color: #777;
  margin-bottom: 14px;
  font-size: 0.9rem;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: #999;
}

.modal-card label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--green-dark);
  margin-top: 12px;
}

.modal-card input,
.modal-card select,
.modal-card textarea {
  width: 100%;
  padding: 8px 10px;
  margin-top: 4px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
}

.modal-card textarea {
  min-height: 70px;
  resize: vertical;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.btn-danger {
  background: #b23a3a;
  color: white;
  border: none;
}

.edit-toolbar {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin: 20px auto;
  max-width: fit-content;
  background: white;
  border-radius: 999px;
  padding: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.edit-toolbar .btn {
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 0.9rem;
}

.edit-toolbar .btn-primary {
  background: var(--green);
  color: white;
}

.edit-toolbar .btn-secondary {
  background: white;
  color: var(--green-dark);
  border: 1px solid #dde3d6;
}

.edit-toolbar .btn-secondary:hover {
  background: var(--green-light);
  opacity: 1;
}

.edit-toolbar .btn-secondary.active {
  background: var(--green-light);
  border-color: var(--green);
  outline: none;
}

.edit-toolbar .btn-danger {
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 0.9rem;
}

.edit-toolbar .selection-count {
  padding: 0 8px;
}

.password-gate {
  background: white;
  padding: 40px 0;
  text-align: center;
}

.password-gate-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
  flex-wrap: wrap;
}

.password-gate-row input {
  padding: 10px 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
}

#password-gate-msg {
  color: #b23a3a;
  margin-top: 10px;
  font-weight: 600;
}

.edit-banner {
  background: #fff3cd;
  color: #7a5b00;
  text-align: center;
  padding: 10px;
  font-weight: 600;
}

#save-status {
  text-align: center;
  margin-top: 10px;
  min-height: 20px;
  color: var(--green-dark);
  font-weight: 600;
}

/* Phones */
@media (max-width: 600px) {
  .logo-img {
    height: 144px;
    width: 144px;
  }

  .logo-text {
    display: none;
  }

  .hero {
    padding: 60px 0;
  }

  .hero h1 {
    font-size: 1.8rem;
  }
}
