/**
 * set the box-sizing property to border-box
 * all elements will include padding and border in the width and height
 * the star selector is a universal selector - selects all elements
 * the before and after pseudo-elements are included
 * now the width property value will be subtracted to include padding and border
 * default model is content-box - padding and border are added to the width and height
 * works best for most designs 
 * - however if width is small and padding is large overflow can occur
 */
*,
*:before,
*:after {
    box-sizing: border-box;
}

/**
  * set the min-height to 100dvh
  * dvh is the dynamic viewport height
  * it will adjust based on the changing viewport height
  * if the browser adds controls or the viewport height changes
  * the min-height will adjust to the new height
  */
html {
    font-family: sans-serif;
    min-height: 100dvh;
}

/**
  * multiple backgrounds
  * background is the shorthand property
  * url() is the background-image property
  * repeat-x is the background-repeat property
  * fixed is the background-attachment property
  * top image and the gradient will be fixed to the viewport
  * page content will scroll and the background will remain fixed
  */

/* prettier-ignore */
body {
    margin: 0;
    min-height: 100dvh;
    background:
        url(images/club-rotate.webp) fixed no-repeat top 20px left 15px / 200px 200px,
        url(images/spade-rotate.webp) fixed no-repeat top 20px right 15px / 200px 200px,
        url(images/heart-rotate.webp) fixed no-repeat bottom 20px left 15px / 200px 200px,
        url(images/diamond-rotate.webp) fixed no-repeat bottom 20px right 15px / 200px 200px,
        fixed linear-gradient(to bottom,
            rgb(255, 0, 0) 40%,
            rgb(0, 0, 0) 63%) #000;
}

/**
  * create a grid container
  * no columns or rows are defined
  * the grid will automatically create columns and rows
  * based on the content
  * max-width is 800px
  * div is a block-level element
  * it will try to take up the full width of the container
  * never larger than 800px
  */

.wrapper {
    display: grid;
    max-width: 800px;
    border: 2px solid white;
    border-radius: 10px;
    background: rgb(99, 0, 0);
    margin-top: 10px;
    margin-bottom: 10px;
}

/**
  * display flex - create a flex container
  * flex direction is row (left to right)
  * all elements will shrink to the minimum size of the content
  * and flow from left to right
  * multiple background images (gradients behave like images)
  * background is the shorthand property
  * url() is the background-image property
  * no-repeat is the background-repeat property
  * top 0px right 0px is the background-position property (x, y)
  * the additional value after the keyword is the offset
  * place the image in the top right corner
  * then move it 0px down and 0px left
  * positive values move in towards the center of the element
  * negative values move out away from the element
  * / 50px 50px is the background-size property (width, height)
  * keyword cover is the background-size property
  * cover will scale the image to cover the entire container
  * contain will scale the image to fit inside the container
  * cover is used most often
  * background color must always be last
  * a stacking order is created
  * first background image/gradient is on top
  * last background image/gradient is on the bottom
  */
/* prettier-ignore */
header {
    display: flex;
    border-radius: 10px;
    border: 2px solid gray;
    margin: 20px;
    background:
        url(images/amazed.webp) no-repeat top left / 100px 100px,
        url(images/ace.webp) no-repeat center center / cover,
        linear-gradient(to bottom,
            hsl(0, 100%, 48%),
            hsl(0, 100%, 44%)) #000;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8);
}

/**
  * h1 is a flex item of the flex container
  * flex-grow is 1 - don't shrink wrap around the content
  * flex-shrink is 1 - allow the item to shrink to fit the container
  * flex-basis is auto - the initial size of the item
  * the flex direction is row (left to right) layout the h1 in the row direction
  * margin is 0 remove the default margin - creating an edge-to-edge design
  * line-height is 4 * font-size - this will set the actual height of the line box
  * the text will be vertically centered in the in the line box
  * background is a gradient
  * border-radius is 10px all 4 corners - will be overridden in the media query
  */
/* prettier-ignore */
header h1 {
    flex: 1 1 auto;
    margin: 0;
    color: #fff;
    line-height: 4;
    text-align: center;
    letter-spacing: 2px;
    text-shadow: 0 -2px 2px rgba(0, 0, 0, 0.6);
    background:
        transparent linear-gradient(to bottom,
            hsla(0, 100%, 68%, 0.747) 20px,
            hsla(0, 56%, 48%, 0.705) 40px,
            rgb(85, 10, 10));
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    font-size: x-large;
}

