/* ---------- Study: breadcrumb, toolbar, the page, status bar ---------- */

.study-doc {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.study-crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px var(--space-5) 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.study-crumbs .is-last {
  color: var(--text);
}

.study-crumbs__sep {
  opacity: 0.5;
}

.study-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 6px var(--space-4);
  border-bottom: 1px solid var(--border);
  min-height: 42px;
}

.study-tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 30px;
  padding: 0 6px;
  color: var(--muted);
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}

.study-tb-btn:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.study-tb-btn.is-active {
  color: var(--green);
  background: rgba(61, 255, 180, 0.12);
  border-color: rgba(61, 255, 180, 0.3);
}

.study-tb-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.study-tb-sep {
  width: 1px;
  height: 18px;
  margin: 0 6px;
  background: var(--border);
}

.study-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-6) var(--space-4) 80px;
}

/* The page: a clean centred column, ~720px. */
.study-page {
  max-width: 720px;
  margin: 0 auto;
}

.study-title {
  width: 100%;
  padding: 0;
  margin: 0 0 var(--space-4);
  font: inherit;
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  background: none;
  border: 0;
  outline: none;
}

.study-title::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

.study-editor__msg {
  color: var(--muted);
}

.study-editor__msg.is-error {
  color: var(--red);
}

/* ----- note text (Tiptap's contenteditable) ----- */

.study-prose {
  min-height: 50vh;
  outline: none;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  word-wrap: break-word;
}

.study-prose > * + * {
  margin-top: 0.7em;
}

.study-prose p {
  margin-bottom: 0;
}

.study-prose h1 { font-size: 1.8rem; line-height: 1.25; margin-top: 1.2em; }
.study-prose h2 { font-size: 1.4rem; line-height: 1.3; margin-top: 1.1em; }
.study-prose h3 { font-size: 1.15rem; line-height: 1.35; margin-top: 1em; }

.study-prose ul,
.study-prose ol {
  padding-left: 1.5em;
}

.study-prose li > p {
  margin: 0;
}

.study-prose s {
  opacity: 0.8;
}

.study-prose p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  height: 0;
  color: var(--muted);
  opacity: 0.6;
  pointer-events: none;
}

/* block indent (paragraphs + headings) */
.study-prose [data-indent="1"] { margin-left: 2em; }
.study-prose [data-indent="2"] { margin-left: 4em; }
.study-prose [data-indent="3"] { margin-left: 6em; }
.study-prose [data-indent="4"] { margin-left: 8em; }
.study-prose [data-indent="5"] { margin-left: 10em; }
.study-prose [data-indent="6"] { margin-left: 12em; }

/* checklist */
.study-prose ul[data-type="taskList"] {
  list-style: none;
  padding-left: 0.2em;
}

.study-prose ul[data-type="taskList"] li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.study-prose ul[data-type="taskList"] li > label {
  flex: 0 0 auto;
  margin-top: 0.32em;
  user-select: none;
}

.study-prose ul[data-type="taskList"] li > div {
  flex: 1;
  min-width: 0;
}

.study-prose ul[data-type="taskList"] input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
  cursor: pointer;
}

.study-prose ul[data-type="taskList"] li[data-checked="true"] > div {
  color: var(--muted);
  text-decoration: line-through;
}

.study-prose ul[data-type="taskList"] ul[data-type="taskList"] {
  margin-top: 0.3em;
}

/* ----- bottom status bar ----- */

.study-status {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 6px var(--space-4);
  font-size: 0.75rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.study-status .is-error {
  color: var(--red);
}

/* ---------- step 2a: fonts, dropdowns, blocks ---------- */

.study-prose {
  font-family: Inter, var(--font-sans);
}

.study-prose sup,
.study-prose sub {
  font-size: 0.75em;
  line-height: 0;
}

/* Highlight text stays dark so it reads on the pastel colours (inline
   colour:inherit from Tiptap is overridden on purpose). */
.study-prose mark {
  color: #0b0d16 !important;
  border-radius: 3px;
  padding: 0 2px;
}

.study-prose blockquote {
  margin-left: 0;
  padding: 2px 0 2px 16px;
  color: var(--chart-label);
  border-left: 3px solid rgba(61, 255, 180, 0.5);
}

.study-prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.2em 0;
}

