/* CSS VARIABLES (Custom Properties) */
:root {
    --primary-color: #2c3e50;
    --accent-color: #3498db;
}

/* BASE STYLES */
body {
    font-family: 'Merriweather', "Times New Roman", serif; 
    margin: 0;
    padding: 20px; 
    background-color: #353434; 
    color: color(srgb 0.2 0.2 0.2); /* wider-gamut color */
}

/* TYPOGRAPHY */
h1, h2, h3 {
    font-family: 'Merriweather', serif;
    color: #2c3e50; /* hex color */
    font-size: 2em; /* relative unit: em */
}

h2 {
    font-size: 1.5rem; /* relative unit: rem */
}

/* Override heading color inside header */
header h1, header h2, header h3 {
    color: white; /* color name */
}

/* IMAGE */
img {
    border-radius: 50%;
    width: 150px; /* absolute unit: px */
    display: block; /* block display */
    margin: auto; /* auto margin to center */
}

/* LINKS & PSEUDO-CLASSES */
a {
    color: #3498db; /* hex color */
    text-decoration: none;
}

/* :hover pseudo-class */
a:hover {
    text-decoration: underline;
}

/* :active pseudo-class */
a:active {
    color: var(--primary-color, #2c3e50);
}

/* HEADER */
header {
    background-color: var(--primary-color, #2c3e50); /* CSS variable with fallback */
    color: white;
    /* Padding longhand - absolute units */
    padding-top: 20pt; /* absolute unit: pt */
    padding-bottom: 20px;
    padding-left: 0px;
    padding-right: 0px;
    text-align: center;
    /* Margin longhand */
    margin-top: 0px;
    margin-bottom: 0.5cm; /* absolute unit: cm */
    margin-left: 0px;
    margin-right: 0px;
    /* Border shorthand */
    border: 2px solid var(--primary-color, #2c3e50);
}

/* NAVIGATION */
nav {
    background-color: rgb(236, 240, 241); /* rgb color */
    /* Padding shorthand */
    padding: 10px 20px 10px 20px;
    /* sticky positioning - stays at top when scrolling */
    position: sticky;
    top: 0;
    z-index: 100;
}

nav h3 {
    color: black; /* color name */
}

nav ul {
    list-style: none;
    padding: 0;
}

/* inline display for horizontal nav links */
nav ul li {
    display: inline;
    margin-right: 15px;
}

/* MAIN CONTENT */
main {
    width: 90%; /* relative unit: % */
    max-width: 900px;
    min-width: 300px;
    /* Margin shorthand with auto */
    margin: 20px auto;
    background-color: hsl(0, 0%, 100%); /* hue, saturation, lightness color */
    padding: 30px;
    border-radius: 8px;
}

/* SECTIONS */
section {
    /* Margin shorthand */
    margin-bottom: 30px;
    /* Padding longhand */
    padding-top: 20px;
    padding-bottom: 20px;
    padding-left: 15px;
    padding-right: 15px;
    /* Border longhand */
    border-style: solid;
    border-color: #2c3e50;
    border-width: 1px;
    border-radius: 5px;
    /* relative positioning */
    position: relative;
}

/* inline-block display for section headings */
section h2 {
    display: inline-block;
    border-bottom: 2px solid var(--primary-color, #2c3e50);
    margin-bottom: 10px;
    text-decoration: underline; /* text decoration */
}

/* FOOTER */
footer {
    /* color-mix color */
    background-color: color-mix(in srgb, #2c3e50 80%, white 20%);
}

/* FLEXBOX */
nav ul {
    display: flex; /* flex display */
    flex-direction: row; /* arrange items horizontally */
    flex-wrap: wrap; /* wrap items if screen is too small */
    justify-content: flex-start; /* align items to the left */
    gap: 15px; /* space between items */
}

/* GRID */
main {
    display: grid;
    grid-template-columns: 1fr; /* single column layout */
    grid-gap: 20px; /* space between grid items */
    align-items: start; /* align items to the top */
}

/* MEDIA QUERIES */

/* Tablet */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    main {
        width: 95%;
        padding: 15px;
    }

    nav ul {
        flex-direction: column;
        gap: 5px;
    }
}

/* Phone */
@media (max-width: 480px) {
    h1 {
        font-size: 1.5em;
    }

    h2 {
        font-size: 1.2rem;
    }

    main {
        min-width: 0;
        width: 100%;
    }

    nav ul li {
        display: block;
        margin-bottom: 5px;
    }
}

/* height property */
header {
    min-height: 100px;
}

/* rgba color */
hr {
    border: 1px solid rgba(44, 62, 80, 0.3); /* rgb with alpha */
}

/* display none example */
/* hides element, can be toggled with JS later */
.hidden {
    display: none;
}

/* hsla color */
section:hover {
    background-color: hsla(210, 29%, 24%, 0.05); /* hsla with alpha */
}

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

/* Class Selector */
.highlight {
    background-color: rgba(52, 152, 219, 0.1);
    border-left: 3px solid var(--accent-color, #3498db);
}

/* ID Selector */
#details {
    border-color: var(--accent-color, #3498db);
}

/* Attribute Selector */
input[type=text] {
    border: 1px solid #2c3e50;
    padding: 5px;
    border-radius: 4px;
}

/* Child Combinator */
main > section {
    margin-top: 10px;
}

/* Adjacent Sibling Combinator */
h2 + p {
    margin-top: 0;
    color: #555;
}

/* General Sibling Combinator */
h2 ~ p {
    line-height: 1.6;
}

/* Combining Two Selectors */
section#details {
    border-top: 3px solid var(--accent-color, #3498db);
}

/* :has() selector */
section:has(h2) {
    padding-top: 25px;
}

/* Nested Selectors */
nav {
    & ul {
        & li {
            font-size: 0.95em;
        }
    }
}

