/*
 * framework.protobject.com
 *
 * The layout of the just-the-docs sites it replaces — navigation on the left,
 * the page in the middle, its outline on the right — in Protobject's colours,
 * with nothing loaded from anywhere else.
 */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-side: #f4f7fa;
  --bg-hover: #e8eef4;
  --text: #1b2733;
  --heading: #16283a;
  --muted: #5a6b7c;
  --line: #dfe6ee;
  --brand: #224466;
  --accent: #1a6fb8;
  --accent-strong: #0f5796;
  --accent-soft: #e6f1fb;
  --code-bg: #f5f7fa;
  --shadow: 0 12px 32px rgba(22, 40, 58, 0.14);

  --note: #1a6fb8;
  --note-bg: #eaf3fc;
  --important: #007a83;
  --important-bg: #e3f6f7;
  --new: #2f7d38;
  --new-bg: #e9f5ea;
  --warning: #b3342f;
  --warning-bg: #fcecec;
  --highlight: #9a6b00;
  --highlight-bg: #fff6d9;

  --tok-kw: #7a3db8;
  --tok-str: #1f7a3c;
  --tok-com: #5f6d7b;
  --tok-num: #b35300;
  --tok-fn: #1a6fb8;
  --tok-pre: #b0306a;
  --tok-tag: #1a6fb8;
  --tok-attr: #7a3db8;

  --sans: 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', Consolas, 'SFMono-Regular', Menlo, monospace;
  --radius: 0.6rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #10161d;
    --bg-side: #151d26;
    --bg-hover: #1f2a36;
    --text: #dfe6ee;
    --heading: #f1f5f9;
    --muted: #97a7b8;
    --line: #29343f;
    --brand: #6cb6f5;
    --accent: #6cb6f5;
    --accent-strong: #9fd0fa;
    --accent-soft: #1a2d40;
    --code-bg: #18212b;
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);

    --note: #6cb6f5;
    --note-bg: #16283a;
    --important: #4fd1d9;
    --important-bg: #10302f;
    --new: #74c47c;
    --new-bg: #172c1a;
    --warning: #f08a85;
    --warning-bg: #3a1c1c;
    --highlight: #f0c14b;
    --highlight-bg: #332a12;

    --tok-kw: #c49bf2;
    --tok-str: #8fd19e;
    --tok-com: #7f8e9d;
    --tok-num: #f2a86c;
    --tok-fn: #7cc0f7;
    --tok-pre: #f28cb8;
    --tok-tag: #7cc0f7;
    --tok-attr: #c49bf2;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: 1.5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.7 var(--sans);
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--accent);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent-strong);
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0.5rem;
  z-index: 50;
  padding: 0.5rem 1rem;
  background: var(--bg);
  border-radius: var(--radius);
}

.skip:focus {
  left: 0.5rem;
}

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

.layout {
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  /* Above the page, so the search results can open over it. */
  z-index: 10;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-side);
  border-right: 1px solid var(--line);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.25rem 1rem;
}

.brand {
  display: block;
  line-height: 0;
}

.brand img {
  height: 2.15rem;
  width: auto;
}

.brand-dark {
  display: none;
}

@media (prefers-color-scheme: dark) {
  .brand-light {
    display: none;
  }
  .brand-dark {
    display: block;
  }
}

.menu {
  display: none;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

.sidebar-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 0.75rem 1.25rem;
}

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

.search {
  position: relative;
  padding: 0 1rem 1rem;
}

.search input {
  width: 100%;
  font: inherit;
  font-size: 0.93rem;
  padding: 0.5rem 0.75rem 0.5rem 2.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237d8d9d' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E")
    no-repeat 0.7rem center / 1rem;
  color: var(--text);
}

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

.search-results {
  position: absolute;
  top: calc(100% - 0.6rem);
  left: 1rem;
  z-index: 30;
  width: min(30rem, calc(100vw - 2rem));
  max-height: min(70vh, 32rem);
  overflow-y: auto;
  padding: 0.35rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.search-results a {
  display: block;
  padding: 0.55rem 0.7rem;
  border-radius: 0.45rem;
  color: var(--text);
  text-decoration: none;
}

.search-results a:hover,
.search-results a[aria-selected='true'] {
  background: var(--accent-soft);
}

.search-results strong {
  display: block;
  font-size: 0.93rem;
  color: var(--heading);
}

.search-results small {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
}

.search-results span {
  display: block;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--muted);
}

.search-results mark {
  background: none;
  color: var(--accent-strong);
  font-weight: 700;
}

