/* TinyLearn — a ruled notebook page. Light only. Brief: /opt/tinylearn/design-brief.json */
:root {
  --bg: #FDFBF8;
  --surface: #FAF6F2;
  --primary: #C88457;
  --accent: #E8AA68;
  --text: #3A302A;
  --muted: #7A6F66;
  --rule: rgba(58, 48, 42, 0.10);
  --margin: rgba(200, 132, 87, 0.35);
  --serif: "Lora", Georgia, "Times New Roman", serif;
  --sans: "Open Sans", "Helvetica Neue", Arial, sans-serif;
  --line: 1.65rem;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; color: var(--text); background: var(--bg);
  font: 16px/var(--line) var(--sans); -webkit-font-smoothing: antialiased;
}
a { color: var(--text); text-decoration-color: var(--margin); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--primary); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.page { max-width: 46rem; margin: 0 auto; padding: 0 16px 4rem; }

/* masthead */
.masthead { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1.4rem 0 0.6rem; }
.brand { font: 500 1.35rem/1 var(--serif); text-decoration: none; display: inline-flex; align-items: center; gap: .5rem; }
.brand .tick { width: 14px; height: 18px; border-radius: 2px; position: relative; }
.brand .tick::after { content: ""; position: absolute; left: 2px; bottom: 1px; width: 3px; height: 20px; background: var(--primary); border-radius: 2px; transform: rotate(32deg); transform-origin: bottom left; }
.nav { display: flex; gap: 1.1rem; align-items: baseline; font-size: .95rem; }
.nav a { text-decoration: none; color: var(--muted); padding-bottom: 2px; border-bottom: 1.5px solid transparent; }
.nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--primary); }
.inline { display: inline; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; }
.linkish:hover { color: var(--text); }

/* the sheet: ruled lines + a red margin, like a notebook page */
.sheet {
  position: relative; background: var(--surface);
  border: 1px solid var(--rule); border-radius: 3px 8px 8px 3px;
  padding: 1.6rem 1.5rem 1.6rem 2.6rem; margin-top: .8rem;
  box-shadow: 0 1px 0 rgba(58,48,42,.04), 0 6px 18px -12px rgba(58,48,42,.25);
}
.sheet::before { content: ""; position: absolute; top: 0; bottom: 0; left: 1.9rem; width: 1px; background: var(--margin); }
@media (max-width: 480px) { .sheet { padding: 1.2rem 1rem 1.2rem 1.9rem; } .sheet::before { left: 1.3rem; } }

h1 { font: 500 1.75rem/1.25 var(--serif); margin: .2rem 0 .9rem; letter-spacing: -.01em; }
h2 { font: 500 1.15rem/1.3 var(--serif); margin: 1.8rem 0 .5rem; }
p { margin: 0 0 var(--line); }
.quiet { color: var(--muted); }
.small { font-size: .9rem; }

/* streak + tally strokes */
.streak { margin-bottom: 1.2rem; }
.streak-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem 1rem; margin-bottom: .6rem; font-family: var(--serif); font-size: 1.1rem; }
.streak-line strong { font-size: 1.6rem; font-weight: 600; color: var(--primary); }
.streak-line .quiet { font-family: var(--sans); font-size: .9rem; }
.tally { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.week { display: flex; flex-direction: column; gap: 4px; }
.d { display: block; width: 10px; height: 14px; position: relative; }
.d::after { content: ""; position: absolute; left: 3px; bottom: 0; width: 2px; height: 14px; border-radius: 1px; background: var(--rule); transform: rotate(28deg); transform-origin: bottom center; }
.d.hit::after { background: var(--primary); }
.d.mark::after { background: var(--accent); }
.d.half::after { background: var(--accent); height: 9px; }
.d.open::after { background: transparent; border: 1px dashed var(--primary); width: 0; }
.d.future::after { opacity: .35; }

/* entries */
.entry { margin-bottom: 1rem; }
.dateline { color: var(--muted); font-size: .9rem; margin-bottom: .2rem; }
.pill { display: inline-block; font-size: .78rem; padding: 0 .5rem; border: 1px solid var(--rule); border-radius: 999px; margin-left: .3rem; vertical-align: middle; color: var(--muted); }
.pill.open { border-color: var(--primary); color: var(--primary); }
.pill.good { background: var(--primary); border-color: var(--primary); color: #fff; }
.pill.half { background: var(--accent); border-color: var(--accent); color: var(--text); }
.pill.miss { border-color: var(--muted); }
.lesson { font-family: var(--serif); font-size: 1.08rem; line-height: var(--line);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--line) - 1px), var(--rule) calc(var(--line) - 1px), var(--rule) var(--line)); }
.lesson p { margin-bottom: var(--line); }
.whynow { color: var(--muted); font-style: italic; font-family: var(--serif); }
.check { border-left: 3px solid var(--accent); padding: .1rem 0 .1rem 1rem; margin: .4rem 0 1rem; }
.check .q { font-weight: 600; margin-bottom: .6rem; }
.check .a .quiet { display: inline-block; min-width: 4.5rem; }
.entry.is-open h1::before { content: "◦ "; color: var(--primary); }

