html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* -------------------------------------------------------
   1. Root variables
------------------------------------------------------- */
:root {
  --ink:#1c1c1c;
  --muted:#6b7280;

  --bg:#f8faf9;
  --card:#ffffff;
  --line:#e5e7eb;

  --accent:#5f7d6b;       /* soft sage */
  --accent-soft:#e2ece7;
  --danger:#b91c1c;
}

/* -------------------------------------------------------
   2. Base resets + typography
------------------------------------------------------- */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15.5px;
}

/* Serif for Sela messages */
#sela-thread .message.sela {
  font-weight: 400;
  letter-spacing: .01em;
}

@media (max-width: 600px) {
  #sela-modal {
    width: 94vw;
  }

  .message {
    max-width: 95%;
  }
}


/* -------------------------------------------------------
   3. Buttons
------------------------------------------------------- */
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Primary — unchanged except for a tiny shadow */
.btn-primary {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: .6rem .9rem;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  transition: background .15s ease, transform .05s ease, box-shadow .15s ease;
}

.btn-primary:hover {
  background: #4f6c5b;
  box-shadow: 0 2px 4px rgba(0,0,0,0.12);
}


/* Secondary — soft, tactile, slightly raised */
.btn-secondary {
  background: linear-gradient(to bottom, #f9fbfa, #f1f4f3);
  border: 1px solid #d7dedb;
  color: #37413f;
  border-radius: 10px;
  padding: .6rem .9rem;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.btn-secondary:hover {
  background: linear-gradient(to bottom, #f1f5f3, #e8edeb);
  border-color: #cbd4d1;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}


/* Danger — same shape, but with a soft red tint */
.btn-danger {
  background: linear-gradient(to bottom, #fff5f5, #ffecec);
  border: 1px solid #e4bcbc;
  color: #a33a3a;
  border-radius: 10px;
  padding: .6rem .9rem;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.btn-danger:hover {
  background: linear-gradient(to bottom, #ffeaea, #ffe1e1);
  border-color: #d9a8a8;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}


.btn {
  display: inline-block;
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f3f3f3;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

/* -------------------------------------------------------
   4. Layout: header, main, cards, grids
------------------------------------------------------- */
header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: center;
  padding: 1.25rem 0;
  backdrop-filter: blur(6px);
}

header .inner {
  width: 100%;
  max-width: 900px;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

main {
  max-width: 900px;
  margin: 1.25rem auto;
  padding: 0 1rem 3rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid-2 {
  grid-template-columns: 1fr 1fr;
}

.row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* -------------------------------------------------------
   5. Typography helpers
------------------------------------------------------- */
h1, h2, h3 {
  line-height: 1.2;
  margin: 0.25rem 0 0.5rem;
}

.muted {
  color: var(--muted);
}

.meta {
  font-size: 0.92rem;
  color: var(--muted);
}

.prose {
  white-space: pre-wrap;
}

.prose p {
  margin: 0.75rem 0;
  line-height: 1.55;
}

.error {
  color: #a40000;
  font-weight: 600;
}

/* -------------------------------------------------------
   6. Form fields
------------------------------------------------------- */
.field label {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.field input[type="date"] {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
}

/* -------------------------------------------------------
   7. Pills, sections, footer
------------------------------------------------------- */
.pill {
  all: unset;
  display: inline-flex;
  align-items: center;
  padding: .25rem .6rem;
  background: rgba(0, 120, 90, 0.212);
  color: var(--accent);
  border-radius: 999px;
  font-size: .85rem;
  margin: 0 .25rem .25rem 0;
  line-height: 1.2;
  white-space: nowrap;
}


.section {
  padding-top: 0.25rem;
  border-top: 1px dashed var(--line);
  margin-top: 1rem;
}

.section h3 {
  margin-top: 0.4rem;
}

footer {
  margin-top: 2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* -------------------------------------------------------
   8. Reading-app nav strip (NAV-1)
   Quiet, persistent wayfinding shared by base.html and
   base_simple.html via templates/_nav.html. Mirrors the
   admin nav region at a lighter weight — this is signposting,
   not a feature bar.
------------------------------------------------------- */
.app-nav {
  padding: 0.6rem 0;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}

/* Inner wrapper aligns the nav links to the same 900px centred column as
   <main>, so the menu sits over the app on desktop. The band above stays
   full width. Mirrors header .inner. */
.app-nav-inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1rem;
}

.app-nav-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: 8px;
}

.app-nav-link:hover {
  background: var(--accent-soft);
  color: #4f6c5b;
}

/* "About" (and future meta-links) are <button>s styled as nav links —
   reset the native button chrome so they sit flush with the <a> links. */
button.app-nav-link {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.site-title-wrap {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: 1.4rem;
  font-weight: 600;
}

.site-title {
  font-weight: 600;
  text-decoration: none;
  color: inherit;
}

/* -------------------------------------------------------
   8. Alerts
------------------------------------------------------- */
.sela-open-alert {
  background: #fff7e6;
  border-color: #f0a500;
  animation: sela-pulse 1.2s ease-in-out infinite alternate;
}

@keyframes sela-pulse {
  from { box-shadow: 0 0 0 rgba(240,165,0,0); }
  to   { box-shadow: 0 0 0 3px rgba(240,165,0,0.4); }
}

/* -------------------------------------------------------
   9. Icon buttons
------------------------------------------------------- */
.icon-btn {
  border: 1px solid #d0d0d0;
  background: #fff;
  border-radius: 999px;
  width: 30px;
  height: 30px;
  line-height: 28px;
  text-align: center;
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
}

.icon-btn:hover {
  background: #f6f6f6;
}

/* -------------------------------------------------------
   10. Messages (chat bubbles)
------------------------------------------------------- */
.message {
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.message {
  margin-bottom: 1rem;
  padding: .75rem .9rem;
  border-radius: 14px;
  max-width: 85%;
  line-height: 1.6;
  animation: fadeInUp .18s ease-out;
}

.message.sela {
  background: var(--accent-soft);
  border: 1px solid #dbe7df;
}

.message.user {
  background: #f5f7f6;   /* very light cool grey-green */
  border: 1px solid #e3e8e5;
  margin-left: auto;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* -------------------------------------------------------
   11. Screen-reader only
------------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* -------------------------------------------------------
   12. Language selector
------------------------------------------------------- */
.sela-lang-wrap {
  display: flex;
  align-items: center;
  gap: .25rem;
  font-size: .8rem;
}

.sela-lang-wrap select {
  border-radius: 999px;
  border: 1px solid #d0d0d0;
  padding: .15rem .6rem;
  font-size: .8rem;
  background: #fff;
  cursor: pointer;
}

.pill-lang {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.9rem;
  height: 1.4rem;
  border-radius: 999px;
  border: 1px solid #ccc;
  background: #f7f7f7;
  text-transform: uppercase;
  font-size: .75rem;
  letter-spacing: .03em;
}

.sela-lang-wrap.offline select {
  display: none;
}

.sela-lang-wrap.offline .pill-lang {
  opacity: 0.6;
}

/* -------------------------------------------------------
   13. Modal styling (global)
------------------------------------------------------- */
dialog {
  border: none;
  padding: 0;
  border-radius: 1rem;
  background: var(--card);
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
  max-width: 32rem;
  width: 90%;
}

dialog {
  max-height: 90vh;
  overflow: hidden;
}

.modal-inner {
  max-height: 90vh;
  overflow-y: auto;
}

dialog::backdrop {
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(2px);
}

.modal-inner {
  padding: 1.5rem;
  border-radius: 1rem;
}

#bible-modal-title,
.info-modal-title {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink);
}

.modal-header {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.modal-avatar {
  border-radius: 50%;
}

.modal-actions .btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: .5rem 1rem;
  border-radius: .5rem;
  cursor: pointer;
}

.modal-actions .btn:hover {
  opacity: .9;
}

dialog[open] {
  animation: modal-fade .25s ease-out;
}

@keyframes modal-fade {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* -------------------------------------------------------
   14. Scroll Shadows for Modal Content
------------------------------------------------------- */

.modal-inner {
  position: relative;
  overflow-y: auto;
  max-height: 80vh;
}

/* Top shadow */
.modal-inner::before {
  content: "";
  position: sticky;
  top: 0;
  height: 1rem;
  background: linear-gradient(to bottom, rgba(0,0,0,0.15), transparent);
  pointer-events: none;
  z-index: 5;
}

/* Bottom shadow */
.modal-inner::after {
  content: "";
  position: sticky;
  bottom: 0;
  height: 1rem;
  background: linear-gradient(to top, rgba(0,0,0,0.15), transparent);
  pointer-events: none;
  z-index: 5;
}

/* -------------------------------------------------------
   15. Global Form Styling
------------------------------------------------------- */

form .field {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

form label {
  font-weight: 500;
  color: var(--ink);
}

form input,
form select {
  padding: .6rem .7rem;
  border: 1px solid var(--line);
  border-radius: .6rem;
  background: var(--card);
  font-size: 1rem;
  color: var(--ink);
}

form input:focus,
form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), .2);
}

form .btn {
  margin-right: .5rem;
}

/* -------------------------------------------------------
   16. Global Form Controls
------------------------------------------------------- */

input[type="text"],
input[type="date"],
select {
  width: 100%;
  padding: .7rem .8rem;
  border: 1px solid var(--line);
  border-radius: .6rem;
  background: var(--card);
  font-size: 1rem;
  color: var(--ink);
  height: 2.75rem; /* ensures consistent height across browsers */
  box-sizing: border-box;
}

input[type="text"]:focus,
input[type="date"]:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), .2);
}

/* Buttons in forms */
.search-form .btn {
  padding: .7rem 1.2rem;
  border-radius: .6rem;
  font-size: 1rem;
  height: 2.75rem; /* matches inputs/selects */
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.button-row {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: .75rem;
}

.selection-summary {
  margin-top: .75rem;
  font-size: .95rem;
  color: var(--muted);
}

.page-title {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--ink);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 600px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* -------------------------------------------------------
   Flash messages (J4 §1.4)
   Shared styling for the global flash region in base.html and the
   existing admin/billing flash markup, which previously rendered as
   unstyled divs. On-palette, quiet by default; success/warning/danger
   tinted via the design tokens.
------------------------------------------------------- */
.flash-messages {
  max-width: 720px;
  margin: 1rem auto 0;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.flash {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
  border-radius: 8px;
  padding: .55rem .8rem;
  font-size: .95rem;
}

.flash-warning {
  border-left-color: #b7791f;
  background: #fbf3e0;
}

.flash-danger,
.flash-error {
  border-left-color: var(--danger);
  background: #fbe3e3;
}

/* ---- Help page (HELP brief, thread H1) -------------------------------
   FAQ-led, area-grouped. Native <details>/<summary> accordion (no JS).
   Video is click-to-play and capped in width so clips sit comfortably on
   mobile; refinement of the visual treatment can come with H2 content. */
.help-header-card { margin-bottom: 1rem; }
.help-title { margin: 0 0 .25rem; }
.help-meta { color: var(--muted, #6b6b6b); font-size: .95rem; }
.help-card { margin-bottom: 1rem; }
.help-area-title { margin: 0 0 .5rem; }
.help-faq { border-top: 1px solid rgba(0, 0, 0, .08); padding: .5rem 0; }
.help-faq:first-of-type { border-top: none; }
.help-faq-q { cursor: pointer; font-weight: 600; }
.help-faq-a { padding: .5rem 0 .25rem; }
.help-clip { margin: .75rem 0 0; }
.help-video {
  display: block;
  width: 100%;
  max-width: 480px;
  border-radius: 8px;
}
.help-clip figcaption {
  margin-top: .25rem;
  font-size: .85rem;
  color: var(--muted, #6b6b6b);
}

