* {
  box-sizing: border-box;
  margin: 0;
}

body {
  background: linear-gradient(to bottom, #a00000 0%, #000000 100%);
  background-attachment: fixed;
  font-family: "Lora", serif;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3,
h4,
h5,
h6,
.menu-label,
.menu-item,
.menu-toc {
  font-family: "Montserrat", sans-serif;
}

.main-wrapper {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  height: 100vh;
  gap: 30px;
  padding: 0 20px;
  box-sizing: border-box;
}

.main-wrapper::after {
  content: "";
  width: 250px;
  flex-shrink: 0;
  display: block;
}

.sticky-menu {
  position: relative;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  width: 250px;
  flex-shrink: 0;
  box-sizing: border-box;
  overflow-x: hidden;
  max-height: 90vh;
  align-self: flex-start;
  margin-top: calc(50vh - 250px);
}

.sticky-menu-ornament {
  display: block;
  width: 100%;
  height: 34px;
  border-radius: 5px 5px 0 0;
  background-color: #a00000;
  object-fit: cover;
  object-position: center top;
}

.sticky-menu ul {
  list-style: none;
}
#main-menu {
  padding: 10px;
}

.menu-label {
  font-weight: bold;
  font-size: 0.7rem;
  color: #888;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.menu-row {
  margin-bottom: 6px;
}

.menu-item {
  padding: 4px 5px;
  margin-bottom: 2px;
  cursor: pointer;
  transition: 0.3s;
  border-radius: 4px;
  font-weight: 500;
  font-size: 1rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.menu-item.active {
  background-color: #a00000;
  color: white;
}

.menu-toc {
  list-style: none;
  margin: 4px 0 0 0;
  padding: 0 0 0 4px;
  max-height: 38vh;
  overflow-y: auto;
  font-size: 0.9rem;
  line-height: 1.25;
}

.menu-toc:empty {
  display: none;
}
.menu-toc li {
  margin: 0;
}

.menu-toc a {
  display: block;
  color: #555;
  text-decoration: none;
  padding: 3px 4px 3px 8px;
  border-left: 3px solid transparent;
  border-radius: 0 3px 3px 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  transition:
    color 0.2s,
    border-color 0.2s,
    background 0.2s;
}

.menu-toc a:hover {
  color: #a00000;
  background: rgba(160, 0, 0, 0.06);
}

.menu-toc a.active {
  color: #a00000;
  font-weight: 600;
  border-left-color: #a00000;
  background: rgba(160, 0, 0, 0.08);
}

.menu-toc .toc-h3 {
  padding-left: 8px;
}
.menu-toc .toc-h4 {
  padding-left: 16px;
  font-size: 0.8rem;
  color: #666;
}
.menu-toc .toc-h4.active {
  color: #a00000;
}

.lang-toolbar {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid #d3d3d3;
  z-index: 20;
}

.language-links {
  margin: 0;
  font-family: "Montserrat", sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
}

.language-links .lang-sep {
  color: #bbb;
  margin: 0 4px;
  user-select: none;
}
.lang-link {
  color: #333;
  text-decoration: none;
  padding: 2px 0;
  transition: color 0.2s;
}
.lang-link:hover,
.lang-link.active {
  color: #a00000;
}

.content-window {
  --content-inline-pad: 50px;
  background: white;
  min-width: 500px;
  max-width: 1000px;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  position: relative;
  border-radius: 5px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  z-index: 11;
  overflow: hidden;
}

#dynamicContent {
  animation: fadeIn 0.5s ease-out;
}

.content-window-scroll {
  padding: 0;
  overflow-y: auto;
  flex-grow: 1;
  min-height: 0;
  scrollbar-gutter: stable both-edges;
  scrollbar-width: thin;
  scrollbar-color: #a00000 #f1f1f1;
}

.content-scroll-inner {
  padding: 0 var(--content-inline-pad) 50px;
  min-height: 100%;
  box-sizing: border-box;
}

.scroll-top-divider {
  height: 1px;
  background-color: #d3d3d3;
  margin: 4px 0 18px;
}

.content-window-scroll::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.content-window-scroll::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}
.content-window-scroll::-webkit-scrollbar-thumb {
  background: #a00000;
  border-radius: 4px;
}
.content-window-scroll::-webkit-scrollbar-thumb:hover {
  background: #750000;
}
.content-window-scroll::-webkit-scrollbar-corner {
  background: #f1f1f1;
}

