/* Partix docs.
   Tokens are taken from portal/frontend/src/styles/index.css so the docs and the
   product read as one thing. Plain CSS: these pages are rendered by Django and must
   not depend on the portal's Vite build. */

:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-2: #f1f5f9;
  --panel-3: #e2e8f0;
  --border: #e2e8f0;
  --border-soft: #f1f5f9;

  --text: #0f172a;
  --text-dim: #475569;
  --text-faint: #94a3b8;

  --signal: #00a76f;
  --signal-dim: #007867;
  --signal-wash: rgba(0, 167, 111, 0.08);
  --warn: #f59e0b;
  --warn-dim: #d97706;
  --warn-wash: rgba(245, 158, 11, 0.09);
  --fail: #ef4444;
  --fail-wash: rgba(239, 68, 68, 0.08);
  --info: #3b82f6;
  --info-wash: rgba(59, 130, 246, 0.08);

  --radius: 10px;
  --shadow-menu: 0 8px 24px rgb(15 23 42 / 0.08);
  --shadow-figure: 0 1px 2px rgb(15 23 42 / 0.04), 0 12px 32px rgb(15 23 42 / 0.08);

  --topbar-h: 60px;
  --sidebar-w: 268px;
  --toc-w: 216px;
  --measure: 46rem;

  --font: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 24px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(circle at 1px 1px, rgba(15, 23, 42, 0.03) 1px, transparent 0);
  background-size: 24px 24px;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--signal-dim);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* topbar ------------------------------------------------------------------- */

/* Quiet by design. The bar orients you and gets out of the way: no filled button, no
   badge, one weight of link. The only colour is the app icon itself. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  background: rgba(248, 250, 252, 0.88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14.5px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.topbar__brand:hover {
  text-decoration: none;
}

/* the same mark the desktop app shows in the dock and tray */
.topbar__brand img {
  display: block;
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

.topbar__name {
  font-weight: 600;
  color: var(--text);
}

.topbar__section {
  font-weight: 400;
  color: var(--text-faint);
}

.topbar__spacer {
  flex: 1;
}

.navtoggle,
.navtoggle__box {
  display: none;
}

/* search ------------------------------------------------------------------- */

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

/* Sits in the bar rather than on top of it: filled, borderless, and only outlined
   once you are actually using it. */
.search__input {
  width: 100%;
  height: 32px;
  padding: 0 34px 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  appearance: none;
  transition: background 0.14s, border-color 0.14s;
}
.search__input::placeholder {
  color: var(--text-faint);
}
.search__input:hover {
  background: var(--panel-3);
}
.search__input:focus {
  outline: none;
  background: var(--panel);
  border-color: var(--panel-3);
}
/* the browser's own clear button sits on top of the shortcut hint */
.search__input::-webkit-search-cancel-button {
  display: none;
}

.search__key {
  position: absolute;
  top: 50%;
  right: 9px;
  transform: translateY(-50%);
  padding: 1px 5px;
  border: 1px solid var(--panel-3);
  border-radius: 4px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10.5px;
  pointer-events: none;
}
.search__input:focus ~ .search__key {
  display: none;
}

.search__panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(520px, 90vw);
  max-height: min(60vh, 520px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-menu);
}

.search__hit {
  display: block;
  padding: 9px 11px;
  border-radius: 8px;
  color: var(--text);
}
.search__hit:hover,
.search__hit--active {
  background: var(--panel-2);
  text-decoration: none;
}

.search__hit-title {
  display: block;
  font-size: 13.5px;
  font-weight: 620;
}

.search__hit-where {
  display: block;
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--signal-dim);
}

.search__hit-snippet {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-dim);
  /* two lines, so a long page cannot push the other results off screen */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search__panel mark {
  background: var(--signal-wash);
  color: var(--signal-dim);
  border-radius: 3px;
  padding: 0 1px;
}

.search__empty {
  margin: 0;
  padding: 14px 11px;
  font-size: 13px;
  color: var(--text-faint);
}

/* shell -------------------------------------------------------------------- */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  gap: 48px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 32px;
  align-items: start;
}

/* the home page, section landings and any page without headings */
.shell--notoc {
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}

/* sidebar ------------------------------------------------------------------ */

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 32px 0 64px;
  scrollbar-width: thin;
}

.sidebar__group + .sidebar__group {
  margin-top: 26px;
}

.sidebar__title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 8px;
  padding: 0 12px;
}

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

.sidebar__link {
  display: block;
  padding: 6px 12px;
  border-left: 2px solid transparent;
  border-radius: 0 8px 8px 0;
  font-size: 13.5px;
  color: var(--text-dim);
}
.sidebar__link:hover {
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
}
.sidebar__link--active,
.sidebar__link--active:hover {
  background: var(--signal-wash);
  border-left-color: var(--signal);
  color: var(--signal-dim);
  font-weight: 600;
}

/* content ------------------------------------------------------------------ */

