/*
*Ryan Guan
*October 29, 2026
*Assignment 6 - stylesheet for my prisoner's dilemma site in /grid/
*/

/**** Reset ***/

*, *::before, *::after {
    box-sizing: border-box;
}

img, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/**** Global & Fonts ***/

h1, h2, h3 {
    font-family: "Merriweather", Georgia, serif;
    line-height: 1.3;
}

h1 {
    font-size: 1.6rem;
    margin: 0;
}

p {
    max-width: 65ch;
}

/******* Outer Grid (whole page) ********/

body {
    display: grid;
    min-height: 100vh;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
        "header"
        "main"
        "footer";
    margin: 0;
    background-color: #f7f4ec;
    color: #222222;
    font-family: "Open Sans", Helvetica, Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
}

header {
    grid-area: header;
    background-color: #1f3a5f;
    color: white;
    padding: 1rem;
}

main {
    grid-area: main;
    padding: 1rem;
}

footer {
    grid-area: footer;
    background-color: #e8e2d4;
    padding: 1rem;
}

/******* Header & Nav (flexbox) ********/

/* logo and h1 sit side by side */
header > div {
    display: flex;
    align-items: center;
    gap: 15px;
}

header svg {
    width: 70px;
}

nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
}

nav a {
    display: block;
    padding: 5px 10px;
    border: 2px solid white;
    color: white;
    text-decoration: none;
}

nav a:hover,
nav a:focus {
    background-color: white;
    color: #1f3a5f;
}

#current_page {
    background-color: #e0a526;
    border-color: #e0a526;
    color: #1f3a5f;
}

/******* SVG logo (payoff matrix) ********/

.box {
    fill: #f7f4ec;
}

/* the bottom right cell is the nash equilibrium so it gets highlighted */
.nash {
    fill: #e0a526;
}

.divider {
    stroke: #1f3a5f;
    stroke-width: 3;
}

.payoff {
    fill: #1f3a5f;
    font-family: "Open Sans", Arial, sans-serif;
    font-size: 16px;
    font-weight: bold;
    text-anchor: middle;
    dominant-baseline: middle;
}

/******* Inner Grid (main content) ********/

/* mobile first, everything in one column */
main {
    display: grid;
    gap: 20px;
    grid-template-areas:
        "intro"
        "content"
        "sidebar";
}

main > section {
    grid-area: intro;
}

article {
    grid-area: content;
}

aside {
    grid-area: sidebar;
    align-self: start;
    background-color: white;
    border-top: 4px solid #e0a526;
    padding: 1rem;
}

/* desktop: intro across the top, then article and sidebar in 2 columns */
@media (min-width: 768px) {
    main {
        grid-template-columns: 2fr 1fr;
        grid-template-areas:
            "intro intro"
            "content sidebar";
        padding: 2rem;
    }
}

/******* Advanced Selectors ********/

/* the first paragraph of each article is a bit bigger, like a lead in */
article > p:first-of-type {
    font-size: 1.15rem;
}

article > h2:first-child,
aside > h2:first-child {
    margin-top: 0;
}

aside > ul {
    padding-left: 1.2rem;
}

aside > ul > li {
    margin-bottom: 0.5rem;
}

/******* Images ********/

article > img {
    background-color: white;
    border: 1px solid #cccccc;
    padding: 10px;
    margin-top: 1rem;
}

/* the paragraph right after an image is its caption */
article > img + p {
    font-size: 0.9rem;
    color: #555555;
    margin-top: 5px;
}

footer a {
    color: #1f3a5f;
}
