@font-face {
  font-family: Domine;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/domine_normal_700.woff2") format("woff2");
}
@font-face {
  font-family: Kameron;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/kameron_normal_700.woff2") format("woff2");
}

:root {
  --bg: #000000;
  --text: #ffffff;
  --muted: #f0f0f0;
  --gold: #edbc24;
  --gold-text: #000000;
  --available-bg: #1a1a1a;
  --danger: #ffb4b4;
  --ok: #b6f5b6;
  --focus: #edbc24;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  --font-display: Kameron, Georgia, serif;
  --font-label: Domine, Georgia, serif;
  --tap: 3rem; /* 48px+ at 16px root; our root is 20px so this is 60px */
  --radius: 0.5rem;
  --max: 52rem;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }


html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-size: 125%; /* 20px base on typical mobile */
  scroll-behavior: smooth;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1.05rem;
  line-height: 1.55;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  max-width: 100%;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

img { max-width: 100%; height: auto; }

:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  z-index: 100;
  background: var(--gold);
  color: var(--gold-text);
  font-weight: 700;
  padding: 0.75rem 1rem;
  text-decoration: none;
}
.skip-link:focus { top: 0.75rem; }

.visually-hidden {
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  white-space: nowrap;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem 1rem;
  border-bottom: 4px solid var(--gold);
  max-width: var(--max);
  margin: 0 auto;
}
.brand {
  flex: 0 0 auto;
  display: block;
  line-height: 0;
  min-height: var(--tap);
}
.brand img { width: 6.25rem; height: auto; display: block; }
.brand-text { min-width: 0; }
.eyebrow {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--gold);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
h1 {
  margin: 0.1rem 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.05rem;
  line-height: 1.15;
  color: var(--text);
}
.sub {
  margin: 0.15rem 0 0;
  font-size: 1.05rem;
  color: var(--text);
}

/* Install tip */
.install-tip {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem;
  background: #111;
  border-bottom: 3px solid var(--gold);
}
.install-tip p {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  line-height: 1.5;
}
.install-tip .btn { width: 100%; }

.offline-note {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.85rem 1rem;
  background: #3b2a00;
  color: #fff;
  font-weight: 700;
  border-bottom: 3px solid var(--gold);
}

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.15rem 1rem 3rem;
}

/* Progress */
.progress-card {
  background: #111;
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  padding: 1.1rem 1rem 1.2rem;
  margin-bottom: 1.35rem;
}
.progress-stats {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1rem;
}
.stat { margin: 0; }
.stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: 1.75rem;
  line-height: 1.2;
  color: var(--gold);
}
.stat-label {
  display: block;
  font-size: 1.05rem;
  color: var(--text);
}
.progress-bar {
  display: block;
  width: 100%;
  height: 1.35rem;
  background: #2a2a2a;
  border: 2px solid #fff;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1.15rem;
}
.progress-bar__fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--gold);
  transition: width 0.3s ease;
}
.loading-line, .empty-msg, .suggest-result {
  margin: 0.75rem 0 0;
  font-size: 1.1rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.suggest-result a {
  color: var(--gold);
  font-weight: 700;
}
#suggest-result .btn { margin-top: 0.6rem; width: 100%; }

.version-picker {
  display: block;
  margin: 0 0 0.35rem;
}
.version-picker span,
.find-box label,
#reading-form label span,
#passcode-block label span {
  display: block;
  font-family: var(--font-label);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
}
.hint { margin: 0 0 1rem; font-size: 1rem; line-height: 1.45; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0.7rem 1.15rem;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.25;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  border: 3px solid transparent;
  overflow-wrap: anywhere;
}
.btn-block { width: 100%; }
.btn-gold {
  background: var(--gold);
  color: var(--gold-text);
  border-color: var(--gold);
}
.btn-gold:hover, .btn-gold:focus-visible {
  background: #ffd84a;
  border-color: #ffd84a;
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: #fff;
}
.btn-ghost:hover, .btn-ghost:focus-visible { background: #222; }
.btn-link {
  background: none;
  border: 0;
  border-radius: 0;
  color: var(--gold);
  text-decoration: underline;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 1.05rem;
  min-height: var(--tap);
  padding: 0.4rem 0;
  cursor: pointer;
}
.btn:disabled { opacity: 0.6; cursor: wait; }

/* Inputs — 18px+ so iOS does not zoom */
.find-box { margin: 0 0 1.15rem; }
input[type="search"],
input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"],
select {
  width: 100%;
  min-height: 3.25rem;
  font-size: 18px; /* iOS zoom threshold is 16px */
  padding: 0.55rem 0.75rem;
  border: 3px solid #fff;
  border-radius: var(--radius);
  background: #fff;
  color: #000;
  font-family: inherit;
  max-width: 100%;
}
input:focus-visible,
select:focus-visible {
  outline: 4px solid var(--gold);
  outline-offset: 2px;
  border-color: var(--gold);
}

/* Tabs */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0 0 0.85rem;
}
.tab {
  flex: 1 1 calc(50% - 0.55rem);
  min-height: var(--tap);
  padding: 0.55rem 0.5rem;
  background: #000;
  color: #fff;
  border: 3px solid #fff;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  cursor: pointer;
}
.tab.is-active {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
}
.filter-status {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  min-height: 1.5em;
}

