/* ===== Theme Variables ===== */
:root {
  --bg: #fafafa;
  --text: #1a1a1a;
  --text-muted: #666;
  --card-bg: #fff;
  --border: #e0e0e0;
  --accent: #4a6fa5;
  --accent-light: #e8eef5;
  --header-bg: #2c3e50;
  --header-text: #fff;
  --prayer-bg: #f5f0e8;
  --prayer-border: #d4c9b0;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212;
    --text: #e0e0e0;
    --text-muted: #999;
    --card-bg: #1e1e1e;
    --border: #333;
    --accent: #7ba3d4;
    --accent-light: #1e2d3d;
    --header-bg: #1a2530;
    --prayer-bg: #2a2520;
    --prayer-border: #4a4030;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }
}

[data-theme="dark"] {
  --bg: #121212;
  --text: #e0e0e0;
  --text-muted: #999;
  --card-bg: #1e1e1e;
  --border: #333;
  --accent: #7ba3d4;
  --accent-light: #1e2d3d;
  --header-bg: #1a2530;
  --prayer-bg: #2a2520;
  --prayer-border: #4a4030;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

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

body {
  margin: 0;
  font-family: "Lora", Georgia, "Times New Roman", serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Header ===== */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  color: var(--header-text);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  flex-wrap: wrap;
}

header h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.header-icon {
  vertical-align: middle;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.header-nav select {
  background: rgba(255, 255, 255, 0.15);
  color: var(--header-text);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
}

.header-nav select:hover {
  background: rgba(255, 255, 255, 0.25);
}

.header-nav select option {
  background: var(--header-bg);
  color: var(--header-text);
  font-family: "Lora", Georgia, "Times New Roman", serif;
}

.prayer-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
  user-select: none;
}

.prayer-toggle input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.prayer-toggle-label {
  opacity: 0.9;
}

.font-size-picker {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.font-size-btn {
  background: rgba(255, 255, 255, 0.1);
  color: var(--header-text);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 4px 8px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
  opacity: 0.6;
  line-height: 1;
}

.font-size-btn:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.font-size-btn:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.font-size-btn.active {
  background: rgba(255, 255, 255, 0.25);
  opacity: 1;
}

.font-size-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  opacity: 1;
}

body.font-smaller main {
  font-size: 14px;
}

body.font-smaller main .verse-primary,
body.font-smaller main .verse-continuation {
  font-size: 0.9rem;
}

body.font-larger main {
  font-size: 18px;
}

body.font-larger main .verse-primary,
body.font-larger main .verse-continuation {
  font-size: 1.2rem;
}

#theme-toggle {
  background: rgba(255, 255, 255, 0.15);
  color: var(--header-text);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

#theme-toggle:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ===== Main Content ===== */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px;
  width: 100%;
  flex: 1;
}

/* ===== Kathisma & Stasis Headings ===== */
.kathisma-heading {
  text-align: center;
  font-size: 1.8rem;
  margin: 0 0 24px;
  color: var(--text);
  font-variant: small-caps;
}

.stasis-heading {
  text-align: center;
  font-size: 1.3rem;
  color: var(--text-muted);
  margin: 32px 0 16px;
  font-weight: 400;
  font-variant: small-caps;
}

/* ===== Psalm ===== */
.psalm {
  margin-bottom: 40px;
}

.psalm-heading {
  text-align: center;
  font-size: 1.4rem;
  margin: 24px 0 4px;
  font-weight: 500;
  font-variant: small-caps;
  color: #c62828;
}

.psalm-description {
  text-align: center;
  color: var(--accent);
  margin: 0 0 20px;
  font-size: 0.95rem;
}

.psalm-note {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0 0 16px;
}

.psalm-body {
  margin-top: 16px;
}

/* ===== Stanzas & Verses ===== */
.stanza {
  margin-bottom: 16px;
}

.verse {
  margin-bottom: 2px;
}

.verse-primary {
  font-size: 1.05rem;
  line-height: 1.7;
  padding-left: 2em;
  text-indent: -2em;
}

.verse-continuation {
  font-size: 1.05rem;
  line-height: 1.7;
  padding-left: 2em;
}

/* ===== Prayer Blocks ===== */
.prayer-block {
  background: var(--prayer-bg);
  border: 1px solid var(--prayer-border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 24px 0;
}

.prayer-text {
  margin: 8px 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

.prayer-instruction {
  margin: 8px 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.prayer-metanie {
  margin: 8px 0;
  font-size: 0.95rem;
}

.cross-marker {
  color: #2c5e2e;
  font-size: 0.8em;
}

.repeat {
  color: var(--accent);
  font-size: 0.85em;
  font-style: italic;
}

/* ===== Login Page ===== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
  text-align: center;
  max-width: 360px;
  width: 100%;
}

.login-card h1 {
  font-size: 1.4rem;
  margin: 16px 0 24px;
  font-variant: small-caps;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-card input[type="password"] {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1rem;
  background: var(--bg);
  color: var(--text);
  text-align: center;
}

.login-card button {
  padding: 10px 14px;
  background: var(--header-bg);
  color: var(--header-text);
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.login-card button:hover {
  background: var(--accent);
}

.login-error {
  color: #c62828;
  margin: 12px 0 0;
  font-size: 0.9rem;
}

/* ===== Prev/Next Arrows ===== */
.nav-arrow {
  background: rgba(255, 255, 255, 0.15);
  color: var(--header-text);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
  line-height: 1;
}

.nav-arrow:hover {
  background: rgba(255, 255, 255, 0.25);
}

.nav-arrow[hidden] {
  display: none;
}

/* ===== Footer ===== */
footer {
  text-align: center;
  padding: 24px 20px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  header {
    padding: 10px 12px;
    gap: 8px;
  }

  header h1 {
    font-size: 1rem;
  }

  .header-nav {
    order: 3;
    width: 100%;
    gap: 8px;
  }

  .header-nav select {
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
    padding: 6px 4px;
  }

  .font-size-picker {
    margin-left: auto;
  }

  .font-size-btn {
    padding: 3px 6px;
  }

  #theme-toggle {
    padding: 6px 8px;
    font-size: 0.9rem;
  }

  main {
    padding: 16px 12px;
  }

  .kathisma-heading {
    font-size: 1.4rem;
  }

  .psalm-heading {
    font-size: 1.2rem;
  }

  .verse-primary,
  .verse-continuation {
    font-size: 1rem;
  }

  .prayer-block {
    padding: 12px 14px;
  }
}
