/* A note written as in Typora (section 21h, app/js/marks.js): its links and code, the link card and the / menu. */

/* A link: the words in their own ink, underlined lightly; darker under the pointer, where a click opens it once the
   note is selected. Typed in, the words take the caret (⌘-click opens). */
.tx a[href] {
  color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); transition: text-decoration-color 120ms ease;
}
.obj.sel .tx a[href]:hover { text-decoration-color: currentColor; cursor: pointer; }
.tx a[href]:focus-visible { outline: none; }
/* Code in a line: the mono face on a light fill, a little smaller (as GitHub and Notion have it); in a code block,
   nothing more than the block's own. */
.tx code {
  font-family: var(--f-mono); font-size: .86em; letter-spacing: 0; font-variant-ligatures: none;
  padding: .12em .34em; border-radius: 4px; background: color-mix(in srgb, currentColor 8.5%, transparent);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.tx > .code code { font-size: inherit; padding: 0; background: none; }
.tx a[href] code { text-decoration: inherit; }

/* The link card and the / menu: a card of the page's own, as the menu is (menu.css). */
.mk-pop {
  position: fixed; left: 0; top: 0; z-index: 31; box-sizing: border-box;
  border-radius: 10px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--rule), var(--pop);
  font: 500 13px/1.2 var(--f-ui); color: var(--ink);
}
.mk-pop[hidden] { display: none; }
#mklb { display: flex; align-items: center; gap: 2px; width: 320px; max-width: calc(100vw - 16px); padding: 4px; }
.mk-url {
  flex: 1; min-width: 0; height: 30px; padding: 0 8px; box-sizing: border-box; border: 0; border-radius: 6px; outline: none;
  background: transparent; color: var(--ink); font: 400 13px/1 var(--f-ui); text-overflow: ellipsis;
}
.mk-url:focus { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.mk-url::placeholder { color: var(--ink-3); }
.mk-b {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px;
  background: transparent; color: var(--ink-2); cursor: default;
}
.mk-b svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.mk-b:hover, .mk-b:focus-visible { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); outline: none; }
#mklb.new .mk-un { display: none; }                         /* nothing to take off yet */

