/* ItsBible design system v2. Self hosted fonts, no frameworks. */

@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("/fonts/literata.woff2") format("woff2-variations");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("/fonts/literataitalic.woff2") format("woff2-variations");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --bg: #f6f1e6;
  --bghi: #fdf9ef;
  --surface: #fffdf7;
  --ink: #211c12;
  --muted: #6e6551;
  --faint: #a59b83;
  --accent: #8a672c;
  --accenthi: #a37c39;
  --accentink: #6b4f1f;
  --border: #e6ddc6;
  --borderhi: #d9cead;
  --shadow: 0 1px 2px rgba(64, 52, 26, 0.06), 0 6px 18px rgba(64, 52, 26, 0.07);
  --shadowlift: 0 2px 4px rgba(64, 52, 26, 0.08), 0 14px 34px rgba(64, 52, 26, 0.12);
  --glow: rgba(163, 124, 57, 0.14);
  --display: "Fraunces", "Iowan Old Style", Palatino, Georgia, serif;
  --serif: "Literata", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --maxw: 46rem;
}

[data-theme="dark"] {
  --bg: #14100a;
  --bghi: #1a150c;
  --surface: #1e1910;
  --ink: #ede5d1;
  --muted: #a89d82;
  --faint: #7c7259;
  --accent: #d6ae64;
  --accenthi: #e2c07e;
  --accentink: #dfb974;
  --border: #352c1a;
  --borderhi: #4a3e26;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 6px 18px rgba(0, 0, 0, 0.35);
  --shadowlift: 0 2px 4px rgba(0, 0, 0, 0.5), 0 14px 34px rgba(0, 0, 0, 0.5);
  --glow: rgba(214, 174, 100, 0.10);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14100a;
    --bghi: #1a150c;
    --surface: #1e1910;
    --ink: #ede5d1;
    --muted: #a89d82;
    --faint: #7c7259;
    --accent: #d6ae64;
    --accenthi: #e2c07e;
    --accentink: #dfb974;
    --border: #352c1a;
    --borderhi: #4a3e26;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 6px 18px rgba(0, 0, 0, 0.35);
    --shadowlift: 0 2px 4px rgba(0, 0, 0, 0.5), 0 14px 34px rgba(0, 0, 0, 0.5);
    --glow: rgba(214, 174, 100, 0.10);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(60rem 30rem at 50% -6rem, var(--bghi), transparent);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.65;
  font-size: 1.0625rem;
  -webkit-font-smoothing: antialiased;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
main { animation: rise 0.45s ease both; }

.skiplink {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 30;
  border-radius: 0 0 0.5rem 0.5rem;
}
.skiplink:focus { left: 1rem; }

a { color: var(--accentink); text-underline-offset: 0.16em; text-decoration-thickness: 1px; }
a:hover { color: var(--accenthi); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }
.wrapwide { max-width: 64rem; margin: 0 auto; padding: 0 1.25rem; }

/* Header */
header.site {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 1rem;
  padding: 0.8rem 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 640;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
}
.brand svg { width: 1.6rem; height: 1.6rem; flex: none; border-radius: 0.45rem; box-shadow: var(--shadow); }
nav.main { display: flex; flex-wrap: wrap; gap: 0.1rem; }
nav.main a {
  position: relative;
  text-decoration: none;
  color: var(--muted);
  padding: 0.35rem 0.7rem;
  border-radius: 0.55rem;
  font-size: 0.95rem;
}
nav.main a::after {
  content: "";
  position: absolute;
  left: 0.7rem;
  right: 0.7rem;
  bottom: 0.15rem;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.22s ease;
}
nav.main a:hover { color: var(--ink); }
nav.main a:hover::after { transform: scaleX(1); }
nav.main a[aria-current="page"] { color: var(--accentink); font-weight: 600; }
nav.main a[aria-current="page"]::after { transform: scaleX(1); }

button.theme {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  width: 2.1rem;
  height: 2.1rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 1rem;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
button.theme:hover { color: var(--accentink); border-color: var(--borderhi); transform: rotate(12deg); }

main { padding: 2.75rem 0 4rem; }

h1, h2, h3 { font-family: var(--display); line-height: 1.22; letter-spacing: 0.005em; }
h1 { font-size: 2.15rem; font-weight: 620; margin: 0 0 0.75rem; }
h2 { font-size: 1.5rem; font-weight: 600; margin: 2.5rem 0 0.6rem; }
h3 { font-size: 1.15rem; font-weight: 600; margin: 1.5rem 0 0.4rem; }
.lede { font-size: 1.15rem; color: var(--muted); margin-top: 0; max-width: 38rem; }

.kicker {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 650;
  font-family: var(--sans);
  color: var(--accentink);
  margin: 0 0 0.4rem;
}

/* Ornament divider */
.ornament { display: flex; justify-content: center; margin: 0.9rem 0; color: var(--accent); opacity: 0.75; }
.ornament svg { width: 8.5rem; height: 0.8rem; }

/* Verse of the day */
.hero {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  box-shadow: var(--shadow);
  padding: 2.75rem 2.25rem 2.5rem;
  text-align: center;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto;
  height: 75%;
  background: radial-gradient(closest-side, var(--glow), transparent);
  pointer-events: none;
}
.hero > * { position: relative; }
.datechip {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 650;
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accentink);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  margin: 0 0 0.4rem;
}
.versetext {
  font-family: var(--serif);
  font-weight: 420;
  font-size: clamp(1.45rem, 3.6vw, 2rem);
  line-height: 1.55;
  margin: 0.5rem 0 1rem;
  text-wrap: balance;
}
.versetext::before {
  content: "“";
  display: block;
  font-family: var(--display);
  font-size: 3.2rem;
  line-height: 0.6;
  color: var(--accent);
  opacity: 0.55;
  margin: 0.6rem auto 0.35rem;
}
.verseref { color: var(--muted); font-size: 1rem; margin-bottom: 1.5rem; font-family: var(--serif); font-style: italic; }
.verseref a { color: inherit; }

.actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.55rem 1.15rem;
  font-size: 0.95rem;
  font-family: var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
.btn:hover { border-color: var(--borderhi); color: var(--accentink); box-shadow: var(--shadow); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 1em; height: 1em; }
.btn.primary {
  background: linear-gradient(180deg, var(--accenthi), var(--accent));
  border-color: var(--accent);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), var(--shadow);
}
.btn.primary:hover { color: #fff; filter: brightness(1.05); }
[data-theme="dark"] .btn.primary { color: #171204; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn.primary { color: #171204; }
}

/* Card grid */
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); margin: 1.25rem 0; }
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.35rem 1.35rem 1.2rem;
  text-decoration: none;
  color: var(--ink);
  display: block;
  box-shadow: var(--shadow);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
