/* mindex reader-only CSS — loaded after styles.css.
   Surfaces: properties panel, outline rail, callouts, task lists,
   heading anchor + fold UI, code-block chrome, footnote /
   definition-list / mark / emoji / strikethrough additions.

   Spec: docs/superpowers/specs/2026-05-01-obsidian-tier1-renderer-design.md §6
*/

/* ───────────── Properties panel (frontmatter) ───────────── */
.props {
  border-top: 1px solid var(--r-border);
  border-bottom: 1px solid var(--r-border);
  margin: 0 0 28px 0;
  padding: 4px 0;
}
.props-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--r-border);
  align-items: baseline;
}
.props-row:last-child { border-bottom: 0; }
.props-key {
  font-family: var(--reader-mono);
  font-size: 12px;
  color: var(--r-text-mute);
  text-transform: lowercase;
}
.props-value, .props-nested-val {
  font-family: var(--reader-body);
  font-size: 13.5px;
  color: var(--r-text-soft);
}
.props-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.props-tag {
  font-family: var(--reader-mono);
  font-size: 11.5px;
  padding: 1px 8px;
  background: var(--r-code-bg);
  color: var(--r-text-soft);
}
.props-nested, .props-nested-inner {
  list-style: none;
  margin: 0;
  padding: 0;
}
.props-nested > li {
  padding: 4px 0;
  border-bottom: 1px dashed var(--r-border);
}
.props-nested > li:last-child { border-bottom: 0; }
.props-nested-inner > li { padding: 2px 0; }
.props-nested-key {
  font-family: var(--reader-mono);
  font-size: 11.5px;
  color: var(--r-text-mute);
}

/* ───────────── Heading anchor (permalink affordance) ───────────── */
.doc-content h1, .doc-content h2, .doc-content h3,
.doc-content h4, .doc-content h5, .doc-content h6 {
  position: relative;
}
.doc-content .heading-anchor {
  position: absolute;
  left: -1.4em;
  top: 0;
  width: 1em;
  text-align: right;
  color: var(--r-text-mute);
  font-family: var(--reader-mono);
  text-decoration: none;
  opacity: 0;
  cursor: pointer;
}
.doc-content .heading-anchor::before {
  content: "#";
  font-size: 0.75em;
  vertical-align: 0.15em;
}
.doc-content h1:hover .heading-anchor,
.doc-content h2:hover .heading-anchor,
.doc-content h3:hover .heading-anchor,
.doc-content h4:hover .heading-anchor,
.doc-content h5:hover .heading-anchor,
.doc-content h6:hover .heading-anchor {
  opacity: 1;
}
.doc-content .heading-anchor:hover {
  color: var(--r-text);
}

/* ───────────── Heading fold ───────────── */
.heading-fold-toggle {
  display: inline-block;
  vertical-align: middle;
  width: 14px; height: 14px;
  margin-right: 6px;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--r-text-mute);
}
.heading-fold-toggle:hover { color: var(--r-text); }
.heading-fold-chev {
  width: 12px; height: 12px;
  display: block;
  transition: transform 180ms ease;
}
.heading-block.is-folded > h1 .heading-fold-chev,
.heading-block.is-folded > h2 .heading-fold-chev,
.heading-block.is-folded > h3 .heading-fold-chev,
.heading-block.is-folded > h4 .heading-fold-chev,
.heading-block.is-folded > h5 .heading-fold-chev,
.heading-block.is-folded > h6 .heading-fold-chev {
  transform: rotate(-90deg);
}
/* Smooth collapse: the click handler in app.jsx drives the height
   animation via the Web Animations API. CSS supplies the steady states
   only — the resting collapsed height for fresh renders / persisted-
   fold-restored sections (no animation needed for the initial paint
   and re-paints from Shiki re-renders, only for user clicks). */
.heading-section { overflow: hidden; }
.heading-block.is-folded > .heading-section { height: 0; }

/* ───────────── Outline rail ───────────── */
.doc-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  grid-template-areas:
    "head head"
    "props props"
    "body rail";
  column-gap: 48px;
  row-gap: 0;
  /* min-height: 100% (styles.css) makes the grid taller than short docs;
     pack rows at the top instead of letting the default stretch push
     content down into the empty head/props rows. */
  align-content: start;
}
.doc-card.no-outline {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "head"
    "props"
    "body";
}
.doc-card .doc-path     { grid-area: head; }
.doc-card .props        { grid-area: props; }
.doc-card .doc-content  { grid-area: body; min-width: 0; }
.doc-card .outline-rail { grid-area: rail; }

@media (max-width: 1100px) {
  .doc-card {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "head"
      "props"
      "body";
  }
  .outline-rail { display: none; }
}

