/* BlockMD website.

   The tokens are copied from app/styles.css on purpose: the site should look like the
   app it is selling, which means Notion's own numbers — ink rgb(55,53,47), greys as
   alpha values off that ink, accent rgb(35,131,226), body 16px/1.5.

   The page is built from the same pieces a Notion page is: a page icon and title,
   plain text blocks, a callout, a simple table, toggles. No card grid, no gradients. */

:root {
  color-scheme: light;

  --bg: #fff;
  --bg-sunken: #f7f6f3;
  --ink: #37352f;
  --ink-2: rgba(55, 53, 47, 0.65);
  --ink-3: rgba(55, 53, 47, 0.45);
  --rule: rgba(55, 53, 47, 0.09);
  --rule-strong: rgba(55, 53, 47, 0.16);
  --hover: rgba(55, 53, 47, 0.06);
  --active: rgba(55, 53, 47, 0.1);

  --accent: #2383e2;
  --accent-hover: #0077d4;
  --accent-soft: rgba(35, 131, 226, 0.12);
  --flash: rgba(35, 131, 226, 0.16);
  --callout: #f1f1ef;
  --code-ink: #eb5757;
  --code-bg: rgba(135, 131, 120, 0.15);
  --good: #448361;

  --font-ui: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text",
    "Segoe UI", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC",
    Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --column: 708px;
  --wide: 1000px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --bg: #191919;
    --bg-sunken: #202020;
    --ink: rgba(255, 255, 255, 0.81);
    --ink-2: rgba(255, 255, 255, 0.46);
    --ink-3: rgba(255, 255, 255, 0.32);
    --rule: rgba(255, 255, 255, 0.13);
    --rule-strong: rgba(255, 255, 255, 0.2);
    --hover: rgba(255, 255, 255, 0.055);
    --active: rgba(255, 255, 255, 0.1);
    --callout: #252525;
    --flash: rgba(35, 131, 226, 0.24);
    --code-ink: #ff7369;
    --good: #4dab9a;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
::selection { background: rgba(35, 131, 226, 0.28); }

html { scroll-padding-top: 64px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: underline; text-decoration-color: var(--ink-3); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--ink); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

code {
  font-family: var(--font-mono);
  font-size: 85%;
  color: var(--code-ink);
  background: var(--code-bg);
  padding: 0.2em 0.4em;
  border-radius: 4px;
}

/* ——— Top bar ——— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 52px;
  padding: 0 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.8) blur(12px);
  -webkit-backdrop-filter: saturate(1.8) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.topbar.scrolled { border-bottom-color: var(--rule); }

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  margin-right: auto;
  border-radius: 6px;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
}
.brand:hover { background: var(--hover); }
.brand img { width: 24px; height: 24px; border-radius: 5px; }

.navlink {
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
}
.navlink:hover { background: var(--hover); }
.navlink[aria-current="page"] { background: var(--active); }

/* ——— Buttons ——— */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--rule-strong);
  background: var(--bg);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.small { font-size: 14px; padding: 6px 12px; border-radius: 6px; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn .meta { font-weight: 400; opacity: 0.75; }

/* ——— Page layout ——— */
.page {
  max-width: calc(var(--column) + 32px);
  margin: 0 auto;
  padding: 0 16px;
}
.wide {
  max-width: calc(var(--wide) + 32px);
  margin: 0 auto;
  padding: 0 16px;
}

.page-icon {
  display: block;
  width: 78px;
  height: 78px;
  margin: 72px 0 12px;
  border-radius: 16px;
}
h1.title {
  font-size: 40px;
  line-height: 1.2;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.lede {
  font-size: 20px;
  line-height: 1.45;
  color: var(--ink-2);
  margin: 0 0 24px;
  max-width: 34em;
}

.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 8px; }
.cta-note { font-size: 14px; color: var(--ink-3); margin: 4px 0 0; min-height: 21px; }

h2 {
  font-size: 30px;
  line-height: 1.3;
  font-weight: 700;
  margin: 72px 0 4px;
  letter-spacing: -0.005em;
}
h3 {
  font-size: 20px;
  line-height: 1.3;
  font-weight: 600;
  margin: 32px 0 2px;
}
p { margin: 4px 0; }
.section-lede { color: var(--ink-2); margin: 0 0 20px; }

/* ——— Demo: the editor and the file on disk, side by side ——— */
.demo {
  margin: 48px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--rule-strong);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
  box-shadow: 0 1px 2px rgba(15, 15, 15, 0.04), 0 12px 32px -12px rgba(15, 15, 15, 0.12);
}
.pane-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  font-size: 13px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--rule);
  user-select: none;
}
.pane-head strong { font-weight: 500; color: var(--ink); }
.pane-head .spacer { margin-left: auto; }

