////
/// Copyright (c) 2016-2022 Martin Donath <martin.donath@squidfunk.com>
///
/// Permission is hereby granted, free of charge, to any person obtaining a
/// copy of this software and associated documentation files (the "Software"),
/// to deal in the Software without restriction, including without limitation
/// the rights to use, copy, modify, merge, publish, distribute, sublicense,
/// and/or sell copies of the Software, and to permit persons to whom the
/// Software is furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
/// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
/// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
/// DEALINGS
////

// ----------------------------------------------------------------------------
// Keyframes
// ----------------------------------------------------------------------------

// Pumping heart animation
@keyframes mdx-heart {
  0%,
  40%,
  80%,
  100% {
    transform: scale(1);
  }

  20%,
  60% {
    transform: scale(1.15);
  }
}

// ----------------------------------------------------------------------------
// Rules
// ----------------------------------------------------------------------------

// Scoped in typesetted content to match specificity of regular content
.md-typeset {

  // Twitter icon
  .twitter {
    color: #00acee;
  }

  // Insiders video
  .mdx-video {
    width: auto;

    // Insiders video container
    &__inner {
      position: relative;
      width: 100%;
      height: 0;
      padding-bottom: 56.138%;
    }

    // Insiders video iframe
    iframe {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      overflow: hidden;
      border: none;
    }
  }

  // Pumping heart
  .mdx-heart {
    animation: mdx-heart 1000ms infinite;
  }

  // Insiders color (for links, etc.)
  .mdx-insiders {
    color: $clr-pink-500;
  }

  // Switch buttons
  .mdx-switch button {
    cursor: pointer;
    transition: opacity 250ms;

    // Button on focus/hover
    &:focus,
    &:hover {
      opacity: 0.75;
    }

    // Code block
    > code {
      display: block;
      color: var(--md-primary-bg-color);
      background-color: var(--md-primary-fg-color);
    }
  }

  // Deprecation
  .mdx-deprecated {
    opacity: 0.5;
    transition: opacity 250ms;

    // Deprecation on focus/hover
    &:focus-within,
    &:hover {
      opacity: 1;
    }
  }

  // Two-column layout
  .mdx-columns {

    // Column
    ol,
    ul {
      columns: 2;

      // [mobile portrait -]: Reset columns on mobile
      @include break-to-device(mobile portrait) {
        columns: initial;
      }
    }

    // Column item
    li {
      break-inside: avoid;
    }
  }

  // Blog author
  .mdx-author {
    display: flex;
    font-size: px2rem(13.6px);

    // Blog author image
    img {
      height: px2rem(40px);
      border-radius: 100%;
    }

    // Blog author content
    p {

      // TODO: refactor, use dedicated classes
      &:first-child {
        flex-shrink: 0;
        margin-right: px2rem(16px);
      }

      // Blog metadata
      > span {
        display: block;
      }
    }
  }
}
