/* ---- Study reading experience (Lora body + sans headings + bronze accent) ---- */

/* widen the study view beyond the app's 720px column */
main { max-width: none; }
.view { max-width: 720px; margin: 0 auto; }

#view-study {
  --study-bg: #1a1e23;
  --study-accent: #a87a2d;
  --study-text: rgba(255, 255, 255, 0.86);
  --study-muted: rgba(255, 255, 255, 0.55);
  --study-heading: #f4f4f2;
  --study-code-bg: #121519;
  --study-line: rgba(255, 255, 255, 0.08);
  background: #0f1215;
  font-family: "Lora", Georgia, "Times New Roman", serif;
  color: var(--study-text);
  max-width: 50vw;
  margin: 0 auto;
}

/* ---- study index (topic list) ---- */
#study-index { max-width: 720px; margin: 0 auto; padding: 0 1.25rem; }
#study-index .study-h { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
#study-index .study-h { font-size: 1.7rem; letter-spacing: -0.01em; color: var(--study-heading); }
#study-list, #study-group-list { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 1rem; }
.study-module {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--study-muted); margin: 1.9rem 0 0.1rem;
}
.study-module:first-of-type { margin-top: 0.3rem; }

/* group cards + group page */
#study-group { max-width: 720px; margin: 0 auto; padding: 0 1.25rem; }
#study-group .study-h { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 1.7rem; letter-spacing: -0.01em; color: var(--study-heading); margin: 0.2rem 0 1rem; }
.study-group { padding: 1.15rem 1.3rem; }
.study-group .t-title { font-size: 1.15rem; }
.study-topic {
  display: flex; align-items: center; gap: 0.75rem; width: 100%;
  background: var(--study-bg); border: 1px solid var(--study-line); border-radius: 10px;
  padding: 0.85rem 1rem; cursor: pointer; text-align: left; font-size: 1rem; color: var(--study-text);
  transition: border-color .15s ease, background .15s ease;
}
.study-topic:hover { border-color: var(--study-accent); }
.study-topic .t-title { flex: 1; font-family: "Lora", Georgia, serif; }
.study-topic .t-domain { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: .72rem; color: var(--study-muted); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.study-topic .t-ready { color: var(--study-accent); font-size: .9rem; }
.study-topic .t-empty { color: var(--study-muted); font-size: .8rem; }

/* ---- study article ---- */
#study-article { max-width: 100%; margin: 0 auto; padding: 0 1.25rem 4rem; }
.study-back {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: none; border: none; color: var(--study-muted); cursor: pointer;
  font-size: .9rem; padding: 0; margin: 0 0 1.5rem;
}
.study-back:hover { color: var(--study-accent); }

/* prev/next pager */
.study-pager {
  display: flex; justify-content: space-between; gap: 1rem;
  margin-top: 1.5rem;
}
.study-pager-top { margin: 0 0 1.5rem; }
.study-pager-btn {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--study-bg); border: 1px solid var(--study-line); border-radius: 8px;
  padding: 0.7rem 1rem; cursor: pointer; color: var(--study-text); font-size: 0.9rem;
  flex: 1; max-width: 48%; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.study-pager-btn:hover:not(:disabled) { border-color: var(--study-accent); }
.study-pager-btn:disabled { opacity: 0.4; cursor: default; }
.study-pager-btn:last-child { text-align: right; }

.study-body {
  background: var(--study-bg); border: 1px solid var(--study-line); border-radius: 14px;
  padding: 2.75rem 2.75rem; line-height: 1.62;
}
.study-body > *:first-child { margin-top: 0; }

/* headings: sans, in-focus */
.study-body h1, .study-body h2, .study-body h3 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--study-heading); letter-spacing: -0.01em; line-height: 1.22;
}
.study-body h1 { font-size: 1.9rem; margin: 0 0 1.2rem; }
.study-body h2 { font-size: 1.35rem; margin: 2.4rem 0 0.9rem; }
.study-body h3 { font-size: 1.1rem; margin: 1.8rem 0 0.6rem; }

.study-body p { font-size: 1.19rem; line-height: 1.62; margin: 0 0 1.6rem; }
.study-body a { color: var(--study-accent); text-decoration: none; border-bottom: 1px solid rgba(168, 122, 45, 0.4); }
.study-body a:hover { border-bottom-color: var(--study-accent); }
.study-body strong { color: var(--study-heading); }
.study-body ul, .study-body ol { margin: 0 0 1.6rem; padding-left: 1.5rem; }
.study-body li { margin: 0.45rem 0; font-size: 1.15rem; line-height: 1.55; }

/* inline code: mono + bronze (Fleury-style key terms) */
.study-body code {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.84em; color: var(--study-accent);
  background: rgba(168, 122, 45, 0.10); padding: 0.08em 0.34em; border-radius: 4px;
}
.study-body p code, .study-body li code { overflow-wrap: anywhere; }

/* blockquote: callout ("key point" / "why it matters") */
.study-body blockquote {
  border-left: 3px solid var(--study-accent); background: rgba(168, 122, 45, 0.07);
  margin: 0 0 1.7rem; padding: 0.9rem 1.15rem; border-radius: 0 8px 8px 0;
}
.study-body blockquote p { margin: 0; font-size: 1.05rem; line-height: 1.55; color: var(--study-text); }

/* code blocks */
.study-body pre.code-block {
  background: var(--study-code-bg); border: 1px solid var(--study-line); border-radius: 9px;
  padding: 1.05rem 1.2rem; overflow-x: auto; margin: 0 0 1.8rem;
  font-size: 0.9rem; line-height: 1.6;
}
.study-body pre.code-block code { background: none; padding: 0; color: #d7e0e6; font-size: 0.9rem; }
.study-body .code-line { display: block; min-height: 1.4em; padding: 0 0.35rem; margin: 0 -0.35rem; }
.study-body .code-line.hl { background: rgba(168, 122, 45, 0.15); box-shadow: inset 3px 0 0 var(--study-accent); }

/* provenance / sources */
.study-body .sources { margin-top: 2.6rem; border-top: 1px solid var(--study-line); padding-top: 1.1rem; font-size: 0.92rem; color: var(--study-muted); }
.study-body .sources p { font-size: 0.92rem; margin: 0 0 0.4rem; }
.study-body .sources a { font-size: 0.92rem; }

/* ---- syntax highlight (minimal dark, one-dark-ish) ---- */
.hljs { color: #d7e0e6; }
.hljs-keyword, .hljs-selector-tag { color: #c792ea; }
.hljs-string, .hljs-symbol, .hljs-regexp { color: #a5c25c; }
.hljs-number, .hljs-literal { color: #e0a75e; }
.hljs-comment, .hljs-quote { color: #5f6b72; font-style: italic; }
.hljs-title, .hljs-title.function_, .hljs-title.class_ { color: #7fb0d9; }
.hljs-type, .hljs-built_in, .hljs-builtin-name { color: #56b6c2; }
.hljs-operator { color: #89ddff; }
.hljs-attr, .hljs-attribute, .hljs-property { color: #e0a75e; }
.hljs-variable, .hljs-params { color: #d7e0e6; }
.hljs-meta { color: #5f6b72; }
.hljs-deletion { color: #f07178; }
.hljs-addition { color: #a5c25c; }

@media (max-width: 600px) {
  .study-body { padding: 1.5rem 1.1rem; border-radius: 0; border: none; }
  .study-body p { font-size: 1.1rem; }
  #view-study { max-width: 100%; }
  #study-article { padding: 0 0 4rem; }
  #study-index, #study-group { padding: 0 1rem; }
}
