/* ----------------------------------------------------
   overview. — Style (mobile-first, calming, minimal)
---------------------------------------------------- */

:root {
  --bg: #fafeff;
  --ink: #474747;
  --muted: #6a7483;
  --soft: #fafeff;
  --brand: #004080;
  --radius: 16px;
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.07);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */
}
*::-webkit-scrollbar {
  width: 0;
  height: 0;
  background: transparent;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

/* Prevent iOS auto-zoom on form inputs */
html, body {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Hide scrollbar on main page but keep scrolling */
html, body {
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */
}
html::-webkit-scrollbar, body::-webkit-scrollbar {
  width: 0;
  height: 0;
  background: transparent;
}

.search, .btn, .grid button, .btn.store {
  font-size: 16px; /* ensure tappable inputs maintain 16px to avoid iOS zoom */
}

.topbar {
  position: sticky;
  top: 0;
  background: var(--brand);
  border-bottom: none;
  padding: 18px 16px; /* reduced vertical padding */
  min-height: 72px; /* reduced header height */
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100; /* ensure header sits above content */
}

.brand {
  font-weight: 800;
  font-size: 36px; /* slightly smaller brand text */
  text-align: center;
  color: var(--soft);
  font-family: 'Georgia', serif;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%); /* vertically center the brand */
  z-index: 2;
  pointer-events: none;
}

.btn {
  border: none;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  border: 1px solid #cfd6dd;
}

/* General store button styling (applies to bottom panel button) */
.btn.store {
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(0,0,0,0.06)), var(--brand);
  background-color: var(--brand);
  color: #fafeff;
  padding: 10px 14px;
  line-height: 1;
  border-radius: 12px;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 8px 20px rgba(4,64,128,0.18);
}

.btn.store:hover {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 10px 24px rgba(4,64,128,0.22);
}

/* Layout */
.container {
  padding: 20px 16px 20px; /* reduced bottom padding to move content closer to viewport bottom */
  max-width: 800px;
  margin: 0 auto;
}

.container > section h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  margin-top: 20px;
}

/* Hero / Search */
.hero h1 {
  font-size: 22px;
  margin-bottom: 4px;
}

.sub {
  color: var(--muted);
  margin-bottom: 16px;
}

.search {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #d2d8de;
  font-size: 16px;
  margin-bottom: 8px;
}

.suggestions {
  list-style: none;
  border: 1px solid #e2e7ed;
  border-radius: 12px;
  background: white;
  display: block;
  margin-top: 6px;
  overflow: hidden;
  height: 200px;        /* fixed height so box remains the same even for 1 item */
  overflow-y: auto;     /* allow scrolling when content exceeds height */
  box-sizing: border-box; /* ensure padding doesn't change size */
  padding-right: 12px;   /* inset scrollbar away from rounded corners */
  -webkit-overflow-scrolling: touch; /* smooth scrolling on iOS */
}

/* Hide scrollbar for suggestions but keep scrolling */
.suggestions {
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */
}
.suggestions::-webkit-scrollbar {
  width: 0;
  height: 0;
  background: transparent;
}

/* Ensure corner matches track when visible */
.suggestions::-webkit-scrollbar-corner {
  background: transparent;
}

@media (min-width: 600px) {
  .suggestions {
    height: 220px; /* larger fixed height on wider screens */
  }
}

.suggestions[hidden] {
  display: none;
}

.suggestions li {
  padding: 12px 14px;
  cursor: pointer;
  border-top: 1px solid #f2f4f7;
}

.suggestions li:first-child {
  border-top: none;
}

.suggestions li:hover {
  background: var(--soft);
}

/* Category Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 10px;
  padding-bottom: 36px; /* extra space below last grid item */
}

@media (min-width: 600px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.grid button {
  border: 1px solid #e2e7ed;
  border-radius: var(--radius);
  background: #fafeff;
  padding: 16px 14px;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow);
}

/* Entry Modal */
.entry {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: none;
  border-radius: 18px;
  width: min(90vw, 700px);
  padding: 0;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow);
  /* brighter translucent surface with stronger whiteness */
  background: rgba(250, 254, 255, 0.95);
  border: 1px solid rgba(250, 254, 255, 0.9);
  -webkit-backdrop-filter: blur(14px) saturate(140%) brightness(1.03);
  backdrop-filter: blur(14px) saturate(140%) brightness(1.03);
  box-shadow: 0 14px 36px rgba(6, 24, 48, 0.08);
}

