$primary: #262362;
$secondary: #fff;
$link-color: #286fd7;
$inverse-link-color: #fff;

$link-hover-color: darken($link-color, 10%);
$inverse-link-hover-color: darken($inverse-link-color, 10%);

$text-color: #444;
$text-color-secondary: #666;

$body-font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
$code-font-family: 'Source Code Pro', monospace;

html {
  position: relative;
  min-height: 100%;
}

body {
  color: $text-color;
  font-family: $body-font-family;
  padding-top: 40px;
}

a {
  color: $link-color;

  &:hover,
  &:focus {
    color: $link-hover-color;
    text-decoration: none;
  }

  code {
    color: $link-color;
  }
}

a.feature-link {
  color: $primary;

  &:hover,
  &:focus {
    color: $link-hover-color;
    text-decoration: none;
  }
}

span {
  color: $primary;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: $text-color;
  font-weight: 400;
}

h1 code,
h2 code,
h3 code,
h4 code,
h5 code,
h6 code {
  color: $text-color;
  background: transparent;
}

h1 {
  font-size: 30px;
  margin-top: 40px;
  margin-bottom: 40px;
}

h2 {
  font-size: 24px;
  margin-top: 30px;
  margin-bottom: 30px;

  code {
    font-size: 24px;
  }
}

h3 {
  font-size: 20px;
  margin-top: 24px;
  margin-bottom: 24px;

  code {
    font-size: 20px;
  }
}

h4 {
  font-size: 18px;
  margin-top: 20px;
  margin-bottom: 20px;

  code {
    font-size: 18px;
  }
}

p,
li {
  font-size: 14px;
  line-height: 22px;
}

.info-text {
  color: $text-color-secondary;
  font-size: 16px;
  line-height: 24px;
  margin-top: 30px;
  margin-bottom: 30px;
}

.info-users-text {
  margin: 0 0 0 0;
  color: $text-color-secondary;
  font-size: 16px;
  line-height: 24px;
}

code {
  font-family: $code-font-family;
  font-size: 13px;
}

.btn {
  color: $text-color;
  background-color: $inverse-link-color;
}

.btn-inverse {
  color: $text-color;
  background-color: #fff;
}

.well {
  box-shadow: none;
}

table {
  width: 100%;
}

table td,
table th {
  border: 1px solid #ddd;
  padding: 8px;
}

table tr:nth-child(even) {
  background-color: #eee;
}

table th {
  padding-top: 12px;
  padding-bottom: 12px;
  background-color: $primary;
  color: $secondary;
}

.blog-meta {
  margin-top: 10px;
  margin-bottom: 20px;
}

.docs-content * img {
  display: block;
  margin: 20px auto;
}

.blog-content * img {
  display: block;
  margin: 20px auto;
}

.blog-content .attribution,
.blog-content figcaption {
  // Stay close to the image.
  display: block;
  margin-top: 6px;
  padding-top: 0px;

  // Italics, centered, lighter text.
  text-align: center;
  font-style: italic;
  color: $text-color-secondary;
}

.blog-content * img:has(+ .attribution),
.blog-content * img:has(+ figcaption) {
  // Remove bottom margins from images where there is an attribution line
  // immediately following the image.
  margin-bottom: 0px;
}

.blog-content .attribution,
.blog-content figcaption {
  // Remove margin above image caption.
  margin-top: 0px;
  // Add margin under image caption.
  margin-bottom: 1em;
}

.blog-content details {
  margin-left: 2em;
  margin-right: 2em;
  border: 1px solid #ccc;
  border-radius: 0.33em;
  padding: 1em;
  margin-bottom: 1em;
}

// Override the top/bottom margins of whatever is inside.
// We rely on the padding of the details element instead.
.blog-content details > summary:first-child,
.blog-content details > summary:first-child > :first-child {
  margin-top: 0px;
}

// Remove bottom margin from last element of <details>
.blog-content details > :not(summary):last-child {
  margin-bottom: 0px;
}

// Remove bottom margin from last child of <summary> if <details> isn't open.
.blog-content details:not([open]) > summary > *:last-child {
  margin-bottom: 0px;
}

.blog-content details > summary:first-child {
  cursor: pointer;

  // No border when closed, added when opened:
  border-bottom: 0px;
  margin-bottom: 0em;
}

.blog-content details[open] > summary:first-child {
  border-bottom: 1px dashed #ccc;
  margin-bottom: 1em;
}

// Create CSS triangle and animate openining/closing:

.blog-content details > summary:first-child {
  padding-left: 1em;
  position: relative;
}

.blog-content details > summary:first-child:before {
  content: '';
  border-width: 0.4rem;
  border-style: solid;
  border-color: transparent transparent transparent #333;
  position: absolute;
  top: 0.5em;
  left: 0px;
  transform-origin: 0.2rem 50%;
  transition: 0.25s transform ease;
}

.blog-content details:not([open]) > summary:before {
  transform: rotate(0);
}

.blog-content details[open] > summary:before {
  transform: rotate(90deg);
}

// Add line above footnotes section if it is not empty.
.blog-content .footnotes:has(li) {
  margin-top: 2em;
  border-top: 1px dotted #ccc;
  padding-top: 2em;
}

.users-content {
  // Shrink the container holding the users list on each side
  padding-left: 15%;
  padding-right: 15%;
}

.row.display-flex {
  // Make responsive columns equal height using flex.
  display: flex;
  flex-wrap: wrap;
}

.row.display-flex > [class*='col-'] {
  flex-grow: 1;
}

.no-space {
  // Remove component spacing by remove padding and margins.
  margin: 0px auto;
  padding: 0px;
}

.img-vert-center {
  // Default img-vert-center to use block, larger screens will use position.
  margin: 0px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

// Set image width to 100% of its container, but still fit within viewport.
.img-100pct {
  width: 100%;
  img,
  video {
    width: 100%;
    max-width: 75vw;
    max-height: 75vh;
    object-fit: contain;
    margin-left: auto;
    margin-right: auto;
  }
}

.panel-solution h2 {
  // Reduce h2 margins in the big "solution" panels on the homepage.
  margin-top: 1em;
  margin-bottom: 1em;
}

.panel-default h2 {
  // Same, but also remove the top-margin for the "features" panels.
  margin-top: 0em;
  margin-bottom: 1em;
}

@media (min-width: 480px) {
  // Set panel height smart phones landscape.
  .panel-solution {
    height: 300px;
  }
}

@media (min-width: 600px) {
  // Set panel height tablets portrait.
  .panel-solution {
    height: 260px;
  }
}

@media (min-width: 768px) {
  // Set panel height tablets.
  .panel-solution {
    height: 240px;
  }
}

@media (min-width: 992px) {
  // Set panel height tablets landscape.
  .panel-solution {
    height: 330px;
  }

  // Vertical center image in column on larger screens
  .img-vert-center {
    margin: 0;
    position: absolute;
    top: 50%;
    left: 50%;
    -ms-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
  }
}

@media (min-width: 1200px) {
  // Set panel height laptops and desktops.
  .panel-solution {
    height: 300px;
  }
}

// Dark mode styles.
body.darkbg {
  background-color: #000;

  // Invert main content container and footer colors on dark background.
  > .container {
    filter: invert(100%) hue-rotate(180deg);

    // Invert images and videos on dark background to restore original colors.
    img,
    video {
      filter: invert(100%) hue-rotate(180deg);
    }
  }
}