.content {
  min-width: 0;
  max-width: var(--measure);
  padding: 40px 0 96px;
}

/* Landing pages are a grid of cards, not prose, so the reading measure does not apply
   and holding them to it just wastes the width. */
.content--wide {
  max-width: 64rem;
}

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--signal);
  margin: 0 0 10px;
}

.content h1 {
  font-size: 2.15rem;
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 640;
  margin: 0 0 12px;
}

.lede {
  font-size: 1.075rem;
  line-height: 1.6;
  color: var(--text-dim);
  margin: 0 0 12px;
}

.content h2 {
  font-size: 1.4rem;
  letter-spacing: -0.018em;
  font-weight: 620;
  margin: 48px 0 14px;
}

/* the opening heading needs less air than one breaking up a wall of prose */
.lede + h2 {
  margin-top: 30px;
}

.content h3 {
  font-size: 1.075rem;
  font-weight: 620;
  letter-spacing: -0.01em;
  margin: 34px 0 10px;
}

.content p {
  margin: 0 0 16px;
}

.content ul,
.content ol {
  margin: 0 0 16px;
  padding-left: 22px;
}
.content li {
  margin-bottom: 7px;
}
.content li::marker {
  color: var(--text-faint);
}

.content strong {
  font-weight: 620;
  color: var(--text);
}

.content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 44px 0;
}

/* figures — the docs are screenshot-led, so these carry a lot of the design -- */

figure {
  margin: 28px 0 32px;
}

figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-figure);
  background: var(--panel);
}

figcaption {
  margin-top: 11px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-faint);
}

/* stands in until the capture is dropped into static/img, and names the one needed */
.slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 240px;
  padding: 32px;
  text-align: center;
  border: 1px dashed var(--panel-3);
  border-radius: var(--radius);
  background: var(--panel);
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 11px,
    rgba(148, 163, 184, 0.06) 11px,
    rgba(148, 163, 184, 0.06) 22px
  );
}
.slot__name {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--signal-dim);
  background: var(--signal-wash);
  padding: 2px 8px;
  border-radius: 6px;
}
.slot__what {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-dim);
  max-width: 34rem;
}

/* callouts (markdown `!!! note`) ------------------------------------------- */

.admonition {
  margin: 24px 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  font-size: 14px;
  line-height: 1.6;
}
.admonition > p:last-child {
  margin-bottom: 0;
}

.admonition-title {
  font-weight: 640;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 0 0 6px;
}

.admonition.note {
  border-color: rgba(59, 130, 246, 0.28);
  background: var(--info-wash);
}
.admonition.note .admonition-title {
  color: var(--info);
}

.admonition.tip {
  border-color: rgba(0, 167, 111, 0.28);
  background: var(--signal-wash);
}
.admonition.tip .admonition-title {
  color: var(--signal-dim);
}

.admonition.warning {
  border-color: rgba(245, 158, 11, 0.32);
  background: var(--warn-wash);
}
.admonition.warning .admonition-title {
  color: var(--warn-dim);
}

/* numbered procedures — in a how-to every ordered list is a set of steps ----- */

.content ol {
  list-style: none;
  counter-reset: step;
  margin: 24px 0;
  padding: 0;
}

.content ol > li {
  position: relative;
  counter-increment: step;
  padding: 0 0 22px 44px;
  margin: 0;
}

.content ol > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -1px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--panel-3);
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 640;
  font-variant-numeric: tabular-nums;
}

.content ol > li:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 13px;
  top: 30px;
  bottom: 4px;
  width: 1px;
  background: var(--border);
}

/* tables ------------------------------------------------------------------- */

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

.content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.content th {
  text-align: left;
  font-weight: 620;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--panel-2);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.content td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}

.content tbody tr:last-child td {
  border-bottom: none;
}

/* code, chips -------------------------------------------------------------- */

/* No border and tight padding: a bordered chip leaves a visible gap before the
   punctuation that follows it, so `1.2.0`. reads as "1.2.0 ." */
code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--panel-2);
  border-radius: 4px;
  padding: 0.1em 0.3em;
}

pre {
  margin: 24px 0;
  padding: 16px 18px;
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.6;
}
pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}

/* mirrors a chip in the product, so prose can point at one by name.
   Scoped to .content so it outranks the plain `strong` rule above. */
.content .chip {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 620;
  line-height: 1.5;
  padding: 1px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
.content .chip--warn {
  color: var(--warn-dim);
  background: var(--warn-wash);
}
.content .chip--ok {
  color: var(--signal-dim);
  background: var(--signal-wash);
}
.content .chip--info {
  color: var(--info);
  background: var(--info-wash);
}
.content .chip--fail {
  color: var(--fail);
  background: var(--fail-wash);
}

/* home cards --------------------------------------------------------------- */

/* auto-fill, not auto-fit: auto-fit collapses the unused tracks, so a group of two
   would lay out as two wide cards while a group of four laid out as three narrow ones,
   and no two groups on the page would line up. */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin: 20px 0 8px;
}