/**
  * sup is a superscript element
  * used for footnotes, endnotes, power, and exponents
  * font-size is 0.6 * inherited font-size
  * find the value of the inherited font-size from the parent element
  * multiply by 0.6
  * use the Developer Tools Computed tab/panel to find the actual font-size of the parent element
  */
header h1 sup {
    font-size: 0.6em;
}

/**
  * background gradient
  * small gradient on top
  * first color is 0% from the top
  * second color is 5% from the top
  * third color is 20% from the top (same color as the background)
  */
/* prettier-ignore */
section {
    margin: 20px;
    border: 2px solid white;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 4px 4px rgba(0, 0, 0, 0.8);
    background:
        linear-gradient(to bottom,
            hsl(0, 100%, 40%) 0%,
            hsla(0, 100%, 40%, 0.5) 5%,
            hsl(0, 100%, 90%) 50%,
            hsla(0, 100%, 40%, 0.5) 95%,
            hsl(0, 100%, 40%) 100%) #fff;
}

/**
  * margin 24px on top and bottom
  * zero on right and left
  * 6px on bottom (override the 24px)
  */
h2 {
    margin: 20px 0 7px;
}

/**
  * use larger line-height for improved readability
  * set maximum width to 60ch (60 characters) for improved readability
  */
.suit {
    margin: 55px 0 50px;
    line-height: 1.4;
    display: grid;
    grid-row: 3;
    gap: 10em;
    justify-content: center;
}

.suit-club {
    position: relative;
    padding: 1em 1.875em;
    color: var(--color);
    border: 0.125em solid rgba(0, 0, 0, 0.5);
    border-radius: 0.25em;
    text-shadow: 0 0 0.9375em var(--color);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: 0.5s;
    z-index: 1;
    text-align: center;
    background-color: #ffa07a;
    cursor: pointer;
}

.suit-club:hover {
    color: #fff;
    border: 0.125em solid rgba(0, 0, 0, 0);
    box-shadow: -0.2em 0.2em 0.2em 0.6em var(--color);
}

.suit-club::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color);
    z-index: -1;
    transform: scale(0);
    transition: 0.5s;
}

.suit-club:hover::before {
    transform: scale(1);
    transition-delay: 0.5s;
    box-shadow: 0 0 0.625em var(--color),
        0 0 1.875em var(--color),
        0 0 3.75em var(--color);
}

.suit-club span {
    position: absolute;
    background: var(--color);
    pointer-events: none;
    border-radius: 0.125em;
    box-shadow: 0 0 0.625em var(--color),
        0 0 1.25em var(--color),
        0 0 1.875em var(--color),
        0 0 3.125em var(--color),
        0 0 6.25em var(--color);
    transition: 0.5s ease-in-out;
    transition-delay: 0.25s;
}

.suit-club:hover span {
    opacity: 0;
    transition-delay: 0s;
}

.suit-club span:nth-child(1),
.suit-club span:nth-child(3) {
    width: 2.5em;
    height: 0.25em;
}

.suit-club:hover span:nth-child(1),
.suit-club:hover span:nth-child(3) {
    transform: translateX(0);
}

.suit-club span:nth-child(2),
.suit-club span:nth-child(4) {
    width: 0.25em;
    height: 2.5em;
}

.suit-club:hover span:nth-child(1),
.suit-club:hover span:nth-child(3) {
    transform: translateY(0);
}

.suit-club span:nth-child(1) {
    top: calc(50% - 0.125em);
    left: -3.125em;
    transform-origin: left;
}

.suit-club:hover span:nth-child(1) {
    left: 50%;
}

.suit-club span:nth-child(3) {
    top: calc(50% - 0.125em);
    right: -3.125em;
    transform-origin: right;
}

.suit-club:hover span:nth-child(3) {
    right: 50%;
}

.suit-club span:nth-child(2) {
    left: calc(50% - 0.125em);
    top: -3.125em;
    transform-origin: top;
}

.suit-club:hover span:nth-child(2) {
    top: 50%;
}

.suit-club span:nth-child(4) {
    left: calc(50% - 0.125em);
    bottom: -3.125em;
    transform-origin: bottom;
}

.suit-club:hover span:nth-child(4) {
    bottom: 50%;
}

.suit-club:active {
    box-shadow: 0em 0em 0em 0em var(--color);
}

