/* Visual examples for docs/index.html feature sections. */

.note-link-demo {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  --cursor-left: 300px;
  --cursor-top: 142px;
  --cursor-select-start-x: -108px;
  --cursor-select-start-y: 2px;
  --cursor-select-end-x: -2px;
  --cursor-select-end-y: 2px;
  --cursor-toolbar-x: 56px;
  --cursor-toolbar-y: -52px;
  --cursor-picker-x: 96px;
  --cursor-picker-y: 72px;
  --cursor-away-x: 178px;
  --cursor-away-y: 150px;
  --cursor-hover-x: 2px;
  --cursor-hover-y: 0;
  --linked-ref-bg: rgba(78, 132, 105, 0.08);
  --linked-ref-text: #385a48;
  width: 100%;
  min-height: 430px;
  aspect-ratio: 1000 / 563;
  overflow: hidden;
  background:
    radial-gradient(circle at 74% 20%, rgba(166, 104, 63, 0.08), transparent 32%),
    linear-gradient(180deg, #eee8df 0%, #e7dfd4 100%);
  color: #251f1a;
}

.note-link-demo::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  border: 1px solid rgba(70, 55, 42, 0.1);
  pointer-events: none;
}

.note-link-demo-topbar {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 42px;
  padding: 0 16px;
  border-bottom: 1px solid #d6cbbb;
  background: #e9e2d7;
}

.note-link-demo-topbar span {
  width: 5px;
  height: 5px;
  border-radius: 2px;
  background: rgba(126, 110, 93, 0.45);
}

.note-link-demo-brand {
  margin-left: 6px;
  color: #a0643e;
  font-size: 0.64rem;
  font-weight: 800;
}

.note-link-demo-path {
  margin-left: 14px;
  color: #817365;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0;
}

.note-link-demo-sync {
  margin-left: auto;
  padding: 6px 10px;
  border: 1px solid #b8d1bd;
  border-radius: 6px;
  background: #e6f0e6;
  color: #547e62;
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.note-link-demo-sync::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: #547e62;
  box-shadow: 0 0 0 3px rgba(84, 126, 98, 0.12);
  vertical-align: 1px;
}

.note-link-demo-body {
  flex: 1;
  display: grid;
  grid-template-columns: 205px minmax(0, 1fr) 218px;
  min-height: 388px;
  background: #f7f3ed;
}

.note-link-demo-stack {
  padding: 22px 14px;
  border-right: 1px solid #d7ccbc;
  background: #e7dfd4;
}

.note-link-demo-stack-title,
.note-link-demo-outline-title {
  color: #706356;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.note-link-demo-stack-title {
  margin: 0 8px 14px;
}

.note-link-demo-stack-item {
  overflow: hidden;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #6e6256;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-link-demo-stack-item + .note-link-demo-stack-item {
  margin-top: 4px;
}

.note-link-demo-stack-item.is-active {
  border-color: #d3bda4;
  background: #ded2c4;
  color: #2c241e;
}

.note-link-demo-stack-item.is-linked {
  --linked-ref-rest-color: #6e6256;
  animation: linkedReferenceReveal 5.4s ease-in-out infinite;
}

