/* Bible in a Year — colors taken from the reader chrome.
   Parchment #ead7b9 and raised surface #f6e8d2 / #ecd9bb are what
   reader-tools-history-fullpage.js paints. Ink is #35103f, the header
   title. Buttons are #3c244d with #fff4df, from index.html. */

@font-face {
  font-family: Spectral;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/spectral-0.ttf") format("truetype");
}
@font-face {
  font-family: Spectral;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/spectral-1.ttf") format("truetype");
}

:root {
  /* index.html :root and header h1 */
  --ink: #35103f;
  --ink-soft: #482052;
  /* index.html button */
  --button: #3c244d;
  --button-text: #fff4df;
  --button-hover: #563669;
  --button-border: #96703c;
  --focus: #79518c;
  /* reader body / toolbar / paper */
  --page: #ead7b9;
  /* contents aside and the tools strip */
  --surface: #ecd9bb;
  /* raised cards: books-back, reading location, install help */
  --raised: #f6e8d2;
  /* index.html current nav and chapter hover */
  --today-bg: #dcc096;
  --hover: #ddc198;
  /* reader borders */
  --line: #b7955a66;
  --line-solid: #b7955a;
  /* chapter captions in the reader; passes contrast on parchment */
  --muted: #624a60;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Spectral, Georgia, "Times New Roman", serif;
  --radius-pill: 999px;
  --footer-h: 4.75rem;
  color-scheme: light;
}

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

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--page);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}

body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#app { min-height: 100dvh; }

.loading, .error {
  padding: 2rem 1.25rem;
  text-align: center;
  font-family: var(--serif);
  color: var(--ink-soft);
}

.error { color: #6e1830; }

a { color: inherit; }

button, a.pill, a.back {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
.day-row:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

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

.plan { background: var(--page); min-height: 100dvh; }

.hero {
  background: var(--surface);
  padding: 0.85rem 1rem 1.15rem;
}

.hero-top,
.hero-main {
  width: min(40rem, 100%);
  margin-left: auto;
  margin-right: auto;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  min-height: 44px;
  padding: 0.2rem 0.85rem 0.2rem 0.55rem;
  background: var(--raised);
  border: 1px solid var(--line-solid);
  border-radius: var(--radius-pill);
  box-shadow: 0 1px 3px #35103f1a;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
}

.pill .chev { font-size: 1.15rem; line-height: 1; }

.progress-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
  min-width: 0;
}

.progress-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  background: var(--button);
  color: var(--button-text);
  border-radius: var(--radius-pill);
  padding: 0.35rem 0.75rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.progress-badge .pct {
  font-size: 0.82rem;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.progress-bar {
  width: 7.5rem;
  height: 0.35rem;
  background: #dbc098;
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-bar > span {
  display: block;
  height: 100%;
  background: var(--button);
  border-radius: var(--radius-pill);
  width: 0%;
}

.hero-main {
  display: flex;
  align-items: stretch;
  gap: 0.9rem;
  margin-top: 1.1rem;
}

.date-card {
  flex: 0 0 auto;
  width: 4.6rem;
  background: var(--raised);
  border: 1px solid var(--line-solid);
  border-radius: 0.55rem;
  box-shadow: 0 1px 4px #35103f14;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.2rem 0.4rem;
  text-align: center;
}

.date-card .mon {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.date-card .num {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -0.02em;
}

.hero-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; justify-content: center; }

.plan-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.45rem;
  line-height: 1.2;
  margin: 0 0 0.35rem;
  color: var(--ink);
}

.today-reading {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  min-height: 44px;
  justify-content: center;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.35;
  text-decoration: none;
}

.today-reading .kicker {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.today-reading .passages {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.today-reading:hover .passages { color: var(--button-hover); }

.month-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(40rem, 100%);
  margin: 0 auto;
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--line);
  background: var(--page);
  position: sticky;
  top: 0;
  z-index: 2;
}

.month-switch h2 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  flex: 1;
}

.month-switch button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--ink);
  font-size: 1.35rem;
}

.month-switch button:hover { background: var(--hover); }
.month-switch button:disabled { color: var(--muted); cursor: default; background: none; }