#slash { width: 236px; max-width: calc(100vw - 16px); max-height: min(328px, 50vh); overflow-y: auto; overscroll-behavior: contain; padding: 5px; user-select: none; -webkit-user-select: none; }
.sl-i { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px 0 6px; border-radius: 6px; white-space: nowrap; cursor: default; }
.sl-i[aria-selected="true"] { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.sl-g {
  flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 5px;
  box-shadow: inset 0 0 0 1px var(--rule); color: var(--ink-2); font: 600 11px/1 var(--f-ui);
}
.sl-g svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.sl-g svg .f { fill: currentColor; stroke: none; }
.sl-t.sm { font-size: 9px; }
.sl-t.q { font: 600 17px/1 var(--f-display); padding-top: 5px; }
.sl-t.m { font: 600 13px/1 var(--f-mono); }
.sl-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sl-i kbd { flex: none; font: 500 10.5px/1 var(--f-mono); letter-spacing: .04em; color: var(--ink-3); }
.sl-none { padding: 9px 10px; color: var(--ink-3); }
@media (pointer: coarse) { .sl-i { height: 42px; } .mk-url, .mk-b { height: 38px; } .mk-b { width: 38px; } }

/* A formula (section 21i, app/js/math.js): in a line, typeset at the words' size; a line of its own, centred, scrolling
   sideways when wider than the note. Until KaTeX is here, its TeX in the mono face; with nothing yet, "Formula", faint. */
.tx .mx { display: inline-block; max-width: 100%; vertical-align: baseline; padding: 0 1px; border-radius: 4px; cursor: default; }
.tx .mx .katex { font-size: 1.08em; }
.tx > .math { display: block; margin: .15em 0; padding: .5em 0; overflow-x: auto; overflow-y: hidden; text-align: center; border-radius: 6px; cursor: default; scrollbar-width: none; }
.tx > .math::-webkit-scrollbar { display: none; }
.tx > .math .katex-display { margin: 0; }
.tx .mx:not(.mx-ok), .tx > .math:not(.mx-ok) { font-family: var(--f-mono); font-size: .86em; }
.tx .mx-none { color: var(--ink-3); font-style: italic; }
.tx:focus .mx:hover, .tx:focus > .math:hover { background: color-mix(in srgb, currentColor 6%, transparent); }
.tx .mx.mx-on, .tx > .math.mx-on { background: color-mix(in srgb, currentColor 10%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, currentColor 22%, transparent); }
.tx .katex .katex-mathml { user-select: none; }

#mxed { display: flex; align-items: flex-start; gap: 2px; width: 360px; max-width: calc(100vw - 16px); padding: 4px; }
.mx-tex {
  flex: 1; min-width: 0; min-height: 30px; max-height: 160px; padding: 6px 8px; box-sizing: border-box; border: 0; border-radius: 6px; outline: none; resize: none;
  background: color-mix(in srgb, var(--ink) 5%, transparent); color: var(--ink); font: 400 13px/18px var(--f-mono); overflow-y: auto;
}
.mx-tex::placeholder { color: var(--ink-3); }
@media (pointer: coarse) { .mx-tex { min-height: 38px; padding: 10px 8px; font-size: 16px; } }

/* A code block in its language (section 21j, app/js/code.js): its pieces coloured by the CSS Custom Highlight API, each
   a hue mixed into the note's own ink, so it reads by day, at night and on a coloured card alike. Its language's name
   at its top right (a click there, typed in, picks another). */
::highlight(cx-kw) { color: color-mix(in oklab, #c4314b 72%, currentColor); }
::highlight(cx-str) { color: color-mix(in oklab, #2f7d32 72%, currentColor); }
::highlight(cx-com) { color: color-mix(in oklab, currentColor 48%, transparent); }
::highlight(cx-num) { color: color-mix(in oklab, #b25f00 72%, currentColor); }
::highlight(cx-lit) { color: color-mix(in oklab, #b25f00 72%, currentColor); }
::highlight(cx-fn) { color: color-mix(in oklab, #3f5fd0 72%, currentColor); }
::highlight(cx-type) { color: color-mix(in oklab, #8a3fc0 70%, currentColor); }
::highlight(cx-tag) { color: color-mix(in oklab, #c4314b 72%, currentColor); }
::highlight(cx-attr) { color: color-mix(in oklab, #3f5fd0 72%, currentColor); }
.tx > .code[data-lang]:not(.code + .code) { position: relative; }
.tx > .code[data-lang]:not(.code + .code)::after {
  content: attr(data-lang); position: absolute; right: .7em; top: calc(var(--blk, .5em) + .1em); pointer-events: none;
  font: 500 .78em/1.6 var(--f-mono); letter-spacing: .02em; color: color-mix(in srgb, currentColor 45%, transparent);
}
.tx:focus > .code[data-lang]:not(.code + .code)::after { text-decoration: underline dotted; text-underline-offset: .25em; }
#cbpick { width: 208px; padding: 5px; }
#cbpick .mk-url { width: 100%; margin-bottom: 4px; background: color-mix(in srgb, var(--ink) 5%, transparent); }
.cb-list { max-height: min(260px, 40vh); overflow-y: auto; overscroll-behavior: contain; }
#cbpick .sl-i { height: 30px; }

/* A link to something on the canvas: as a link, with a dotted underline; its list's items say what and where. */
.tx a.ref { color: inherit; text-decoration: underline dotted; text-decoration-thickness: 1.5px; text-underline-offset: .2em;
  text-decoration-color: color-mix(in srgb, currentColor 55%, transparent); }
.obj.sel .tx a.ref:hover { text-decoration-color: currentColor; cursor: pointer; }
#slash.rf { width: 300px; }
.rf-i { height: 44px; }
.rf-i .sl-n { display: flex; flex-direction: column; gap: 2px; }
.rf-i .sl-n small { font: 400 11px/1.2 var(--f-ui); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; }