/* Psalm grid: two columns on phones so cells stay large and never overflow */
.psalm-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}
.psalm-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #111;
  border-radius: var(--radius);
  overflow: hidden;
}
.psalm-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 5.2rem;
  width: 100%;
  padding: 0.45rem 0.3rem 0.35rem;
  border: 3px solid;
  border-bottom-width: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  font-family: var(--font-display);
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  background: inherit;
}
.psalm-cell__num {
  font-size: 1.5rem;
  line-height: 1.1;
  font-weight: 700;
}
.psalm-cell__status {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
}
.psalm-card.is-read .psalm-cell,
.psalm-card.is-read .about-btn {
  background: var(--gold);
  color: #000;
  border-color: #000;
}
.psalm-card.is-available .psalm-cell,
.psalm-card.is-available .about-btn {
  background: var(--available-bg);
  color: #fff;
  border-color: #fff;
}
.psalm-card.is-highlight {
  box-shadow: 0 0 0 4px #fff, 0 0 0 8px var(--gold);
}
.psalm-card[hidden] { display: none; }

.about-btn {
  min-height: var(--tap);
  width: 100%;
  margin: 0;
  padding: 0.35rem 0.4rem;
  border: 3px solid;
  border-radius: 0 0 var(--radius) var(--radius);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
}

