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

/* iOS 26 Safe Area Support */
body {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  background: linear-gradient(180deg, #e3e8ea 0%, #cfdde0 50%, #b0c9cb 100%);
  color: #2f3a3d;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Make Google Map responsive */
.map-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
  margin: 20px 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.map-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 8px;
}

/* Float-in animation */
@keyframes floatIn {
  0% { opacity: 0; transform: translateY(15px); }
  /* end with NO transform (fixes iOS tap bug on FB iframe) */
  100% { opacity: 1; transform: none; }
}
.main-float { animation: floatIn 1s ease-out forwards; }

/* NAV */
nav {
  background-color: rgba(33, 55, 70, 0.95);
  text-align: center;
  padding: 0.8rem 0;
  border-bottom: 2px solid #91a9b0;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 10;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
}
nav a {
  color: #cdd7db;
  text-decoration: none;
  margin: 0 1rem;
  font-weight: 600;
  transition: color 0.3s ease;
}
nav a:hover { color: #ffffff; }

main {
  max-width: 900px;
  width: 95%;
  margin: 140px auto 40px auto;
  padding: 2rem;
  background-color: rgba(255,255,255,0.95);
  border-radius: 8px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.15);
  text-align: center;
}

.logo {
  width: 160px;
  height: auto;
  display: block;
  margin: 0 auto 12px auto;
}

h1 {
  color: #1f3b4d;
  font-size: 2rem;
  margin-bottom: 0.5rem;
}
.subtitle {
  color: #355a6a;
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

/* Daily Verse */
.daily-verse {
  margin: 20px auto 30px auto;
  font-style: italic;
  color: #1f3b4d;
  font-size: 1.1rem;
  max-width: 700px;
  line-height: 1.6;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  opacity: 0;
  animation: fadeInVerse 2s ease-in forwards;
  background: rgba(240, 248, 250, 0.9);
  padding: 12px 18px;
  border-radius: 10px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.05);
}
.cross { font-size: 1.2rem; color: #355a6a; opacity: 0.9; }
#verseText small { display: block; margin-top: 6px; font-size: 0.9rem; color: #355a6a; }

@keyframes fadeInVerse {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Facebook feed */
.fb-container { margin-top: 2rem; display:flex; justify-content:center; }

/* Footer */
footer {
  text-align:center;
  background: rgba(50, 70, 85, 0.9);
  color: #cdd7db;
  padding: 1rem 0;
  font-size: 0.9rem;
  margin-top:auto;
  border-top: 2px solid #91a9b0;
}
footer a {
  color:#a8c0c8;
  text-decoration:none;
  font-weight:600;
}
footer a:hover { color:#ffffff; }

/* Responsive */
@media (max-width:600px){
  main { margin: 120px 10px 20px 10px; padding:1rem; }
  nav a { margin:0 0.5rem; font-size:0.9rem; }
  .logo { width: 120px; }
  .daily-verse { font-size: 1rem; padding:10px 12px; }
}

/* --- BLOG: DEFENSIVE / RESPONSIVE STYLES --- */

/* Prevent images from ever overflowing */
img { max-width: 100%; height: auto; display: block; }

/* Make sure fixed nav doesn't overlap content:
   Set nav height explicitly and add matching top padding to body/main */
nav {
  height: 60px;
  align-items: center;
  padding: 0 12px;
}
body {
  padding-top: 60px; /* equal to nav height */
}

/* If you have .main-float used across pages, target blog main specifically */
main.main-float, .main-float {
  max-width: 1100px;
  width: 95%;
  margin: 20px auto 60px;
  background: rgba(255,255,255,0.98);
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.08);
  padding: 20px;
  text-align: center;
  box-sizing: border-box;
}

/* Buttons */
#loginBtn, #accountBtn {
  display: inline-block;
  padding: 8px 14px;
  margin: 8px 6px;
  background: #274060;
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
}

/* Account Panel - ensure it fills available width and stacks nicely on mobile */
#accountPanel {
  width: 100%;
  display: none; /* JS toggles this */
  background: #f8fbfb;
  border: 1px solid #d6e2e2;
  border-radius: 8px;
  padding: 12px;
  box-sizing: border-box;
  margin-bottom: 16px;
}

/* Post form */
#postForm {
  width: 100%;
  background: #f8fbfb;
  border: 1px solid #d6e2e2;
  border-radius: 8px;
  padding: 12px;
  box-sizing: border-box;
  margin-bottom: 16px;
}

