/* ============================================================================
   Font Declarations
   ============================================================================ */

/* Unna font family - Serif font for primary text */
@font-face {
  font-family: 'Unna';
  src: url('/assets/Unna-Regular.6f84bbad.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'Unna';
  src: url('/assets/Unna-Bold.697fe112.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
}

@font-face {
  font-family: 'Unna';
  src: url('/assets/Unna-Italic.3f43b190.ttf') format('truetype');
  font-weight: normal;
  font-style: italic;
}

@font-face {
  font-family: 'Unna';
  src: url('/assets/Unna-BoldItalic.072a1730.ttf') format('truetype');
  font-weight: bold;
  font-style: italic;
}

/* Anuphan font family - Sans-serif font for prayer blocks */
@font-face {
  font-family: 'Anuphan';
  src: url('/assets/Anuphan-Regular.c08026e5.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'Anuphan';
  src: url('/assets/Anuphan-Bold.eb034823.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
}

/* Libertinus font family */
@font-face {
  font-family: 'Libertinus';
  src: url('/assets/LibertinusSerif-Regular.cf4d09a5.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'Libertinus';
  src: url('/assets/LibertinusSerif-Bold.8c0eeb3d.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
}

/* WixMadeforDisplay font family for buttons */
@font-face {
  font-family: 'WixMadeforDisplay';
  src: url('/assets/WixMadeforDisplay-VariableFont_wght.ade8fe70.ttf') format('truetype');
  font-weight: 400 800;
  font-style: normal;
}

/* ============================================================================
   Theme Variables
   ============================================================================ */

:root {
  /* Colors */
  --color-grey-0: black;
  --color-grey-1: #201d18;
  --color-grey-2: #f0f0f0;
  --color-red-0: #4d0404;
  --color-red-1: #650505;
  --color-red-1-transparent: #650505AA;
  --color-red-2: #b40000;
  --color-gold-0: #aa9041;
  --color-gold-1: #eac65b;
  --color-gold-2: #fff3cf;
  --color-gold-3: #fff8e5;
  /* Light theme */
  --color-prayer-bg: var(--color-gold-2);
  --color-prayer-text: var(--color-grey-0);
  --color-prayer-accent: var(--color-red-2);
  --color-menu-item-bg: var(--color-red-0);
  --color-menu-bg: var(--color-red-1);
  --color-menu-text: var(--color-gold-1);
  --color-footer-bg: var(--color-red-1-transparent);
  --color-settings: var(--color-red-0);
  --color-settings-selected-btn-bg: var(--color-gold-1);
  /* Fonts */
  --font-text: 'Anuphan', serif;
  --font-comments: 'Unna', sans;
  --font-headings: 'Libertinus', sans-serif;
  --font-btns: 'WixMadeforDisplay', sans-serif;
}

[data-theme="dark"] {
  /* Dark theme */
  --color-prayer-bg: var(--color-grey-0);
  --color-prayer-text: var(--color-grey-2);
  --color-prayer-accent: var(--color-gold-1);
  --color-menu-item-bg: var(--color-grey-1);
  --color-menu-bg: var(--color-grey-0);
  --color-menu-text: var(--color-gold-1);
  --color-footer-bg: var(--color-red-1-transparent);
  --color-settings: var(--color-gold-1);
  --color-settings-selected-btn-bg: var(--color-red-0);
}

/* ============================================================================
   Global Styles
   ============================================================================ */

* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  font-family: var(--font-headings);
}

/* Make sure we respect the safe area */
body {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  background-color: var(--color-menu-bg);
}

/* Default height for SVG images */
img[src$=".svg"] {
  height: 2.5rem;
}

.prayer-block hr {
  margin: 2rem 0;
  border: none;
  border-top: 3px double var(--color-prayer-accent);
  overflow: visible;
  text-align: center;
}

.prayer-block hr::after {
  background: var(--color-prayer-bg);
  background-image: url("/assets/bedge-grunge.3b0b975f.png");
  content: "§";
  font-size: 1.5rem;
  color: var(--color-prayer-accent);
  padding: 0 0.5rem;
  position: relative;
  top: -1.05rem;
}

p {
  margin: 0.5rem 0;
}

p.prayer-accent {
  text-align: center;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--color-menu-text);
  margin: 1rem 0;
  font-weight: bold;
}

h3 {
  font-size: 1.5rem;
  text-align: center;
}

/* ============================================================================
   Layout Components
   ============================================================================ */

.app-container {
  overflow-y: auto;
  max-width: 700px;
  margin: 0 auto;
}

.page {
  min-height: calc(100vh - 8rem);
  padding: 6rem 1rem 1rem 1rem;
  background-color: var(--color-menu-bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
}

.footer {
  width: 100%;
  max-width: 700px;
  position: fixed;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background-color: var(--footer-bg);
}

.footer div {
  display: flex;
  color: var(--color-menu-text);
}

.footer-content-left {
  justify-content: flex-start;
  align-items: center;
}

.footer-content-right {
  justify-content: center;
  align-items: flex-end;
  flex-direction: column;
}

.nav-bar {
  width: 100%;
  max-width: 700px;
  min-height: 4rem;
  position: fixed;
  top: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background-color: var(--color-menu-bg);
  box-shadow: 0 -0 0.5rem rgb(0, 0, 0);
}

@media screen and (min-width: 701px) {
  .nav-bar {
    left: 50%;
    transform: translateX(-50%);
  }

  .footer {
    left: 50%;
    transform: translateX(-50%);
  }
}

.nav-bar div {
  min-width: 5rem;
}

.nav-title-cross {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.nav-title-cross img {
  min-height: 3rem;
  width: auto;
}

#btnBack {
  text-align: left;
  padding: 0.5rem 1rem;
}

#btnBack img {
  height: 1.75rem;
  margin-top: 4px;
}

#btnSettings {
  text-align: right;
  padding: 0.5rem 1rem;
  animation: fadeIn 1s ease-in;
}

#btnSettings img {
  height: 1.75rem;
  margin-top: 4px;
}

/* ============================================================================
   Utility Classes
   ============================================================================ */

/* Hide elements completely */
.no-display {
  display: none !important;
}

/* Info/error message box for loading states and errors */
.message-box {
  text-align: center;
  padding: 2rem;
  color: var(--color-prayer-text);
  font-size: 1.4rem;
}

/* Interactive button elements */
.btn {
  cursor: pointer;
  border-radius: 1rem;
  user-select: none;
}

.btn, .btn span {
  font-family: var(--font-btns);
  font-weight: 700;
  font-size: 1.3rem;
  text-align: center;
}

/* List container */
.list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* List item */
.list-item {
  padding: 1rem;
  font-size: 1.4rem;
  display: flex;
  justify-content: space-between;
  box-shadow: 0px 0px 0.5rem 0px rgba(0,0,0,0.75);
  background-color: var(--color-menu-item-bg);
  color: var(--color-menu-text);
}

/* List items with images */
.list-item > div {
  display: flex;
  align-items: center;
}

.list-item img {
  width: 2.5rem;
  height: 2.5rem;
  margin-right: 0.5rem;
}

.list-item-name, .list-item-name span {
  text-align: right;
}

.list-item.simple {
  justify-content: center;
}

/* Book shelf grid layout */
.book-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

/* Individual book items */
.book {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 1rem;
  box-shadow: 0px 0px 0.5rem 0px rgba(0, 0, 0, 0.75);
  background-color: var(--color-menu-item-bg);
  color: var(--color-menu-text);
  font-size: 1.2rem;
  font-weight: bold;
  min-height: 10rem;
  text-align: center;
}

.book img {
  width: 3rem;
  height: 3rem;
}

/* ============================================================================
   Today's Readings Page
   ============================================================================ */

.todays-readings-header {
  position: sticky;
  top: calc(4rem + env(safe-area-inset-top));
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  font-weight: bold;
  font-size: 1.2rem;
  color: var(--color-menu-text);
  background-color: var(--color-menu-bg);
  border-radius: 2rem;
  box-shadow: 0px 0px 0.5rem 0px rgba(0, 0, 0, 0.75);
}

.todays-readings-header .btn {
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.todays-readings-header .btn img {
  width: 1.5rem;
  height: 1.5rem;
}

.daily-readings-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.daily-reading-section {
  padding: 1rem 0 0 0;
  border-top: 1px solid var(--color-prayer-accent);
}

.daily-reading-section:first-child {
  border-top: none;
  padding-top: 0;
}

.daily-reading-section-title {
  margin: 0 0 1rem 0;
  font-size: 1.4rem;
  color: var(--color-prayer-accent);
}

.daily-reading-section-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.daily-reading-entry {
  padding-left: 0;
}

.daily-reading-meta {
  margin: 0 0 0.75rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: baseline;
  color: var(--color-prayer-accent);
}

.daily-reading-kind {
  font-weight: bold;
}

.daily-reading-citation {
  opacity: 0.95;
}

.daily-reading-meta-separator {
  opacity: 0.55;
}

.daily-reading-excerpt {
  padding: 0;
}

.daily-reading-chapter-label {
  margin: 1rem 0 0.5rem 0;
  text-align: left;
  font-size: 1rem;
  color: var(--color-prayer-accent);
  font-family: var(--font-comments);
}

/* ============================================================================
   Prayer Content Styles
   ============================================================================ */

/* Main prayer text block */
.prayer-block {
  text-align: justify;
  color: var(--color-prayer-text);
  font-family: var(--font-text);
}

/* Emphasized prayer text (responses, key phrases) */
.prayer-accent {
  color: var(--color-prayer-accent);
  font-family: var(--font-comments);
  font-weight: bold;
  font-style: italic;
}

/* Instructional comments within prayers */
.prayer-comment {
  margin: 1rem 0;
  font-family: var(--font-comments);
  font-style: italic;
  border-left: 2px solid var(--color-prayer-accent);
  padding-left: 1rem;
  color: var(--color-prayer-accent);
}

.prayer-heading {
  color: var(--color-prayer-text);
}

/* ============================================================================
   Page Styles
   ============================================================================ */

/* Fade-in animation for language buttons */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

#pageOnboarding .list-item {
  animation: fadeIn 2s ease-in;
}

#pageHome .book {
  animation: fadeIn 1s ease-in;
}

#pageTodaysReadings {
  justify-content: start;
}

