/* Documentation pages.
 *
 * Loaded after main.css and built only from its custom properties, so the docs
 * follow the site's light/dark theme without knowing anything about it — a
 * palette change in main.css reaches these pages for free. Nothing here
 * restyles a shared component; every selector is scoped to .docs-page or to a
 * class only the generator emits. */

/* ── shell ──────────────────────────────────────────────────────────────── */

.docs-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
  padding-top: 40px;
  padding-bottom: 72px;
}

/* minmax(0, 1fr) above matters: without it a wide table or long code line
   would blow the grid track out and scroll the whole page sideways. */

.docs-main {
  min-width: 0;
}

/* ── sidebar ────────────────────────────────────────────────────────────── */

.docs-nav {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  font-size: 0.94rem;
}
.docs-nav-heading {
  margin: 0 0 12px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.docs-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--line);
}
.docs-nav li {
  margin: 0;
}
.docs-nav a {
  display: block;
  padding: 7px 14px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.35;
  transition: color var(--transition), border-color var(--transition);
}
.docs-nav a:hover {
  color: var(--ink);
}
.docs-nav a.is-current {
  color: var(--brand);
  border-left-color: var(--brand);
  font-weight: 600;
}
.docs-nav-extra {
  margin-top: 18px !important;
  padding-top: 14px !important;
  border-left: 0 !important;
  border-top: 1px solid var(--line);
}
.docs-nav-extra a {
  border-left: 0;
  padding-left: 0;
}

/* ── language bar ───────────────────────────────────────────────────────── */

.lang-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 10px;
  margin-top: -4px;
}
.lang-pill {
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
  transition: color var(--transition), border-color var(--transition);
}
.lang-pill:hover {
  color: var(--ink);
  border-color: var(--ink);
}
.lang-pill.is-current {
  color: var(--brand);
  border-color: var(--brand);
  background: var(--brand-soft);
}

/* ── prose ──────────────────────────────────────────────────────────────── */

.prose {
  max-width: 74ch;
  font-size: 1.02rem;
  line-height: 1.72;
  color: var(--ink);
}
.prose h1 {
  font-size: clamp(1.85rem, 1.2rem + 2vw, 2.5rem);
  line-height: 1.2;
  margin: 0 0 28px;
  letter-spacing: -0.02em;
}
.prose h2 {
  font-size: 1.42rem;
  line-height: 1.3;
  margin: 52px 0 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  letter-spacing: -0.01em;
}
.prose h3 {
  font-size: 1.1rem;
  margin: 32px 0 10px;
}
.prose h4 {
  font-size: 1rem;
  margin: 24px 0 8px;
  color: var(--muted);
}
.prose p,
.prose ul,
.prose ol {
  margin: 0 0 18px;
}
.prose li {
  margin: 0 0 7px;
}
.prose li > ul,
.prose li > ol {
  margin: 7px 0 0;
}
.prose a {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.prose a:hover {
  color: var(--brand-dark);
}
.prose strong {
  font-weight: 650;
}
.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 40px 0;
}

/* Heading anchors: invisible until the heading is hovered, so they never
   compete with the text but stay available for deep links. */
.prose .anchor {
  margin-left: 10px;
  color: var(--muted);
  text-decoration: none;
  opacity: 0;
  font-weight: 400;
  transition: opacity var(--transition);
}
.prose h2:hover .anchor,
.prose h3:hover .anchor,
.prose .anchor:focus {
  opacity: 1;
}

/* Anchor targets must clear the sticky header, or a deep link lands with the
   heading hidden underneath it. */
.prose h2,
.prose h3 {
  scroll-margin-top: 90px;
}

/* ── code ───────────────────────────────────────────────────────────────── */

.prose code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.12em 0.38em;
  word-break: break-word;
}
.prose pre {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  overflow-x: auto;
  margin: 0 0 20px;
  line-height: 1.55;
}
.prose pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 0.86rem;
  word-break: normal;
}

