@import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');

body {
    background-color: #f0f8ff;
    color: #222;
    font-family: Arial, sans-serif;
}

/* Sticky header */
header {
    position: sticky;
    top: 0;
    background-color: #fff;
    z-index: 10;
}

/* Absolutely position the “Back to Top” link */
footer nav {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
}

/* CSS Variables + Fallback */
:root {
    --main-color: #d63384;
}

b.specs {
    color: var(--main-color, #ff69b4);
    /* fallback to pink */
}

/* Element Selector */
h2 {
    color: rgb(34, 90, 150);
}

/* ID Selector */
#top {
    background-color: color-mix(in srgb, blue 70%, white);
    color: white;
    padding: 1rem;
}

/* Class Selector */
.specs {
    font-weight: bold;
}

/* Attribute Selector */
input[placeholder] {
    background-color: #fff3cd;
}

/* Universal Selector */
* {
    box-sizing: border-box;
}

/* Descendant Combinator */
main section {
    margin-bottom: 2rem;
}

/* Child Combinator */
ul>li {
    margin-left: 1rem;
}

/* General Sibling Combinator */
h2~p {
    font-style: italic;
}

/* Adjacent Sibling Combinator */
h3+section {
    border-top: 2px solid #ccc;
}

/* Combining Selectors */
h1.title,
#top {
    text-transform: uppercase;
}

button {
    min-width: 100px;
    width: 3cm;
    height: 10mm;
}

/* Pseudo-class Selector */
a:hover {
    color: #ff5733;
}

/* Unit Usage */
nav {
    padding: 1rem;
    margin-top: 2em;
    border-radius: 10px;

    ul {
        display: flex;
        gap: 1rem;
        list-style: none;

        li {
            a {
                text-decoration: none;
                color: #333;

                &:hover {
                    color: #d63384;
                }
            }
        }
    }
}


/* Box Model (Long and Short) */
section {
    margin-top: 1rem;
    margin-bottom: 1rem;
    padding: 1rem 2rem;
    border: 2px solid #999;
}

/* Display property */
nav ul {
    display: inline-block;
}

body {
    font-family: 'Roboto', sans-serif;
}

/* Section box model (longhand margin + padding) */
section {
    margin-top: 1rem;
    margin-right: 1rem;
    margin-bottom: 1rem;
    margin-left: 1rem;

    padding-top: 0.5rem;
    padding-right: 1rem;
    padding-bottom: 0.5rem;
    padding-left: 1rem;

    border-style: solid;
    border-color: #aaa;
    border-width: 2px;
    border-radius: 8px;
}

/* Shorthand version */
footer {
    margin: 1rem auto;
    padding: 1rem 2rem;
    border: 1px dashed #666;
    border-radius: 5px;
}

/* Form fieldset styling */
fieldset {
    border-style: dotted;
    border-color: #555;
    border-width: 2px;
    padding: 0.5rem;
    margin-top: 1rem;
    border-radius: 6px;
}

/* Example Grid Container */
.media-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    justify-items: center;
}

/* Highlight any <fieldset> that contains a <select> dropdown */
fieldset:has(select) {
    background-color: #f0f8ff;
    border: 2px solid #00bfff;
}

/* Media Query for Desktop approach */
nav ul {
    display: flex;
    justify-content: center;
    gap: 1rem;
    list-style-type: none;
}

img,
video {
    max-width: 100%;
    height: auto;
}

main {
    padding: 2rem;
}

/* Media Query for Tablet */
@media screen and (max-width: 768px) {
    nav ul {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }

    main {
        padding: 1.5rem;
        font-size: 1rem;
    }

    footer {
        padding: 1rem;
        text-align: center;
    }
}

/* Media Query for Mobile */
@media screen and (max-width: 480px) {
    body {
        font-size: 14px;
    }

    h1,
    h2 {
        font-size: 1.2rem;
        text-align: center;
    }

    main {
        padding: 1rem;
    }

    nav ul {
        padding: 0;
    }

    img,
    video {
        display: block;
        margin: 0 auto;
        width: 90%;
    }

    input,
    textarea,
    select {
        width: 100%;
        box-sizing: border-box;
    }
}