.entry::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 56px; /* height of the overlay area */
  background: linear-gradient(to bottom, rgba(250,254,255,1), rgba(250,254,255,0.02));
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  pointer-events: none;
  z-index: 2; /* gradient sits above content */
}

.entry::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

#entryContent {
  padding: 24px 24px 24px 24px;
  padding-top: 40px; /* reduced top padding now that there's no close button */
  overflow-y: auto;
  max-height: calc(90vh - 48px);
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */
  position: relative; /* create stacking context for content */
  z-index: 1; /* content sits below the gradient */
}

#entryContent::-webkit-scrollbar {
  width: 0;
  height: 0;
  background: transparent;
}

.entry h3 {
  margin-bottom: 4px;
}

.entry section {
  margin-top: 18px;
}

.scripture {
  background: rgba(250, 254, 255, 0.98);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(250, 254, 255, 0.9);
  -webkit-backdrop-filter: blur(10px) saturate(120%) brightness(1.02);
  backdrop-filter: blur(10px) saturate(120%) brightness(1.02);
  box-shadow: 0 6px 18px rgba(6, 24, 48, 0.04);
}

.entry details {
  margin-top: 20px; /* push 'Additional Verses' a bit lower */
}

.entry details ul {
  padding-left: 30px; /* move list inward from the dialog edge */
  margin-left: 0;
  font-size: 14px;
  font-style: italic;
  color: #4a4a4a;
}

.entry details li {
  margin-left: 0;
}

/* Bottom panel now part of main content */
.bottom-panel {
  margin-top: 20px;
  padding: 20px 12px 8px; /* reduced vertical padding */
  border-top: 1px solid rgba(0,0,0,0.04);
  background: transparent;
  text-align: center;
}

.bottom-panel small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

/* Dialog close button */
.entry form[method="dialog"] {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4; /* close button container sits above the gradient */
}

.entry .close {
  position: relative; /* allow z-index to take effect */
  z-index: 5; /* ensure button visually appears on top of gradient */
  background: #c00000d8;
  color: #fafeff;
  border: transparent;
  font-size: 24px;
  line-height: 1;
  width: 25px;
  height: 25px;
  border-radius: 80px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-top: -30px;
  margin-right: -4px;
}

/* Store chooser dialog tweaks */
.store-dialog {
  width: min(90vw, 420px);
  padding: 18px 18px 24px;
  border-radius: 14px;
}

#storeContent h3 {
  margin-top: 6px;
  margin-bottom: 8px;
}

.store-choices {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 12px;
}

.store-choices .btn.store {
  flex: 1;              /* equal width */
  min-width: 140px;     /* prevent too small on narrow screens */
  max-width: 220px;     /* avoid overly wide on large screens */
  padding: 10px 14px;
  font-weight: 700;
  text-align: center;
  /* liquid glass / beveled button */
  background: linear-gradient(180deg, rgba(#fafeff,1), rgba(#fff,1)), var(--brand);
  background-color: var(--brand); /* fallback */
  color: #fafeff;
  border-radius: 12px;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 8px 20px rgba(4,64,128,0.18);
}

.store-choices .btn.store:hover {
  /* subtle lift (transitions globally disabled for clicks; hover still styles) */
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 10px 24px rgba(4,64,128,0.22);
}

/* Disable click/tap animations and highlights on interactive elements */
button, .btn, .grid button, .suggestions li, #searchResults li, .store-choices .btn.store {
  -webkit-tap-highlight-color: transparent; /* iOS tap flash */
  -webkit-user-select: none;
  user-select: none;
  transition: none !important; /* remove transition-based animations */
}

button:active, .btn:active, .grid button:active, .suggestions li:active, #searchResults li:active, .store-choices .btn.store:active {
  transform: none !important;
  background-color: inherit !important;
  box-shadow: none !important;
}

/* Keep keyboard focus visible for accessibility */
:focus {
  outline: none;
}
:focus-visible {
  outline: 2px solid rgba(0,64,128,0.15);
  outline-offset: 2px;
}

/* Fallback for browsers without backdrop-filter: increase opacity slightly */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .entry, .scripture, .grid button {
    background: rgba(#fafeff,2);
    border-color: rgba(#fafeff, 0.2);
  }
}

