:root {
  --ink: #16130f;
  --cream: #f6f1e6;
  --cream-soft: rgba(246, 241, 230, 0.84);
  --gold: #c6a36a;
  --glass: rgba(18, 15, 12, 0.9);
  --banner-max: 46rem;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--ink);
}

body {
  font-family: "Source Serif 4", Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  color: var(--cream);
}

#view {
  position: absolute;
  inset: 0;
}

/* Banner sits above the map surface but below Esri UI so expand panels cover it. */
.banner {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
  padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) 0
    max(0.75rem, env(safe-area-inset-left));
}

.esri-view .esri-ui {
  z-index: 2 !important;
}

.banner-card {
  position: relative;
  pointer-events: auto;
  width: min(var(--banner-max), 100%);
  padding: 0.85rem 1.6rem 1rem;
  text-align: center;
  background: var(--glass);
  border: 1px solid rgba(198, 163, 106, 0.38);
  border-top: none;
  border-radius: 0 0 1rem 1rem;
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
}

.banner-close {
  position: absolute;
  top: 0.28rem;
  right: 0.35rem;
  z-index: 1;
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(246, 241, 230, 0.42);
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}

.banner-close:hover,
.banner-close:focus-visible {
  color: rgba(246, 241, 230, 0.82);
}

.banner-close:focus {
  outline: none;
}

.banner-close:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 2px;
}

.banner-restore {
  pointer-events: auto;
  display: none;
  margin: 0 auto;
  padding: 0.28rem 0.85rem 0.38rem;
  border: 1px solid rgba(198, 163, 106, 0.38);
  border-top: none;
  border-radius: 0 0 0.75rem 0.75rem;
  background: var(--glass);
  color: #fbf7ef;
  font-family: "Cormorant Garamond", Palatino, Georgia, serif;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
}

.banner.is-dismissed .banner-card {
  display: none;
}

.banner.is-dismissed .banner-restore {
  display: block;
}

.banner-card::before {
  content: "";
  display: block;
  height: 2px;
  margin: -0.85rem -1.6rem 0.75rem;
  background: linear-gradient(90deg, transparent, var(--gold) 20%, #f0e2c4 50%, var(--gold) 80%, transparent);
}

.title {
  margin: 0;
  font-family: "Cormorant Garamond", "Palatino Linotype", Palatino, Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.85rem, 4.2vw, 3.35rem);
  line-height: 0.95;
  letter-spacing: 0.035em;
  color: #fbf7ef;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
}

.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  margin: 0.55rem auto 0.7rem;
}

.ornament::before,
.ornament::after {
  content: "";
  width: 3.4rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold));
}

.ornament::after {
  background: linear-gradient(90deg, var(--gold), transparent);
}

.ornament span {
  width: 0.38rem;
  height: 0.38rem;
  background: var(--gold);
  transform: rotate(45deg);
}

.scripture {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: center;
}

.scripture.is-interactive {
  cursor: pointer;
}

.scripture:focus {
  outline: none;
}

.scripture:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 5px;
}

.scripture-text {
  display: block;
  margin: 0;
  font-family: "Source Serif 4", Georgia, "Iowan Old Style", serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(0.84rem, 1.25vw, 1.02rem);
  line-height: 1.45;
  color: var(--cream-soft);
}

.scripture-text--short {
  display: none;
}

.scripture-text .mark {
  font-style: normal;
  color: rgba(198, 163, 106, 0.9);
}

.scripture-meta {
  display: block;
}

.citation {
  display: block;
  margin-top: 0.55rem;
  font-family: "Cormorant Garamond", Palatino, Georgia, serif;
  font-style: normal;
  font-weight: 600;
  font-size: 0.98rem;
  font-variant: small-caps;
  letter-spacing: 0.14em;
  color: var(--gold);
}

.citation-short {
  display: none;
}