.day-list {
  list-style: none;
  width: min(40rem, 100%);
  margin: 0 auto;
  padding: 0 0 2rem;
}

.day-list li { margin: 0; padding: 0; }

.day-row {
  display: grid;
  grid-template-columns: 4.2rem 1fr auto;
  gap: 0.7rem;
  align-items: start;
  padding: 0.85rem 1rem;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  scroll-margin: 4.5rem;
}

.day-row:hover { background: var(--hover); }

.day-row.is-today { background: var(--today-bg); }

.day-num {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  padding-top: 0.25rem;
}

.day-body { min-width: 0; }

.day-date {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.day-readings {
  margin-top: 0.15rem;
  font-size: 0.95rem;
  color: var(--ink-soft);
  line-height: 1.35;
}

.day-check {
  width: 1.45rem;
  height: 1.45rem;
  margin-top: 0.15rem;
  border-radius: 50%;
  border: 1.5px solid #b89143;
  background: transparent;
  color: transparent;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.day-row.is-complete .day-check {
  background: var(--button);
  border-color: var(--button);
  color: var(--button-text);
}

.plan-footer {
  width: min(40rem, 100%);
  margin: 0 auto;
  padding: 0.5rem 1rem 2rem;
  text-align: center;
}

.plan-footer button {
  color: var(--ink-soft);
  font-size: 0.95rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  min-height: 44px;
  padding: 0 0.75rem;
}

.plan-footer button:hover { color: var(--ink); }

.day-screen {
  min-height: 100dvh;
  background: var(--page);
  display: flex;
  flex-direction: column;
}

.day-header {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--page);
  border-bottom: 1px solid var(--line);
  padding: 0.25rem 0.35rem 0.45rem;
}

.day-header-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.25rem;
  min-height: 2.75rem;
  width: min(40rem, 100%);
  margin: 0 auto;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 44px;
  padding: 0 0.45rem;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--ink);
}

.back .chev { font-size: 1.25rem; }

.dots {
  display: flex;
  gap: 0;
  align-items: center;
  padding-right: 0.15rem;
}

.dot {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  border: 0;
  padding: 0;
  display: grid;
  place-items: center;
}

.dot::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #b89143;
}

.dot[aria-current="true"]::before { background: var(--button); }

.day-sub {
  width: min(40rem, 100%);
  margin: 0 auto;
  padding: 0 0.85rem 0.15rem 2.2rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.cards {
  flex: 1;
  width: min(32rem, 100%);
  margin: 0 auto;
  padding: 0.75rem 0.75rem calc(var(--footer-h) + 1.25rem);
}

.section {
  margin: 0 0 1.35rem;
  scroll-margin-top: 5.5rem;
}

.section-label {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.15rem;
  margin: 0.35rem 0 0.55rem 0.15rem;
  color: var(--ink);
}

.card {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: contain;
  background: #dbc098;
  border-radius: 0.15rem;
  box-shadow: 0 2px 10px #35103f22;
  margin: 0 0 0.75rem;
}

.card[data-loaded="true"] { background: var(--page); }

.day-footer {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem;
  align-items: center;
  width: 100%;
  padding: 0.55rem 0.85rem calc(0.55rem + env(safe-area-inset-bottom));
  background: var(--page);
  border-top: 1px solid var(--line);
}

.nav-day, .complete-btn {
  min-height: 44px;
  border-radius: 0.45rem;
  padding: 0 0.85rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.nav-day { color: var(--button); }
.nav-day:hover { background: var(--hover); }
.nav-day:disabled { color: var(--muted); cursor: default; background: none; }

.complete-btn {
  justify-self: center;
  background: var(--button);
  color: var(--button-text);
  border: 1px solid var(--button-border);
  min-width: 9.5rem;
}

.complete-btn:hover { background: var(--button-hover); }

.complete-btn[aria-pressed="true"] {
  background: var(--today-bg);
  color: #291233;
  border-color: var(--button-border);
}

@media (min-width: 800px) {
  .plan-title { font-size: 1.7rem; }
  .cards { width: min(36rem, 100%); }
  .day-footer {
    padding-left: max(1.5rem, calc(50vw - 18rem));
    padding-right: max(1.5rem, calc(50vw - 18rem));
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
