/* The help site's stylesheet. The primary and header colors come in as custom properties the page sets from the
   site's settings - see knowledge/site/base.html - so this file is the same for every site. */

:root {
  --primary: #2f6fed;
  --header-bg: #ffffff;
  --header-text: #1f2430;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --text: #1f2430;
  --text-muted: #6b7280;
  --surface: #ffffff;
  --ground: #f7f7f9;
  --border: #e6e8ec;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px -12px rgba(16, 24, 40, 0.12);
  --primary-soft: color-mix(in srgb, var(--primary) 10%, white);
  --primary-deep: color-mix(in srgb, var(--primary) 80%, black);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

/* following a link to a heading of the article glides there, for readers who haven't asked for less motion */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0;
}

.container {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
}

main.container {
  flex: 1;
  padding-bottom: 64px;
}

/* the org looking at its own site */

.preview-bar {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 8px 24px;
  background: #fff7e6;
  color: #7a4b00;
  font-size: 14px;
  border-bottom: 1px solid #ffe2b3;
}

.preview-bar a {
  color: inherit;
  font-weight: 600;
}

/* header */

.site-header {
  background: var(--header-bg);
  /* a hairline of the header's own text color, so it reads as an edge on a white header and a dark one alike */
  border-bottom: 1px solid color-mix(in srgb, var(--header-text) 10%, transparent);
  color: var(--header-text);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 68px;
}

.brand {
  color: var(--header-text);
  font-weight: 700;
  font-size: 18px;
  white-space: nowrap;
}

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

/* search boxes - the compact one in the header, and the big one on the home page */

.search {
  position: relative;
  display: flex;
  width: 100%;
}

.search input {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px 8px 40px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  background: currentColor;
  opacity: 0.45;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><path d='m20 20-3.5-3.5'/></svg>") no-repeat center / contain;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><path d='m20 20-3.5-3.5'/></svg>") no-repeat center / contain;
  pointer-events: none;
  color: var(--text);
}

.search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.header-search {
  max-width: 320px;
}

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

.hero h1 {
  font-size: clamp(28px, 4.5vw, 40px);
  font-weight: 700;
  margin-bottom: 28px;
}

.hero-search {
  max-width: 640px;
  margin: 0 auto;
  box-shadow: var(--shadow);
  border-radius: 999px;
}

.hero-search::before {
  left: 20px;
  width: 20px;
  height: 20px;
}

.hero-search input {
  font-size: 18px;
  padding: 16px 140px 16px 52px;
  border-radius: 999px;
}

.hero-search button {
  position: absolute;
  right: 6px;
  top: 6px;
  bottom: 6px;
  padding: 0 22px;
  font: inherit;
  font-weight: 600;
  color: white;
  background: var(--primary);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s;
}

.hero-search button:hover {
  background: var(--primary-deep);
}

/* sections on the home page */

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

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  color: inherit;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.card:hover {
  text-decoration: none;
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.section-card h2 {
  font-size: 18px;
  font-weight: 650;
  color: var(--text);
}

.section-card p {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 15px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.section-card .meta {
  display: block;
  margin-top: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 0;
}

/* popular articles */

.popular {
  margin-top: 56px;
}

.popular h2,
.page-header h1 {
  font-size: 22px;
  font-weight: 700;
}

.popular ol {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 8px 32px;
}

.popular li a {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  border-radius: 8px;
  color: var(--text);
}

.popular li a:hover {
  text-decoration: none;
  background: var(--primary-soft);
}

.popular li a:hover .title {
  color: var(--primary);
}

.popular .title {
  font-weight: 600;
}

.popular .section,
.article-item .section {
  font-size: 13px;
  color: var(--text-muted);
}

/* breadcrumbs and page headers */

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 24px 0 8px;
  font-size: 14px;
  color: var(--text-muted);
}

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

.breadcrumbs a:hover {
  color: var(--primary);
}

.breadcrumbs > * + *::before {
  content: "/";
  margin-right: 8px;
  opacity: 0.5;
}

.page-header {
  padding: 8px 0 24px;
}

.page-header h1 {
  font-size: clamp(24px, 3.5vw, 32px);
}

.page-header .lead {
  margin: 8px 0 0;
  font-size: 17px;
  color: var(--text-muted);
  max-width: 720px;
}

.page-header.not-found {
  text-align: center;
  padding: 96px 0;
}

.page-header.not-found .lead {
  margin: 12px auto 28px;
}

.button {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--primary);
  color: white;
  font-weight: 600;
}

.button:hover {
  background: var(--primary-deep);
  text-decoration: none;
}

/* lists of articles - a section's, and search results */

.article-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.article-item {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.article-item:hover {
  text-decoration: none;
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.article-item h2 {
  font-size: 17px;
  font-weight: 650;
  color: var(--primary);
}

.article-item p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 15px;
}

.article-item .section {
  display: block;
  margin-bottom: 4px;
}

mark {
  background: var(--primary-soft);
  color: var(--primary-deep);
  border-radius: 3px;
  padding: 0 2px;
}

/* the article page: the article, with its section's other articles alongside */

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 40px;
  align-items: start;
  padding-top: 8px;
}

/* the .article card and the .doc typography of the article page are in article.css, which the page links after
   this file - they're shared with the blog */

.article-footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

.sidebar {
  position: sticky;
  top: 24px;
}

.sidebar h2 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.sidebar h2 a {
  color: inherit;
}

.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--border);
}

.sidebar li > a {
  display: block;
  padding: 6px 14px;
  margin-left: -2px;
  border-left: 2px solid transparent;
  color: var(--text-muted);
  font-size: 15px;
}

.sidebar li > a:hover {
  color: var(--text);
  text-decoration: none;
}

.sidebar li.current > a {
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}

/* the current article's top level headings, listed beneath it on the same rail; the one the reader is at is marked
   current by js/helpsite.js as they scroll */
.sidebar .headings {
  border-left: none;
  margin: 2px 0 6px;
}

.sidebar .headings li > a {
  padding: 4px 14px 4px 30px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
  border-left-color: transparent;
}

.sidebar .headings li > a:hover {
  color: var(--text);
}

.sidebar .headings li.current > a {
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}

/* footer */

.site-footer {
  padding: 32px 0;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-muted);
}

@media (max-width: 860px) {
  .site-header .container {
    flex-wrap: wrap;
    padding-top: 12px;
    padding-bottom: 12px;
  }

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

  .article-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    order: 2;
  }

  .hero {
    padding: 48px 0 32px;
  }

  .hero-search input {
    padding-right: 110px;
  }

  .hero-search button {
    padding: 0 16px;
  }
}