.editor-pane { border-right: 1px solid var(--rule); }
.blocks {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 20px 24px 28px 8px;
}
.block {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 2px;
  padding: 3px 2px;
  margin-bottom: 1px;
  border-radius: 4px;
  transition: background 0.4s;
}
.block.flash { background: var(--flash); transition: none; }
.block.dragging { opacity: 0.4; }
.handle {
  flex: none;
  display: grid;
  place-items: center;
  width: 20px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--ink-3);
  cursor: grab;
  touch-action: none;
  opacity: 0;
  transition: opacity 0.12s;
}
.block:hover .handle, .handle:focus-visible, .blocks.hint .handle { opacity: 1; }
.handle:hover { background: var(--hover); }
.handle:active { cursor: grabbing; }
.handle svg { width: 12px; height: 16px; }
@media (hover: none) { .handle { opacity: 1; } }

.block-body { flex: 1; min-width: 0; }
.block-body > * { margin: 0; }
.block-body h4 { font-size: 26px; line-height: 1.3; font-weight: 700; }
.block[data-kind="h"] .handle { margin-top: 5px; }
.block-body ul { padding-left: 1.4em; list-style: disc; }
.block-body li { padding: 1px 0; }
.block-body .todo { display: flex; gap: 8px; align-items: center; }
.block-body .todo span.box {
  width: 16px; height: 16px; flex: none;
  border: 1.5px solid var(--ink-2);
  border-radius: 3px;
}
.block-body .callout-box {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 6px;
  background: var(--callout);
}

.drop-line {
  position: absolute;
  left: 30px;
  right: 24px;
  height: 3px;
  margin-top: -2px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.6;
  pointer-events: none;
}

.file-pane { background: var(--bg-sunken); min-width: 0; }
.file {
  margin: 0;
  padding: 20px 0 28px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  overflow-x: auto;
}
.file .ln {
  display: block;
  padding: 0 16px 0 0;
  white-space: pre;
  transition: background 0.6s;
}
.file .ln::before {
  content: attr(data-n);
  display: inline-block;
  width: 3.2em;
  padding-right: 1.2em;
  text-align: right;
  color: var(--ink-3);
  user-select: none;
}
.file .ln.flash { background: var(--flash); transition: none; }

.stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--good);
  font-weight: 500;
}
.stat::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.demo-caption {
  font-size: 14px;
  color: var(--ink-3);
  text-align: center;
  margin: 14px 0 0;
}

/* ——— Callout ——— */
.callout {
  display: flex;
  gap: 12px;
  padding: 16px 16px 16px 12px;
  margin: 16px 0;
  border-radius: 6px;
  background: var(--callout);
}
.callout .emoji { font-size: 20px; line-height: 1.2; flex: none; width: 24px; text-align: center; }
.callout p { margin: 0; }
.callout p + p { margin-top: 6px; }

/* ——— Feature list: plain Notion blocks, a column of short headed paragraphs ——— */
.features { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 40px; }
.features h3 { margin-top: 24px; }
.features p { color: var(--ink-2); }

