/* Cloverpop User Manual. All site styling lives here. */

@font-face { font-family: 'Plus Jakarta Sans'; src: url('../fonts/plus-jakarta-sans-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Plus Jakarta Sans'; src: url('../fonts/plus-jakarta-sans-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Lato'; src: url('../fonts/lato-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Lato'; src: url('../fonts/lato-400-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Lato'; src: url('../fonts/lato-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --navy: #1f2f3f;
  --blue: #2487bf;
  --blue-dark: #0059b4;
  --blue-tint: #d0eeff;
  --muted: #677888;
  --border: #e3e8ee;
  --bg-soft: #f5f8fb;
  --header-h: 64px;
  --sidebar-w: 280px;
  --toc-w: 230px;
  --font-body: 'Lato', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-head: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 16px); }
body { margin: 0; font-family: var(--font-body); font-size: 17px; line-height: 1.65; color: var(--navy); background: #fff; -webkit-font-smoothing: antialiased; }
a { color: var(--blue-dark); }
a:hover { color: var(--blue); }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-head); color: var(--navy); line-height: 1.25; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 30; height: var(--header-h); display: flex; align-items: center; gap: 16px; padding: 0 24px; background: var(--navy); color: #fff; }
.brand { display: flex; align-items: center; gap: 14px; color: #fff; text-decoration: none; flex-shrink: 0; }
.brand:hover { color: #fff; }
.brand img { display: block; height: 30px; width: auto; }
.brand-title { padding-left: 14px; border-left: 1px solid rgba(255, 255, 255, .3); font-family: var(--font-head); font-weight: 600; font-size: 15px; letter-spacing: .02em; }
.menu-toggle { display: none; position: relative; width: 40px; height: 40px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.menu-toggle span, .menu-toggle span::before, .menu-toggle span::after { content: ''; position: absolute; left: 10px; width: 20px; height: 2px; border-radius: 1px; background: #fff; }
.menu-toggle span { top: 19px; }
.menu-toggle span::before { top: -6px; left: 0; }
.menu-toggle span::after { top: 6px; left: 0; }

/* Search */
.search { position: relative; margin-left: auto; width: min(360px, 40vw); }
.search input { width: 100%; height: 38px; padding: 0 12px 0 36px; border: 1px solid rgba(255, 255, 255, .2); border-radius: 8px; color: #fff; font: inherit; font-size: 15px;
  background: rgba(255, 255, 255, .1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 4 4'/%3E%3C/svg%3E") no-repeat 11px center; }
.search input::placeholder { color: rgba(255, 255, 255, .65); }
.search input:focus { outline: none; border-color: var(--blue); color: var(--navy);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%231f2f3f' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 4 4'/%3E%3C/svg%3E") no-repeat 11px center; }
.search input:focus::placeholder { color: var(--muted); }
.search-results { position: absolute; top: calc(100% + 6px); right: 0; width: min(480px, 92vw); max-height: 70vh; overflow-y: auto; margin: 0; padding: 6px; list-style: none; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(15, 30, 50, .18); }
.search-results a { display: block; padding: 10px 12px; border-radius: 6px; color: var(--navy); text-decoration: none; }
.search-results a:hover { background: var(--bg-soft); }
.search-results a.active { background: var(--blue-tint); box-shadow: inset 3px 0 0 var(--blue-dark); }
.sr-title { display: block; font-family: var(--font-head); font-weight: 600; }
.sr-section { display: block; margin: 2px 0 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--blue-dark); }
.sr-snippet { display: block; font-size: 14px; line-height: 1.45; color: var(--muted); }
.sr-empty { padding: 12px; color: var(--muted); }

/* Layout */
.layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w); max-width: 1440px; margin: 0 auto; }
.layout.no-toc { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }

/* Sidebar */
.sidebar { position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow-y: auto; padding: 24px 16px 48px 20px; border-right: 1px solid var(--border); font-size: 15px; }
.nav-sections, .nav-sections ul { list-style: none; margin: 0; padding: 0; }
.nav-sections details { margin-bottom: 2px; }
.nav-sections summary { display: flex; justify-content: space-between; align-items: center; padding: 7px 8px; border-radius: 6px; cursor: pointer; list-style: none; font-family: var(--font-head); font-weight: 600; font-size: 14px; line-height: 1.35; color: var(--navy); }
.nav-sections summary::-webkit-details-marker { display: none; }
.nav-sections summary::after { content: ''; flex-shrink: 0; width: 6px; height: 6px; margin-left: 10px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; }
.nav-sections details[open] > summary::after { transform: rotate(45deg); }
.nav-sections summary:hover { background: var(--bg-soft); }
.nav-sections details ul { margin: 2px 0 10px 10px; padding-left: 10px; border-left: 1px solid var(--border); }
.nav-sections a { display: block; padding: 5px 8px; border-radius: 6px; line-height: 1.4; color: var(--muted); text-decoration: none; }
.nav-sections a:hover { color: var(--navy); background: var(--bg-soft); }
.nav-sections a[aria-current="page"] { color: var(--blue-dark); background: var(--blue-tint); font-weight: 700; }

/* Content */
.content { min-width: 0; padding: 40px 56px 96px; }
.content > * { max-width: 780px; }
.content > .section-grid { max-width: none; }
.breadcrumb { margin: 0 0 8px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--blue-dark); }
.content h1 { margin: 0 0 24px; font-size: 36px; font-weight: 700; letter-spacing: -.01em; }
.lead { font-size: 19px; color: var(--muted); margin: 0 0 32px; }
.doc h2 { margin: 44px 0 12px; font-size: 24px; font-weight: 700; }
.doc h3 { margin: 32px 0 8px; font-size: 19px; font-weight: 600; }
.doc h4, .doc h5, .doc h6 { margin: 24px 0 8px; font-size: 17px; font-weight: 600; }
.doc > :first-child { margin-top: 0; }
.doc p { margin: 0 0 16px; }
.doc ul, .doc ol { margin: 0 0 16px; padding-left: 26px; }
.doc li { margin: 4px 0; }
.doc li > ul, .doc li > ol { margin: 4px 0; }
.doc li::marker { color: var(--blue); }
.doc img { display: block; max-width: 100%; height: auto; margin: 16px 0; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 2px 10px rgba(15, 30, 50, .08); cursor: zoom-in; }
.doc hr { margin: 32px 0; border: 0; border-top: 1px solid var(--border); }
.table-wrap { overflow-x: auto; margin: 0 0 20px; }
.doc table { width: 100%; border-collapse: collapse; font-size: 15px; }
.doc td, .doc th { padding: 10px 12px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.doc td p { margin: 0 0 8px; }
.doc td p:last-child { margin-bottom: 0; }

/* Indented lists after images */
.doc .indent-1 { margin-left: 26px; }
.doc .indent-2 { margin-left: 52px; }
.doc .indent-3 { margin-left: 78px; }
.doc .indent-4, .doc .indent-5, .doc .indent-6, .doc .indent-7, .doc .indent-8 { margin-left: 104px; }

/* On-page table of contents */
.toc { position: sticky; top: var(--header-h); align-self: start; max-height: calc(100vh - var(--header-h)); overflow-y: auto; padding: 40px 24px 40px 8px; font-size: 14px; }
.toc-title { margin: 0 0 10px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.toc a { display: block; margin-left: -2px; padding: 4px 0 4px 12px; border-left: 2px solid transparent; line-height: 1.4; color: var(--muted); text-decoration: none; }
.toc .toc-h3 a { padding-left: 24px; }
.toc a:hover { color: var(--navy); }
.toc a.active { color: var(--blue-dark); border-left-color: var(--blue); font-weight: 700; }

/* Home */
.section-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.section-card { padding: 20px 22px; border: 1px solid var(--border); border-radius: 12px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.section-card:hover { border-color: var(--blue-tint); box-shadow: 0 6px 20px rgba(15, 30, 50, .08); }
.section-card h2 { margin: 0 0 10px; font-size: 18px; }
.section-card ul { list-style: none; margin: 0; padding: 0; font-size: 15px; }
.section-card li { margin: 5px 0; }
.section-card a { text-decoration: none; }
.section-card a:hover { text-decoration: underline; }

/* Keyboard focus */
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }

/* Image lightbox */
.lightbox { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 32px; background: rgba(10, 20, 30, .85); cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; background: #fff; }

/* Responsive */
@media (max-width: 1100px) {
  .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 800px) {
  body { font-size: 16px; }
  .site-header { gap: 8px; padding: 0 12px; }
  .menu-toggle { display: block; margin-left: -6px; }
  .brand-title { display: none; }
  .search { flex: 1; width: auto; }
  .layout, .layout.no-toc { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; top: var(--header-h); bottom: 0; left: 0; z-index: 20; width: min(320px, 85vw); height: auto; background: #fff; box-shadow: 0 0 40px rgba(0, 0, 0, .2); transform: translateX(-100%); visibility: hidden; transition: transform .2s, visibility 0s linear .2s; }
  .nav-open .sidebar { transform: none; visibility: visible; transition: transform .2s; }
  .content { padding: 24px 20px 64px; }
  .content h1 { font-size: 28px; }
}
@media print {
  .site-header, .sidebar, .toc, .lightbox { display: none; }
  .layout, .layout.no-toc { display: block; }
}
