/* Notebook theme: bold handwritten headings, sans-serif product labels and
   explanations, and pencil outlines on ruled paper. */

:root {
  --mm-bg: #fbf7ec;
  --mm-surface: #fffdf6;
  --mm-surface-soft: #f3ecd9;
  --mm-text: #282936;
  --mm-pic-ink: #3a3b48;
  --mm-muted: #494a55;
  --mm-border: #d9d0ba;
  --mm-accent: #2f5fa8;
  --mm-accent-soft: #e4ebf6;
  --mm-branch-0: #2f5fa8;
  --mm-branch-1: #2f7d4f;
  --mm-branch-2: #ad5222;
  --mm-branch-3: #7a4fa3;
  --mm-rule: rgb(70 120 190 / 17%);
  --mm-margin: rgb(214 84 84 / 38%);
  --mm-note: #fff1a6;
  --mm-tape: rgb(205 220 235 / 70%);
  --mm-plain: "Pretendard Variable", Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --mm-hand: "Gaegu", var(--mm-plain);
  --mm-font: var(--mm-plain);
  --mm-shadow: 2px 3px 0 rgb(43 47 58 / 7%), 0 8px 22px rgb(43 47 58 / 8%);
}

@media (prefers-color-scheme: dark) {
  /* Dark: a chalkboard-like dark notebook. */
  :root {
    --mm-bg: #1f2523;
    --mm-surface: #262d2a;
    --mm-surface-soft: #2f3733;
    --mm-text: #faf5e9;
    --mm-pic-ink: var(--mm-text);
    --mm-hatch-opacity: .64;
    --mm-muted: #d8d6cc;
    --mm-border: #3d4642;
    --mm-accent: #8fb3ea;
    --mm-accent-soft: #2c3a4c;
    --mm-branch-0: #8fb3ea;
    --mm-branch-1: #8fd1a5;
    --mm-branch-2: #f0b07a;
    --mm-branch-3: #c4a8ec;
    --mm-rule: rgb(236 232 220 / 7%);
    --mm-margin: rgb(240 120 120 / 26%);
    --mm-note: #5a5230;
    --mm-tape: rgb(200 210 220 / 22%);
    --mm-shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 22px rgb(0 0 0 / 30%);
  }
}

