/* Base page layout */
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #222222;
    background-color: #ffffff;
}

header,
main,
footer {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Navigation links in the header; they wrap onto more lines on a phone */
nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    padding: 0;
    list-style: none;
}

nav a {
    color: #1f5f8b;
}

/* Leave room above a section when a navigation link scrolls to it */
section {
    scroll-margin-top: 110px;
}

footer {
    margin-top: 40px;
    font-size: 16px;
    color: #555555;
}

/* On wide screens the header stays at the top so the questions are always one click away */
@media (min-width: 700px) {
    header {
        position: sticky;
        top: 0;
        z-index: 10;
        background-color: #ffffff;
        border-bottom: 1px solid #dddddd;
    }

    header h1 {
        margin: 12px 0 0;
        font-size: 26px;
    }

    nav ul {
        margin: 8px 0 12px;
    }
}

/* Three key numbers in the introduction, shown directly as text */
.key-numbers {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 0;
    list-style: none;
}

.key-numbers li {
    flex: 1 1 200px;
    padding: 12px 16px;
    background-color: #f4f4f4;
    border-radius: 4px;
}

.key-numbers strong {
    display: block;
    font-size: 28px;
}

/* Active chart titles state the takeaway of each chart */
.chart-title {
    margin-bottom: 4px;
    font-size: 18px;
}

/* "What this means" box at the end of each question */
.takeaway {
    padding: 12px 16px;
    border-left: 4px solid #222222;
    background-color: #f4f4f4;
}

/* Notes under a chart (accessibility: page text at least 16px, Week 8) */
.chart-note {
    font-size: 16px;
    color: #555555;
}

/* How to use the charts (Week 8 interaction cues) */
.instructions {
    max-width: 600px;
    margin-top: 24px;
    padding: 15px 20px;
    background-color: #f4f4f4;
    border-radius: 4px;
}

/* Filter buttons (Week 6 filters exercise); black for the active button, as in the Design Book palette */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}

.filter {
    padding: 8px 14px;
    font-size: 16px;
    color: #222222;
    background-color: #e6e6e6;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease-in;
}

.filter:hover {
    background-color: #cccccc;
}

.filter.active {
    color: #ffffff;
    background-color: #222222;
    cursor: default;
}

/* Accessibility: a clear outline when a button or link is reached with the keyboard */
.filter:focus-visible,
a:focus-visible {
    outline: 3px solid #0072b2;
    outline-offset: 2px;
}

/* Accessibility: text for screen readers only, hidden on screen (Week 8) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* A label in front of a row of buttons when a chart has two sets of filters */
.filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.filter-row .filters {
    margin: 6px 0;
}

.filter-row-label {
    min-width: 48px;
    font-weight: 700;
}
