"use strict";

/*
Copyright 2021 Q-CTRL. All rights reserved.

Licensed under the Q-CTRL Terms of service (the "License"). Unauthorized
copying or use of this file, via any medium, is strictly prohibited.
Proprietary and confidential. You may not use this file except in compliance
with the License. You may obtain a copy of the License at

     https://q-ctrl.com/terms

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS. See the
License for the specific language.
*/
// Markdown
// Sets defaults for article and post copy.
var plugin = require("tailwindcss/plugin");

module.exports = function (_ref) {
  var addBase = _ref.addBase,
      theme = _ref.theme;
  var markdown = {
    ".markdown": {
      fontSize: theme("fontSize.base"),
      lineHeight: theme("lineHeight.md"),
      color: theme("colors.dark"),
      "> * + *, li > p + p": {
        '&:not([class*="mt-"]):not([class*="my-"])': {
          marginTop: theme("margin.7")
        }
      },
      "> p + ol, > p + ul": {
        '&:not([class*="mt-"]):not([class*="my-"])': {
          marginTop: theme("margin.5")
        }
      },
      "> hr, > figure": {
        '&:not([class*="my-"])': {
          '&:not([class*="mt-"])': {
            marginTop: theme("margin.12")
          },
          '&:not([class*="mb-"])': {
            marginBottom: theme("margin.12")
          }
        }
      },
      "> hr": {
        borderTop: "1px dotted ".concat(theme("colors.gray.300"))
      },
      a: {
        fontWeight: theme("fontWeight.medium"),
        whiteSpace: "nowrap",
        color: theme("colors.primary.light"),
        "&:link": {
          cursor: "pointer"
        },
        "&:hover": {
          color: theme("colors.primary.DEFAULT")
        },
        "&:focus": {
          color: theme("colors.primary.dark")
        }
      },
      strong: {
        fontWeight: theme("fontWeight.bold"),
        color: theme("colors.black"),
        "a": {
          fontWeight: theme("fontWeight.bold")
        }
      },
      h2: {
        '&:not([class*="my-"])': {
          '&:not([class*="mt-"])': {
            marginTop: theme("margin.12")
          },
          '&:not([class*="mb-"])': {
            marginBottom: '-' + theme("margin.2")
          }
        }
      },
      h3: {
        '&:not([class*="my-"])': {
          '&:not([class*="mt-"])': {
            marginTop: theme("margin.9")
          },
          '&:not([class*="mb-"])': {
            marginBottom: '-' + theme("margin.2")
          }
        }
      },
      'code, kbd, :not(pre) > code[class*="language-"]': {
        display: "inline-block",
        padding: "0 ".concat(theme("padding.1")),
        fontFamily: theme("fontFamily.mono"),
        fontWeight: theme("fontWeight.normal"),
        fontStyle: "normal",
        "-webkit-font-smoothing": "antialiased",
        "-moz-osx-font-smoothing": "grayscale",
        border: "1px solid ".concat(theme("colors.gray.200")),
        borderRadius: theme("borderRadius.DEFAULT"),
        lineHeight: theme("lineHeight.sm")
      },
      kbd: {
        color: theme("colors.gray.600"),
        backgroundColor: theme('colors.gray.100'),
        border: theme('colors.theme.gray')
      },
      'pre, pre[class*="language-"]': {
        padding: theme("squash.lg"),
        backgroundColor: theme("colors.gray.100"),
        overflow: "auto",
        fontSize: "1em",
        lineHeight: theme("lineHeight.sm"),
        textAlign: "left",
        direction: "ltr",
        wordSpacing: "normal",
        tabSize: "4",
        hyphens: "none",
        "overflow-wrap": "normal",
        "word-break": "normal",
        "white-space": "pre",
        color: "#5e6687",
        scrollbarWidth: "thin",
        scrollbarColor: "#E9E7EA #F8F6F9",
        "&::-webkit-scrollbar": {
          width: theme("width[2.5]"),
          height: theme("height[2.5]")
        },
        "&::-webkit-scrollbar-track": {
          backgroundColor: theme("colors.gray.100")
        },
        "&::-webkit-scrollbar-thumb": {
          border: "2px solid ".concat(theme("colors.gray.100")),
          backgroundColor: theme("colors.gray.300")
        },
        "&::-webkit-scrollbar-thumb:hover": {
          backgroundColor: theme("colors.gray.400")
        },
        "> code": {
          fontSize: theme("fontSize[87.5]"),
          borderWidth: "0"
        }
      },
      blockquote: {
        '&:not([class*="my-"])': {
          '&:not([class*="mt-"])': {
            marginTop: theme("margin.12")
          },
          '&:not([class*="mb-"])': {
            marginBottom: theme("margin.12")
          }
        }
      },
      "ul:not(.list-none)": {
        paddingLeft: "2ch",
        "& > li": {
          "padding-inline-start": "0.25ch"
        },
        "&:not(.list-disc):not(.list-circle)": {
          paddingLeft: "0.75ch",
          "list-style-type": "'*'",
          "& > li": {
            "padding-inline-start": "1.5ch"
          }
        }
      },
      "ol:not(.list-none)": {
        paddingLeft: "1.8ch",
        "& > li": {
          "padding-inline-start": "0.5ch"
        },
        "&.list-decimal-leading-zero, &.list-lower-roman, &.list-upper-roman": {
          paddingLeft: "2.8ch"
        },
        "&:not(.list-decimal-leading-zero):not(.list-lower-latin):not(.list-lower-roman):not(.list-upper-latin):not(.list-upper-roman)": {
          "list-style-type": "decimal"
        }
      },
      "ol:not(.list-none) li, ul:not(.list-none) li": {
        "list-style-position": "outside",
        "&::marker": {
          color: theme("colors.primary.DEFAULT"),
          fontWeight: theme("fontWeight.medium")
        }
      },
      "h1, h2, h3, h4, h5, h6": {
        ".header-anchor": {
          position: "absolute",
          marginLeft: "-1em",
          "transition-property": "opacity",
          "transition-timing-function": theme("transitionTimingFunction.ease-in-out"),
          "transition-duration": theme("transitionDuration.200"),
          "-webkit-font-smoothing": "antialiased",
          "-moz-osx-font-smoothing": "grayscale",
          opacity: "0"
        },
        "&:hover .header-anchor": {
          opacity: "1"
        }
      },
      "table, th": {
        "&:not(.text-center):not(.text-right):not(.text-justify)": {
          textAlign: "left"
        }
      },
      "table tr": {
        "vertical-align": "top"
      },
      "table:not(.table-reset)": {
        width: theme("width.full"),
        tr: {
          "vertical-align": "top",
          "&:not(:last-child)": {
            borderBottom: "1px dotted ".concat(theme("colors.gray.300"))
          }
        },
        "thead tr": {
          borderBottom: "1px dotted ".concat(theme("colors.gray.300"))
        },
        "td, th": {
          padding: theme("stretch.sm")
        }
      },
      ".dark &": {
        kbd: {
          color: theme("colors.gray.100"),
          backgroundColor: theme('colors.gray.800'),
          border: theme('colors.gray.700')
        }
      }
    }
  };
  addBase(markdown);
};