.scroll-content a {
  color: #a00000;
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid transparent;
  transition: all 0.2s ease-in-out;
}
.scroll-content a:hover {
  color: #000000;
  border-bottom: 1px solid #000000;
}
.scroll-content p {
  text-align: justify;
  line-height: 1.5;
  margin-bottom: 15px;
}
.scroll-content h2,
.scroll-content h3,
.scroll-content h4 {
  margin: 15px 0;
  color: #333;
}
.scroll-content ul {
  padding-left: 30px;
  margin-bottom: 15px;
}
.scroll-content li {
  margin-bottom: 8px;
  line-height: 1.2;
  text-align: justify;
}

.scroll-content blockquote {
  margin: 18px 0;
  padding: 10px 15px;
  border-left: 4px solid #a00000;
  background: #faf9f9;
  color: #242424;
  font-style: italic;
  line-height: 1.55;
  border-radius: 0 6px 6px 0;
  box-shadow: inset 0 0 0 1px rgba(160, 0, 0, 0.1);
}

.in-text-media {
  display: flow-root;
}

.in-text-media-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  object-fit: contain;
  background: #f4f2f0;
}

.media-figure-right,
.media-figure-left {
  width: min(30%, 442px);
  padding: 0;
}
.media-community,
.media-map {
  width: 440px;
}
.media-flag {
  width: 300px;
}
.media-coat-of-arms {
  width: 280px;
}

.media-figure-right,
.media-community,
.media-map,
.media-coat-of-arms {
  float: right;
  margin: 5px 0 12px 24px;
}
.media-figure-left,
.media-flag {
  float: left;
  margin: 5px 24px 12px 0;
}

.in-text-media-text {
  text-align: justify;
  line-height: 1.58;
  text-wrap: pretty;
}

.media-caption {
  font-family: "Montserrat", sans-serif;
  font-size: 0.8rem;
  color: #666;
  margin-top: 8px;
  text-align: center;
  line-height: 1.3;
  padding: 0 5px;
  font-style: italic;
}

.video-embed {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 10px 0 4px;
  aspect-ratio: 16 / 9;
  background: #111;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin: 24px 0 10px;
}

.gallery-thumb-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.gallery-thumb-btn:hover,
.gallery-thumb-btn:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  outline: 2px solid #a00000;
  outline-offset: 2px;
}

.gallery-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center;
  background: #e8e8e8;
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.88);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}

.gallery-lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.gallery-lightbox-img {
  max-width: min(92vw, 1200px);
  max-height: 88vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  user-select: none;
}

.gallery-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease;
  z-index: 3;
}

.gallery-lightbox-close:hover,
.gallery-lightbox-close:focus-visible {
  background: rgba(255, 255, 255, 0.3);
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.gallery-lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.85);
  font-family: "Montserrat", sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  z-index: 2;
}

.gallery-lightbox-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  transition:
    background 0.2s ease,
    color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.gallery-lightbox-prev {
  left: 16px;
}

.gallery-lightbox-next {
  right: 16px;
}

.gallery-lightbox-btn:hover,
.gallery-lightbox-btn:focus-visible {
  background: rgba(255, 255, 255, 0.3);
  color: #fff;
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.hero-band {
  width: 100%;
  padding: 10px 0 0;
}

.hero {
  display: grid;
  place-items: center;
  position: relative;
  width: 100%;
  margin: 0 auto;
  padding-top: 10px;
  padding-bottom: 20px;
  text-align: center;
  container-type: inline-size;
}

#heroRoot {
  position: relative;
}

.hero-slides {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 1;
  max-height: min(52vh, 420px);
  border-radius: 5px;
  overflow: hidden;
  background: #e8e8e8;
}

.hero-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  z-index: 0;
  transition: opacity 1.1s ease-in-out;
  pointer-events: none;
  transform: translateZ(0);
}

.hero-slide.is-visible {
  opacity: 1;
  z-index: 1;
}

.hero-btn {
  position: absolute;
  top: 0;
  height: 100%;
  width: 10%;
  max-width: 100px;
  color: rgba(255, 255, 255, 0.6);
  border: none;
  font-size: 2rem;
  cursor: pointer;
  z-index: 10;
  transition: all 0.3s ease;
  border-radius: 0;
  padding: 0;
  display: flex;
  align-items: center;
}

.hero-prev {
  left: 0;
  background: linear-gradient(
    to right,
    rgba(0, 0, 0, 0.5) 0%,
    transparent 100%
  );
  justify-content: flex-start;
  padding-left: 15px;
}