.card {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  transition: border-color 0.14s, box-shadow 0.14s, transform 0.14s;
}
.card:hover {
  text-decoration: none;
  border-color: var(--panel-3);
  box-shadow: var(--shadow-menu);
  transform: translateY(-1px);
}
.card__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 620;
  font-size: 14.5px;
  color: var(--text);
  margin: 0 0 5px;
}
/* Two lines exactly, so every card in a row is the same height whatever the length of
   the page's opening sentence. Anything longer is cut with an ellipsis. */
.card__body {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-dim);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__tag {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--panel-2);
  border-radius: 20px;
  padding: 2px 8px;
}

.card--soon .card__title {
  color: var(--text-dim);
}

/* a section that exists in the nav but has no pages yet */
.empty {
  padding: 40px 32px;
  text-align: center;
  border: 1px dashed var(--panel-3);
  border-radius: var(--radius);
  background: var(--panel);
}
.empty__title {
  font-weight: 620;
  font-size: 15px;
  margin: 0 0 6px;
}
.empty__body {
  font-size: 13.5px;
  color: var(--text-dim);
  margin: 0 auto;
  max-width: 32rem;
}

/* release notes ------------------------------------------------------------ */

.release {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
}
.release:last-of-type {
  border-bottom: none;
}

.release__head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.release__head h2 {
  margin-bottom: 0;
}

.release__date {
  font-size: 12.5px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.release__latest {
  font-size: 10.5px;
  font-weight: 620;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--signal-dim);
  background: var(--signal-wash);
  border-radius: 20px;
  padding: 2px 8px;
}

.release__none {
  font-size: 13.5px;
  color: var(--text-faint);
}

.toc__now {
  color: var(--signal-dim);
  font-size: 11px;
}

/* release bodies are written by hand on GitHub, so they arrive at any heading level */
.release__body h1,
.release__body h2,
.release__body h3 {
  font-size: 1rem;
  font-weight: 620;
  margin: 22px 0 8px;
}

.release__body ul {
  margin-top: 4px;
}

.pages {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.pages__step {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
}
.pages__step:hover {
  text-decoration: none;
  border-color: var(--panel-3);
  box-shadow: var(--shadow-menu);
}
.pages__step--off {
  color: var(--text-faint);
  background: transparent;
  border-color: var(--border-soft);
}

.pages__count {
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}
.pages__total {
  display: block;
  font-size: 11.5px;
  color: var(--text-faint);
}

.release__source {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-faint);
}

/* pager -------------------------------------------------------------------- */

.pager {
  display: flex;
  gap: 14px;
  margin-top: 64px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.pager__item {
  flex: 1 1 0;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}
.pager__item:hover {
  text-decoration: none;
  border-color: var(--panel-3);
  box-shadow: var(--shadow-menu);
}
.pager__item--next {
  text-align: right;
  margin-left: auto;
}
.pager__dir {
  display: block;
  font-size: 11.5px;
  color: var(--text-faint);
  margin-bottom: 3px;
}
.pager__label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

/* on this page ------------------------------------------------------------- */

.toc {
  position: sticky;
  top: var(--topbar-h);
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 44px 0 64px;
}

.toc__title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 10px;
}

.toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--border);
}

.toc__link {
  display: block;
  padding: 4px 0 4px 12px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-faint);
}
.toc__link:hover {
  color: var(--text);
  text-decoration: none;
}
.toc__link--sub {
  padding-left: 24px;
}
.toc__link--active {
  color: var(--signal-dim);
  border-left-color: var(--signal);
  font-weight: 600;
}

/* responsive --------------------------------------------------------------- */

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    gap: 40px;
  }
  .toc {
    display: none;
  }
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    padding: 0 20px;
    gap: 0;
  }

  .search {
    max-width: none;
  }
  .search__panel {
    width: min(520px, calc(100vw - 40px));
  }

  .navtoggle__box {
    display: inline-flex;
    align-items: center;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-dim);
    padding: 6px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    cursor: pointer;
  }

  .sidebar {
    display: none;
    position: static;
    max-height: none;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
  }
  /* a checkbox, so the drawer opens with no script */
  .navtoggle:checked ~ .shell .sidebar {
    display: block;
  }

  .content {
    padding: 28px 0 72px;
  }
  .content h1 {
    font-size: 1.8rem;
  }
  .pager {
    flex-direction: column;
  }
}

/* print — enterprise readers do print these -------------------------------- */

@media print {
  .topbar,
  .sidebar,
  .toc,
  .pager,
  .navtoggle__box {
    display: none !important;
  }
  body {
    background: #fff;
    font-size: 11pt;
  }
  .shell,
  .content {
    display: block;
    max-width: none;
    padding: 0;
  }
  figure img {
    box-shadow: none;
  }
  .content h2 {
    break-after: avoid;
  }
  figure {
    break-inside: avoid;
  }
}
