/* Base resets */
* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: Moderat, sans-serif;
  overflow: hidden;
  color: #4caf50;
}

/* Layout containers */
#mainpage {
  display: flex;
  height: 100vh;
  margin: 0;
  flex-direction: row;
  background: #fff;
}

#content {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 570px;
  background-color: #ffffff;
  padding: 20px 50px 10px 80px;
  overflow-y: auto;
  font-weight: 100;
}

#map {
  flex: 1;
  height: 100vh;
  transition: filter 0.5s ease-in-out;
}

/* Draggable logo header */
#head_logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  touch-action: none;
}

#head_logo h1 { margin: 0; font-size: 2rem; }

/* --- Cards: Intro & About share the same container styling --- */
#intro,
#about-project {
  max-width: 760px;
  margin: 2.5rem auto 3rem;
  padding: 1.25rem 1.25rem 1.5rem;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.08);
  background: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.06);
}

/* ===== Share Form Dialog ===== */
dialog#story-form-dialog {
  border: none;
  border-radius: 12px;
  padding: 0;
  width: min(760px, 92vw);
  max-width: 760px;
  box-shadow: 0 20px 40px rgba(0,0,0,.18);
}
dialog#story-form-dialog::backdrop {
  background: rgba(0,0,0,.45);
}

/* Card shell – mirror #about-project look */
.sf-card {
  margin: 0; /* dialog handles positioning */
  padding: 0;
  background: transparent;
  box-shadow: 0 8px 24px rgba(0,0,0,.06);
  overflow: hidden;
}

/* Header like your green section headings */
.sf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: #4caf50;
  color: #fff;
}
.sf-header h3 {
  margin: 0;
  font-size: clamp(1.05rem, 1.1vw + 0.9rem, 1.25rem);
  font-weight: 600;
}

/* Body content: same readable spacing as #about-project */
.sf-body {
  padding: 1.25rem 1.25rem 1rem;
}
.sf-blurb {
  margin-bottom: .75rem;
  color: #4caf50;           /* align with intro/about tone */
  text-align: justify;      /* match #intro */
  line-height: 1.55;
}
.sf-blurb p { margin: .6rem 0; }

/* Form controls styled to match site */
.sf-form label {
  display: block;
  margin-top: 1rem;
  color: #4caf50;
  font-weight: 600;
}
.sf-form input,
.sf-form textarea {
  width: 100%;
  margin-top: .4rem;
  padding: .65rem .7rem;
  border: 1px solid #aaa;
  border-radius: 8px;
  font: 400 0.95rem/1.3 inherit;
  color: #111;
  background: #fff;
}
.sf-form textarea {
  min-height: 140px;
  resize: vertical;
}

/* Footer actions */
.sf-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid #eee;
  background: #fff;
}

/* Buttons – align with site’s green + neutral “ghost” */
.sf-btn {
  appearance: none;
  border-radius: 10px;
  padding: 10px 14px;
  font: 600 14px/1.2 system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans";
  cursor: pointer;
  transition: transform .06s ease, box-shadow .12s ease, background .12s ease, color .12s ease;
}
.sf-btn-primary {
  border: 1px solid rgba(0,0,0,.12);
  color: #fff;
  background: linear-gradient(180deg, #4caf50, #3f9a45);
  box-shadow: 0 3px 10px rgba(76, 175, 80, .20);
}
.sf-btn-primary:hover {
  background: linear-gradient(180deg, #55b757, #3f9a45);
  box-shadow: 0 6px 16px rgba(76, 175, 80, .28);
}
.sf-btn-primary:active { transform: translateY(1px); }
.sf-btn-ghost {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
}
.sf-btn-ghost:hover { background: #f8fafc; }



/* Intro content */
#intro h2 {
  font-size: 1.5em;
  margin: 1rem 0 0;
  color: #4caf50;
}

#intro p {
  color: #4caf50;
  margin: 0.8rem 0;
  line-height: 1.55;
  /* desktop/base weight; mobile tweak below */
  font-weight: 400;
}

#intro blockquote,
#intro em {
  color: #4caf50;
  font-weight: 400;
}

