/* ProClose Help Center. Hand-written, no framework. */

:root {
  --bg: #f6f7f9;
  --text: #1b2330;
  --muted: #6a7482;
  --accent: #4f46e5;
  --accent-contrast: #ffffff;
  --card-border: #e7e9ee;
  --card-bg: #ffffff;
  --radius: 12px;
  --amber: #b45309;
  --violet: #7c3aed;
  --max-measure: 72ch;
  --header-height: 64px;
  --font-ui: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-hero: var(--font-ui);
}

[data-theme="dark"] {
  --bg: #12161e;
  --text: #e8eaf0;
  --muted: #9aa3b2;
  --accent: #818cf8;
  --accent-contrast: #12161e;
  --card-border: rgba(255, 255, 255, 0.1);
  --card-bg: rgba(255, 255, 255, 0.04);
  --amber: #f59e0b;
  --violet: #8b5cf6;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

[data-theme="dark"] {
  color-scheme: dark;
}

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

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ---------------------------------------------------------------------- */
/* Header                                                                  */
/* ---------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--card-border);
  height: var(--header-height);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 100%;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  color: var(--text);
}

.brand:hover {
  text-decoration: none;
}

.brand-logo {
  height: 24px;
  width: 24px;
}

.brand-name {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
}

.header-search {
  position: relative;
  flex: 1;
  max-width: 420px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex-shrink: 0;
}

.theme-toggle {
  background: transparent;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: 16px;
}

.theme-icon-dark {
  display: none;
}

[data-theme="dark"] .theme-icon-light {
  display: none;
}

[data-theme="dark"] .theme-icon-dark {
  display: inline;
}

.btn-open-app {
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}

.btn-open-app:hover {
  text-decoration: none;
  opacity: 0.9;
}

.sidebar-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 12px;
  font-size: 14px;
}

/* ---------------------------------------------------------------------- */
/* Search                                                                  */
/* ---------------------------------------------------------------------- */

.search-input {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 9px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.search-input::placeholder {
  color: var(--muted);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.search-input-hero {
  font-size: 16px;
  padding: 14px 18px;
  border-radius: var(--radius);
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(20, 26, 40, 0.16);
  z-index: 50;
  max-height: 60vh;
  overflow-y: auto;
}

.search-result {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--card-border);
  color: var(--text);
}

.search-result:last-child {
  border-bottom: none;
}

.search-result:hover,
.search-result.is-active {
  background: var(--card-bg);
  text-decoration: none;
}

.search-result-title {
  font-weight: 600;
  font-size: 14px;
}

.search-result-category {
  font-size: 12px;
  color: var(--muted);
  align-self: center;
}

.search-result-description {
  grid-column: 1 / -1;
  font-size: 13px;
  color: var(--muted);
}

.search-empty {
  padding: 14px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------------------------------------------------------------------- */
/* Home page                                                               */
/* ---------------------------------------------------------------------- */

.home-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px 64px;
}

.hero {
  padding: 72px 0 48px;
  text-align: center;
}

.hero-title {
  font-family: var(--font-hero);
  font-weight: 800;
  font-size: clamp(34px, 5.5vw, 56px);
  letter-spacing: -0.5px;
  margin: 0 0 28px;
}

.hero-search {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.category-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 22px;
}

.category-card h2 {
  margin: 0 0 8px;
  font-size: 17px;
}

.category-description {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 14px;
}

.category-article-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.category-article-list li a {
  font-size: 14px;
}

.category-article-list li.empty {
  color: var(--muted);
  font-size: 14px;
}

/* ---------------------------------------------------------------------- */
/* Article layout                                                          */
/* ---------------------------------------------------------------------- */

.article-layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: calc(var(--header-height) + 20px);
  padding: 24px 0;
  max-height: calc(100vh - var(--header-height) - 40px);
  overflow-y: auto;
}

.sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-category {
  margin-bottom: 4px;
}

.sidebar-category-toggle {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 8px;
  border-radius: 6px;
}

.sidebar-category-toggle:hover {
  background: var(--card-bg);
}

.sidebar-article-list {
  list-style: none;
  margin: 0;
  padding: 0 0 8px 8px;
  display: none;
  flex-direction: column;
}

.sidebar-category.is-open .sidebar-article-list {
  display: flex;
}

.sidebar-article-list li a {
  display: block;
  padding: 6px 8px;
  font-size: 14px;
  color: var(--muted);
  border-radius: 6px;
}

.sidebar-article-list li a:hover {
  color: var(--text);
  text-decoration: none;
  background: var(--card-bg);
}

.sidebar-article-list li a.active {
  color: var(--text);
  background: var(--card-bg);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent);
}

.article-main {
  min-width: 0;
  padding: 28px 0 64px;
}

.breadcrumb {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
}

.breadcrumb a {
  color: var(--muted);
}

.breadcrumb a:hover {
  color: var(--text);
}

.breadcrumb-sep {
  margin: 0 6px;
}

/* ---------------------------------------------------------------------- */
/* Article body typography                                                 */
/* ---------------------------------------------------------------------- */

