/*
 * Notevine Help: the in-app Help, on the web. Neutral surfaces as in the app, Notevine blue used as ink only, and the
 * hand-drawn underline under each title. Kept self-contained so the future website can reuse it.
 */

:root,
[data-md-color-scheme="default"] {
  --nv-ink: #0166fe;
  --nv-surface: #ffffff;
  --nv-backdrop: #f2f3f5;
  --nv-card: #f4f5f7;
  --nv-card-hover: #eaeef6;
  --nv-text: #1b1c1e;
  --nv-muted: #5b5f66;
  --nv-line: #e1e3e7;

  --md-primary-fg-color: var(--nv-surface);
  --md-primary-fg-color--light: var(--nv-surface);
  --md-primary-fg-color--dark: var(--nv-backdrop);
  --md-primary-bg-color: var(--nv-text);
  --md-primary-bg-color--light: var(--nv-muted);
  --md-accent-fg-color: var(--nv-ink);
  --md-typeset-a-color: var(--nv-ink);
  --md-default-bg-color: var(--nv-surface);
  --md-default-fg-color: var(--nv-text);
  --md-default-fg-color--light: var(--nv-muted);
  --md-footer-bg-color: var(--nv-backdrop);
  --md-footer-bg-color--dark: var(--nv-backdrop);
  --md-footer-fg-color: var(--nv-text);
  --md-footer-fg-color--light: var(--nv-muted);
  --md-footer-fg-color--lighter: var(--nv-muted);
}

/* The app's dark theme: near-black surfaces with a charcoal hierarchy. */
[data-md-color-scheme="slate"] {
  --nv-ink: #7fb0ff;
  --nv-surface: #08090b;
  --nv-backdrop: #111214;
  --nv-card: #161719;
  --nv-card-hover: #1e2430;
  --nv-text: #e4e5e8;
  --nv-muted: #bec1c7;
  --nv-line: #2e3035;

  --md-hue: 220;
  --md-default-bg-color: var(--nv-surface);
  --md-default-fg-color: var(--nv-text);
  --md-default-fg-color--light: var(--nv-muted);
  --md-default-fg-color--lighter: #8e929a;
  --md-typeset-color: var(--nv-text);
}

/* Top bar: a plain surface with search, as the app's Help bar is. */
.md-header {
  color: var(--nv-text);
  background-color: var(--nv-surface);
  box-shadow: 0 1px 0 var(--nv-line);
}
.md-header[data-md-state="shadow"],
.md-header--shadow {
  box-shadow: 0 1px 0 var(--nv-line);
}
.md-search__form {
  background-color: var(--nv-card);
  border-radius: 999px;
}
.md-search__input,
.md-search__input::placeholder,
.md-search__icon {
  color: var(--nv-muted);
}
.md-tabs {
  display: none;
}

/* Sidebar: categories as muted headings, the open topic filled, as in the app. */
.md-nav--primary > .md-nav__list > .md-nav__item--nested > .md-nav__link {
  color: var(--nv-muted);
  font-weight: 500;
}
.md-nav__link--active,
.md-nav__item .md-nav__link--active {
  color: var(--nv-ink);
  font-weight: 600;
}

/* Article head: breadcrumb, title with its ink underline, summary. */
.md-typeset .nv-crumbs {
  margin: 0 0 0.6rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--nv-muted);
}
.md-typeset .nv-crumbs a {
  color: var(--nv-ink);
}

.md-typeset h1 {
  width: fit-content; /* as wide as the title, so the underline matches it */
  max-width: 100%;
  margin: 0 0 1rem;
  font-weight: 600;
  font-size: 2rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--nv-text);
}
.md-typeset h1 .headerlink {
  display: none;
}
.md-typeset h1::after {
  content: "";
  display: block;
  height: 10px;
  margin-top: 4px;
  background-color: var(--nv-ink);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='10' viewBox='0 0 100 10' preserveAspectRatio='none'%3E%3Cpath d='M1.5 6 C30 1 60 9.5 98.5 4' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 0 0 / 100% 100%;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='10' viewBox='0 0 100 10' preserveAspectRatio='none'%3E%3Cpath d='M1.5 6 C30 1 60 9.5 98.5 4' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 0 0 / 100% 100%;
  animation: nv-ink 700ms cubic-bezier(0.4, 0, 0.2, 1) both;
}
@keyframes nv-ink {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}
@media (prefers-reduced-motion: reduce) {
  .md-typeset h1::after { animation: none; }
}

.md-typeset .nv-summary {
  margin: 0 0 1.6rem;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--nv-muted);
}

.md-typeset h2 {
  margin-top: 2rem;
  font-weight: 500;
  font-size: 1.25rem;
  color: var(--nv-text);
}

/* Screenshots, framed as the app frames them. */
.md-typeset img {
  display: block;
  border-radius: 12px;
  background: var(--nv-backdrop);
}

/* Help home: each topic is a row with its title and summary, the whole row clickable. */
.md-typeset .nv-topics ul {
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.4rem;
}
.md-typeset .nv-topics ul > li {
  position: relative;
  margin: 0;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  background: var(--nv-card);
  color: var(--nv-muted);
  font-size: 0.78rem;
  line-height: 1.45;
  transition: background-color 120ms ease;
}
.md-typeset .nv-topics ul > li:hover {
  background: var(--nv-card-hover);
}
.md-typeset .nv-topics ul > li > a {
  color: var(--nv-text);
  font-size: 0.85rem;
  font-weight: 500;
}
.md-typeset .nv-topics ul > li > a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.md-typeset .nv-topics ul > li:focus-within {
  outline: 2px solid var(--nv-ink);
  outline-offset: 2px;
}
.md-typeset .nv-topics ul > li > a:focus {
  outline: none;
}

/* Related topics: plain links, as text buttons in the app. */
.md-typeset .nv-related ul {
  padding: 0;
  margin-left: 0;
  list-style: none;
}
.md-typeset .nv-related ul > li {
  margin: 0.2rem 0;
}

@media (prefers-reduced-motion: reduce) {
  .md-typeset .nv-topics ul > li { transition: none; }
}

/* The site name is already in the top bar; on wide screens the sidebar starts with Help home, as in the app. */
@media screen and (min-width: 76.25em) {
  .md-nav--primary > .md-nav__title {
    display: none;
  }
}