a.card:hover { border-color: var(--borderhi); transform: translateY(-3px); box-shadow: var(--shadowlift); }
a.card::after {
  content: "→";
  position: absolute;
  right: 1.2rem;
  bottom: 1rem;
  color: var(--faint);
  transition: color 0.2s ease, transform 0.2s ease;
}
a.card:hover::after { color: var(--accentink); transform: translateX(3px); }
.card h3 { margin: 0 0 0.35rem; }
.card p { margin: 0 1.2rem 0 0; color: var(--muted); font-size: 0.95rem; }
.cardglyph {
  display: inline-grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 0.7rem;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accentink);
  margin-bottom: 0.7rem;
}
.cardglyph svg { width: 1.25rem; height: 1.25rem; }

/* Verse cards on topic pages */
.versecard {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  padding: 1.35rem 1.4rem 1.15rem 1.7rem;
  margin: 0.95rem 0;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.versecard::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--accenthi), var(--accent));
}
.versecard blockquote { margin: 0; font-family: var(--serif); font-weight: 420; font-size: 1.18rem; line-height: 1.6; }
.versecard footer { margin-top: 0.65rem; display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; color: var(--muted); font-size: 0.9rem; font-family: var(--serif); font-style: italic; }
.copybtn { border: none; background: none; color: var(--accentink); cursor: pointer; font-size: 0.88rem; font-family: var(--sans); font-style: normal; padding: 0; text-decoration: underline; text-underline-offset: 0.16em; }
.copybtn:hover { color: var(--accenthi); }