.hero-prev:hover {
  background: linear-gradient(
    to right,
    rgba(0, 0, 0, 0.8) 0%,
    transparent 100%
  );
  color: #ffffff;
}

.hero-next {
  right: 0;
  background: linear-gradient(to left, rgba(0, 0, 0, 0.5) 0%, transparent 100%);
  justify-content: flex-end;
  padding-right: 15px;
}

.hero-next:hover {
  background: linear-gradient(to left, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
  color: #ffffff;
}

.main-footer {
  position: fixed;
  bottom: 14px;
  right: 14px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  border-radius: 6px;
  z-index: 50;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 10px 14px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}

.footer-content {
  text-align: right;
  font-size: 0.82rem;
  line-height: 1.35;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mobile-menu-btn {
  display: none;
  width: 100%;
  background: #a00000;
  color: #ffffff;
  border: none;
  padding: 12px 15px;
  font-size: 1.1rem;
  font-family: "Montserrat", sans-serif;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid #750000;
  transition: background-color 0.2s;
}

.mobile-menu-btn:hover {
  background: #8b0000;
}

@media (max-width: 1150px) {
  body {
    padding: 0;
    background: #ffffff;
    height: auto !important;
    overflow: auto !important;
  }

  .main-wrapper {
    flex-direction: column;
    justify-content: flex-start;
    height: auto !important;
    padding: 0;
  }

  .main-wrapper::after {
    display: none;
  }

  .sticky-menu {
    position: sticky;
    top: 0;
    z-index: 200;
    left: 0;
    transform: none;
    width: 100%;
    max-width: 100%;
    margin-bottom: 0;
    margin-top: 0;
    flex-shrink: 0;
    overflow: visible;
    border-radius: 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border-bottom: none;
  }

  .sticky-menu-ornament {
    object-fit: none;
    object-position: center;
    border-radius: 0;
  }

  .mobile-menu-btn {
    display: block;
    padding-right: 120px;
  }
  #main-menu {
    display: none;
  }

  .main-wrapper {
    position: relative;
  }

  .lang-toolbar {
    position: fixed;
    top: 34px;
    right: 0;
    height: 47px;
    background: transparent;
    border: none;
    padding: 0 15px;
    justify-content: flex-end;
    z-index: 201;
  }

  .lang-link,
  .language-links .lang-sep {
    color: #ffffff;
  }

  .lang-link.active,
  .lang-link:hover {
    color: #ffffff;
    text-decoration: underline;
  }

  .sticky-menu.is-open #main-menu {
    display: block;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.98);
    z-index: 100;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
    max-height: 60vh;
    overflow-y: auto;
    padding-bottom: 15px;
    border-radius: 0 0 5px 5px;
  }

  .content-window {
    min-width: 0;
    max-width: 100%;
    max-height: none;
    flex-grow: 1;
    --content-inline-pad: 20px;
    border-radius: 0;
    box-shadow: none;
    position: static;
    overflow: visible;
    z-index: auto !important;
  }
  .content-window-scroll {
    overflow: visible !important;
  }

  .main-footer {
    position: static;
    width: 100%;
    max-width: 100%;
    background: transparent;
    box-shadow: none;
    padding: 30px 0 10px 0;
    margin-top: 40px;
    border-top: 1px solid #e0e0e0;
    justify-content: center;
  }

  .footer-content {
    text-align: center;
    color: #555;
  }
  .media-figure-right,
  .media-community,
  .media-map,
  .media-coat-of-arms {
    float: right !important;
    max-width: 45% !important;
    min-width: 220px !important;
    margin: 5px 0 15px 20px !important;
    display: block;
  }

  .media-figure-left,
  .media-flag {
    float: left !important;
    max-width: 45% !important;
    min-width: 220px !important;
    margin: 5px 20px 15px 0 !important;
    display: block;
  }
}

@media (max-width: 600px) {
  .media-figure-right,
  .media-figure-left,
  .media-community,
  .media-map,
  .media-flag,
  .media-coat-of-arms {
    float: none !important;
    max-width: 100% !important;
    width: auto !important;
    margin: 20px auto !important;
  }

  .hero-btn {
    display: none;
  }

  .photo-gallery {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }

  .gallery-lightbox-btn {
    width: 44px;
    height: 44px;
    font-size: 1.5rem;
  }
}