/* History */
.view-intro { margin: 0 0 1rem; }
#view-history h2, #view-history h3 {
  font-family: var(--font-display);
  font-weight: 700;
}
#view-history h2 { font-size: 1.7rem; margin: 0 0 0.35rem; }
#view-history h3 { font-size: 1.3rem; margin: 1.5rem 0 0.6rem; color: var(--gold); }

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}
.timeline li {
  background: #111;
  border-left: 6px solid var(--gold);
  padding: 0.85rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.timeline .when {
  display: block;
  font-weight: 700;
  font-size: 1.05rem;
}
.timeline .what {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin: 0.15rem 0;
}
.timeline .who, .timeline .note { margin: 0.15rem 0 0; }
.timeline button { margin-top: 0.5rem; width: 100%; }

.people-list { display: grid; gap: 0.75rem; }
.person {
  background: #111;
  border: 2px solid #fff;
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
}
.person h4 {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
}
.person p { margin: 0; overflow-wrap: anywhere; }

.export-line { margin: 1.75rem 0 0; font-size: 1rem; }
.export-line a { color: var(--gold); font-weight: 700; }

/* Dialogs: fit the phone screen, sticky actions in thumb reach */
.sheet {
  width: min(36rem, calc(100% - 0.8rem));
  max-width: 100%;
  height: auto;
  max-height: calc(100dvh - 0.8rem);
  max-height: calc(100vh - 0.8rem);
  margin: auto;
  padding: 0;
  border: 4px solid var(--gold);
  border-radius: 0.75rem;
  background: #000;
  color: #fff;
  overflow: hidden;
}
.sheet::backdrop { background: rgba(0, 0, 0, 0.8); }
.sheet-inner {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 0.8rem);
  max-height: calc(100vh - 0.8rem);
}
.sheet-body {
  flex: 1 1 auto;
  overflow: auto;
  padding: 1.1rem 1rem 0.5rem;
  -webkit-overflow-scrolling: touch;
}
.sheet-actions {
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  padding: 0.7rem 1rem calc(0.85rem + var(--safe-bottom));
  background: #000;
  border-top: 2px solid var(--gold);
  display: grid;
  gap: 0.5rem;
}
.sheet h2 {
  font-family: var(--font-display);
  font-size: 1.65rem;
  margin: 0 0 0.75rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.detail-block { margin: 0 0 1rem; }
.detail-block p { margin: 0 0 0.45rem; overflow-wrap: anywhere; }
.detail-block a,
#about-body a,
#dialog-body a {
  color: var(--gold);
  font-weight: 700;
}
.reading-item {
  background: #111;
  border-left: 6px solid var(--gold);
  padding: 0.7rem 0.85rem;
  margin: 0 0 0.6rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.reading-item .btn { width: 100%; margin-top: 0.4rem; }
.secondary-link {
  display: block;
  text-align: center;
  margin: 0.35rem 0 0;
  font-size: 1rem;
  color: var(--gold);
  font-weight: 700;
  min-height: 2.75rem;
  padding: 0.4rem 0;
}

.verse {
  margin: 1rem 0;
  padding: 0.85rem 0.9rem;
  border-left: 6px solid var(--gold);
  background: #111;
  font-size: 1.15rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.verse cite {
  display: block;
  margin-top: 0.5rem;
  font-style: normal;
  font-size: 0.95rem;
  color: var(--muted);
}
.traditional-title {
  font-family: var(--font-label);
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
}

/* Form */
#reading-form { display: grid; gap: 1rem; }
.optional { font-family: var(--font-ui); font-weight: 400; font-size: 0.95rem; }
.form-status {
  margin: 0;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius);
  font-weight: 700;
}
.form-status.is-error {
  background: #3b1010;
  color: #fff;
  border: 2px solid var(--danger);
}
.form-status.is-ok {
  background: #103b10;
  color: #fff;
  border: 2px solid var(--ok);
}
#remove-btn { color: #ffb4b4; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.1rem + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 40;
  width: min(34rem, calc(100% - 1.5rem));
  background: var(--gold);
  color: #000;
  font-weight: 700;
  font-size: 1.2rem;
  line-height: 1.4;
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  box-shadow: 0 0 0 3px #000, 0 8px 24px rgba(0,0,0,0.5);
  text-align: center;
}

/* Footer */
.site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem 1rem calc(2.25rem + var(--safe-bottom));
  border-top: 4px solid var(--gold);
  text-align: center;
}
.footer-brand {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--gold);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  text-decoration: underline;
  min-height: var(--tap);
}
.footer-brand img { width: 5.5rem; height: auto; }
.tagline { margin: 0.75rem 0 0; font-size: 1.05rem; }

@media (min-width: 640px) {
  .progress-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }
  .tab { flex: 1 1 auto; }
  .psalm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  .psalm-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .progress-bar__fill { transition: none; }
}

#about-body a.btn-gold,
#dialog-body a.btn-gold,
#about-body a.btn-ghost,
#dialog-body a.btn-ghost {
  color: inherit;
}
#about-body a.btn-gold,
#dialog-body a.btn-gold { color: #000; }

.sheet-actions #passcode-block { text-align: left; }
.sheet-actions #passcode-block .hint { margin: 0.35rem 0 0.25rem; }
