/* Best Practice */
/* what I was trying to do */
/* what is the resource I used */
/* what I learned from it */

:root {
	--color: #1a1a1a;
	--background-color: #f7f5f1;
	--global-border-color: #e4e3bc;
	--font-family: 'GT America Mono Regular';
	--body-copy: 0.9rem;
	--heading-copy: 1.75rem;
	--gutter: 1rem;
	--vertical: 1.5rem;
	--hover: rgb(196, 214, 196);
	--underline-hover: #64966a;
    --global-border-color-dark: #c9c8a2;
    --color-muted: #666;
    --overlay: rgb(0 0 0 / 66%);
}

* {
	box-sizing: border-box;
}

body {
	color: var(--color);
	background-color: var(--background-color);
	font-size: var(--body-copy);
	font-family: var(--font-family);
	min-block-size: 100vh;
	display: grid;
	grid-template-rows: auto 1fr auto;
	margin: 0;
	line-height: 1.5;

}

header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding-block-start: var(--vertical);
    padding-inline: var(--gutter);
    background-color: var(--background-color);

    @media (min-width: 600px) {
        padding-inline: 1.5rem;
    }

    @media (min-width: 1000px) {
        padding-inline: 2rem;
    }
}

.navbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding-block-end: 1rem;
	margin-block-end: 1rem;
}

.build-icon {
    width: 18px;
    height: 18px;
}

.nav-left {
	display: flex;
	gap: 1.5rem;
	list-style: none;
	padding: 0;
	margin: 0;
}

.nav-left li a {
	text-decoration: none;
	font-size: 0.9rem;
	font-weight: 400;
}

.nav-left li a.active {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

.dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    background-color: var(--background-color);
    border: 1px solid var(--global-border-color);
    padding: 0.5rem 0;
    margin-top: 0;
    list-style: none;
    z-index: 1000;
}

.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown.dropdown-active .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    padding-block: 0.3rem;
    padding-inline: 0.8rem;
    display: block;
    text-decoration: none;
}

.dropdown-menu a.active {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

hgroup {
    padding-inline: var(--gutter);

    @media (min-width: 600px) {
        padding-inline: 1.5rem;
    }

    @media (min-width: 1000px) {
        padding-inline: 2rem;
    }

    p {
        max-width: 75ch;
        font-weight: 300;
        font-size: 0.9rem;
        text-wrap: balance;
        padding-block-end: 3rem;

        @media (min-width: 600px) {
            font-size: 1rem;
        }
    }

    h1 {
        font-size: calc(2 * var(--heading-copy));
        font-weight: 1000;

        @media (min-width: 600px) {
            font-size: 4rem;
            margin-block-end: 0.75rem;
        }

        @media (min-width: 1000px) {
            font-size: 5rem;
        }
    }

    h2 {
        font-size: 1rem;
        text-wrap: balance;
        padding-block-end: 0.5rem;
        line-height: 1.3rem;

        @media (min-width: 600px) {
            font-size: 1.5rem;
            line-height: 1.9rem;
        }
    }
}

main {
	padding-inline: var(--gutter);
	width: 100%;

	@media (min-width: 600px) {
		padding-inline: 1.5rem;
	}

	@media (min-width: 1000px) {
		padding-inline: 2rem;
	}
}

/* wanted to target <p>  element (large paragraph on page) that is direct a children child of <main> */
/* https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Selectors/Child_combinator */
/* learned that child-combinator (>) matches only immediate children of parent tag, "<" is invalid, (wish I used it in my other projects lol) */
main > p {
    margin-bottom: 2rem;
    max-width: 75ch;
    font-size: 0.9rem;

    @media (min-width: 600px) {
        margin-bottom: 2.5rem;
        font-size: var(--body-copy);
    }

    @media (min-width: 1000px) {
        margin-bottom: 3rem;
        font-size: var(--body-copy);
    }
}

/* responsive grid system */
/* Needed 1 column for mobile and up to 4 columns on desktop */
/* https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/repeat */
/* repeat() allows me to have multiple columns (or rows) in a repeating pattern. I can expand the grid to 4 columns on large screens and compact down to 1 column on smaller screen */
#content-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    border-top: 1px solid var(--global-border-color);
    width: 100%;
    box-sizing: border-box;
    margin: 0;
  
    @media (min-width: 600px) {
    	grid-template-columns: repeat(2, 1fr);
    	padding-inline: 1.5rem;
    }
    
    @media (min-width: 1000px) {
    	grid-template-columns: repeat(3, 1fr);
    	padding-inline: 2rem;
    }
    
    @media (min-width: 1400px) {
    	grid-template-columns: repeat(4, 1fr);
    	padding-inline: 2rem;
    	max-width: 1400px;
    	margin: 0 auto;
    }
}

