/* --------------------------------

File#: _1_popover
Title: Popover
Descr: A pop-up box controlled by a trigger element
Usage: codyhouse.co/license

-------------------------------- */

/* variables */
:root {
    /* colors */
    --pd8-color-primary-hsl: 250, 84%, 54%;
    --pd8-color-bg-hsl: 0, 0%, 100%;
    --pd8-color-contrast-high-hsl: 230, 7%, 23%;
    --pd8-color-contrast-higher-hsl: 230, 13%, 9%;
    --pd8-color-bg-light-hsl: 0, 0%, 100%;
    --pd8-color-bg-dark-hsl: 240, 4%, 95%;
    --pd8-color-white-hsl: 0, 0%, 100%;
    --pd8-color-primary-darker-hsl: 250, 84%, 38%;
    --pd8-color-primary-light-hsl: 250, 84%, 60%;
    --pd8-color-accent-hsl: 342, 89%, 48%;
    --pd8-color-contrast-lower-hsl: 240, 4%, 85%;

    /* spacing */
    --pd8-space-sm: 0.75rem;
    --pd8-space-2xs: 0.375rem;
    --pd8-space-md: 1.25rem;
    --pd8-space-xs: 0.5rem;

    /* typography */
    --pd8-text-base: 1rem;
    --pd8-text-sm: 0.833rem;
    --pd8-text-sm: 0.833rem;
}

@media(min-width: 64rem){
    :root {
        /* spacing */
        --pd8-space-sm: 1.125rem;
        --pd8-space-2xs: 0.5625rem;
        --pd8-space-md: 2rem;
        --pd8-space-xs: 0.75rem;

        /* typography */
        --pd8-text-base: 1.25rem;
        --pd8-text-sm: 1rem;
        --pd8-text-sm: 1rem;
    }
}

/* buttons */
.pd8-btn {
    position: relative;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-size: 1em;
    white-space: nowrap;
    text-decoration: none;
    background: hsl(var(--pd8-color-bg-dark-hsl));
    color: hsl(var(--pd8-color-contrast-higher-hsl));
    cursor: pointer;
    text-decoration: none;
    line-height: 1.2;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: all 0.2s ease;
    will-change: transform;
    padding: var(--pd8-space-2xs) var(--pd8-space-sm);
    border-radius: 0.25em;
}

.pd8-btn:focus-visible {
    box-shadow: 0px 0px 0px 2px hsl(var(--pd8-color-bg-hsl)), 0px 0px 0px 4px hsla(var(--pd8-color-contrast-higher-hsl), 0.15);
    outline: none;
}

.pd8-btn:active {
    transform: translateY(2px);
}

.pd8-btn--primary {
    background: hsl(var(--pd8-color-primary-hsl));
    color: hsl(var(--pd8-color-white-hsl));
    box-shadow: inset 0px 1px 0px hsla(var(--pd8-color-white-hsl), 0.15), 0px 1px 3px hsla(var(--pd8-color-primary-darker-hsl), 0.25), 0px 2px 6px hsla(var(--pd8-color-primary-darker-hsl), 0.1), 0px 6px 10px -2px hsla(var(--pd8-color-primary-darker-hsl), 0.25);
}

.pd8-btn--primary:hover {
    background: hsl(var(--pd8-color-primary-light-hsl));
    box-shadow: inset 0px 1px 0px hsla(var(--pd8-color-white-hsl), 0.15), 0px 1px 2px hsla(var(--pd8-color-primary-darker-hsl), 0.25), 0px 1px 4px hsla(var(--pd8-color-primary-darker-hsl), 0.1), 0px 3px 6px -2px hsla(var(--pd8-color-primary-darker-hsl), 0.25);
}

.pd8-btn--primary:focus {
    box-shadow: inset 0px 1px 0px hsla(var(--pd8-color-white-hsl), 0.15), 0px 1px 2px hsla(var(--pd8-color-primary-darker-hsl), 0.25), 0px 1px 4px hsla(var(--pd8-color-primary-darker-hsl), 0.1), 0px 3px 6px -2px hsla(var(--pd8-color-primary-darker-hsl), 0.25), 0px 0px 0px 2px hsl(var(--pd8-color-bg-hsl)), 0px 0px 0px 4px hsl(var(--pd8-color-primary-hsl));
}

/* component */
:root {
    --popover-width: 250px;
    --popover-control-gap: 4px;
    --popover-viewport-gap: 20px;
    --popover-transition-duration: 0.2s;
}