#pageBible {
  padding-top: 5rem;
}

#pageBible .book {
  font-size: 1.5rem;
}

#pageTodaysReadings, #pageText {
  min-height: 100vh;
  background-color: var(--color-prayer-bg);
  background-image: url("/assets/bedge-grunge.aa9f6c4c.webp");
}

#pageBibleChapters .book-shelf {
  gap: 0.5rem;
}

/* ============================================================================
   Settings Menu & Backdrop
   ============================================================================ */

/* Backdrop overlay - covers entire screen */
.settings-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 998;
  animation: fadeIn 0.2s ease-in;
}

[data-theme="dark"] {
  .settings-backdrop {
    background-color: rgba(104, 104, 104, 0.5);
  }
}

/* Settings menu popup */
.settings-menu {
  position: fixed;
  top: 4.5rem;
  right: 1rem;
  max-width: 20rem;
  padding: 1rem 0;
  width: calc(100vw - 2rem);
  color: var(--color-settings);
  background-color: var(--color-prayer-bg);
  border-radius: 1rem;
  box-shadow: 0px 0px 1rem 0px rgba(0,0,0,0.75);
  z-index: 999;
  animation: slideDown 0.2s ease-out;
}

.settings-menu hr {
  margin: 1rem 0;
  border: none;
  border-bottom: 1px solid var(--color-settings);
}