.entries { list-style: none; padding: 0; margin: 0; }
.entries li { padding: .2rem 0; }
.entries .n { display: inline-block; min-width: 2.2rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.entries a { text-decoration: none; }
.entries a:hover { text-decoration: underline; }

/* buttons, forms */
.btn { font: 600 .95rem var(--sans); color: #fff; background: var(--primary); border: 0; border-radius: 6px; padding: .55rem 1rem; cursor: pointer; }
.btn:hover { background: #b4744b; }
.btn.quiet-btn { background: transparent; color: var(--text); border: 1px solid var(--rule); }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
input[type="search"], input[type="text"], input[type="password"], input[type="number"], select {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--rule); border-radius: 6px; padding: .45rem .6rem;
}
input:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(232,170,104,.25); }
input[type="search"] { flex: 1 1 14rem; }
.settings fieldset { border: 1px dashed var(--rule); border-radius: 6px; padding: .8rem 1rem; margin: 0 0 1.2rem; }
.settings legend { font-family: var(--serif); padding: 0 .4rem; }
.settings label { display: block; margin: .4rem 0; }
.settings input[type="number"] { width: 5rem; }
.settings input[type="text"] { width: 10rem; }
.settings .checkbox input { margin-right: .4rem; }

.flash { list-style: none; padding: .5rem 1rem; margin: .8rem 0 0; background: #fff6ea; border: 1px solid var(--accent); border-radius: 6px; }
.flash-warn { margin-top: 1rem; color: var(--primary); }
.error { color: #9b3d1a; }

/* replies + sources */
.replies, .sources { list-style: none; padding: 0; margin: 0; }
.replies li { margin-bottom: .8rem; }
.replies p { margin: 0; }
.feedback { color: var(--muted); font-style: italic; }
.sources li { padding: .15rem 0; font-size: .92rem; overflow-wrap: anywhere; }
.sources li.used .ref { border-bottom: 1.5px solid var(--primary); }
.sources details { display: inline; }
.sources summary { display: inline; cursor: pointer; font-size: .85rem; margin-left: .4rem; }
.excerpt { margin: .3rem 0 .6rem; padding: .5rem .8rem; background: var(--bg); border-radius: 6px; font-size: .88rem; color: var(--muted); }
.pager { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1.5rem; font-size: .92rem; }

/* login */
.login { display: grid; gap: 1.5rem; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 640px) { .login { grid-template-columns: 1.1fr 1fr; } }
.login .still { width: 100%; height: auto; border-radius: 6px; display: block; }
.login label { display: block; margin: .6rem 0; }
.login input[type="text"], .login input[type="password"] { width: 100%; }
.login .btn { margin-top: .6rem; }

.colophon { color: var(--muted); font-size: .85rem; margin-top: 1.4rem; padding-left: .2rem; }
@media (prefers-reduced-motion: no-preference) { .btn { transition: background .15s; } }

/* multiple-choice options: big tap targets */
.choices { margin: .2rem 0 .8rem; padding-left: 1.6rem; }
.choices li { margin: .35rem 0; }
.choices li a { display: block; padding: .5rem .8rem; background: var(--bg); border: 1px solid var(--rule); border-radius: 6px; text-decoration: none; }
.choices li a:hover, .choices li a:focus-visible { border-color: var(--primary); }
.choices li.right { font-weight: 600; }
.choices li.right::marker { color: var(--primary); }
