.mdb-app {
  --mdb-story-bg-width: max(100vw, calc((100vh - 112px) * 1.7778));
  background:
    radial-gradient(ellipse at 50% 12%, rgba(255, 252, 245, 0.18) 0%, rgba(255, 252, 245, 0) 60%),
    linear-gradient(180deg, rgba(245, 234, 210, 0.18) 0%, rgba(218, 195, 155, 0.32) 100%),
    #efe5d2 url('/wp-content/plugins/gramps-view/assets/img/kaszuby-bg.jpg') center top / var(--mdb-story-bg-width) auto repeat-y;
  color: #212121;
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
}

/* Family navbar (shared with home page) */
.mdb-app .family-navbar-custom {
  background: rgba(255, 252, 246, 0.9);
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 30px rgba(28, 39, 33, 0.08);
  border-bottom: 1px solid rgba(120, 141, 122, 0.18);
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
}

.mdb-app .family-navbar-custom .family-navbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  box-sizing: border-box;
}

.mdb-app .family-navbar-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mdb-app .family-navbar-custom .site-title {
  color: #17324d;
  font-family: "Playfair Display", "Georgia", serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  margin: 0;
}

.mdb-app .family-navbar-custom .site-title:hover {
  color: #0f588c;
}

.mdb-app .family-navbar-subtitle {
  color: #5d6f61;
  font-size: 0.76rem;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mdb-app .family-navbar-panel {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  flex: 1 1 auto;
  min-width: 0;
}

.mdb-app .family-navbar-toggle {
  display: none;
  border: 1px solid rgba(23, 50, 77, 0.14);
  background: rgba(255, 255, 255, 0.72);
  border-radius: 14px;
  width: 46px;
  height: 46px;
  padding: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
}

.mdb-app .family-navbar-toggle span:not(.screen-reader-text) {
  width: 18px;
  height: 2px;
  background: #17324d;
  border-radius: 999px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.mdb-app .family-navbar-toggle.is-open span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.mdb-app .family-navbar-toggle.is-open span:nth-child(2) {
  opacity: 0;
}

.mdb-app .family-navbar-toggle.is-open span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.mdb-app .family-navbar-custom .family-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.mdb-app .family-navbar-custom .family-menu li a,
.mdb-app .family-navbar-custom .family-menu li a.nav-link {
  color: #17324d;
  text-decoration: none;
  padding: 10px 14px !important;
  border-radius: 999px;
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 0.84rem !important;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.01em;
  transition: background-color 0.25s, color 0.25s, transform 0.18s, box-shadow 0.18s;
  display: block;
}

.mdb-app .family-navbar-custom .family-menu li a:hover {
  background-color: rgba(15, 88, 140, 0.08);
  color: #0f588c;
  transform: translateY(-1px);
}

.mdb-app .family-navbar-custom .family-menu li.current-menu-item a {
  background: linear-gradient(135deg, rgba(18, 108, 173, 0.12), rgba(255, 255, 255, 0.9));
  color: #0f588c;
  box-shadow: inset 0 0 0 1px rgba(18, 108, 173, 0.16);
}

/* Main content area — biały kontener wycofany; tło/padding przejmuje shortcode */
.mdb-app .mdb-main {
  margin: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: 22px 0 40px;
}

.mdb-app .mdb-content {
  padding: 0 clamp(16px, 4vw, 48px);
}

.mdb-app .mdb-content--full:has(> .gramps-story) {
  padding: 0 !important;
}

.mdb-app .mdb-main:has(.gramps-story) {
  padding-top: 0;
  padding-bottom: 0;
}

/* Footer */
.mdb-app .mdb-footer {
  background: #0b2a4b;
  box-shadow: 0 -12px 24px rgba(11, 42, 75, 0.35);
  color: #fff;
  padding: 24px 0;
}

.mdb-app .mdb-footer a {
  color: #fff;
}

.mdb-app .mdb-footer .footer-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

.mdb-app .mdb-footer .footer-menu li {
  margin: 0;
}

.mdb-app .mdb-footer .footer-menu a {
  text-decoration: none;
  font-weight: 500;
}

/* Hero banner (featured image between navbar and content) */
.mdb-app .mdb-hero {
  width: 100%;
  height: 100px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.mdb-app .mdb-hero--tree {
  position: relative;
  height: 112px;
  display: flex;
  align-items: center;
  overflow: hidden;
  isolation: isolate;
}

.mdb-app .mdb-hero__content {
  width: 100%;
  padding: 0 max(18px, calc((100% - 1240px) / 2 + 18px));
  box-sizing: border-box;
  color: #fff;
  text-align: left;
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.55);
}

.mdb-app .mdb-hero__eyebrow {
  margin: 0 0 4px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: uppercase;
}

.mdb-app .mdb-hero__title {
  max-width: 760px;
  margin: 0 0 6px;
  color: #fff;
  font-size: clamp(18px, 1.35vw, 22px);
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: 0;
}

.mdb-app .mdb-hero + .mdb-main {
  margin-top: 0;
}

/* ===== Front page (family-front-page) ===== */

/* White background instead of blue gradient */
body.mdb-app:has(.family-slider) {
  background: #fff;
}

/* No navbar shadow on front page — slider is directly below */
body.mdb-app:has(.family-slider) .family-navbar-custom {
  box-shadow: none;
}

/* Slider wrapper: contains Smart Slider, single shadow below */
.mdb-app .family-slider {
  position: relative;
  z-index: 999;
  overflow: hidden;
  line-height: 0;
  font-size: 0;
}

/* Kill any margins Smart Slider adds inside the wrapper */
.mdb-app .family-slider > * {
  margin: 0 !important;
}

/* Front page content — flush below slider, white */
.mdb-app .family-main {
  background: #fff;
  margin: 0;
  padding: 0;
  position: relative;
  z-index: 1;
}

.mdb-app .family-content {
  background: #fff;
}

/* Reduce gap between slider and first content block */
.mdb-app .family-content > .wp-block-group:first-child {
  padding-top: 20px !important;
}

/* Icon centering in Gutenberg columns */
.mdb-app .wp-block-image figure.aligncenter {
  width: fit-content !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Family footer (used on front page) */
.mdb-app .family-footer {
  margin-top: 0;
}

.mdb-app .family-footer a {
  transition: color 0.2s;
}

.mdb-app .family-footer a:hover {
  color: #fff !important;
}

/* Responsive */
@media (max-width: 991px) {
  .mdb-app .mdb-main {
    margin: 0;
    padding-top: 18px;
    padding-bottom: 32px;
  }

  .mdb-app .mdb-footer .footer-menu {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .mdb-app .mdb-hero {
    height: 60px;
  }

  .mdb-app .mdb-hero--tree {
    height: auto;
    min-height: 112px;
  }

  .mdb-app .mdb-hero__content {
    width: 100vw !important;
    max-width: 100vw;
    padding: 0 18px;
  }

  .mdb-app .mdb-hero__title {
    width: calc(100vw - 36px) !important;
    max-width: calc(100vw - 36px) !important;
    font-size: 16px !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
    hyphens: auto;
  }
}

@media (max-width: 768px) {
  .mdb-app .family-navbar-custom .family-navbar-inner {
    padding: 12px 14px;
    gap: 12px;
    flex-wrap: wrap;
  }

  .mdb-app .family-navbar-toggle {
    display: inline-flex;
  }

  .mdb-app .family-navbar-panel {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 12px 4px 2px;
  }

  .mdb-app .family-navbar-panel.is-open {
    display: flex;
  }

  .mdb-app .family-navbar-custom .family-menu {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .mdb-app .family-navbar-custom .family-menu li a {
    padding: 10px 14px !important;
    font-size: 0.92rem !important;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.8);
  }

}

@media (max-width: 480px) {
  .mdb-app .family-navbar-custom .site-title {
    font-size: 1.15rem;
  }

  .mdb-app .family-navbar-subtitle {
    font-size: 0.7rem;
  }
}