/* The paper, pencil grain and pigments are shared by every drawing. */
.mm-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.mm-node-pic, .mm-panel-pic {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1px;
  margin: 2px 0 3px;
  font-size: 26px;
  line-height: 1;
}
.mm-node[data-depth="0"] .mm-node-pic { font-size: 30px; }
.mm-panel-pic { gap: 2px; margin: 1px 0 5px; font-size: 34px; }
.mm-panel-pic.is-inline { display: inline-flex; max-width: 100%; margin: 0; vertical-align: middle; }
.mm-pictogram {
  display: block;
  flex: none;
  width: auto;
  height: 1em;
  fill: none;
  fill-rule: evenodd;
  stroke: var(--mm-pic-ink);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mm-pic-dot { fill: var(--mm-pic-ink); stroke: none; }
.mm-pic-blush { fill: #f39bb0; stroke: none; opacity: .8; }

/* ---------- paper ---------- */
.mm-viewport {
  background-image: linear-gradient(to bottom, transparent calc(100% - 1px), var(--mm-rule) calc(100% - 1px));
}
/* Red margin line, like a notebook page. */
.mm-viewport::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: 44px;
  border-left: 2px solid var(--mm-margin);
  pointer-events: none;
}
.mm-bar { border-bottom-style: dashed; }
.mm-title { font-family: var(--mm-hand); font-size: 28px; font-weight: 700; letter-spacing: 0; }
.mm-account-link, .mm-account-state { font-size: 14px; font-weight: 600; }

/* ---------- lines: pencil strokes ---------- */
.mm-edge {
  filter: url(#mm-crayon);
  stroke: color-mix(in srgb, var(--c, var(--mm-text)) 82%, var(--mm-text));
  stroke-linejoin: round;
  stroke-opacity: .96;
  stroke-width: 2.3;
}
.mm-edge[data-depth="1"] { stroke-width: 3.6; stroke-opacity: 1; }
.mm-edge[data-depth="2"] { stroke-width: 2.9; }
.mm-edge[data-depth="3"] { stroke-width: 2.5; }
.mm-viewport.is-animating .mm-edge,
.mm-viewport.is-animating .mm-node::before { filter: none; }

/* ---------- topics: boxes drawn by hand ----------
   The node itself is transparent; ::before draws the box (paper, ink border),
   slightly tilted and run through the pencil filter so the edge wobbles while
   the writing stays crisp and level. */
.mm-node {
  --wob: 24px 30px 20px 27px / 20px 21px 27px 18px;
  --tilt: -.7deg;
  --ink: color-mix(in srgb, var(--c) 70%, var(--mm-text));
  --paper: var(--mm-surface);
  --line: 2.3px;
  isolation: isolate;
  border-color: transparent;
  border-radius: var(--wob);
  background: transparent;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0;
}
.mm-node[data-wobble="1"] { --wob: 21px 26px 30px 22px / 26px 18px 21px 25px; --tilt: .7deg; }
.mm-node[data-wobble="2"] { --wob: 29px 22px 25px 20px / 19px 27px 20px 26px; --tilt: -.45deg; }
.mm-node[data-wobble="3"] { --wob: 22px 28px 19px 30px / 25px 20px 26px 19px; --tilt: .9deg; }
.mm-node::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border: var(--line) solid var(--ink);
  border-radius: var(--wob);
  background: var(--paper);
  rotate: var(--tilt);
  filter: url(#mm-crayon);
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.mm-node:hover { border-color: transparent; }
.mm-node:hover::before { border-color: var(--c); }
.mm-node.has-summary { border-radius: var(--wob); padding-block: 8px 10px; }

/* Sparse diagonal pencil strokes leave paper showing behind the words. */
.mm-node[data-depth="1"] {
  --paper: color-mix(in srgb, var(--c) 8%, var(--mm-surface));
  --line: 2.8px;
  border-color: transparent;
  background: transparent;
  font-family: var(--mm-hand);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
}
.mm-node[data-depth="1"]::before {
  background-image: repeating-linear-gradient(-36deg, transparent 0 3.1px, color-mix(in srgb, var(--c) 18%, transparent) 3.4px 4.6px);
}
.mm-node[data-depth="2"] { font-size: 17px; }

/* Centre: a sticky note with a strip of tape. */
.mm-node[data-depth="0"],
.mm-node[data-depth="0"].has-summary {
  --wob: 6px 3px 7px 4px;
  --tilt: -1.4deg;
  --paper: var(--mm-note);
  --line: 0px;
  border-radius: 6px;
  background: transparent;
  color: var(--mm-text);
  font-family: var(--mm-hand);
  font-size: 36px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
}
.mm-node[data-depth="0"]::before { box-shadow: 2px 4px 0 rgb(43 47 58 / 9%), 0 8px 12px rgb(43 47 58 / 10%); }
.mm-node[data-depth="0"]::after {
  content: "";
  position: absolute;
  top: -9px; left: 50%;
  width: 74px; height: 20px;
  translate: -50% 0;
  rotate: 3deg;
  background: var(--mm-tape);
  pointer-events: none;
}
.mm-node[data-depth="0"].has-body .mm-node-label::after { background: var(--mm-text); }

/* The few words under the picture. */
.mm-node[data-depth].has-summary .mm-node-summary {
  margin-top: 4px;
  color: var(--mm-muted);
  font: 500 15px/1.45 var(--mm-plain);
}

/* Selected / drop target: circled again with a highlighter. */
.mm-node[aria-current="true"],
.mm-node[data-depth="0"][aria-current="true"],
.mm-node.is-drop-target { border-color: transparent; box-shadow: none; }
.mm-node[aria-current="true"]::before,
.mm-node.is-drop-target::before {
  border-color: var(--c);
  border-width: calc(var(--line) + 1px);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--c) 24%, transparent);
}
/* A drop target also gets a dashed ring, so it shows even on the selected topic. */
.mm-node.is-drop-target { outline: 2.5px dashed var(--c); outline-offset: 5px; }
.mm-node[data-depth="0"][aria-current="true"]::before { box-shadow: 0 0 0 5px color-mix(in srgb, var(--mm-branch-2) 35%, transparent); }

.mm-fold { font-size: 13px; font-weight: 700; }

/* ---------- controls, toast ---------- */
.mm-zoom-label { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mm-toast { font-size: 15px; }

/* ---------- detail panel: a page torn from the same notebook ---------- */
.mm-panel {
  border-radius: 6px 14px 8px 16px;
  background:
    linear-gradient(to right, transparent 9px, var(--mm-margin) 9px, var(--mm-margin) 11px, transparent 11px),
    var(--mm-surface);
}
.mm-panel-title { font-family: var(--mm-hand); font-size: 30px; font-weight: 700; line-height: 1.25; letter-spacing: 0; }
.mm-panel-prose { font-size: 16px; line-height: 1.75; }
.mm-panel-prose strong { font-weight: 700; color: var(--mm-accent); }
.mm-panel-prose a { text-decoration: underline; }
/* Keep emphasis and links legible on the sticky note in both themes. */
.mm-panel-prose > blockquote:first-child :is(a, strong) { color: var(--mm-text); }
.mm-panel-prose > blockquote:first-child {
  position: relative;
  isolation: isolate;
  border: 0;
  border-radius: 21px 17px 24px 13px / 16px 21px 15px 19px;
  background: transparent;
  font-size: 1.125em;
  font-weight: 600;
  line-height: 1.55;
}
.mm-panel-prose > blockquote:first-child::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  border: 2.4px solid color-mix(in srgb, var(--mm-pic-ink) 78%, transparent);
  border-radius: inherit;
  background: var(--mm-note);
  rotate: -.5deg;
  filter: url(#mm-crayon);
}
.mm-panel-label, .mm-panel-feedback { font-size: 14px; }

@media (max-width: 767px) {
  .mm-viewport::before { left: 18px; }
  .mm-title { font-size: 24px; line-height: 1.12; }
  .mm-account-link, .mm-account-state { padding-inline: 7px; font-size: 13px; white-space: nowrap; }
  .mm-node { padding-inline: 10px; }
  .mm-node[data-depth="1"] { padding-inline: 11px; }
  .mm-node[data-depth="0"], .mm-node[data-depth="0"].has-summary { padding-inline: 12px; font-size: 30px; }
  .mm-node-pic, .mm-node[data-depth="0"] .mm-node-pic { font-size: 22px; }
  .mm-node-pic + .mm-node-summary-text { display: none; }
}

@media (max-width: 360px) {
  .mm-title { font-size: 22px; }
  .mm-node[data-depth="1"] { padding-inline: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  .mm-node::before { transition: none; }
}