/* Always there for screen readers; on screen only when it has news. */
.search-status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.search-status.is-visible {
  position: static;
  width: auto;
  height: auto;
  margin: 0.5rem 0.1rem 0;
  overflow: visible;
  clip-path: none;
  white-space: normal;
  font-size: 0.88rem;
  color: var(--muted);
}

/* ---------------------------------------------------------------- navigation */

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

.nav a {
  display: block;
  padding: 0.3rem 0.65rem;
  border-radius: 0.45rem;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.45;
  text-decoration: none;
}

.nav a:hover {
  background: var(--bg-hover);
  color: var(--heading);
}

.nav a[aria-current='page'] {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

.nav li + li {
  margin-top: 0.1rem;
}

.nav-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-row a {
  flex: 1;
}

.nav-toggle {
  flex: none;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 0.45rem;
  background: none;
  cursor: pointer;
}

.nav-toggle:hover {
  background: var(--bg-hover);
}

.nav-toggle::after {
  content: '';
  width: 0.45rem;
  height: 0.45rem;
  margin-left: -0.2rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 150ms ease;
}

.nav .is-open > .nav-row .nav-toggle::after {
  margin: -0.2rem 0 0;
  transform: rotate(45deg);
}

.nav .has-children > ul {
  display: none;
  margin: 0.2rem 0 0.4rem 0.9rem;
  padding-left: 0.45rem;
  border-left: 1px solid var(--line);
}

.nav .has-children.is-open > ul {
  display: block;
}

.nav .has-children > ul a {
  font-size: 0.9rem;
  padding: 0.22rem 0.6rem;
}

.sidebar-foot {
  margin-top: auto;
  padding: 1.5rem 0.65rem 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--muted);
}

.sidebar-foot p {
  margin: 0.25rem 0;
}

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

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

.main {
  display: grid;
  grid-template-columns: minmax(0, 48rem) 13rem;
  justify-content: start;
  gap: 3.5rem;
  padding: 2.5rem 3rem 4rem;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
  font-size: 0.87rem;
  color: var(--muted);
}

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

.outline {
  position: sticky;
  top: 2.5rem;
  align-self: start;
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
  font-size: 0.85rem;
  line-height: 1.45;
}

.outline p {
  margin: 0 0 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.outline a {
  display: block;
  margin-left: -1px;
  padding: 0.22rem 0 0.22rem 0.8rem;
  border-left: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
}

.outline .outline-3 a {
  padding-left: 1.6rem;
}

.outline a:hover {
  color: var(--heading);
}

.outline a.is-current {
  border-left-color: var(--accent);
  color: var(--accent-strong);
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.pager a {
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--heading);
  font-weight: 600;
  text-decoration: none;
}

.pager a:hover {
  border-color: var(--accent);
}

.pager span {
  display: block;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--muted);
}

.pager-next {
  grid-column: 2;
  text-align: right;
}

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

.content {
  overflow-wrap: break-word;
}

.content h1,
.content h2,
.content h3,
.content h4 {
  color: var(--heading);
  line-height: 1.25;
  scroll-margin-top: 1.5rem;
}

.content h1 {
  margin: 0 0 1rem;
  font-size: 2.3rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.content h2 {
  margin: 2.75rem 0 0.9rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
  font-size: 1.55rem;
  font-weight: 650;
}

.content h3 {
  margin: 2rem 0 0.6rem;
  font-size: 1.22rem;
  font-weight: 650;
}

.content h4 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.05rem;
}

.anchor {
  margin-left: 0.4rem;
  color: var(--muted);
  font-weight: 400;
  text-decoration: none;
  opacity: 0;
  transition: opacity 120ms ease;
}

.content :is(h2, h3, h4):hover .anchor,
.anchor:focus {
  opacity: 1;
}

.content p,
.content ul,
.content ol {
  margin: 0 0 1rem;
}

.content li + li {
  margin-top: 0.3rem;
}

.content li > p {
  margin-bottom: 0.4rem;
}

.content hr {
  margin: 2.25rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.content img {
  max-width: 100%;
  height: auto;
}

.content :not(pre) > code {
  padding: 0.12em 0.38em;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 0.35em;
  font-family: var(--mono);
  font-size: 0.86em;
}

.fs-5 {
  font-size: 1rem;
}

.fs-6 {
  font-size: 1.24rem;
  line-height: 1.6;
}

.fw-300 {
  font-weight: 400;
  color: var(--muted);
}

/* code */

.code-block {
  position: relative;
  margin: 1.1rem 0 1.4rem;
}

pre.code {
  margin: 0;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.6;
  tab-size: 2;
}

.content > pre.code {
  margin: 1.1rem 0 1.4rem;
}

.copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.2rem 0.6rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms ease;
}