/* ——— Table ——— */
.table-wrap { overflow-x: auto; margin: 16px 0; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td {
  text-align: left;
  padding: 8px 12px;
  border: 1px solid var(--rule-strong);
  vertical-align: top;
}
th { font-weight: 500; color: var(--ink-2); background: var(--bg-sunken); }
td.yes { color: var(--good); }
td.no { color: var(--ink-3); }
tr.us td { font-weight: 500; }

/* ——— Toggles ——— */
details {
  border-radius: 4px;
  margin: 1px 0;
}
summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 4px 0;
  cursor: pointer;
  list-style: none;
  border-radius: 4px;
  font-weight: 500;
}
summary::-webkit-details-marker { display: none; }
summary:hover { background: var(--hover); }
summary::before {
  content: "";
  flex: none;
  width: 22px;
  height: 22px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 6l7 6-7 6z'/%3E%3C/svg%3E") center / 18px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 6l7 6-7 6z'/%3E%3C/svg%3E") center / 18px no-repeat;
  opacity: 0.55;
  transition: transform 0.15s;
}
details[open] > summary::before { transform: rotate(90deg); }
.toggle-body { padding: 2px 0 10px 28px; }
.toggle-body p { color: var(--ink-2); }

/* ——— Download page ——— */
.release-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin: 0 0 4px; }
.release-head .date { color: var(--ink-3); font-size: 14px; }
.tag {
  display: inline-block;
  font-size: 12px;
  line-height: 1.5;
  padding: 0 6px;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
  vertical-align: 2px;
}
.tag.grey { background: var(--active); color: var(--ink-2); }

.platform {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 16px;
  padding: 16px 0;
  border-top: 1px solid var(--rule);
}
.platform:last-child { border-bottom: 1px solid var(--rule); }
.platform h3 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.platform p { color: var(--ink-2); font-size: 14px; margin: 2px 0 0; }
.platform .files { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.platform.mine { position: relative; }
.platform.mine::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 16px;
  bottom: 16px;
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
}

.filelist { list-style: none; margin: 4px 0 8px; padding: 0; }
.filelist li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 14px;
}
.filelist li:hover { background: var(--hover); }
.filelist .size { color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.filelist a { word-break: break-all; }

.notes {
  font-size: 14px;
  color: var(--ink-2);
  margin: 4px 0 12px;
}
.notes p { margin: 6px 0; }
.notes ul { margin: 6px 0; padding-left: 1.4em; }

.loading { color: var(--ink-3); padding: 16px 0; }

/* ——— Footer ——— */
footer {
  margin-top: 96px;
  padding: 24px 0 48px;
  border-top: 1px solid var(--rule);
  font-size: 14px;
  color: var(--ink-3);
}
footer .page { display: flex; flex-wrap: wrap; gap: 8px 20px; }
footer .page span:first-child { margin-right: auto; }
footer a { color: var(--ink-2); }

/* ——— Load moment: the demo settles in once, nothing else moves ——— */
@media (prefers-reduced-motion: no-preference) {
  .demo { animation: rise 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) 0.1s both; }
  @keyframes rise { from { opacity: 0; transform: translateY(12px); } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before { transition: none !important; }
}

/* ——— Narrow screens ——— */
@media (max-width: 760px) {
  .page-icon { margin-top: 40px; width: 64px; height: 64px; }
  h1.title { font-size: 32px; }
  .lede { font-size: 18px; }
  h2 { font-size: 24px; margin-top: 56px; }
  .demo { grid-template-columns: 1fr; }
  .editor-pane { border-right: 0; border-bottom: 1px solid var(--rule); }
  .features { grid-template-columns: 1fr; }
  .platform { grid-template-columns: 1fr; }
  .platform .files { justify-content: flex-start; }
  .platform.mine::before { left: -10px; }
  .navlink.hide-narrow { display: none; }
}