.study-prose pre {
  padding: 12px 14px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.55;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.study-prose pre code {
  font-family: inherit;
  background: none;
  padding: 0;
}

.study-prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 1px 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}

/* callouts: coloured left border + soft tint + small label */
.study-callout {
  --c: 96, 165, 250;
  padding: 10px 14px 10px 16px;
  background: rgba(var(--c), 0.1);
  border-left: 4px solid rgb(var(--c));
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.study-callout::before {
  content: attr(data-callout);
  display: block;
  margin-bottom: 2px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgb(var(--c));
  user-select: none;
}

.study-callout[data-callout="tip"] { --c: 61, 255, 180; }
.study-callout[data-callout="warning"] { --c: 255, 200, 92; }
.study-callout[data-callout="important"] { --c: 255, 107, 142; }

/* toolbar dropdowns */
.study-dd {
  position: relative;
  display: inline-flex;
}

.study-tb-dd {
  gap: 5px;
}

.study-tb-dd.is-wide .study-dd__label {
  display: inline-block;
  min-width: 88px;
  text-align: left;
}

.study-dd__label {
  font-size: 0.8rem;
  white-space: nowrap;
}

.study-dd__panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 60;
  min-width: 150px;
  max-height: 320px;
  overflow-y: auto;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 18px 50px -12px rgba(0, 0, 0, 0.8), var(--card-shadow);
}

.study-dd__panel[hidden] {
  display: none;
}

.study-dd__panel.is-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 170px;
  padding: 9px;
}

.study-dd__panel.is-swatches[hidden] {
  display: none;
}

.study-dd__opt {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  text-align: left;
  font: inherit;
  font-size: 0.88rem;
  color: var(--text);
  background: none;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
}

.study-dd__opt:hover {
  background: rgba(255, 255, 255, 0.07);
}

.study-dd__opt.is-active {
  color: var(--green);
}

.study-dd__opt.is-reset {
  flex-basis: 100%;
  justify-content: center;
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  border-radius: 0 0 5px 5px;
  margin-top: 2px;
}

.study-dd__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.study-sw {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  cursor: pointer;
}

.study-sw:hover {
  transform: scale(1.12);
}

/* collapsible section (Tiptap renders: div[data-type=details] > button + div > summary + content) */
.study-prose div[data-type="details"] {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.study-prose div[data-type="details"] > button {
  flex: 0 0 34px;
  height: 34px;
  padding: 0;
  font-size: 1.5rem; /* big ▸/▾ and a 34px click area */
  line-height: 34px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.study-prose div[data-type="details"] > button:hover {
  background: rgba(61, 255, 180, 0.15);
}

.study-prose div[data-type="details"] > button::before {
  content: "▸";
}

.study-prose div[data-type="details"].is-open > button::before {
  content: "▾";
}

.study-prose div[data-type="details"] > button:hover {
  color: var(--green);
}

.study-prose div[data-type="details"] > div {
  flex: 1;
  min-width: 0;
}

.study-prose div[data-type="details"] summary {
  display: block;
  list-style: none;
  font-weight: 600;
  min-height: 34px;
  line-height: 34px;
}

.study-prose div[data-type="details"] summary.is-empty::before {
  content: attr(data-placeholder);
  float: left;
  height: 0;
  font-weight: 400;
  color: var(--muted);
  opacity: 0.6;
  pointer-events: none;
}

.study-prose div[data-type="details"] [data-type="detailsContent"] {
  padding: 2px 0 4px;
}

.study-prose div[data-type="details"] [data-type="detailsContent"][hidden] {
  display: none;
}
