body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  overflow-y: scroll; // Prevent scrollbar layout shifting
  font-size: 1rem; // Override pkgdown on xxl breakpoint
}

b,
strong {
  font-weight: 600;
}

a {
  color: #0969da;
  text-underline-offset: 0.2em;
}

a:hover,
a:focus {
  text-decoration-thickness: Max(2px, 0.125rem);
}

pre a {
  text-decoration: none;
}

pre a:hover,
pre a:focus {
  text-decoration: underline;
  text-decoration-thickness: Max(2px, 0.125rem);
}

// Keep link styling for inline code
:not(pre) > code a:any-link {
  color: #0969da;
  text-decoration-color: currentcolor;
}

// Anchor link fixes for reflow issues, keyboard navigation
a.anchor {
  display: inline-block;
  opacity: 0;
}

h1:hover a.anchor,
h2:hover a.anchor,
h3:hover a.anchor,
h4:hover a.anchor,
h5:hover a.anchor,
h6:hover a.anchor,
a.anchor:hover,
a.anchor:focus {
  opacity: 1;
}

pre {
  padding: 0.75rem 1rem;
  // Override pkgdown for better contrast
  background-color: var(--bs-gray-100);
}

main li + li {
  margin-top: 0.25em;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
}

h4 {
  font-size: 1.125rem;
}

h5 {
  font-size: 1rem;
}

h1,
h2,
h3,
h4,
h5 {
  margin-top: 1.5rem;
}

blockquote {
  padding-left: 0.3125rem solid #e9ecef;
}

// Revert Bootstrap 5's Reboot styles that change native button styling
button {
  border-radius: revert;
}

label {
  font-weight: 700;
}

// Remove extra margin from pkgdown
details {
  margin-bottom: 0;
}

// pkgdown sets display: block on table, which may drop table semantics in older browsers
main table {
  display: table;
}

// Make highlighted text legible for lighter text (e.g., dark background examples)
::selection {
  color: $body-color;
}

.navbar {
  box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.15);
}

.navbar-light .navbar-brand:hover,
.navbar-light .navbar-brand:focus {
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

.navbar-badge {
  font-size: 0.85em;
}

// Adjust navbar text contrast
.navbar-light .navbar-nav .nav-link {
  color: var(--bs-gray-700);
}

.navbar-light .navbar-nav .nav-link:hover,
.navbar-light .navbar-nav .nav-link:focus {
  color: var(--bs-gray-900);
}

.dropdown-toggle::after {
  // Adjust Bootstrap 5's dropdown arrow alignment
  vertical-align: 0.15em;
}

.dropdown-item:active {
  color: #1e2125;
  background-color: #e9ecef;
}

// Reduce max page width at xx-large breakpoint
@include media-breakpoint-up(xxl) {
  .container-md,
  .container {
    max-width: calc(1160px + 1.5rem);
  }
}

// Fix toc disappearing, increase main content width
@include media-breakpoint-up(md) {
  .row > main {
    max-width: 75%;
  }
}

// Fix toc disappearing
.col-md-3 {
  margin-left: 0;
}

// Fix toc disappearing in Safari from old clearfix hack in Bootstrap
.row::before,
.row::after {
  display: none !important;
}

.page-header {
  // Remove extraneous whitespace
  min-height: 0 !important;
}

// Work around skip link being hidden when focused
a[href='#main'] {
  position: absolute;
  margin: 4px;
  padding: 0.75rem;
  background-color: hsla(0, 0%, 100%, 0.9);
  font-weight: 600;
  text-decoration: none;
  z-index: 1040;
}

#toc > .nav .nav li {
  font-size: 0.9rem;
}

#toc > .nav .nav a {
  margin: 0;
  border-left: 2px solid var(--bs-gray-200);
  border-radius: 0;
}

// Allow keyboard navigation for copy buttons
.btn-copy-ex {
  visibility: visible;
  opacity: 0;
}

.hasCopyButton:hover button.btn-copy-ex,
.btn-copy-ex:focus {
  opacity: 1;
}

// Restore margins for code blocks on small screens
@include media-breakpoint-down(sm) {
  div > div > pre {
    margin-left: 0;
    margin-right: 0;
  }

  .btn-copy-ex {
    right: 5px;
  }
}

// Custom callouts
.callout {
  margin: 1rem 0;
  padding: 0.625rem 1.25rem;
  border-left: 0.25rem solid #e9ecef;

  &-box {
    @extend .callout;
    margin: 1.25rem 0;
    padding: 1rem 1.25rem;
    border: 1px solid #e9ecef;
    border-left-width: 0.25rem;
    border-radius: 0.25rem;
  }

  & > :last-child {
    margin-bottom: 0;
  }

  &-note {
    @extend .callout-box;
    border-left-color: #5bc0de;
  }

  &-tip {
    @extend .callout-box;
    border-left-color: #3fb618;
  }

  &-warning {
    @extend .callout-box;
    border-left-color: #f0ad4e;
  }
}

.reactable {
  font-size: 0.875rem;
}

.props-tbl {
  font-size: 0.875rem;
}

.props-tbl th {
  font-weight: 600;
}

.props-tbl th[scope='row'] {
  font-weight: 400;
}
