/* ============================================================
   styles.css — HW2 Personal Website
   External stylesheet linked to all pages
   ============================================================ */

/* ------ 1. Box-model reset (inheritance) ------ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ------ 2. Body — element selector ------ */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* fallback chain */
    font-size: 1rem;           /* relative unit */
    line-height: 1.6;
    color: #222;
    background-color: #f5f7fa; /* background color on body */
    min-height: 100vh;         /* vh unit */
}

/* ------ 3. Header — element selector + background ------ */
header {
    background-color: #1a1a2e;
    color: #eaeaea;
    padding: 1.5rem 2rem;      /* rem units */
    border-bottom: 4px solid #e94560;
}

/* ------ 4. h1, h2, h3 — element selectors + text-shadow ------ */
h1 {
    font-size: 2rem;
    font-weight: 700;
    text-transform: uppercase;   /* text-transform */
    letter-spacing: 0.05em;      /* em unit */
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.45); /* text-shadow */
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 0.75rem;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.15);
    border-bottom: 2px solid #e94560;
    padding-bottom: 0.3rem;
    text-align: left;
}

h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

/* ------ 5. Paragraphs — element selector ------ */
p {
    font-size: 1rem;
    margin-bottom: 1rem;
    text-align: justify;        /* text-align */
}

/* ------ 6. Navigation — element + descendant selectors ------ */
nav {
    background-color: #16213e;  /* background color on nav */
    padding: 0.5rem 0.75rem;
    margin-top: 0.75rem;
    border-radius: 4px;
}

nav ul {
    list-style-type: none;      /* list-style-type */
    list-style-position: inside;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0;
}

nav ul li {
    margin: 0;
}

/* descendant selector: nav a */
nav a {
    color: #e0e0e0;
    text-decoration: none;      /* remove underlines from nav links */
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.4rem 1rem;
    border-radius: 3px;
    display: inline-block;
    text-transform: capitalize;
}

nav a:hover {
    background-color: #e94560;
    color: #fff;
}

/* ------ 7. Main container — box model (width, margin, padding) ------ */
main {
    max-width: 55rem;           /* rem unit */
    width: 90vw;                /* vw unit */
    margin: 2rem auto;
    padding: 0 1.5rem;
}

/* ------ 8. Section & Article — box model (border, padding, margin) ------ */
section,
article {
    background-color: #ffffff;
    border: 1px solid #dde1ea;  /* border */
    border-radius: 6px;
    padding: 1.5rem 2rem;       /* padding */
    margin-bottom: 1.5rem;      /* margin */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

/* ------ 9. ul / ol — element selectors + list-style ------ */
ul {
    list-style-type: disc;          /* list-style-type */
    list-style-position: outside;   /* list-style-position */
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

ol {
    list-style-type: decimal;
    list-style-position: outside;
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

ul li,
ol li {
    margin-bottom: 0.4rem;
    font-size: 1rem;
}

/* ------ 10. Definition list dl, dt, dd — element selectors ------ */
dl {
    margin-bottom: 1rem;
    padding-left: 0.5rem;
}

dt {
    font-weight: 700;
    font-style: normal;
    color: #1a1a2e;
    margin-top: 0.75rem;
    text-transform: capitalize;
}

dd {
    font-style: italic;         /* font-style */
    color: #555;
    margin-left: 1.5rem;
    margin-bottom: 0.5rem;
}

/* ------ 11. Anchor — element selector ------ */
a {
    color: #e94560;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
    color: #c0392b;
}

/* ------ 12. Blockquote ------ */
blockquote {
    border-left: 4px solid #e94560;
    padding: 0.75rem 1.25rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: #555;
    background-color: #fef9f9;
    border-radius: 0 4px 4px 0;
}

/* ------ 13. Figure & img ------ */
figure {
    margin: 1.25rem 0;
    text-align: center;
}

figure img {
    max-width: 100%;
    height: auto;
    border: 2px solid #dde1ea;
    border-radius: 4px;
}

figcaption {
    font-size: 0.875rem;
    color: #666;
    margin-top: 0.5rem;
    font-style: italic;
}

/* ------ 14. time element ------ */
time {
    font-size: 0.85rem;
    color: #888;
    display: block;
    margin-bottom: 0.75rem;
}

/* ------ 15. Form elements ------ */
form {
    background-color: #ffffff;
    border: 1px solid #dde1ea;
    border-radius: 6px;
    padding: 2rem;
    max-width: 600px;
    margin: 0 auto 1.5rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

label {
    font-weight: 600;
    color: #1a1a2e;
    display: block;
    margin-top: 1rem;
    margin-bottom: 0.3rem;
    font-size: 0.95rem;
}

input[type="text"],
input[type="email"],
textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;       /* inheritance */
    font-size: 1rem;
    background-color: #fafafa;
}

input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
    outline: 2px solid #e94560;
    border-color: #e94560;
    background-color: #fff;
}

button[type="submit"] {
    margin-top: 1.25rem;
    padding: 0.6rem 1.8rem;
    background-color: #e94560;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;  /* text-transform */
    letter-spacing: 0.04em;
}

button[type="submit"]:hover {
    background-color: #c0392b;
}

/* ------ 16. Footer ------ */
footer {
    background-color: #1a1a2e;
    color: #aaaaaa;
    text-align: center;         /* text-align */
    padding: 1rem 2rem;
    font-size: 0.875rem;
    margin-top: 2rem;
}

/* ------ 17. ID selector: #intro (unique element) ------ */
#intro {
    background-color: #eef2ff;
    border-left: 5px solid #1a1a2e;
    padding: 1.5rem 2rem;
}

/* ------ 18. Class selector: .highlight (reusable) ------ */
.highlight {
    background-color: #fff3cd;
    color: #856404;
    font-weight: 600;
    padding: 0.1em 0.4em;
    border-radius: 3px;
}

/* ------ 19. Back-to-top link (descendant selector) ------ */
p a[href="#top"] {
    font-size: 0.875rem;
    color: #888;
    display: inline-block;
    margin-top: 0.5rem;
    border: 1px solid #ccc;
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
}

p a[href="#top"]:hover {
    background-color: #e94560;
    color: #fff;
    text-decoration: none;
    border-color: #e94560;
}

/* ------ 20. Responsive Design (relative units + media query) ------ */
@media (max-width: 600px) {
    h1 {
        font-size: 1.4rem;
    }

    h2 {
        font-size: 1.2rem;
    }

    main {
        padding: 0 0.75rem;
    }

    nav ul {
        flex-direction: column;
    }

    section,
    article {
        padding: 1rem 1.25rem;
    }

    form {
        padding: 1.25rem;
    }
}