/* ── tables ─────────────────────────────────────────────────────────────── */

/* The generator wraps every table in .table-scroll so a wide one scrolls
   inside its own box instead of widening the page. */
.table-scroll {
  overflow-x: auto;
  margin: 0 0 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.prose table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.93rem;
}
.prose th,
.prose td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.prose th {
  background: var(--bg-soft);
  font-weight: 650;
  white-space: nowrap;
}
.prose tr:last-child td {
  border-bottom: 0;
}

/* ── blockquote ─────────────────────────────────────────────────────────── */

.prose blockquote {
  margin: 0 0 20px;
  padding: 14px 18px;
  border-left: 3px solid var(--brand);
  background: var(--brand-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.prose blockquote > :last-child {
  margin-bottom: 0;
}

/* ── index cards ────────────────────────────────────────────────────────── */

.docs-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin: 32px 0 8px;
}
.docs-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  text-decoration: none !important;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.docs-card:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.docs-card-title {
  font-weight: 650;
  color: var(--ink);
  line-height: 1.35;
}
.docs-card-desc {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ── prev / next ────────────────────────────────────────────────────────── */

.docs-prevnext {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.docs-prevnext .pn {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 48%;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.92rem;
  line-height: 1.35;
  transition: border-color var(--transition);
}
.docs-prevnext .pn:hover {
  border-color: var(--brand);
}
.docs-prevnext .next {
  margin-left: auto;
  text-align: right;
}

/* ── header nav on docs pages ───────────────────────────────────────────── */

.docs-header-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}
.docs-header-nav a:not(.btn) {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.94rem;
}
.docs-header-nav a:not(.btn):hover {
  color: var(--ink);
}

/* ── narrow screens ─────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .docs-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    padding-top: 24px;
  }
  /* Static, not sticky: a pinned sidebar on a phone eats the viewport. */
  .docs-nav {
    position: static;
    max-height: none;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    background: var(--bg-soft);
  }
  .prose {
    font-size: 1rem;
  }
  .docs-prevnext {
    flex-direction: column;
  }
  .docs-prevnext .pn {
    max-width: none;
  }
  .docs-prevnext .next {
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  .docs-header-nav a:not(.btn) {
    display: none;
  }
}

/* ── marketing pages (web/content/ → /sync, /features/…) ─────────────────────
 *
 * Same stylesheet as the docs because they share .prose and the theme tokens;
 * the layout differs because the audience does. A reader arriving from
 * "obsidian gantt chart" has not decided anything yet, so the page leads with
 * a claim, a screenshot and a way to act, and only then explains. */

.page-shell {
  padding-top: 56px;
  padding-bottom: 80px;
}

.page-hero {
  max-width: 46rem;
  margin: 0 auto 40px;
  text-align: center;
}
.page-hero h1 {
  font-size: clamp(2rem, 1.2rem + 2.6vw, 3rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
  margin: 0 0 18px;
}
.page-lead {
  font-size: clamp(1.05rem, 1rem + 0.4vw, 1.22rem);
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 26px;
}
.page-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin: 0;
}

.page-shot {
  margin: 0 0 48px;
}
.page-shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* The prose column is centred on these pages — there is no sidebar to align to,
   and a full-width measure would be unreadable. */
.page-shell .prose {
  margin: 0 auto;
}

.page-close {
  max-width: 46rem;
  margin: 64px auto 0;
  padding: 32px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
}
.page-close p {
  margin: 0 0 18px;
}
.page-close p:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin: 0;
}

@media (max-width: 640px) {
  .page-shell {
    padding-top: 32px;
  }
  .page-close {
    padding: 24px 18px;
  }
}

/* Inline screenshots inside prose. Bordered like the hero shot so a screenshot
   never blends into the page background, and constrained to the text measure. */
.prose img {
  display: block;
  width: 100%;
  height: auto;
  margin: 26px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
