/* ───────── Global & Form & Export-Button Styles (unchanged except where noted) ───────── */

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #fdfdfc;
  margin: 0;
  padding: 20px;
  color: #333;
  /* Note: we no longer use text-align:center on body, 
     because we’ll handle centering the Masonry grid explicitly. */
}

h1 {
  text-align: center;
  margin-bottom: 5px;
  font-size: 2.5rem;
  letter-spacing: 1px;
}

/* Dad’s Name & Subtitle */

.dad-name {
  text-align: center;
  font-size: 1.5rem;
  color: #222;
  margin-bottom: 5px;
}

.subtitle {
  text-align: center;
  font-size: 1.2rem;
  color: #555;
  margin-top: -5px;
  margin-bottom: 20px;
  font-style: italic;
}

/* Dad’s Photo Header */

.dad-photo-container {
  text-align: center;
  margin-bottom: 20px;
}

.dad-photo {
  max-width: 400px;
  max-height: 400px;
  border-radius: 50%;
  border: 4px solid #fff;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  object-fit: cover;
}

/* Obituary Link (Submission Page Only) */

.obituary-link {
  text-align: center;
  margin-bottom: 20px;
}

.obituary-link a {
  color: #007BFF;
  text-decoration: none;
  font-size: 1rem;
}

.obituary-link a:hover {
  text-decoration: underline;
}

/* Form Page Styles */

.form-container {
  max-width: 500px;
  margin: 0 auto 40px;
  background: #fff;
  border-radius: 8px;
  padding: 25px 30px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.form-container h2 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 1.5rem;
  text-align: center;
  color: #222;
  letter-spacing: 0.5px;
}

.form-label {
  display: block;
  margin-bottom: 15px;
  font-size: 1rem;
  color: #333;
}

.form-input,
.form-input-file {
  width: 100%;
  padding: 10px 12px;
  margin-top: 6px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
}

.form-textarea {
  width: 100%;
  padding: 10px 12px;
  margin-top: 6px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  resize: vertical;
  box-sizing: border-box;
  min-height: 120px;
}

.submit-btn {
  display: block;
  width: 100%;
  background: #007BFF;
  color: #fff;
  border: none;
  padding: 12px;
  font-size: 1.1rem;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.2s ease;
}

.submit-btn:hover {
  background: #0056b3;
}

.form-input:invalid,
.form-textarea:invalid {
  border-color: #e74c3c;
}

/* View Board Button */

.view-board-container {
  text-align: center;
  margin-top: 15px;
}

.view-board-btn {
  display: inline-block;
  background: #28A745;
  color: #fff;
  text-decoration: none;
  padding: 10px 20px;
  font-size: 1rem;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.view-board-btn:hover {
  background: #1e7e34;
}

/* Export Button */

.export-container {
  text-align: center;
  margin-top: 20px;
  margin-bottom: 20px;
}

#exportBtn {
  background: #007BFF;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  font-size: 1rem;
  cursor: pointer;
}

#exportBtn:hover {
  background: #0056b3;
}

/* ───────── Masonry Container (.board-grid) ───────── */

/*
  We’re using Masonry.js now. .board-grid will be a normal block with
  position: relative → Masonry will place each .card absolutely inside it.
  We simply give .board-grid “margin: 0 auto;” to center its final width.

  Each .card has a fixed width: 250px (so the columns are exactly 250px wide).
  Masonry’s JavaScript will read that width (plus gutter) to determine how many
  cards fit per row.
*/

.board-wrapper,
.board-grid,
.card {
  overflow: visible;
}

.board-grid {
  position: relative;         /* required by Masonry */
  margin: 0 auto;             /* center the whole grid container */
  /* no width/max-width: let Masonry compute final width from children + gutters */
  padding: 0;
}

/* Each card is 250px wide, with 20px gutter. */
.card {
  position: absolute;         /* Masonry will set top/left for each card */
  width: 250px;
  padding: 20px 20px 30px;
  background: #fff;
  /* box-shadow: 0 6px 14px rgba(0,0,0,0.12); */
  border-radius: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  transform-origin: top center; /* keep rotation centered so it doesn't push the grid */
  text-align: left;
}

.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border-radius: 8px;  /* match your card’s radius */
  box-shadow: 0 6px 14px rgba(0,0,0,0.12);
  z-index: -1;         /* sit behind the card content */
}

.card-header {
  width: 100%;
  height: 10px;
  background: repeating-linear-gradient(
    -45deg,
    transparent, transparent 5px,
    rgba(255,255,255,0.5) 5px, rgba(255,255,255,0.5) 10px
  );
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  margin-bottom: 10px;
}

.card-name {
  margin: 0 0 8px;
  font-size: 1.1rem;
  color: #222;
  text-shadow: 0px 1px 1px rgba(255,255,255,0.8);
}

.card-message {
  font-size: 0.95rem;
  color: #333;
  line-height: 1.4;
  white-space: normal; /* preserve newlines, wrap text normally */
}

.card-photo {
  margin-top: 12px;
  text-align: center;
}

.card-photo img {
  max-width: 100%;
  max-height: 140px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.1);
}

.card:hover {
  transform: scale(1.02); 
  box-shadow: 0 8px 12px rgba(0,0,0,0.15);
  z-index: 1;
}

/* ───────── Responsive Tweaks ───────── */
/* When the viewport is ≤600px, we only have room for a single 250px card + 20px gutter → cards stack. Hide Export button. */

@media (max-width: 600px) {
  .export-container {
    display: none;
  }
  /* (Keep your existing mobile form/button tweaks exactly as before) */
  .form-container {
    padding: 20px;
    margin: 0 10px 30px;
  }
  .form-input,
  .form-input-file,
  .form-textarea {
    font-size: 0.95rem;
    padding: 8px 10px;
  }
  .submit-btn {
    font-size: 1rem;
    padding: 10px;
  }
  .view-board-btn {
    display: inline-block;
  }
}