@media screen and (min-width: 701px) {
  .settings-menu {
    right: calc(50vw - 350px + 1rem);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Settings section */
.settings-section {
  padding: 0 0.5rem;
}

.settings-section-title {
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 1rem;
  text-align: center;
  font-family: var(--font-btns);
}

/* Settings options container */
.settings-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

/* Theme section with 3 columns */
.settings-options.three-columns {
  grid-template-columns: repeat(3, 1fr);
}

/* Individual setting option button */
.settings-option {
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.settings-option.full-width {
  grid-column: 1 / -1;
}

.settings-option.active {
  background-color: var(--color-settings-selected-btn-bg);
}

.settings-option img {
  width: 2rem;
  height: 2rem;
}

.settings-option span {
  font-size: 0.9rem;
  font-weight: 600;
}

/* ============================================================================
   Chapter Item Styles
   ============================================================================ */

/* Chapter number button — thin like list-item, 3 per row in a book-shelf grid */
.chapter-item {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  box-shadow: 0px 0px 0.5rem 0px rgba(0, 0, 0, 0.75);
  background-color: var(--color-menu-item-bg);
  color: var(--color-menu-text);
}

#pageBibleChaptersContent .book-shelf {
  grid-template-columns: repeat(3, 1fr);
}

/* ============================================================================
   Bible Chapter Styles
   ============================================================================ */

.bible-chapter {
  padding: 1rem;
  line-height: 1.8;
}

.bible-section-heading {
  margin: 1.5rem 0 1rem 0;
  font-family: 'Unna', serif;
  font-weight: bold;
  color: var(--primary-color);
}

.bible-verse {
  margin: 0.5rem 0;
  text-indent: 1.5rem;
  color: var(--color-prayer-text);
}

.verse-number {
  font-weight: bold;
  color: var(--primary-color);
  margin-right: 0.3rem;
  font-size: 0.9em;
}

.chapter-navigation {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1rem 1.5rem;
}

.chapter-navigation-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4.5rem;
  min-height: 4rem;
  background-color: var(--color-menu-item-bg);
  box-shadow: 0px 0px 0.5rem 0px rgba(0, 0, 0, 0.75);
}

.chapter-navigation-btn img {
  width: 2rem;
  height: 2rem;
}

.chapter-navigation-btn.disabled {
  opacity: 0.35;
  pointer-events: none;
}