.code-block:hover .copy,
.copy:focus-visible,
.copy.is-done {
  opacity: 1;
}

@media (hover: none) {
  .copy {
    opacity: 1;
  }
}

.tok-kw {
  color: var(--tok-kw);
}
.tok-str {
  color: var(--tok-str);
}
.tok-com {
  color: var(--tok-com);
  font-style: italic;
}
.tok-num {
  color: var(--tok-num);
}
.tok-fn {
  color: var(--tok-fn);
}
.tok-pre {
  color: var(--tok-pre);
}
.tok-tag {
  color: var(--tok-tag);
}
.tok-attr {
  color: var(--tok-attr);
}

/* tables */

.table {
  margin: 1.2rem 0 1.5rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  line-height: 1.5;
}

.table th {
  background: var(--bg-side);
  color: var(--heading);
  font-weight: 650;
  text-align: left;
  white-space: nowrap;
}

.table th,
.table td {
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.table tr:last-child td {
  border-bottom: 0;
}

/* callouts */

.callout {
  --c: var(--note);
  --c-bg: var(--note-bg);
  margin: 1.25rem 0 1.5rem;
  padding: 0.85rem 1.1rem;
  background: var(--c-bg);
  border-left: 4px solid var(--c);
  border-radius: 0.5rem;
}

.callout-important {
  --c: var(--important);
  --c-bg: var(--important-bg);
}
.callout-new {
  --c: var(--new);
  --c-bg: var(--new-bg);
}
.callout-warning {
  --c: var(--warning);
  --c-bg: var(--warning-bg);
}
.callout-highlight {
  --c: var(--highlight);
  --c-bg: var(--highlight-bg);
}

.callout-title {
  margin: 0 0 0.3rem !important;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--c);
}

.callout > :last-child {
  margin-bottom: 0;
}

.content blockquote {
  margin: 1.25rem 0;
  padding: 0.2rem 1rem;
  border-left: 4px solid var(--line);
  color: var(--muted);
}

/* buttons */

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.25rem 0 1.5rem !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--heading);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  transition: border-color 120ms ease, background 120ms ease;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .btn-primary,
  .btn-primary:hover {
    color: #0b1a29;
  }
}

.btn-secondary {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-strong);
}

/* videos */

.video {
  position: relative;
  display: block;
  margin: 1rem 0 1.25rem;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
  border-radius: 0.75rem;
}

.video img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.88;
  transition: opacity 200ms ease, transform 300ms ease;
}

.video-play {
  position: absolute;
  inset: 0;
  width: 4.5rem;
  height: 4.5rem;
  margin: auto;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  transition: background 200ms ease, transform 200ms ease;
}

.video-play::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 54%;
  border-style: solid;
  border-width: 0.8rem 0 0.8rem 1.3rem;
  border-color: transparent transparent transparent #fff;
  transform: translate(-50%, -50%);
}

.video:hover img {
  opacity: 1;
  transform: scale(1.02);
}

.video:hover .video-play {
  background: #c4302b;
  transform: scale(1.06);
}

/* ---------------------------------------------------------------- narrower */

@media (max-width: 78rem) {
  .main {
    grid-template-columns: minmax(0, 48rem);
  }
  .outline {
    display: none;
  }
}

@media (max-width: 56rem) {
  /* Headings reached by a link clear the sticky bar at the top. */
  html {
    scroll-padding-top: 5rem;
  }

  .layout {
    display: block;
  }

  .sidebar {
    position: sticky;
    z-index: 20;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-head {
    padding: 0.7rem 1rem;
  }

  .brand img {
    height: 1.8rem;
  }

  .menu {
    display: inline-flex;
  }

  .search,
  .sidebar-body {
    display: none;
  }

  .sidebar-body {
    max-height: calc(100vh - 7rem);
    padding: 0 1rem 1rem;
  }

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

  .sidebar.is-open .sidebar-body {
    display: flex;
  }

  .search-results {
    left: 1rem;
    width: calc(100% - 2rem);
  }

  .main {
    display: block;
    padding: 1.5rem 1rem 3rem;
  }

  .content h1 {
    font-size: 1.9rem;
  }

  .pager {
    grid-template-columns: 1fr;
  }

  .pager-next {
    grid-column: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