/* Reader */
.progresstrack { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 40; pointer-events: none; }
.progresstrack > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accenthi), var(--accent)); }

.readerbar {
  position: sticky;
  top: 3.75rem;
  z-index: 10;
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1.75rem;
  padding: 0.6rem 0.75rem;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-color: transparent;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1L6 6L11 1' fill='none' stroke='%23907748' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 0.65rem;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 1.9rem 0.45rem 0.9rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  cursor: pointer;
  transition: border-color 0.2s ease;
}
select:hover { border-color: var(--borderhi); }
.fontctl { margin-left: auto; display: flex; gap: 0.3rem; }
.fontctl .btn { padding: 0.35rem 0.75rem; }

.scripture {
  font-family: var(--serif);
  font-weight: 420;
  font-size: var(--readsize, 1.2rem);
  line-height: 1.8;
}
.scripture h1 {
  text-align: center;
  font-size: 2.3rem;
  margin: 1rem 0 0.2rem;
}
.scripture h1 + p { margin-top: 1.6rem; }
.chapterrule { display: flex; justify-content: center; margin: 0.5rem 0 1.4rem; color: var(--accent); opacity: 0.7; }
.chapterrule svg { width: 8.5rem; height: 0.8rem; }
.scripture p { margin: 0 0 0.4rem; }
sup.vnum {
  color: var(--accent);
  font-size: 0.62em;
  font-family: var(--sans);
  margin-right: 0.4em;
  font-weight: 650;
  opacity: 0.85;
}
.pager { display: flex; justify-content: space-between; gap: 1rem; margin: 2.25rem 0 0; }
.status { color: var(--muted); font-style: italic; padding: 2rem 0; text-align: center; font-family: var(--serif); }

/* Plans */
.plan {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.35rem 1.4rem;
  margin: 1.1rem 0;
  box-shadow: var(--shadow);
}
.plan summary {
  cursor: pointer;
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 620;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.plan summary::-webkit-details-marker { display: none; }
.plan summary::after {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--faint);
  border-bottom: 2px solid var(--faint);
  transform: rotate(45deg);
  margin-left: auto;
  transition: transform 0.25s ease;
}
.plan[open] summary::after { transform: rotate(225deg); }
.progress { height: 0.5rem; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin: 0.85rem 0 0.3rem; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--accenthi), var(--accent)); border-radius: 999px; width: 0; transition: width 0.35s ease; }
.progresslabel { font-size: 0.85rem; color: var(--muted); }
.dayrow { display: flex; align-items: center; gap: 0.7rem; padding: 0.45rem 0.15rem; border-bottom: 1px solid var(--border); transition: background 0.15s ease; }
.dayrow:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.dayrow:last-child { border-bottom: none; }
.dayrow input { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); cursor: pointer; }
.dayrow label { flex: 1; cursor: pointer; }
.dayrow input:checked + label { color: var(--faint); text-decoration: line-through; text-decoration-color: var(--borderhi); }
.dayrow a { font-size: 0.9rem; white-space: nowrap; }

/* Footer */
footer.site {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
  padding: 2rem 0 3rem;
  text-align: center;
}
footer.site .ornament { margin: 0 0 1.2rem; }
footer.site nav { display: flex; gap: 1.1rem; flex-wrap: wrap; justify-content: center; margin-bottom: 0.9rem; }
footer.site a { color: var(--muted); text-decoration: none; }
footer.site a:hover { color: var(--accentink); }
footer.site p { max-width: 34rem; margin: 0 auto; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

@media (max-width: 640px) {
  .hero { padding: 2rem 1.35rem 1.9rem; }
  .readerbar { top: 6.4rem; }
}

@media print {
  header.site, footer.site, .readerbar, .pager, .actions, .progresstrack { display: none; }
  body { background: #fff; color: #000; }
}