.outline-rail {
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow: auto;
  padding: 8px 0;
}
.outline-head {
  font-family: var(--reader-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--r-text-mute);
  margin-bottom: 10px;
}
.outline-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--r-border);
}
.outline-item {
  font-family: var(--reader-body);
  font-size: 13px;
  line-height: 1.5;
  color: var(--r-text-soft);
  padding: 3px 12px;
  border-left: 2px solid transparent;
  margin-left: -1px;
}
.outline-item a { display: block; color: inherit; }
.outline-item:hover { color: var(--r-text); }
.outline-item.is-active {
  border-left-color: var(--r-text);
  color: var(--r-text);
}
.outline-l1 { padding-left: 12px; }
.outline-l2 { padding-left: 12px; }
.outline-l3 { padding-left: 24px; }
.outline-l4 { padding-left: 36px; }
.outline-l5 { padding-left: 48px; }
.outline-l6 { padding-left: 60px; }

/* ───────────── Callouts (GitHub flavor) ───────────── */
.callout {
  margin: 1.25em 0;
  padding: 12px 16px 12px 18px;
  border-left: 3px solid var(--r-text-mute);
  background: rgba(0, 0, 0, 0.02);
}
.callout-title {
  font-family: var(--reader-body);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--r-text);
  text-transform: capitalize;
}
.callout-body { color: var(--r-text-soft); }

.callout-note      { border-left-color: var(--r-callout-note-bar);
  background: color-mix(in srgb, var(--r-callout-note-bar) 4%, var(--r-bg)); }
.callout-note      .callout-title { color: var(--r-callout-note-bar); }

.callout-tip       { border-left-color: var(--r-callout-tip-bar);
  background: color-mix(in srgb, var(--r-callout-tip-bar) 4%, var(--r-bg)); }
.callout-tip       .callout-title { color: var(--r-callout-tip-bar); }

.callout-important { border-left-color: var(--r-callout-important-bar);
  background: color-mix(in srgb, var(--r-callout-important-bar) 4%, var(--r-bg)); }
.callout-important .callout-title { color: var(--r-callout-important-bar); }

.callout-warning   { border-left-color: var(--r-callout-warning-bar);
  background: color-mix(in srgb, var(--r-callout-warning-bar) 4%, var(--r-bg)); }
.callout-warning   .callout-title { color: var(--r-callout-warning-bar); }

.callout-caution   { border-left-color: var(--r-callout-caution-bar);
  background: color-mix(in srgb, var(--r-callout-caution-bar) 4%, var(--r-bg)); }
.callout-caution   .callout-title { color: var(--r-callout-caution-bar); }

/* ───────────── Task lists (read-only) ───────────── */
.doc-content ul.task-list {
  list-style: none;
  padding-left: 0;
}
.doc-content .task-list-item {
  padding-left: 0;
  position: relative;
}
.doc-content .task-list-item input[type=checkbox] {
  appearance: none;
  -webkit-appearance: none;
  width: 12px; height: 12px;
  margin: 0 8px 0 0;
  vertical-align: -1px;
  border: 1px solid var(--r-text-mute);
  background: transparent;
  position: relative;
  cursor: default;
}
.doc-content .task-list-item input[type=checkbox]:checked::after {
  content: "";
  position: absolute;
  left: 2px; top: -2px;
  width: 4px; height: 8px;
  border-right: 2px solid var(--r-text);
  border-bottom: 2px solid var(--r-text);
  transform: rotate(45deg);
}

/* ───────────── Footnotes ───────────── */
.doc-content section.footnotes {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--r-border);
  font-size: 0.9em;
  color: var(--r-text-soft);
}
.doc-content section.footnotes h2 {
  font-family: var(--reader-body);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--r-text-mute);
  font-weight: 500;
  margin-bottom: 12px;
}
.doc-content section.footnotes ol { padding-left: 1.5em; }
.doc-content section.footnotes a.footnote-backref { color: var(--r-text-mute); }
.doc-content sup a {
  text-decoration: none;
  color: var(--r-text-mute);
}
.doc-content sup a:hover { color: var(--r-text); }

/* ───────────── Definition lists ───────────── */
.doc-content dl { margin: 1em 0; }
.doc-content dt { font-weight: 600; margin-top: 1em; color: var(--r-text); }
.doc-content dd { margin: 0.25em 0 0 1.5em; color: var(--r-text-soft); }

