/* ----------------------- */
/* Base + Layout           */
/* ----------------------- */
html, body {
  height: auto;                 /* avoid fixed viewport heights for PDF export */
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  /* no flex here: keeps Safari "Export as PDF" from cutting content */
  font-family: Helvetica, Arial, sans-serif;
  line-height: 1.6;
  background: #FDFDFD;
  color: #1B3A4B;
}

main.container {
  max-width: 1100px;
  margin: 30px auto;
  padding: 0 20px;
  box-sizing: border-box;
}

/* ----------------------- */
/* Header                  */
/* ----------------------- */
.site-header {
  background: #62B6CB;
  width: 100%;
  padding: 8px 15px;
  box-sizing: border-box;
}

.site-header .header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 5px 15px;
  box-sizing: border-box;
  flex-wrap: wrap;
  gap: 10px;
}

.site-header .logo img,
.site-footer .logo img {
  max-height: 75px;
  width: auto;
  flex-shrink: 0;
}

/* Hamburger button (hidden on desktop; your JS can toggle .open) */
#hamburger-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
}

/* Navigation */
.site-header nav { flex: 1 1 auto; min-width: 0; }

.site-header nav ul {
  list-style: none;
  display: flex;
  margin: 10px 0;
  padding: 0;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 15px;
}

.site-header nav a {
  color: #FDFDFD;
  text-decoration: none;
  font-weight: bold;
  transition: color 0.3s ease;
  font-size: 1.1em;
  white-space: nowrap;
}