/* POSTS GRID - mobile-first: single column */
.posts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

/* POST CARD - make height consistent using auto rows + minmax */
.post-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #e1eaea;
  padding: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  box-sizing: border-box;
  overflow: hidden;
}

/* Title row with profile image */
.post-card h4 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px 0;
  color: #274060;
  font-size: 1.05rem;
}
.profile-photo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid #ccc;
}

/* Image in card: fixed aspect ratio container to prevent huge vertical images */
.post-image-wrap {
  width: 100%;
  height: 0;
  padding-bottom: 56.25%; /* 16:9 aspect */
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 10px;
}
.post-image-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Body text should be constrained and not push layout */
.post-body {
  font-size: 1rem;
  line-height: 1.5;
  color: #2b3335;
  margin: 8px 0 12px 0;
  flex-grow: 0;
}

/* Footer row: reactions / timestamp / actions, keep it at bottom */
.post-card .post-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.9rem;
  color: #55686a;
}

/* Comments block */
.comment-section {
  background: #f5f8f8;
  padding: 8px;
  border-radius: 8px;
  margin-top: 8px;
}
.comment-input { width: calc(100% - 90px); }
.comment-btn {
  width: 80px;
  display: inline-block;
}

/* Reaction emoji spacing */
.reactions .emoji { margin-right: 6px; cursor: pointer; }

/* Scroll top button visuals */
#scrollTopBtn { opacity: 0; transition: opacity 0.3s ease; }

/* Desktop / larger screens: 2-column grid and larger images */
@media (min-width: 760px) {
  .posts-grid { grid-template-columns: 1fr 1fr; }
  main.main-float { padding: 28px; }
  .post-body { font-size: 1rem; }
  .post-image-wrap { padding-bottom: 50%; } /* slightly taller images on desktop */
}

/* Larger desktop */
@media (min-width: 1100px) {
  .posts-grid { grid-template-columns: repeat(2, 1fr); gap: 22px; }
  .post-image-wrap { padding-bottom: 44%; }
}

/* Defensive: ensure nav links don't push content left on very narrow phones */
@media (max-width: 420px) {
  nav { height: auto; padding: 10px 6px; }
  body { padding-top: env(safe-area-inset-top); } /* revert to safe area if nav becomes multi-line */
  .logo { width: 110px; }
  main.main-float { margin: 12px 8px; padding: 12px; }
}

/* --- Small tweaks so the verse stays compact site-wide --- */
.daily-verse{ padding:10px 12px; line-height:1.35; font-size:1rem; gap:6px; }
#verseText small{ display:inline; margin-left:8px; font-size:.9rem; }

/* Make sure the FB container is allowed to show */
.fb-container{ display:flex; }

/* ---------------- iOS Safari tap fix for Facebook iframe ---------------- */
/* Ensure NO transforms on ancestors of the FB iframe so taps (play/open) work */
.main-float { transform: none !important; }                 /* after animation completes */
#fbFallback, .fb-container, .fb-card, .fb-iframe-wrap { transform: none !important; }
.fb-iframe-wrap { position: relative; z-index: 1; }
.fb-iframe-wrap iframe { pointer-events: auto; }

/* Optional: a little extra breathing room for the logo (keeps theme) */
.logo { margin: 14px auto 12px; }
@media (max-width:600px){ .logo{ margin:12px auto 10px; } }

/* Optional: tweak iframe height on small screens */
@media (max-width:600px){
  .fb-iframe-wrap { height: 520px; }
}