/* ───────────── Mark / strikethrough ───────────── */
.doc-content mark {
  background: rgba(255, 235, 150, 0.45);
  color: inherit;
  padding: 0 2px;
}
[data-r-mode="dark"] .doc-content mark {
  background: rgba(255, 235, 150, 0.18);
}
.doc-content s, .doc-content del {
  text-decoration-thickness: 1px;
  color: var(--r-text-mute);
}

/* ───────────── Code-block chrome (copy + lang) ───────────── */
.code-block {
  position: relative;
  margin: 1em 0;
}
.code-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 26px;
  font-family: var(--reader-mono);
}
.code-lang {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--r-text-mute);
}
.code-copy-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 11px;
  color: var(--r-text-mute);
  cursor: pointer;
}
.code-copy-btn:hover { color: var(--r-text-soft); }
.code-copy-btn.is-copied { color: var(--r-text); }
.code-block pre {
  margin: 0;
}
/* Shiki overrides individual token color via inline style; the wrapping
   <pre> background still comes from styles.css' .doc-content pre rule
   for the fallback case, and from Shiki's inline style for highlighted
   blocks. Both work. */

/* ---------- Workspace landing view ---------- */

.workspace-landing { padding: 24px 0 0; }
.workspace-landing-title {
  font-family: "Instrument Serif", serif;
  font-style: italic;
  font-weight: 400;
  font-size: 40px;
  color: var(--r-text);
  margin: 0 0 8px;
  line-height: 1.1;
}
.workspace-landing-meta {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 12px;
  color: var(--r-text-mute);
  margin-bottom: 32px;
}
.workspace-landing-empty {
  color: var(--r-text-soft);
  font-size: 14px;
}
.workspace-landing-recent-head {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--r-text-mute);
  margin-bottom: 12px;
}
.workspace-landing-recent { list-style: none; padding: 0; margin: 0; }
.workspace-landing-recent li {
  margin: 0;
  padding: 6px 0;
  border-top: 1px solid var(--r-border);
}
.workspace-landing-recent li:last-child { border-bottom: 1px solid var(--r-border); }
.workspace-landing-recent a {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 13px;
  color: var(--r-text);
  text-decoration: none;
}
.workspace-landing-recent a:hover { color: var(--r-text-soft); }

/* ───────────── Share reader (public /s/:token SPA) ─────────────
   The share-reader entry (packages/ui-web/src/share-reader.entry.jsx)
   renders its own chrome — .share-shell wraps a top .share-picker bar,
   a single centered reading column (main), and a footer. The article
   itself carries .doc-content so it inherits the full reader typography
   above; only the share-specific chrome lives here. Mirrors the
   server-rendered static fallback in auth/src/shares/render-html.ts.
   Scheme/style CSS variables (--r-bg, --reader-body, …) and
   [data-r-mode] are set on documentElement by applyScheme/applyStyle. */
/* The app SPA pins html+body to the viewport (styles.css: `html, body {
   height: 100% }` + `body { overflow: hidden }`) and scrolls an inner pane
   (.doc-scroll). The share page is a plain top-to-bottom document with no
   inner scroll pane, so that global rule clips everything past the first
   viewport — body's overflow:hidden propagates to the viewport, killing the
   scrollbar. The share shell mounts into #share-root (the app SPA uses
   #root), so scope the scroll restore to that and leave the app untouched. */
html:has(#share-root),
html:has(#share-root) body {
  height: auto;
  overflow: visible;
}

.share-shell {
  background: var(--r-bg);
  color: var(--r-text);
  min-height: 100vh;
}
.share-shell > main {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 1.25rem 0;
}
/* The article supplies its own column width via .doc-content; inside the
   centered share column it should fill the measure rather than left-bias. */
.share-shell #share-article { max-width: none; }

.share-picker {
  display: flex;
  justify-content: flex-end;
  gap: 18px;
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 1.25rem 0;
}
.share-picker label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--reader-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--r-text-mute);
}
.share-picker select {
  font-family: var(--reader-body);
  font-size: 13px;
  color: var(--r-text);
  background: var(--r-bg-soft);
  border: 1px solid var(--r-border);
  border-radius: 0;
  padding: 4px 8px;
}

/* The outline reuses the SPA's .outline-head / .outline-list /
   .outline-item rail styling above; only the top-of-column placement is
   share-specific (the SPA mounts it as a sticky sidebar via .doc-card). */
.share-shell nav.outline {
  margin: 0 0 40px;
  padding: 0 0 24px;
  border-bottom: 1px solid var(--r-border);
}

.share-shell > footer {
  max-width: 720px;
  margin: 56px auto 0;
  padding: 16px 1.25rem 48px;
  border-top: 1px solid var(--r-border);
  font-family: var(--reader-mono);
  font-size: 12px;
  color: var(--r-text-mute);
}