.note-link-demo-editor {
  position: relative;
  padding: 34px clamp(26px, 4.6vw, 54px);
  background:
    linear-gradient(90deg, rgba(152, 132, 112, 0.055) 1px, transparent 1px),
    linear-gradient(180deg, #fbf8f2, #f8f4ee);
  background-size: 44px 44px, auto;
  color: #2c241e;
  box-shadow: inset 0 18px 58px rgba(214, 203, 188, 0.28);
}

.note-link-demo-doc-title {
  margin-bottom: 20px;
  color: #2b241e;
  font-size: clamp(1.25rem, 2.2vw, 1.9rem);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.1;
}

.note-link-demo-line {
  max-width: 520px;
  color: rgba(45, 35, 26, 0.74);
  font-size: clamp(0.82rem, 1.35vw, 1.05rem);
  line-height: 1.72;
}

.note-link-demo-heading {
  margin: 16px 0 5px;
  color: rgba(45, 35, 26, 0.86);
  font-size: clamp(0.82rem, 1.15vw, 0.96rem);
  font-weight: 800;
  line-height: 1.25;
}

.note-link-demo-doc-title + .note-link-demo-heading {
  margin-top: 0;
}

.note-link-demo-token {
  display: inline;
  padding: 0;
  border-radius: 999px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  background: transparent;
  color: #a0643e;
  font-weight: 620;
  text-decoration-line: underline;
  text-decoration-color: currentColor;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.18em;
  transition: background 120ms, color 120ms, margin 120ms, padding 120ms, text-decoration-color 120ms;
  animation: noteLinkPrimary 11s ease-in-out infinite;
}

.note-link-demo-token--second {
  background: transparent;
  box-shadow: none;
  color: #a0643e;
  margin: 0;
  padding: 0;
  text-decoration-color: currentColor;
  animation: none;
}

.note-link-demo-token--node {
  color: #287ca1;
  text-decoration-style: dotted;
  animation: nodeLinkPulse 5.4s ease-in-out infinite;
  animation-delay: 1.1s;
}

.note-link-demo-caret {
  display: inline-block;
  width: 2px;
  height: 1.15em;
  margin-left: 2px;
  transform: translateY(0.2em);
  background: #a0643e;
  animation: caretBlink 1s steps(1, end) infinite, caretVisibility 11s ease-in-out infinite;
}

.note-link-demo-toolbar {
  position: absolute;
  left: 245px;
  top: 80px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px;
  border: 1px solid #d1c2af;
  border-radius: 10px;
  background: rgba(255, 250, 243, 0.96);
  box-shadow: 0 14px 34px rgba(68, 53, 39, 0.16);
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  animation: toolbarReveal 11s ease-in-out infinite;
}

.note-link-demo-tool {
  min-width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-radius: 7px;
  color: #6f6255;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
}

.note-link-demo-tool--italic {
  font-style: italic;
}

.note-link-demo-tool-separator {
  width: 1px;
  height: 22px;
  background: #d7ccbc;
}

.note-link-demo-tool--link {
  min-width: 86px;
  background: rgba(160, 100, 62, 0.12);
  color: #9c5f3b;
  animation: linkToolPress 11s ease-in-out infinite;
}

.note-link-demo-suggest {
  position: absolute;
  left: 368px;
  top: 122px;
  z-index: 3;
  width: min(360px, calc(100% - 52px));
  padding: 0;
  border: 1px solid #d3bda4;
  border-radius: 12px;
  background: #fffaf3;
  box-shadow: 0 18px 42px rgba(68, 53, 39, 0.14);
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px);
  animation: suggestReveal 11s ease-in-out infinite;
}

.note-link-demo-suggest-search {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 14px;
  border-bottom: 1px solid #dfd4c5;
  color: #9ba0ad;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
}

