:root {
  --bg: #f7f6f3;
  --card: #fcfbf8;
  --ink: #26272b;
  --muted: #64656b;
  --line: #e2e0da;
  --accent: #e6c878;        /* light gold: buttons, highlights */
  --accent-ink: #26272b;    /* dark gray text on gold */
  --accent-strong: #8a6a1c; /* deeper gold for links and outlines (readable on light) */
  --soft: #f8efd6;          /* pale gold panels */
  --warn: #9a3b2c;
  --warn-soft: #f7e7e2;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1c1f;
    --card: #24252a;
    --ink: #ecebe7;
    --muted: #a2a3a9;
    --line: #36373d;
    --accent: #e6c878;
    --accent-ink: #1b1c1f;
    --accent-strong: #e6c878;
    --soft: #2d2a20;
    --warn: #e8a08f;
    --warn-soft: #3a2723;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 17px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
main { max-width: 620px; margin: 0 auto; padding: 20px 18px 64px; min-height: 100vh; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 2rem; letter-spacing: -.01em; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

.topbar { display: flex; align-items: center; gap: 8px; margin-bottom: 22px; }
.brand { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; }
.brand-mark { width: 26px; height: 26px; vertical-align: -6px; margin-right: 8px; }

.hero { padding: 48px 0 24px; text-align: center; }
.hero .brand-mark { width: 56px; height: 56px; margin: 0 0 16px; }
.hero p { max-width: 30em; margin-left: auto; margin-right: auto; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.card + .card { margin-top: 14px; }
.soft { background: var(--soft); border-color: transparent; }
.warn { background: var(--warn-soft); border-color: transparent; }

label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
input[type='password'], input[type='text'], select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
textarea {
  min-height: 46vh;
  resize: vertical;
  font-family: var(--serif);
  font-size: 1.12rem;
  line-height: 1.6;
  border-radius: var(--radius);
  padding: 18px;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

button, .btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 11px 18px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
}
button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 8px 10px; }
button.danger { color: var(--warn); }
button.block { width: 100%; }
button:disabled { opacity: .55; cursor: default; }

.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; min-height: 36px; padding: 6px 14px; font-weight: 500; color: var(--muted); }
.seg button[aria-pressed='true'] { background: var(--accent); color: var(--accent-ink); }

.toggle { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.toggle input { width: 20px; height: 20px; accent-color: var(--accent-strong); }

.entry-list { list-style: none; padding: 0; margin: 0; }
.entry-list li + li { margin-top: 10px; }
.entry-item {
  width: 100%;
  text-align: left;
  display: block;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-weight: 400;
}
.entry-item .date { font-size: .82rem; color: var(--muted); display: block; margin-bottom: 2px; }
.entry-item .snippet { font-family: var(--serif); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.entry-text { font-family: var(--serif); font-size: 1.12rem; white-space: pre-wrap; }

.reflection h3 { margin-top: 4px; }
.reflection .section + .section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.kicker { font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
blockquote { margin: 6px 0 8px; padding-left: 14px; border-left: 3px solid var(--accent); font-family: var(--serif); font-size: 1.08rem; }
.ref { font-weight: 600; }
.question { font-family: var(--serif); font-size: 1.15rem; font-style: italic; }

.resource { padding: 14px 0; border-bottom: 1px solid var(--line); }
.resource:last-child { border-bottom: 0; }
.resource .row { margin-top: 8px; }

.dots { display: inline-flex; gap: 5px; }
.dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: pulse 1.2s infinite ease-in-out; }
.dots span:nth-child(2) { animation-delay: .15s; }
.dots span:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.error { color: var(--warn); font-size: .92rem; min-height: 1.2em; margin-top: 8px; }
.steps { color: var(--muted); font-size: .85rem; margin-bottom: 10px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (prefers-reduced-motion: reduce) { .dots span { animation: none; opacity: .7; } }

/* Hide the journal while the app is in the background (app switcher previews). */
body.veiled main { visibility: hidden; }
a { color: var(--accent-strong); text-underline-offset: 3px; }
a.btn { color: var(--ink); }
a.btn.primary { color: var(--accent-ink); }
