/* Palette taken from the app's "forest" theme (src/theme.ts) so the site and
   the app read as one product. */
:root {
  --forest-50: #f1f5f0;
  --forest-100: #e1eade;
  --forest-200: #c3d5be;
  --forest-500: #5d7f5a;
  --forest-600: #496447;
  --forest-700: #3a4f38;
  --forest-900: #1e291d;
  --sand-100: #f5f0e6;
  --sand-300: #dcd0b8;

  --bg: #ffffff;
  --bg-soft: var(--forest-50);
  --surface: #ffffff;
  --border: #e2e6e0;
  --text: #1d231c;
  --text-soft: #5b6459;
  --accent: var(--forest-600);
  --accent-contrast: #ffffff;
}

/* Dark palette applies by OS preference (system default) unless a visitor has
   picked a theme explicitly via the header switch (theme-toggle.js), which
   sets data-theme and wins either way. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0e1113;
    --bg-soft: #141917;
    --surface: #171c19;
    --border: #2a312c;
    --text: #e8ece7;
    --text-soft: #a3aca2;
    --accent: #8fae8b;
    --accent-contrast: #10130f;
  }
}

:root[data-theme='dark'] {
  --bg: #0e1113;
  --bg-soft: #141917;
  --surface: #171c19;
  --border: #2a312c;
  --text: #e8ece7;
  --text-soft: #a3aca2;
  --accent: #8fae8b;
  --accent-contrast: #10130f;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-thickness: 2px;
}

/* ── Chrome ─────────────────────────────────────────────────────────────── */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}

.site-header__inner,
.site-footer__inner,
main {
  margin: 0 auto;
  max-width: 46rem;
  padding: 0 1.25rem;
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  padding-block: 1rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 650;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}

/* The favicon does the work here: it brings its own ground and rounded
   corners, so this only has to size it. */
.wordmark__mark {
  display: block;
  width: 1.9rem;
  height: 1.9rem;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  margin-left: auto;
  font-size: 0.95rem;
}

.site-nav a {
  color: var(--text-soft);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--accent);
  text-decoration: underline;
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.theme-switch__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: none;
  color: var(--text-soft);
  cursor: pointer;
}

.theme-switch__btn svg {
  display: block;
  width: 1rem;
  height: 1rem;
}

.theme-switch__btn:hover {
  color: var(--text);
}

.theme-switch__btn[aria-pressed="true"] {
  background: var(--bg-soft);
  color: var(--accent);
}

main {
  padding-block: 2.5rem 4rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-soft);
  font-size: 0.9rem;
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  padding-block: 1.5rem 2rem;
}

.site-footer__inner nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-left: auto;
}

/* ── Prose ──────────────────────────────────────────────────────────────── */

h1 {
  margin: 0 0 0.4rem;
  font-size: 2rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h2 {
  margin: 2.4rem 0 0.6rem;
  font-size: 1.25rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

h3 {
  margin: 1.6rem 0 0.4rem;
  font-size: 1.02rem;
}

p,
ul,
ol,
dl {
  margin: 0 0 1rem;
}

ul,
ol {
  padding-left: 1.35rem;
}

li {
  margin-bottom: 0.35rem;
}

.lede {
  font-size: 1.15rem;
  color: var(--text-soft);
}

.updated {
  margin: 0 0 2rem;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.callout {
  margin: 1.5rem 0;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0.5rem;
  background: var(--bg-soft);
}

.callout > :last-child {
  margin-bottom: 0;
}

table {
  width: 100%;
  margin-bottom: 1.25rem;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th,
td {
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  font-weight: 600;
}

.table-scroll {
  overflow-x: auto;
}

code {
  padding: 0.1rem 0.35rem;
  border-radius: 0.3rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
}

/* ── Landing ────────────────────────────────────────────────────────────── */

.hero {
  padding-block: 1rem 0.5rem;
}

.hero h1 {
  font-size: 2.4rem;
}

.cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  margin: 2rem 0;
  padding: 0;
  list-style: none;
}

.cards li {
  margin: 0;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: var(--surface);
}

.cards h2 {
  margin: 0 0 0.3rem;
  font-size: 1rem;
}

.cards p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.95rem;
}

/* ── Theme catalogue ────────────────────────────────────────────────────── */

.theme-catalogue__status {
  color: var(--text-soft);
}

.theme-catalogue {
  display: grid;
  gap: 1rem;
  margin: 1.5rem 0;
  padding: 0;
  list-style: none;
}

.theme-card {
  margin: 0;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: var(--surface);
}

.theme-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.6rem;
}

.theme-card__dot {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  flex: none;
  background: var(--accent);
}

/* One class per swatch in the admin portal's PALETTE (admin/app.js), so a
   theme's colour renders here without an inline style, which the site's CSP
   (style-src 'self', no 'unsafe-inline') blocks. */
.theme-card__dot--forest {
  background: #5d7f5a;
}

.theme-card__dot--ocean {
  background: #2b7a9b;
}

.theme-card__dot--slate {
  background: #5b6b86;
}

.theme-card__dot--plum {
  background: #8a5a86;
}

.theme-card__dot--amber {
  background: #b07d33;
}

.theme-card__name {
  margin: 0;
  font-size: 1.05rem;
}

.theme-card__meta {
  margin-left: auto;
  color: var(--text-soft);
  font-size: 0.85rem;
}

.theme-card__description {
  margin: 0.4rem 0 0;
  color: var(--text-soft);
  font-size: 0.95rem;
}

.theme-card__toggle {
  margin-top: 0.8rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.theme-card__toggle:hover {
  border-color: var(--accent);
}

.theme-card__body {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}

.theme-card__verses {
  margin: 0;
  padding-left: 1.35rem;
}

.theme-card__verses li {
  margin-bottom: 0.9rem;
}

.theme-card__verses li:last-child {
  margin-bottom: 0;
}

.theme-card__address {
  margin: 0 0 0.15rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.theme-card__text {
  margin: 0;
}

.theme-card__note {
  margin: 0.3rem 0 0;
  color: var(--text-soft);
  font-size: 0.9rem;
  font-style: italic;
}

.theme-card__empty {
  margin: 0;
  color: var(--text-soft);
}

/* ── Email reveal ───────────────────────────────────────────────────────── */

.email-reveal-btn {
  display: inline;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  cursor: pointer;
}

.email-reveal-btn:hover {
  text-decoration-thickness: 2px;
}

.email-reveal-btn:disabled {
  color: var(--text-soft);
  cursor: default;
  text-decoration: none;
}

.email-reveal__challenge {
  display: inline-block;
  vertical-align: middle;
}
