/* Homework 3: one external stylesheet shared by all four pages. */

/* Box model: width includes padding and borders. */
* {
    box-sizing: border-box;
}

/* Font, text color, and line height are inherited by child elements. */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    background-color: #f3f6fb;
    color: #24344d;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1rem;
    line-height: 1.7;
}

.container {
    width: 90%;
    max-width: 68rem;
    margin: 0 auto;
}

.site-header {
    background-color: #142849;
    color: #ffffff;
}

.header-content {
    padding: 2.7rem 0 2.3rem;
}

h1 {
    margin: 0;
    color: #142849;
    font-size: 2.8rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: left;
    text-shadow: 0 0.08rem 0.12rem rgba(0, 0, 0, 0.2);
}

h2 {
    margin: 0 0 1rem;
    color: #142849;
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.35;
    text-shadow: 0 0.06rem 0.1rem rgba(20, 40, 73, 0.1);
}

h3 {
    margin: 0 0 0.8rem;
    color: #142849;
    font-size: 1.2rem;
    line-height: 1.4;
}

p {
    margin: 0 0 1rem;
}

.site-header h1 {
    color: #ffffff;
    text-transform: capitalize;
}

a {
    color: #204eaa;
    text-decoration: underline;
    text-underline-offset: 0.2em;
    overflow-wrap: anywhere;
}

a:hover {
    color: #142849;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 0.2rem solid #ad6200;
    outline-offset: 0.25rem;
}

nav {
    padding: 0.6rem 0;
    border-top: 0.06rem solid #3d5272;
    border-bottom: 0.2rem solid #3566c8;
    background-color: #142849;
}

.site-nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0 auto;
    padding: 0;
    list-style-type: none;
}

.site-nav li {
    margin: 0;
}

/* Descendant selector: this link style applies inside navigation. */
nav a {
    display: block;
    padding: 0.6rem 1.1rem;
    border-radius: 0.3rem;
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
}

nav a:hover,
nav a[aria-current="page"] {
    background-color: #2d5dc0;
    color: #ffffff;
}

.skip-link {
    position: absolute;
    z-index: 1;
    top: -5rem;
    left: 1rem;
    padding: 0.65rem 1rem;
    border-radius: 0.25rem;
    background-color: #ffffff;
    color: #142849;
    font-weight: 700;
}

.skip-link:focus {
    top: 1rem;
}

main {
    flex: 1;
    padding: 2.5rem 0;
}

section {
    width: 100%;
    margin-bottom: 2rem;
}

/* ID selector: only the home page introduction has this treatment. */
#intro {
    padding: 2rem;
    border: 0.06rem solid #cbd8ed;
    border-left: 0.35rem solid #2d5dc0;
    border-radius: 0.5rem;
    background-color: #ffffff;
}

#intro p {
    max-width: 55rem;
    margin-bottom: 0;
    font-size: 1.08rem;
}

.section-heading {
    margin-bottom: 1.6rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 1.4rem;
}

.grid-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid > * {
    min-width: 0;
}

.card {
    height: 100%;
    margin: 0;
    padding: 1.6rem;
    border: 0.06rem solid #d2dceb;
    border-radius: 0.5rem;
    background-color: #ffffff;
}

.card > :last-child {
    margin-bottom: 0;
}

.highlight {
    margin: 0 0 1.2rem;
    padding: 1rem 1.2rem;
    border-left: 0.25rem solid #2d5dc0;
    background-color: #fff7dc;
    color: #142849;
    font-style: italic;
}

/* Rule order: both selectors have the same specificity. This later
   background color overrides the earlier yellow on .highlight. */
.highlight {
    background-color: #e8efff;
}

.highlight p {
    margin: 0;
}

ul {
    margin: 0 0 1rem;
    padding-left: 1.4rem;
    list-style-type: square;
    list-style-position: outside;
}

ol {
    margin: 0 0 1rem;
    padding-left: 1.5rem;
    list-style-type: decimal;
    list-style-position: outside;
}

li {
    margin-bottom: 0.45rem;
}

dl {
    margin: 0 0 1rem;
    padding: 1rem;
    border: 0.06rem solid #d2dceb;
    border-radius: 0.35rem;
    background-color: #f8faff;
}

dt {
    color: #142849;
    font-weight: 700;
}

dd {
    margin: 0.2rem 0 0.9rem;
}

dd:last-child {
    margin-bottom: 0;
}

.quote-section {
    margin: 2rem 0 0;
}

.quote-section blockquote {
    margin-bottom: 0;
}

.button {
    display: inline-block;
    padding: 0.65rem 1.2rem;
    border: 0.12rem solid #2453ad;
    border-radius: 0.35rem;
    background-color: #2453ad;
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.button:hover {
    border-color: #142849;
    background-color: #142849;
    color: #ffffff;
}

.project-card {
    display: flex;
    flex-direction: column;
}

.project-date {
    color: #4b5d77;
    font-size: 0.9rem;
}

figure {
    margin: 0.4rem 0 1.4rem;
}

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

/* Equal preview heights keep the project cards consistent. */
.project-preview {
    display: block;
    width: 100%;
    height: 18rem;
    border: 0.06rem solid #d2dceb;
    border-radius: 0.3rem;
    background-color: #eef2f8;
    object-fit: contain;
}

figcaption {
    margin-top: 0.6rem;
    color: #4b5d77;
    font-size: 0.85rem;
}

.project-link {
    margin-top: auto;
}

.contact-card {
    max-width: 46rem;
    height: auto;
    margin: 0 auto;
}

.form-field {
    margin-bottom: 1.2rem;
}

label {
    display: block;
    margin-bottom: 0.35rem;
    color: #142849;
    font-weight: 700;
}

input,
textarea {
    display: block;
    width: 100%;
    padding: 0.65rem 0.8rem;
    border: 0.08rem solid #6c7e99;
    border-radius: 0.3rem;
    background-color: #ffffff;
    color: inherit;
    font: inherit;
}

textarea {
    min-height: 9rem;
    resize: vertical;
}

form > :last-child {
    margin-bottom: 0;
}

.site-footer {
    padding: 1.5rem 0;
    border-top: 0.06rem solid #d2dceb;
    background-color: #e9eff8;
    color: #344864;
    font-size: 0.9rem;
}

.footer-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem 1.5rem;
}

.site-footer p {
    margin: 0;
}

/* Relative units and a single column keep small screens readable. */
@media (max-width: 40rem) {
    .header-content {
        padding: 2rem 0 1.7rem;
    }

    h1 {
        font-size: 2.1rem;
    }

    h2 {
        font-size: 1.45rem;
    }

    main {
        padding: 1.5rem 0;
    }

    #intro,
    .card {
        padding: 1.25rem;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .site-nav ul {
        gap: 0.2rem;
    }

    nav a {
        padding: 0.55rem 0.7rem;
    }

    .footer-content {
        justify-content: center;
        text-align: center;
    }
}
