/* Class 16: Step 3: Padding counts inside width, not on top of it */
* {
    box-sizing: border-box
}

/* Class 11: Step 4: The basics */
:root {
    --text: #1A237E;
    --text-muted: #5C6BC0;
    --accent: #EA2563;
    --background: #ffffff;
    --border: #abacac;
    --error: crimson;
}

body {
    font-family: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--background);
    line-height: 1.6;
    /* Lab 14: Task 5: Break your own page */
    max-width: 50rem;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

h1 { 
    font-size: 3rem; /* Class 12: Step 2: My own scale */
    margin-bottom: 0.25rem; 
    margin-top: -1rem;
    /* Lab 14: Task 5: Break my own page */
    line-height: 1.3;
}

header p { 
    color: var(--text-muted); 
    font-size: 1.1rem; 
    margin-top: 0; 
    flex-wrap: wrap;
}

nav button {
    font: inherit;
    font-weight: 500;
    color: var(--background);
    background: var(--accent);
    border: none;
    border-radius: 4px;
    padding: 0.2rem 1rem;
    cursor: pointer;
}


h2 {
    font-size: 1.75rem; /* Class 12: Step 2 */
    line-height: 1.2; /* Class 12: Step 2 */
    margin-top: 2.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

p { 
    font-size: 1.05rem; /* Class 12: Step 2 */
    margin-bottom: 1rem;
}

/* Lab 12: Task 3: Footer */
/* Lab 14: Task 4: Foot stacks on narrow screens */
footer { 
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
}

footer ul {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

footer button {
    font: inherit;
    font-weight: 700;
    color: var(--background);
    background: var(--accent);
    border: none;
    border-radius: 6px;
    padding: 0.6rem 1.4rem;
    cursor: pointer;
}

@media (min-width: 43rem) {
    footer { 
        flex-direction: row; 
        justify-content: space-between;
        align-items: center;
    }
}

/* Lab 11: Task 4: Links */
a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

a:hover { border-bottom-color: var(--accent); }

.portrait {
    width: 180px;
    height: 180px;
    object-fit: cover;
    border-radius: 50%;
    margin-top: 0.5rem;
}

section {
    margin-bottom: 3rem;
}

/* Lab 12: Task 2: List without bullets */
ul {
    list-style: none;
    padding-left: 1.25rem;
}

li {
    margin-bottom: 0.5rem;
    padding-left: 1rem;
    border-left: 2px solid var(--accent)
}

/* Lab 12: Task 1: Header side by side */
header {
    /* Lab 12: Task 4: Let the header stack when there isn't room */
    flex-wrap: wrap;
    display: flex;
    align-items: center;
    /* Lab 12: Task 4: Changing the gap */
    gap: 1rem;
}

/* Lab 13: Task 4: Separate the bar from the header */
nav {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

/* Lab 13: Step 3: The nav bar */
nav a {
    text-decoration: none;
    font-weight: 700;
    padding-bottom: 0.25rem;
    border-bottom: 2px solid transparent;
}

nav a:hover {
    border-bottom-color: var(--accent);
}

/* Lab 13: Task 1: Which page am I on */
nav a.current {
    border-bottom-color: var(--accent);
    color: var(--accent);
}

/* Lab 14: Task 1: The nav stacks on narrow screens */
nav ul {
    display: flex;
    gap: 1rem;
    list-style: none;
    padding-left: 0;
    margin-bottom: 2rem;
    flex-direction: column;
}

@media (min-width: 33rem) {
    nav ul{
        flex-direction: row;
    }
}

/* Class 14: Step 2: The cards go in a row */
/* Class 14: Step 3: Stack by default */
/* Class 14: Step 5: Break my own page */
.cards {
    display: flex;
    /* Lab 14: Task 6: One layout choice of my own */
    flex-wrap: wrap;
    flex-direction: column;
    gap: 1.5rem;
}

.card {
    flex: 1;
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
}

/* Class 14: Step 3: A row when there's room */
@media (min-width: 43rem) {
    .cards {
        flex-direction: row;
    }
}

body.dark {
    --text: white;
    --text-muted: silver;
    --accent: #EA2563;
    --background: black;
    --border: dimgray;
    --error: lightsalmon;
}

/* Class 16: Step 3: The form */
form label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

form input, form textarea {
    font: inherit;
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--background);
    color: var(--text);
}

form input:focus, form textarea:focus {
    border-color: var(--accent);
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

form button {
    font: inherit;
    font-weight: 700;
    color: var(--background);
    background: var(--accent);
    border: none;
    border-radius: 6px;
    padding: 0.6rem 1.4rem;
    cursor: pointer;
}

#form-status {
    font-weight: 500;
    color: var(--accent);
}

/* Lab 16: Task 2: The error state */
#form-status.error {
    color: var(--error);
}