.content-block {
	position: relative;
	min-width: 0;
	border-bottom: 1px solid var(--global-border-color);
	grid-template-rows: auto min-content;
	background-color: var(--background-color);


	@media (min-width: 600px) {
		border-right: 1px solid var(--global-border-color);
	}

	/* grid dividers using :nth-child() to control card borders at different breakpoints, */
	/* saw this on https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Selectors/:nth-child */
	/* this ":nth-child()" can target repeating items in a grid system, makes it possible to adjust the borders based on the column count I have */
	@media (min-width: 600px) {
		&:nth-child(2n) {
			border-right: none;
		}
	}

	@media (min-width: 1000px) {
		&:nth-child(2n) {
			border-right: 1px solid var(--global-border-color);
		}
		
		&:nth-child(3n) {
			border-right: none;
		}
	}

	@media (min-width: 1400px) {
		&:nth-child(3n) {
			border-right: 1px solid var(--global-border-color);
		}
		
		&:nth-child(4n) {
			border-right: none;
		}
	}
}

.block-image {
	/* keeps images centered in the grid with visible white space, without forcing them to stretch or crop */
	/* I referenced this site https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/aspect-ratio */
	/* aspect-ratio keeps the container square (or 4:3 on mobile) so images don't stretch weird, they stay their actual size in the center */
	aspect-ratio: 1 / 1;
	background-color: var(--background-color);
	border-bottom: 1px solid var(--global-border-color);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	width: 100%;
	overflow: hidden;
  
	@media (min-width: 600px) {
	    padding: 1.25rem;
	}
  
	@media (min-width: 1000px) {
	    padding: 1.5rem;
	}
  
	@media (min-width: 1400px) {
	    padding: 2rem;
	}
}

.block-image img,
.block-image picture {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    clip-path: inset(0);
}

.block-video iframe {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.block-image video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* found inspiration from my house crops, the video was being stretched when I tired to format it other ways */
    /* https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/basic-shape/inset */
    /* this clipping mask is revealing the video in a square shape */
    clip-path: inset(0);
}

.block-text {
    background-color: var(--background-color);
    font-size: 0.6rem;
    font-style: italic;
    line-height: 1rem;
    overflow: auto;

    @media (min-width: 600px) {
        padding-block-start: 1rem;
        font-size: 0.9rem;
        line-height: 1.4rem;
    }

    @media (min-width: 1000px) {
        padding: 1.5rem;
        font-size: 1rem;
        line-height: 1.5rem;
    }

    @media (min-width: 1400px) {
        padding: 2rem;
        font-size: 0.9rem;
    }
}

/* Are.na generates PDF thumbnails with black borders baked in */
/* https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/zoom  */
/* clip-path and scale used to crop them out since the source image cannot be changed */
.block-pdf img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    clip-path: inset(5%);
    transform: scale(1.11);
}

.block-info {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;

    @media (min-width: 600px) {
        padding: 1.25rem;
    }

    @media (min-width: 1000px) {
        padding: 1.5rem;
    }

    @media (min-width: 1400px) {
        padding: 2rem;
    }
}

.block-title {
	font-size: 1rem;
	line-height: 2rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;

	@media (min-width: 600px) {
		font-size: 1.05rem;
	}

	@media (min-width: 1000px) {
		font-size: 1.1rem;
	}

	@media (min-width: 1400px) {
		font-size: 1.15rem;
	}
}

.block-type {
    font-size: 0.8rem;
    color: var(--color-muted);
    opacity: 50%;
    font-weight: 300;
    text-transform: capitalize;
    text-overflow: ellipsis;
    letter-spacing: 0.05rem;
    line-height: 1.2;
	overflow: hidden;
	white-space: nowrap;
    padding-block-end: 0.5rem;
}

.view-btn {
    margin-block-start: auto;
    padding: 0.4rem 1rem;
    background-color: var(--global-border-color);
    border: none;
    border-radius: 0.75rem;
    font-family: var(--font-family);
    font-size: 0.8rem;
    cursor: pointer;
    width: fit-content;
}

.view-btn:hover {
    background-color: var(--global-border-color-dark);
    color: var(--color);
}

a.content-block {
    text-decoration: none;
    color: inherit;
}

.link-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--color);
}

.link-preview span {
    font-size: 0.85rem;
    color: var(--color-muted);
}

/* "here" */
a {
	color: var(--color);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;
}

a:hover {
	color: var(--underline-hover);
}

em {
	font-style: italic;
}

footer {
    padding-block: var(--vertical);
    padding-inline: var(--gutter);
    border-top: 1px solid var(--global-border-color);
    background-color: var(--background-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

footer p {
    font-size: 0.85rem;
    margin: 0;
}