.popover {
    position: fixed;
    width: var(--popover-width);
    z-index: 5;
    margin-top: var(--popover-control-gap);
    margin-bottom: var(--popover-control-gap);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s var(--popover-transition-duration), opacity var(--popover-transition-duration);
}

.popover--is-visible {
    visibility: visible;
    opacity: 1;
    transition: visibility 0s, opacity var(--popover-transition-duration);
}

/* utility classes */
.pd8-text-sm {
    font-size: var(--pd8-text-sm);
}

.pd8-text-base {
    font-size: var(--pd8-text-base);
}

.pd8-text-gap-sm {
    --pd8-space-multiplier: 0.75;
}

.pd8-text-component :where(h1, h2, h3, h4) {
    line-height: var(--pd8-heading-line-height, 1.2);
    margin-top: calc(var(--pd8-space-md) * var(--pd8-space-multiplier, 1));
    margin-bottom: calc(var(--pd8-space-sm) * var(--pd8-space-multiplier, 1));
}

.pd8-text-component :where(p, blockquote, ul li, ol li) {
    line-height: var(--pd8-body-line-height, 1.4);
}

.pd8-text-component :where(ul, ol, p, blockquote, .pd8-text-component__block) {
    margin-bottom: calc(var(--pd8-space-sm) * var(--pd8-space-multiplier, 1));
}

.pd8-text-component :where(ul, ol) {
    padding-left: 1.25em;
}

.pd8-text-component ul :where(ul, ol), .pd8-text-component ol :where(ul, ol) {
    padding-left: 1em;
    margin-bottom: 0;
}

.pd8-text-component ul {
    list-style-type: disc;
}

.pd8-text-component ol {
    list-style-type: decimal;
}

.pd8-text-component img {
    display: block;
    margin: 0 auto;
}

.pd8-text-component figcaption {
    margin-top: calc(var(--pd8-space-xs) * var(--pd8-space-multiplier, 1));
    font-size: var(--pd8-text-sm);
    text-align: center;}

.pd8-text-component em {
    font-style: italic;
}

.pd8-text-component strong {
    font-weight: bold;
}

.pd8-text-component s {
    text-decoration: line-through;
}

.pd8-text-component u {
    text-decoration: underline;
}

.pd8-text-component mark {
    background-color: hsla(var(--pd8-color-accent-hsl), 0.2);
    color: inherit;
}

.pd8-text-component blockquote {
    padding-left: 1em;
    border-left: 4px solid hsl(var(--pd8-color-contrast-lower-hsl));
    font-style: italic;
}

.pd8-text-component hr {
    margin: calc(var(--pd8-space-md) * var(--pd8-space-multiplier, 1)) auto;
    background: hsl(var(--pd8-color-contrast-lower-hsl));
    height: 1px;
}

.pd8-text-component > *:first-child {
    margin-top: 0;
}

.pd8-text-component > *:last-child {
    margin-bottom: 0;
}

.pd8-text-component.pd8-line-height-xs {
    --pd8-heading-line-height: 1;
    --pd8-body-line-height: 1.1;
}

.pd8-text-component.pd8-line-height-sm {
    --pd8-heading-line-height: 1.1;
    --pd8-body-line-height: 1.2;
}

.pd8-text-component.pd8-line-height-md {
    --pd8-heading-line-height: 1.15;
    --pd8-body-line-height: 1.4;
}

.pd8-text-component.pd8-line-height-lg {
    --pd8-heading-line-height: 1.22;
    --pd8-body-line-height: 1.58;
}

.pd8-text-component.pd8-line-height-xl {
    --pd8-heading-line-height: 1.3;
    --pd8-body-line-height: 1.72;
}

.pd8-shadow-md {
    box-shadow:0 0.9px 1.5px rgba(0, 0, 0, 0.03),0 3.1px 5.5px rgba(0, 0, 0, 0.08),0 14px 25px rgba(0, 0, 0, 0.12);
}

:where(.pd8-inner-glow) {
    position: relative;
}

.pd8-inner-glow::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: inset 0 0 0.5px 1px hsla(0, 0%, 100%, 0.075);
}

.pd8-radius-md {
    border-radius: 0.25em;
}

.pd8-padding-sm {
    padding: var(--pd8-space-sm);
}

.pd8-bg-light {
    --pd8-bg-o: 1;
    background-color: hsla(var(--pd8-color-bg-light-hsl), var(--pd8-bg-o));
}