.scripture-hint {
  display: none;
  margin-top: 0.35rem;
  font-family: "Cormorant Garamond", Palatino, Georgia, serif;
  font-size: 0.78rem;
  font-style: normal;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.submap {
  position: absolute;
  z-index: 3;
  right: 0;
  bottom: 0;
  width: 350px;
  margin: 0;
  padding: 0;
  pointer-events: none;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.submap img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: auto;
}

.submap-toggle {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin: 0;
  padding: 0;
  pointer-events: auto;
  border: 0;
  border-radius: 0;
  background: rgba(18, 15, 12, 0.72);
  color: rgba(246, 241, 230, 0.92);
  cursor: pointer;
}

.submap-toggle:hover,
.submap-toggle:focus-visible {
  background: rgba(18, 15, 12, 0.9);
  color: #fbf7ef;
}

.submap-toggle:focus {
  outline: none;
}

.submap-toggle:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 2px;
}

.submap-toggle-icon {
  display: block;
  width: 14px;
  height: 14px;
}

.submap-toggle-icon--show {
  display: none;
}

.submap.is-collapsed {
  width: 20px;
  height: 20px;
}

.submap.is-collapsed img {
  display: none;
}

.submap.is-collapsed .submap-toggle-icon--hide {
  display: none;
}

.submap.is-collapsed .submap-toggle-icon--show {
  display: block;
}

@media (max-width: 760px) {
  .banner {
    padding-left: max(3.35rem, env(safe-area-inset-left));
    padding-right: max(3.35rem, env(safe-area-inset-right));
  }

  .banner-card {
    padding: 0.65rem 1.55rem 0.65rem 0.95rem;
  }

  .banner-card::before {
    margin: -0.65rem -1.55rem 0.55rem -0.95rem;
  }

  .title {
    letter-spacing: 0.02em;
  }

  .ornament {
    margin: 0.4rem auto 0.45rem;
  }

  .ornament::before,
  .ornament::after {
    width: 2.2rem;
  }

  .scripture-text--full {
    display: none;
  }

  .scripture-text--short {
    display: block;
  }

  .banner.is-open .scripture-text--full {
    display: block;
  }

  .banner.is-open .scripture-text--short {
    display: none;
  }

  .scripture-meta {
    display: flex;
    align-items: baseline;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.15rem 0.7rem;
    margin-top: 0.4rem;
  }

  .citation {
    margin-top: 0;
    letter-spacing: 0.08em;
  }

  .citation-full {
    display: none;
  }

  .citation-short {
    display: inline;
  }

  .scripture-hint {
    display: inline;
    margin-top: 0;
    letter-spacing: 0.12em;
  }

  .submap {
    width: 120px;
    right: 0;
    bottom: 0;
  }

  .submap.is-collapsed {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 380px) {
  .title {
    font-size: 1.65rem;
  }
}

.esri-view {
  background: var(--ink);
}

.esri-view .esri-ui-inner-container.esri-ui-corner-container {
  top: max(0.75rem, env(safe-area-inset-top)) !important;
  left: max(0.75rem, env(safe-area-inset-left)) !important;
  right: max(0.75rem, env(safe-area-inset-right)) !important;
}

.esri-basemap-gallery {
  width: min(22.5rem, calc(100vw - 5.25rem));
  max-height: min(68vh, 32rem);
  overflow: auto;
}

.layers-panel {
  display: flex;
  flex-direction: column;
  width: min(22.5rem, calc(100vw - 5.25rem));
  max-height: min(68vh, 32rem);
  overflow: hidden;
  background: #fff;
}

.layers-panel .esri-layer-list {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.layer-list-header,
.layer-list-links {
  flex: 0 0 auto;
  padding: 0.7rem 0.9rem 0.8rem;
  background: #f6f1e6;
  color: #3d3424;
  font-family: "Cormorant Garamond", Palatino, Georgia, serif;
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.layer-list-header {
  border-bottom: 1px solid rgba(110, 95, 55, 0.22);
}

.layer-list-links {
  border-top: 1px solid rgba(110, 95, 55, 0.22);
}

.layer-list-3d-link {
  color: #3d3424;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-decoration: underline;
}

.layer-list-3d-link:hover,
.layer-list-3d-link:focus-visible {
  color: #16130f;
}

@media (prefers-reduced-motion: reduce) {
  .scripture-text {
    transition: none;
  }
}