.site-header nav a:hover,
.site-header nav a.active { color: #1B3A4B; text-decoration: underline; }

/* ----------------------- */
/* Highlight Block         */
/* ----------------------- */
.highlight { background: #F4E9CD; padding: 20px; border-radius: 8px; margin: 20px 0; }

/* Two-column profile layout */
.profile-section {
  display: flex;
  align-items: flex-start;
  gap: 30px;
  margin: 30px 0;
  flex-wrap: wrap;
}

.profile-photo img {
  width: 200px;
  height: auto;
  border-radius: 8px;
  flex-shrink: 0;
}

.profile-letter {
  flex: 1;
  text-align: left;
}

/* Content block image above paragraph */
.content-block { max-width: 1100px; margin: 30px auto; text-align: left; }
.content-block img { width: 100%; height: auto; border-radius: 12px; display: block; margin-bottom: 20px; }

/* ----------------------- */
/* Footer                  */
/* ----------------------- */
.site-footer {
  background: #1B3A4B;
  color: #FDFDFD;
  font-size: 0.9em;
  padding: 50px 40px;
}

.site-footer .footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  max-width: 1100px;
  margin: 0 auto;
  flex-wrap: wrap;
  gap: 8px;
}

.site-footer .footer-left { display: flex; flex-direction: column; gap: 8px; }
.site-footer .social-icons a { display: inline-block; padding: 0 10px; transition: transform 0.3s ease; }
.site-footer .social-icons a:hover { transform: scale(1.1); }
.site-footer .footer-right ul { list-style: none; padding: 25px 0 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.site-footer .footer-right a { color: #FDFDFD; text-decoration: none; transition: color 0.3s ease; }
.site-footer .footer-right a:hover, .site-footer .footer-right a:active { color: #F4E9CD; text-decoration: underline; }
.site-footer p.copyright { font-size: 0.75em; margin-top: 10px; text-align: center; color: #FDFDFD; }

/* ----------------------- */
/* Harbour Banner (top)    */
/* ----------------------- */
.banner {
  width: 100%;
  margin: 0;
  padding: 0;
  line-height: 0;
  overflow: visible; /* no clipping for print/PDF */
  background-image: url('/stjohns-banner.png?v=12');
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  position: relative;
}
.banner::before {
  content: "";
  display: block;
  /* 2012 × 746 -> 746/2012 = 37.08% */
  padding-top: 37.08%;
}

/* Accent name */
.accent-name { color: #62B6CB; font-weight: bold; font-style: italic; font-size: 1.2em; }

/* ----------------------- */
/* Gallery                 */
/* ----------------------- */
.gallery { display: flex; flex-wrap: wrap; gap: 15px; justify-content: center; }
.gallery img { width: 450px; height: auto; border-radius: 8px; object-fit: cover; }

/* ----------------------- */
/* Responsive / Mobile     */
/* ----------------------- */
@media (max-width: 768px) {
  #hamburger-toggle { display: block; }
  .site-header nav { display: none; width: 100%; margin-top: 10px; }
  .site-header nav.open { display: block; }
  .site-header nav ul { flex-direction: column; align-items: flex-start; gap: 10px; margin: 0; }
  .profile-section { flex-direction: column; gap: 20px; }
  .profile-photo img { width: 100%; max-width: 300px; margin: 0 auto; }
  .site-footer .footer-inner { flex-direction: column; align-items: flex-start; }
}

/* =========================================================
   PRINT + SAFARI "EXPORT AS PDF" STYLES
   - linear flow (no flex/100vh)
   - full blue header + FULL menu
   - harbour banner printed
   - footer banner printed
   - no clipping or cut-offs
   ========================================================= */
@media print {
  @page { size: auto; margin: 12mm; }

  html, body {
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    display: block !important;          /* disable any flex assumptions */
    overflow: visible !important;
    background: #fff !important;
    color: #000 !important;
    -webkit-print-color-adjust: exact;   /* keep colors (Safari/Chromium) */
    print-color-adjust: exact;
  }

  /* Header: show blue bar and FULL nav at top */
  .site-header {
    display: block !important;
    position: static !important;
    width: 100% !important;
    margin: 0 0 10mm 0 !important;
    padding: 6mm 10mm !important;
    background: #62B6CB !important;
    color: #FFFFFF !important;
    box-shadow: none !important;
    border: 0 !important;
    page-break-after: avoid;
  }
  .site-header .header-inner {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    max-width: none !important;
    padding: 0 !important;
    gap: 8mm !important;
    flex-wrap: wrap !important;          /* ensures Home, About, Gallery, Place a Sign, Contact all appear */
  }
  .site-header .logo img {
    display: block !important;
    height: 14mm !important;
    width: auto !important;
  }
  .site-header nav { display: block !important; width: auto !important; }
  .site-header nav ul {
    display: flex !important;
    gap: 6mm !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    flex-wrap: wrap !important;
  }
  .site-header nav a {
    color: #FFFFFF !important;
    text-decoration: underline !important;
    font-weight: 700 !important;
    font-size: 12pt !important;
    white-space: nowrap !important;
  }

  /* Keep main content linear */
  main.container {
    max-width: none !important;
    margin: 0 !important;
    padding: 0 12mm !important;
  }
  .profile-section {
    display: block !important;           /* no flex in print */
  }
  .profile-letter, .profile-photo {
    float: none !important;
    width: 100% !important;
  }

  /* Print the harbour banner (prefer real image if present) */
  .banner {
    display: block !important;
    overflow: visible !important;
    page-break-after: avoid;
    background-image: url('/stjohns-banner.png?v=12') !important;
    background-size: cover !important;
    background-position: center !important;
  }
  /* If your HTML contains an <img> inside .banner or #top-banner, show it in print too */
  .banner img, #top-banner img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-width: none !important;
    margin: 0 0 8pt 0 !important;
  }

  /* Footer banner (keep blue area) */
  .site-footer {
    background: #1B3A4B !important;
    color: #FFFFFF !important;
    padding: 12mm 12mm !important;
    margin-top: 10mm !important;
  }
  .site-footer .footer-inner { display: block !important; }
  .site-footer a { color: #FFFFFF !important; text-decoration: underline !important; }

  /* Prevent awkward splits */
  h2, h3, p, ul, li {
    break-inside: avoid-page;
    page-break-inside: avoid;
  }
  h2, h3 {
    break-after: avoid-page;
    page-break-after: avoid;
  }

  /* Never clip long sections */
  * {
    overflow: visible !important;
    box-shadow: none !important;
    text-shadow: none !important;
    transform: none !important; /* avoid transform creating new containing blocks in print/PDF */
  }
}

/* ---------------------------------------------------------
   SAFARI "EXPORT AS PDF" sometimes uses screen media.
   These rules mimic our print fixes for that path by
   detecting WebKit and forcing linear flow + no clipping.
   --------------------------------------------------------- */
@supports (-webkit-touch-callout: none) {
  @media screen {
    /* When exporting as PDF, Safari snapshots the page.
       Ensure full linear flow and no fixed viewport constraints. */
    html, body {
      height: auto !important;
      min-height: 0 !important;
      overflow: visible !important;
    }
    /* Avoid anything that could clip content during snapshot */
    .banner { overflow: visible !important; }
  }
}