/* ACIM Today — v2.0 (2026) */

:root {
  --size: 1.2rem;
  --measure: 36rem;
  --paper: #f6f3ea;
  --paper-2: #ece7d9;
  --ink: #23302d;
  --ink-soft: #5b6a64;
  --sage: #5e7a62;
  --sage-deep: #3f5a45;
  --gold: #b88a2e;
  --rule: #d9d2bf;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #16201f; --paper-2: #1d2a28; --ink: #e6e1d3; --ink-soft: #a3ada5;
    --sage: #9cbb9f; --sage-deep: #bcd5be; --gold: #d9b25f; --rule: #2e3d3a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #16201f; --paper-2: #1d2a28; --ink: #e6e1d3; --ink-soft: #a3ada5;
  --sage: #9cbb9f; --sage-deep: #bcd5be; --gold: #d9b25f; --rule: #2e3d3a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}
a { color: var(--sage-deep); }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: .5rem; z-index: 10; background: var(--paper); padding: .4rem .7rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Top bar */
.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: calc(.5rem + env(safe-area-inset-top)) 1rem .5rem;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--ink); font-weight: 600; letter-spacing: .01em; }
.tools { display: flex; gap: .25rem; }
.tools button {
  border: 1px solid var(--rule); background: transparent; border-radius: 999px;
  min-width: 2.5rem; height: 2.25rem; padding: 0 .7rem; font-size: .9rem;
}
.tools button:hover { background: var(--paper-2); }
.tools .cal { padding: 0 .55rem; }
.tools .cal svg { width: 1.4rem; height: 1.4rem; vertical-align: -.3rem; }
.tools .cal .spot { fill: var(--gold); }

/* Lesson */
main { flex: 1; width: 100%; max-width: calc(var(--measure) + 2.5rem); margin: 0 auto; padding: 2rem 1.25rem 7rem; outline: none; }
.meta { text-align: center; margin-bottom: 1.75rem; }
.section { margin-top: 0; }
.section { margin: .5rem 0 0; color: var(--gold); font-size: .85rem; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: .25rem 0 0; font-family: var(--serif); font-weight: 500; font-size: 2.1rem; color: var(--sage-deep); }

.text { font-family: var(--serif); font-size: var(--size); line-height: 1.7; }
.text p { margin: 0 0 1em; }
.text .idea {
  text-align: center; font-size: 1.25em; line-height: 1.45; color: var(--ink);
  margin: 0 auto 1.4em; max-width: 30ch; text-wrap: balance;
}
.text .idea strong { font-weight: 600; }
.text .idea + .idea { font-size: 1.05em; color: var(--ink-soft); }
.text blockquote {
  margin: 1.2em 0; padding: .2em 0 .2em 1.1em;
  border-left: 3px solid var(--sage); color: var(--ink);
}
.text blockquote blockquote { border-left-color: var(--gold); }
.text h2 {
  font-family: var(--serif); font-weight: 500; font-size: 1.3em; color: var(--sage-deep);
  text-align: center; margin: 0 0 .9em; text-wrap: balance;
}
.text h2.sub { font-size: 1em; color: var(--ink-soft); font-style: italic; margin-top: -.4em; }
.text .center { text-align: center; }
.text blockquote p { margin: 0 0 .35em; }
.text blockquote .d2 { padding-left: 1.4em; }
.text blockquote .d3 { padding-left: 2.8em; }
.text hr { border: 0; border-top: 1px solid var(--rule); margin: 2em auto; width: 40%; }
.text .lesson-mark {
  text-align: center; font-family: var(--sans); font-size: .8rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--gold); margin: 2.2em 0 .8em;
}
.text .lesson-mark::before, .text .lesson-mark::after { content: "—"; margin: 0 .6em; color: var(--rule); }
.tools svg { width: 1.05rem; height: 1.05rem; vertical-align: -.15rem; }
.loading { text-align: center; color: var(--ink-soft); font-family: var(--sans); }

/* Bottom pager */
.pager {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: center; gap: .5rem;
  padding: .6rem 1rem calc(.6rem + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--rule);
}
.pager button {
  flex: 0 1 8rem; height: 2.75rem; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--paper-2); font-size: 1rem;
}

/* Lesson list dialog */
dialog {
  width: min(34rem, 100vw - 1.5rem); max-height: min(44rem, 100vh - 3rem);
  padding: 0; border: 1px solid var(--rule); border-radius: 14px;
  background: var(--paper); color: var(--ink);
  display: none; flex-direction: column;
}
dialog[open] { display: flex; }
dialog::backdrop { background: rgb(0 0 0 / .35); }
.list-head { display: flex; justify-content: space-between; align-items: center; padding: .9rem 1rem .4rem; }
.list-head h2 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 1.3rem; }
.list-head button { border: 0; background: none; font-size: 1.2rem; padding: .3rem .5rem; }
.list-search { padding: 0 1rem .6rem; }
.list-search input {
  width: 100%; height: 2.5rem; padding: 0 .8rem; font: inherit;
  border: 1px solid var(--rule); border-radius: 8px; background: var(--paper-2); color: var(--ink);
}
.list-items { list-style: none; margin: 0; padding: 0 .5rem .75rem; overflow-y: auto; }
.list-items a {
  display: grid; grid-template-columns: 2.6rem 1fr; gap: .5rem; align-items: baseline;
  padding: .45rem .5rem; border-radius: 8px; text-decoration: none; color: var(--ink);
}
.list-items a:hover, .list-items a:focus-visible { background: var(--paper-2); }
.list-items .n { color: var(--ink-soft); font-variant-numeric: tabular-nums; text-align: right; font-size: .9rem; }
.list-items .t { font-family: var(--serif); }
.list-items .is-today .n { color: var(--gold); font-weight: 700; }
.list-items .is-current { background: var(--paper-2); }

/* Footer */
.foot { text-align: center; color: var(--ink-soft); font-size: .85rem; padding: 0 1rem 6rem; }
.foot p { margin: .25rem 0; }

@media (max-width: 30rem) {
  .brand span { display: none; }
  h1 { font-size: 1.8rem; }
  main { padding-top: 1.5rem; }
}
@media print {
  .bar, .pager, .foot { display: none !important; }
  main { padding: 0; }
}