#intro blockquote {
  background: #f9f9f9;
  border-left: 2px solid #ccc;
  margin: 0.5em 0;
  padding: 0.5em 10px;
  font-style: normal;
  position: relative;
}
#intro blockquote::before {
  content: open-quote;
  color: #ccc;
  font-size: 3rem;
  line-height: 0;
  margin-right: 0.25em;
  position: absolute;
  left: -0.25em;
  top: -0.25em;
}

/* About content */
#about-project h2 {
  font-size: clamp(1.05rem, 1.2vw + 0.9rem, 1.25rem);
  margin: 0 0 .5rem;
}
#about-project p {
  margin: .5rem 0 0;
  line-height: 1.55;
}
#about-project .about-cta { margin-top: .75rem; }
#about-project .about-cta a {
  color: #2563eb;
  text-decoration: none;
  border-bottom: 1px dashed rgba(37,99,235,.45);
}
#about-project .about-cta a:hover { border-bottom-style: solid; }
#about-project .about-meta {
  display: block;
  margin-top: .75rem;
  color: #6b7280; /* neutral-500 */
}

/* Justify Text */
#intro, #about-project { text-align: justify; text-justify: inter-word; }

/* Theme/category buttons */
#themes {
  width: 100%;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.theme {
  display: inline-block;
  margin-right: 0;
  padding: 5px 10px;
  background-color: #4caf50;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  user-select: none;
}
.theme.active { background-color: #1cfc66; }

/* Share your story button */
.btn-share {
  margin-top: 1rem;
  padding: 0.75em 1.5em;
  background-color: orange;
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
}

/* Article listing */
#article-list { width: 100%; max-width: 570px; padding-top: 10px; }
#article-list ul.grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.card {
  position: relative;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.2s;
  background: #fff;
}
.card:hover { transform: scale(1.05); }
.card img {
  width: 100%; height: 150px; object-fit: cover; display: block;
}
.overlay, .inactiveoverlay {
  position: absolute; bottom: 0; left: 0; width: 100%; padding: 5px;
  font-size: 0.8rem; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.overlay { background: #4caf50; color: #fff; }
.inactiveoverlay { background: red; color: #fff; }

/* Modal */
.modal {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  display: flex; justify-content: center; align-items: center;
  z-index: 1000;
}
.modal-content {
  background-color: #ffffff; width: 90%; max-width: 500px; overflow-y: auto;
  border-radius: 10px; position: relative; text-align: center;
  animation: modalFadeIn 0.4s ease forwards;
}
@keyframes modalFadeIn { from { transform: translateY(-30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-content header { padding: 0.5rem; background: #4caf50; color: #ffffff; }
.modal-content header h2 { margin: 0; font-size: 1.4rem; }
.modal-content header h3 { margin: 0.3rem 0; font-size: 1rem; }


.modal-content.swap-fade { transition: opacity .16s ease; }
.modal-content.swap-fade.fade-out { opacity: 0; }




/* Modal footer (kept for future use; no buttons in current build) */
.modal .modal-footer {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-top: 1px solid #e5e7eb; background: #fff;
}

/* Optional enter/exit */
.modal { opacity: 0; transition: opacity .15s ease; }
.modal.show { opacity: 1; }

/* Image area + description area */
.imgWrapper {
  width: 100%; height: 300px; overflow: hidden; margin: 0;
  display: flex; align-items: center; justify-content: center; background-color: #f9f9f9; position: relative;
}
.imgWrapper img { width: 100%; height: 100%; object-fit: contain; transition: transform 0.5s ease; border-radius: 8px; }
.imgWrapper:hover img { transform: scale(1.1); }

.descriptionWrapper {
  background-color: #ffffff; max-height: 200px; overflow-y: auto; margin-top: 10px;
  text-align: justify; scrollbar-width: none; padding: 25px;
}
.descriptionWrapper::-webkit-scrollbar { display: none; }
.progress-bar {
  height: 4px; width: 0%; background-color: #4caf50;
  position: sticky; top: 0; left: 0; z-index: 1; transition: width 0.25s ease;
}

/* Page footer */
footer {
  background: #4caf50; color: #ffffff; font-size: 0.9rem;
  padding: 0.3rem; display: flex; align-items: center; justify-content: center;
}

/* Leaflet toggle button — gradient style */
.leaflet-bar .residents-toggle-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 132px; padding: 8px 12px;
  font: 600 14px/1.2 system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji","Segoe UI Emoji";
  color: #fff;
  background: linear-gradient(180deg, #4caf50, #3f9a45);
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 10px;
  text-decoration: none;
  box-shadow: 0 3px 10px rgba(76, 175, 80, .28);
  transition: transform .06s ease, box-shadow .12s ease, background .12s ease;
}
.leaflet-bar .residents-toggle-btn:hover {
  background: linear-gradient(180deg, #55b757, #3f9a45);
  box-shadow: 0 6px 16px rgba(76, 175, 80, .32);
}
.leaflet-bar .residents-toggle-btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 6px rgba(76, 175, 80, .25);
}
.leaflet-bar .residents-toggle-btn:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .5);
  outline-offset: 2px;
}

/* Make the Leaflet bar wrapper transparent so our button’s radius shows */
.leaflet-bar.leaflet-control { background: transparent; border: none; box-shadow: none; }

/* Marker clusters custom colours */
.marker-cluster-small div { background-color: rgba(255, 165, 0, 0.6) !important; }
.marker-cluster-small { background-color: rgba(255, 165, 0, 0.2) !important; }

/* Sepia filter when toggling people markers */
#map.sepia { filter: sepia(0.6); }

/* Share dialog (native <dialog>) */
dialog#share-dialog {
  width: min(680px, 92vw);
  border: none;
  border-radius: 12px;
  padding: 0;
  box-shadow: 0 20px 40px rgba(0,0,0,.25);
}
dialog#share-dialog::backdrop {
  background: rgba(0,0,0,.5);
}
.share-sheet header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: #4caf50; color: #fff; border-top-left-radius: 12px; border-top-right-radius: 12px;
}
.share-sheet .body {
  padding: 18px; background: #fff; max-height: 70vh; overflow: auto;
}
.share-sheet footer {
  display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; background: #fff; border-top: 1px solid #eee; border-bottom-left-radius: 12px; border-bottom-right-radius: 12px;
}
.share-sheet button.primary {
  background: #4caf50; color: #fff; border: none; border-radius: 8px; padding: 10px 14px; font-weight: 600; cursor: pointer;
}
.share-sheet button.ghost {
  background: #fff; color: #374151; border: 1px solid #d1d5db; border-radius: 8px; padding: 10px 14px; font-weight: 600; cursor: pointer;
}





/* Responsive adjustments */
@media (max-width: 500px) {
  #mainpage { display: grid; }

  #content {
    order: 1; width: 100%; padding: 20px; background: white;
    position: absolute; top: 50%; bottom: 0; left: 0; right: 0;
    border-top-left-radius: 12px; border-top-right-radius: 12px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2); z-index: 2;
    transition: top 0.3s ease; will-change: transform;
    -webkit-overflow-scrolling: touch; touch-action: pan-y;
    overflow-y: auto; padding-bottom: 80px;
  }

  #content::before { display: none; }

  #content-handle {
    width: 40px; height: 5px; background: #ccc; border-radius: 3px;
    margin: 10px auto 5px auto; cursor: grab;
  }

  #map { position: absolute; top: 0; bottom: 0; width: 100%; z-index: 1; }

  #themes .theme, .card .overlay, #article-list p { font-weight: bold; }

  /* Heavier mobile weight for Intro & About paragraphs */
  #intro p, #about-project p { font-weight: 500; }

   dialog#story-form-dialog {
    max-width: none;
    max-height: none;
    border-radius: 0;
  }
  .sf-header { padding: 14px; }
  .sf-body {
    padding: 16px;
    height: calc(100vh - 130px); /* header+footer space */
    overflow-y: auto;
  }
  .sf-footer {
    justify-content: center;
    padding: 14px;
  }
  .sf-form label { font-weight: 700; }
  .sf-btn { width: 100%; font-size: 15px; }

  
}