.note-link-demo-suggest-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border: 2px solid #7f766c;
  border-radius: 3px;
  opacity: 0.78;
  background:
    linear-gradient(#7f766c, #7f766c) 3px 4px / 7px 1.4px no-repeat,
    linear-gradient(#7f766c, #7f766c) 3px 8px / 7px 1.4px no-repeat;
}

.note-link-demo-suggest-row {
  padding: 11px 15px 12px;
  color: #6f6257;
  font-weight: 700;
}

.note-link-demo-suggest-row.is-selected {
  background: #eadfd2;
  color: #2c241e;
  animation: suggestionHover 11s ease-in-out infinite;
}

.note-link-demo-suggest-title {
  overflow: hidden;
  color: #2c241e;
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-link-demo-suggest-snippet {
  overflow: hidden;
  margin-top: 4px;
  color: #756a5f;
  font-size: 0.69rem;
  font-weight: 650;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-link-demo-preview {
  position: absolute;
  left: 372px;
  top: 142px;
  z-index: 3;
  width: min(320px, calc(100vw - 64px));
  border: 1px solid #d1c2af;
  border-radius: 14px;
  background: #eee7dc;
  box-shadow: 0 20px 48px rgba(68, 53, 39, 0.2);
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  animation: previewReveal 11s ease-in-out infinite;
}

.note-link-demo-preview-head {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 15px 17px 14px;
}

.note-link-demo-preview-icon {
  width: 18px;
  height: 18px;
  border: 2px solid #8a7b6c;
  border-radius: 4px;
  opacity: 0.72;
  background:
    linear-gradient(#8a7b6c, #8a7b6c) 4px 5px / 8px 1.5px no-repeat,
    linear-gradient(#8a7b6c, #8a7b6c) 4px 9px / 8px 1.5px no-repeat,
    linear-gradient(#8a7b6c, #8a7b6c) 4px 13px / 5px 1.5px no-repeat;
}

.note-link-demo-preview-title {
  overflow: hidden;
  color: #2b241e;
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-link-demo-preview-kind {
  color: #756858;
  font-size: 0.7rem;
  font-weight: 750;
}

.note-link-demo-preview-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid #d1c2af;
}

.note-link-demo-preview-actions span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-right: 1px solid #d1c2af;
  color: #2b241e;
  font-size: 0.75rem;
  font-weight: 800;
}

.note-link-demo-preview-actions span:last-child {
  border-right: 0;
  color: #f87171;
}

.note-link-demo-cursor {
  position: absolute;
  z-index: 5;
  left: var(--cursor-left);
  top: var(--cursor-top);
  width: 36px;
  height: 36px;
  background: #050505;
  filter: drop-shadow(0 7px 10px rgba(45, 35, 26, 0.24));
  mask: url("data:image/svg+xml,%3Csvg width='512' height='512' viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M31 2C8 8-4 31 5 54l199 441c11 24 46 20 51-6l30-150c8-40 39-70 79-77l113-20c26-5 31-39 7-51L58 5C49 1 39-1 31 2Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='512' height='512' viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M31 2C8 8-4 31 5 54l199 441c11 24 46 20 51-6l30-150c8-40 39-70 79-77l113-20c26-5 31-39 7-51L58 5C49 1 39-1 31 2Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  transform: translate(0, 0) rotate(-8deg);
  animation: cursorLinkMove 11s ease-in-out infinite;
  pointer-events: none;
}

.note-link-demo-outline {
  padding: 24px 15px;
  border-left: 1px solid #d7ccbc;
  background: #e9e2d7;
}

.note-link-demo-outline-title {
  margin-bottom: 14px;
}

.note-link-demo-outline-item {
  position: relative;
  overflow: hidden;
  padding: 9px 10px 9px 18px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #706356;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-link-demo-outline-item::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
  transform: translateY(-50%);
}

.note-link-demo-outline-item + .note-link-demo-outline-item {
  margin-top: 5px;
}

.note-link-demo-outline-item.is-active {
  border-color: #d3bda4;
  background: #ded2c4;
  color: #2c241e;
}

.note-link-demo-outline-item.is-heading {
  margin-left: 12px;
  padding-left: 24px;
  color: #5f544b;
  font-weight: 760;
}

.note-link-demo-outline-item.is-heading::before {
  left: 13px;
  width: 3px;
  height: 3px;
  opacity: 0.34;
}

.note-link-demo-outline-item.is-linked {
  --linked-ref-rest-color: #706356;
  --linked-ref-nudge: -2px;
  animation: linkedReferenceReveal 11s ease-in-out infinite;
}

@keyframes cursorLinkMove {
  0%, 10% {
    opacity: 0;
    transform: translate(var(--cursor-select-start-x), var(--cursor-select-start-y)) rotate(-8deg) scale(1);
  }
  14% {
    opacity: 1;
    transform: translate(var(--cursor-select-start-x), var(--cursor-select-start-y)) rotate(-8deg) scale(1);
  }
  24% {
    opacity: 1;
    transform: translate(var(--cursor-select-end-x), var(--cursor-select-end-y)) rotate(-8deg) scale(1);
  }
  31%, 35% {
    opacity: 1;
    transform: translate(var(--cursor-toolbar-x), var(--cursor-toolbar-y)) rotate(-8deg) scale(1);
  }
  36%, 38% {
    opacity: 1;
    transform: translate(var(--cursor-toolbar-x), var(--cursor-toolbar-y)) rotate(-8deg) scale(0.82);
  }
  41%, 44% {
    opacity: 1;
    transform: translate(var(--cursor-toolbar-x), var(--cursor-toolbar-y)) rotate(-8deg) scale(1.04);
  }
  49%, 58% {
    opacity: 1;
    transform: translate(var(--cursor-picker-x), var(--cursor-picker-y)) rotate(-8deg) scale(1);
  }
  54%, 56% {
    opacity: 1;
    transform: translate(var(--cursor-picker-x), var(--cursor-picker-y)) rotate(-8deg) scale(0.82);
  }
  63%, 72% {
    opacity: 1;
    transform: translate(var(--cursor-away-x), var(--cursor-away-y)) rotate(-8deg) scale(1);
  }
  80%, 92% {
    opacity: 1;
    transform: translate(var(--cursor-hover-x), var(--cursor-hover-y)) rotate(-8deg) scale(1);
  }
  96%, 100% {
    opacity: 0;
    transform: translate(18px, 4px) rotate(-8deg) scale(1);
  }
}

@keyframes suggestionHover {
  0%, 45%, 100% {
    background: #eadfd2;
    box-shadow: none;
  }
  52%, 60% {
    background: #e0cfbb;
    box-shadow: inset 0 0 0 1px rgba(160, 100, 62, 0.16);
  }
}

@keyframes noteLinkPrimary {
  0%, 14%, 100% {
    background: transparent;
    box-shadow: none;
    color: rgba(45, 35, 26, 0.74);
    margin: 0;
    padding: 0;
    text-decoration-color: transparent;
  }
  18%, 34%, 42%, 58% {
    background: rgba(92, 160, 230, 0.28);
    box-shadow: 0 0 0 3px rgba(92, 160, 230, 0.28);
    color: #243041;
    margin: 0;
    padding: 0;
    text-decoration-color: transparent;
  }
  64%, 78% {
    background: transparent;
    box-shadow: none;
    color: #a0643e;
    margin: 0;
    padding: 0;
    text-decoration-color: currentColor;
  }
  84%, 96% {
    background: rgba(160, 100, 62, 0.14);
    box-shadow: 0 0 0 4px rgba(160, 100, 62, 0.14);
    color: #9c5f3b;
    margin: 0 0.12em;
    padding: 0.06em 0.5em;
    text-decoration-color: transparent;
  }
}

@keyframes nodeLinkPulse {
  0%, 34%, 100% {
    background: transparent;
    box-shadow: none;
    color: #287ca1;
    text-decoration-color: currentColor;
  }
  48%, 70% {
    background: rgba(40, 124, 161, 0.12);
    box-shadow: 0 0 0 5px rgba(40, 124, 161, 0.12);
    color: #24708f;
    text-decoration-color: transparent;
  }
}

@keyframes suggestReveal {
  0%, 35% {
    opacity: 0;
    transform: translateY(8px);
  }
  42%, 58% {
    opacity: 1;
    transform: translateY(0);
  }
  63%, 100% {
    opacity: 0;
    transform: translateY(4px);
  }
}

@keyframes toolbarReveal {
  0%, 24% {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  30%, 42% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  50%, 100% {
    opacity: 0;
    transform: translateY(4px) scale(0.99);
  }
}

@keyframes linkToolPress {
  0%, 26%, 100% {
    background: rgba(160, 100, 62, 0.12);
    box-shadow: none;
  }
  32%, 42% {
    background: #e0c8ae;
    box-shadow: inset 0 0 0 1px rgba(160, 100, 62, 0.18);
  }
}

@keyframes previewReveal {
  0%, 82% {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  86%, 96% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(4px) scale(0.99);
  }
}

@keyframes linkedReferenceReveal {
  0%, 52%, 100% {
    border-color: transparent;
    background: transparent;
    color: var(--linked-ref-rest-color);
    box-shadow: none;
    transform: translateX(0);
  }
  62%, 88% {
    border-color: transparent;
    background: var(--linked-ref-bg);
    color: var(--linked-ref-text);
    box-shadow: none;
    transform: translateX(var(--linked-ref-nudge, 0));
  }
  72% {
    border-color: transparent;
    background: rgba(78, 132, 105, 0.11);
    color: #2f4f3f;
    box-shadow: none;
    transform: translateX(0);
  }
}

@keyframes caretBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@keyframes caretVisibility {
  0%, 14% { visibility: visible; }
  15%, 100% { visibility: hidden; }
}

@media (min-width: 901px) {
  .note-link-demo {
    --cursor-left: 300px;
    --cursor-top: 142px;
    --cursor-select-start-x: -108px;
    --cursor-select-start-y: 2px;
    --cursor-select-end-x: -2px;
    --cursor-select-end-y: 2px;
    --cursor-toolbar-x: 56px;
    --cursor-toolbar-y: -52px;
    --cursor-picker-x: 96px;
    --cursor-picker-y: 72px;
    --cursor-away-x: 178px;
    --cursor-away-y: 150px;
    --cursor-hover-x: 2px;
    --cursor-hover-y: 0;
  }
}

@media (min-width: 701px) and (max-width: 900px) {
  .note-link-demo {
    --cursor-left: 244px;
    --cursor-top: 142px;
    --cursor-select-start-x: -92px;
    --cursor-select-start-y: 2px;
    --cursor-select-end-x: 14px;
    --cursor-select-end-y: 2px;
    --cursor-toolbar-x: 48px;
    --cursor-toolbar-y: -52px;
    --cursor-picker-x: 82px;
    --cursor-picker-y: 72px;
    --cursor-away-x: 150px;
    --cursor-away-y: 150px;
    --cursor-hover-x: 10px;
    --cursor-hover-y: 0;
  }

  .note-link-demo-toolbar {
    left: 178px;
  }

  .note-link-demo-suggest {
    left: 292px;
  }

  .note-link-demo-preview {
    left: 292px;
  }
}

@media (max-width: 700px) {
  .note-link-demo {
    min-height: 500px;
    aspect-ratio: auto;
    --cursor-left: 142px;
    --cursor-top: 124px;
    --cursor-select-start-x: -54px;
    --cursor-select-start-y: -2px;
    --cursor-select-end-x: 126px;
    --cursor-select-end-y: -2px;
    --cursor-toolbar-x: -18px;
    --cursor-toolbar-y: -42px;
    --cursor-picker-x: -18px;
    --cursor-picker-y: 102px;
    --cursor-away-x: 110px;
    --cursor-away-y: 190px;
    --cursor-hover-x: 116px;
    --cursor-hover-y: 0;
  }

  .note-link-demo-path {
    display: none;
  }

  .note-link-demo-body {
    grid-template-columns: 1fr;
    min-height: 560px;
  }

  .note-link-demo-stack {
    display: none;
  }

  .note-link-demo-editor {
    min-height: 432px;
    padding: 30px 24px;
  }

  .note-link-demo-line {
    max-width: 100%;
    font-size: 0.88rem;
    line-height: 1.85;
  }

  .note-link-demo-toolbar {
    left: 24px;
    top: 82px;
  }

  .note-link-demo-suggest {
    left: 24px;
    top: 150px;
    width: calc(100% - 48px);
  }

  .note-link-demo-preview {
    left: 24px;
    top: 300px;
    width: calc(100% - 48px);
  }

  .note-link-demo-outline {
    min-height: 128px;
    border-top: 1px solid #d7ccbc;
    border-left: 0;
    padding: 16px 20px;
  }

  .note-link-demo-outline-item {
    display: block;
    margin: 0 0 6px;
    max-width: calc(100% - 18px);
  }

  .note-link-demo-outline-item + .note-link-demo-outline-item {
    margin-top: 5px;
  }

  .note-link-demo-cursor {
    left: var(--cursor-left);
    top: var(--cursor-top);
  }
}
