/* Rea portal. Reading-first: long instructional bodies must be comfortable on
   a phone at night and on a desk in daylight, so the palette follows the
   reader's system theme and the prose column is measured in characters. */

:root {
  --bg: #fbfaf7;
  --panel: #ffffff;
  --ink: #1c1b19;
  --ink-dim: #5d5a54;
  --line: #e4e0d8;
  --accent: #7a5cff;
  --accent-soft: #efeaff;
  --mark: #ffe9a8;
  --radius: 12px;
  --measure: 68ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16151a;
    --panel: #1e1d24;
    --ink: #eceaf3;
    --ink-dim: #a09cae;
    --line: #302e39;
    --accent: #a992ff;
    --accent-soft: #2a2440;
    --mark: #5a4a12;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; }

main {
  max-width: 62rem;
  margin: 0 auto;
  padding: 1.5rem 1.1rem 4rem;
}

/* ---- chrome ---- */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: .7rem 1.1rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 650;
  letter-spacing: -.01em;
  text-decoration: none;
  white-space: nowrap;
}

.find { flex: 1; display: flex; justify-content: flex-end; }

.find input {
  width: min(24rem, 100%);
  padding: .5rem .8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: inherit;
  font: inherit;
}

.find input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

footer {
  max-width: 62rem;
  margin: 0 auto;
  padding: 2rem 1.1rem 3rem;
  color: var(--ink-dim);
  font-size: .85rem;
  border-top: 1px solid var(--line);
}

/* ---- headings and text ---- */

h1 { font-size: 1.9rem; line-height: 1.2; letter-spacing: -.02em; margin: .2rem 0 .5rem; }
h2 { font-size: 1.15rem; letter-spacing: -.01em; margin: 2rem 0 .7rem; }
h3 { font-size: 1rem; margin: 0 0 .2rem; }

.lede { color: var(--ink-dim); max-width: var(--measure); margin: 0 0 1rem; }
.stats { color: var(--ink-dim); font-size: .9rem; }
.stats b { color: var(--ink); }
.meta, .dim { color: var(--ink-dim); font-size: .82rem; }
.empty { color: var(--ink-dim); padding: 1.4rem 0; }

.crumbs { font-size: .85rem; color: var(--ink-dim); margin-bottom: .9rem; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .sep { opacity: .5; margin: 0 .35rem; }
.crumbs .here { color: var(--ink); }

.hero { padding: 1rem 0 1.5rem; }

/* ---- cards and rows ---- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: .9rem;
}

.card {
  display: block;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}

.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card h2 { margin: 0 0 .35rem; font-size: 1.05rem; }
.card p { margin: 0 0 .6rem; color: var(--ink-dim); font-size: .87rem; }

.bar {
  height: 5px;
  border-radius: 999px;
  background: var(--accent-soft);
  overflow: hidden;
}

.bar i { display: block; height: 100%; background: var(--accent); }

.rows { display: flex; flex-direction: column; gap: .5rem; }

.row {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: .8rem 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
}

.row:hover { border-color: var(--accent); }
.row-main { min-width: 0; }
.row-main p { margin: 0; color: var(--ink-dim); font-size: .87rem; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; white-space: nowrap; }

.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .45rem; }
.list li { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }

/* ---- tags and progress pips ---- */

.tag {
  display: inline-block;
  padding: .1rem .5rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
  vertical-align: .08em;
}

.tag.big { font-size: .78rem; margin: 0 0 .3rem; }

.pips { display: inline-flex; gap: 3px; }

.pip {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--line);
}

.pip.on { background: var(--accent); }

/* ---- record prose ---- */

article { max-width: var(--measure); }

.prose {
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  line-height: 1.75;
}

.prose h1, .prose h2, .prose h3 {
  font-family: ui-sans-serif, system-ui, sans-serif;
  letter-spacing: -.01em;
  margin: 1.8rem 0 .6rem;
}

.prose h2 { font-size: 1.25rem; }
.prose h3 { font-size: 1.05rem; }
.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .9em;
  background: var(--accent-soft);
  padding: .1em .35em;
  border-radius: 5px;
}

.prose pre {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .9rem;
  overflow-x: auto;
}

.prose pre code { background: none; padding: 0; }

.prose blockquote {
  margin: 1.2rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--accent);
  color: var(--ink-dim);
}

/* Tables carry a lot of these lessons (value tables, comparisons); they must
   scroll inside themselves rather than pushing the page sideways. */
.prose table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .9rem;
}

.prose th, .prose td {
  border: 1px solid var(--line);
  padding: .45rem .6rem;
  text-align: left;
  vertical-align: top;
}

.prose th { background: var(--panel); }
.prose img { max-width: 100%; }

.snip { font-size: .87rem; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 .15em; }

.alsohere { margin-top: 2rem; }

.detail {
  margin-top: 2.5rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  color: var(--ink-dim);
  font-size: .85rem;
}

.detail summary { cursor: pointer; }
.detail dl { display: grid; grid-template-columns: max-content 1fr; gap: .3rem .9rem; margin: .8rem 0 0; }
.detail dt { color: var(--ink); }
.detail dd { margin: 0; }

@media (max-width: 34rem) {
  h1 { font-size: 1.5rem; }
  .row { flex-direction: column; align-items: flex-start; gap: .5rem; }
  .row-side { flex-direction: row; align-items: center; gap: .7rem; }
}