.article-body {
  max-width: var(--max-measure);
}

.article-body h1 {
  font-size: 32px;
  margin: 0 0 6px;
  line-height: 1.25;
}

.article-updated {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 32px;
}

.article-body h2 {
  font-size: 22px;
  margin: 40px 0 14px;
  line-height: 1.3;
  position: relative;
}

.article-body h3 {
  font-size: 17px;
  margin: 28px 0 10px;
}

.heading-anchor {
  position: absolute;
  left: -20px;
  color: var(--muted);
  opacity: 0;
  text-decoration: none;
  font-weight: 400;
}

.article-body h2:hover .heading-anchor {
  opacity: 1;
}

.article-body p {
  margin: 0 0 16px;
}

.article-body ul,
.article-body ol {
  margin: 0 0 16px;
  padding-left: 24px;
}

.article-body li {
  margin-bottom: 6px;
}

.article-body li ul,
.article-body li ol {
  margin-top: 6px;
  margin-bottom: 0;
}

.article-body code {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.9em;
  font-family: "SF Mono", Menlo, Consolas, monospace;
}

.article-body pre {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  margin: 0 0 20px;
}

.article-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.55;
}

/* ---------------------------------------------------------------------- */
/* Screenshots                                                             */
/* ---------------------------------------------------------------------- */

.shot {
  margin: 0 0 24px;
}

.shot img {
  width: 100%;
  height: auto;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .shot img {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}

/* ---------------------------------------------------------------------- */
/* Tables                                                                  */
/* ---------------------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  margin: 0 0 24px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
}

.article-body table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}

.article-body th,
.article-body td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--card-border);
  text-align: left;
}

.article-body th {
  background: var(--card-bg);
  font-weight: 600;
  position: sticky;
  top: 0;
}

.article-body tr:last-child td {
  border-bottom: none;
}

/* ---------------------------------------------------------------------- */
/* Callouts                                                                */
/* ---------------------------------------------------------------------- */

.callout {
  border-left: 3px solid var(--muted);
  background: var(--card-bg);
  border-radius: 0 8px 8px 0;
  padding: 14px 18px;
  margin: 0 0 20px;
}

.callout p {
  margin: 6px 0 0;
}

.callout p:first-of-type {
  margin-top: 6px;
}

.callout-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 999px;
}

.callout-note {
  border-left-color: var(--accent);
}

.callout-note .callout-label {
  background: rgba(99, 102, 241, 0.16);
  color: var(--accent);
}

.callout-important {
  border-left-color: var(--amber);
}

.callout-important .callout-label {
  background: rgba(245, 158, 11, 0.16);
  color: var(--amber);
}

.callout-preview {
  border-left-color: var(--violet);
}

.callout-preview .callout-label {
  background: rgba(124, 58, 237, 0.12);
  color: var(--violet);
}

/* ---------------------------------------------------------------------- */
/* Prev / next                                                             */
/* ---------------------------------------------------------------------- */

.prev-next {
  max-width: var(--max-measure);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--card-border);
}

.prev-link,
.next-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 48%;
  color: var(--text);
}

.next-link {
  text-align: right;
  margin-left: auto;
}

.prev-next-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.prev-next-title {
  font-size: 14px;
  font-weight: 600;
}

.prev-link:hover,
.next-link:hover {
  text-decoration: none;
}

.prev-link:hover .prev-next-title,
.next-link:hover .prev-next-title {
  text-decoration: underline;
}

/* ---------------------------------------------------------------------- */
/* Footer                                                                  */
/* ---------------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--card-border);
  padding: 28px 0;
}

.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--text);
}

/* ---------------------------------------------------------------------- */
/* Responsive                                                              */
/* ---------------------------------------------------------------------- */

@media (max-width: 960px) {
  .article-layout {
    grid-template-columns: 1fr;
  }

  .sidebar-toggle {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    z-index: 30;
    padding: 20px;
    max-height: none;
    display: none;
  }

  .sidebar.is-open {
    display: block;
  }

  .header-search {
    max-width: none;
  }

  .brand-name {
    display: none;
  }
}

@media (max-width: 640px) {
  .header-inner {
    gap: 10px;
    padding: 0 14px;
  }

  .btn-open-app {
    padding: 8px 12px;
    font-size: 13px;
  }

  .home-main {
    padding: 0 14px 48px;
  }

  .article-layout {
    padding: 0 14px;
  }

  .prev-next {
    flex-direction: column;
  }

  .next-link {
    text-align: left;
    margin-left: 0;
  }

  .prev-link,
  .next-link {
    max-width: 100%;
  }
}

/* ---------------------------------------------------------------------- */
/* Print                                                                   */
/* ---------------------------------------------------------------------- */

@media print {
  .site-header,
  .site-footer,
  .sidebar,
  .prev-next,
  .search-results {
    display: none !important;
  }

  .article-layout {
    display: block;
    max-width: 100%;
  }

  .article-body {
    max-width: 100%;
  }

  body {
    background: #fff;
    color: #000;
  }
}