.suit-club-blue {
    --color: #004b7a;
    font-size: 0.8em;
}

.suit-club-red {
    --color: #940034;
    font-size: 1.5em;
}

.suit-club-green {
    --color: #305026;
    font-size: 2.2em;
}

.suit-heart {
    appearance: none;
    background-color: #FFFFFF;
    border-radius: 40em;
    border-style: none;
    box-sizing: border-box;
    color: #000000;
    cursor: pointer;
    display: inline-block;
    font-weight: 700;
    letter-spacing: -0.015em;
    margin: 0;
    outline: none;
    padding: 1em 1.3em;
    quotes: auto;
    text-align: center;
    text-decoration: none;
    transition: all .15s;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.suit-heart:hover {
    background-color: #FFC229;
    box-shadow: #FF6314 0 -0.375em 0.5em inset;
    transform: scale(1.125);
}

.suit-heart:active {
    transform: scale(1.025);
}

.suit-heart-small {
    font-size: 0.8em;
    font-family: serif;
    box-shadow: #adffd2 0 -0.75em 0.375em inset;
}

.suit-heart-normal {
    font-size: 1.5em;
    font-family: -apple-system, sans-serif;
    box-shadow: #ADCFFF 0 -0.75em 0.375em inset;
}

.suit-heart-large {
    font-size: 2.5em;
    font-family: monospace;
    box-shadow: #d3adff 0 -0.75em 0.375em inset;
}

.suit-spade {
    --c: #fff;
    color: #0000;
    border: none;
    outline-offset: .1em;
    font-weight: bold;
    margin: 0;
    cursor: pointer;
    padding: .1em .3em;
    text-align: center;
    transition: 0.3s;
}

.suit-spade-small:hover,
.suit-spade-small:focus-visible {
    --_p: 100%;
    --_i: 1;
}

.suit-spade-normal:hover,
.suit-spade-normal:focus-visible {
    --_p: 0%;
    --_i: 1;
}

.suit-spade-large:hover,
.suit-spade-large:focus-visible {
    --_p: 0%;
    --_i: 1;
    --_x: -1;
}

.suit-spade:active {
    text-shadow: none;
    color: var(--c);
    box-shadow: inset 0 0 9e9q #0005;
    transition: 0s;
}

.suit-spade-small {
    font-size: 1em;
    transform: perspective(31.25em) rotateY(calc(-20deg*var(--_i, -1)));
    text-shadow: calc(var(--_i, -1)* -0.08em) -.01em 0 var(--c),
        calc(var(--_i, -1)*0.08em) .01em 0.125em #0004;
    background: linear-gradient(90deg, #0000 33%, #fff5, #0000 67%) var(--_p, 0%)/300% no-repeat,
        #004dff;
}

.suit-spade-normal {
    font-size: 2.2em;
    transform: perspective(31.25em) rotateY(calc(20deg*var(--_i, -1)));
    text-shadow: calc(var(--_i, -1)* 0.08em) -.01em 0 var(--c),
        calc(var(--_i, -1)*-0.08em) .01em 0.125em #0004;
    background: linear-gradient(90deg, #0000 33%, #fff5, #0000 67%) var(--_p, 100%)/300% no-repeat,
        #004dff;
}

.suit-spade-large {
    font-size: 3.3em;
    transform: perspective(31.25em) rotateX(calc(20deg*var(--_i, -1)));
    text-shadow: -.01em calc(var(--_i, -1)* -0.08em) 0 var(--c),
        .01em calc(var(--_i, -1)*0.08em) 0.125em #0004;
    background: linear-gradient(180deg, #0000 33%, #fff5, #0000 67%) 0% calc(var(--_x, 1) * -150%)/100% 200% no-repeat,
        #004dff;
}

.suit-diamond {
    all: unset;
    width: 6.25em;
    height: 1.875em;
    background: transparent;
    border: none;
    position: relative;
    color: #f0f0f0;
    cursor: pointer;
    z-index: 1;
    padding: 0.625em 1.25em;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    border-radius: 0.625em;
}

.suit-diamond::after,
.suit-diamond::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    z-index: -99999;
    transition: all .4s;
}

.suit-diamond::before {
    transform: translate(0%, 0%);
    width: 100%;
    height: 100%;
    border-radius: 0.625em;
}

.suit-diamond::after {
    transform: translate(0.625em, 0.625em);
    width: 2.1875em;
    height: 2.1875em;
    background: #ffffff15;
    backdrop-filter: blur(0.3125em);
    -webkit-backdrop-filter: blur(0.3125em);
    border-radius: 3.125em;
}

.suit-diamond:hover::before {
    transform: translate(5%, 20%);
    width: 110%;
    height: 110%;
}

.suit-diamond:hover::after {
    border-radius: 0.625em;
    transform: translate(-2.5%, -10%);
    width: 95%;
    height: 100%;
}

.suit-diamond:active::after {
    transition: 0s;
    transform: translate(-2.5%, -5%);
}

.suit-diamond-small {
    font-size: 0.8em;
    background-color: #d91717;
}

.suit-diamond-normal {
    font-size: 1.5em;
    background-color: #000000;
}

.suit-diamond-large {
    font-size: 2.2em;
    background-color: #327b33;
}

/**
  * Responsive Images
  * set width to 100%
  * images will scale to fit the container
  * percentage is based on the width of the containing block (parent element)
  */
img {
    width: 100%;
}

/**
  * Setup flex container
  * elements flow in row direction (left to right)
  * gap between elements is 20px
  * margin is 0 on top 
  * 20px on right and left
  * 20px on bottom
  */
footer {
    display: flex;
    gap: 20px;
    margin: 0 20px 20px;
}

/**
  * All anchor pseudo states
  * remove default text decoration
  * color is white
  * height is 2 * font-size (2 * 16 = 32)
  */
footer a {
    color: white;
    text-decoration: none;
    line-height: 2;
}

/**
  * first child of footer
  * margin-right is auto
  * as a flex item margin auto will consume all available space (unused pixels
  * the other flex items will be pushed to the right)
  */
footer a:first-child {
    margin-right: auto;
}

/**
  * square brackets are attribute selectors
  * href^="javascript" means href attribute starts with javascript
  * the $ means ends with
  * the * means contains
  * the ~ means contains word
  * the | means starts with
  * the ^ means starts with
  * the = means is equal to
  * the != means is not equal to
  * position is relative (setting up for the active state - moving the element down 2px)
  * style like a button
  */
footer a[href^="javascript"] {
    position: relative;
    color: #000;
    background-color: #fff;
    border-radius: 3px;
    padding: 0 10px;
    box-shadow: 0 2px 2px #000;
}

footer a[href^="javascript"]:active {
    top: 2px;
    box-shadow: none;
}



/*
Start Media Query
     if screen is 48rem or larger (can use px or em)
     rem is based on font size of root element
         (16px * 48 = 768)
     use the following rules
*/

@media (min-width: 48rem) {
    /**
    * override the margin of the container 
    * margin is now 20px on top and bottom
    * auto on left and right
    * auto will center the container
    */

    .wrapper {
        margin: 20px auto;
        position: relative;
    }

    /**
    * height is 400px - a design decision
    * multiple background images
    * background is the shorthand property
    * url() is the background-image property
    * no-repeat is the background-repeat property
    * 80px -10px is the background-position property (x, y)
    * / 200px 200px is the background-size property (width, height)
    */
    /* prettier-ignore */
    header {
        height: 400px;
        background:
            url(images/amazed.webp) no-repeat top left / 250px 250px,
            url(images/ace.webp) no-repeat center center / cover,
            linear-gradient(to bottom,
                hsl(0, 100%, 48%),
                hsl(0, 100%, 44%)) #000;
        position: relative;
    }

    header::after {
        content: " ";
        float: right;
        background: url(images/arrow-rotate2.webp) no-repeat top left / 400px 400px;
        width: 400px;
        height: 400px;
        position: absolute;
        right: -95px;
        top: -70px;
    }

    /**
    * font-size is 2.75 * inherited font-size (16px)
    * height is 2 * font-size (2.75 * 16 = 44)
    * flex item flowing in row direction (left to right the main axis)
    * align-self is flex-end (bottom of flex container the cross axis)
    * remove border-radius from top of header
    */
    header h1 {
        font-size: 2.75em;
        line-height: 2;
        align-self: flex-end;
        border-top-left-radius: 0px;
        border-top-right-radius: 0px;
    }

    /**
    * override the width of the image (auto is the intrinsic width)
    * float the image to the right
    * set margin opposite the float direction
    */
    img {
        width: 250px;
        height: 250px;
        float: right;
        margin: 0 0 50px 5px;
    }
}