/* --- light & dark mode variables and changes --- */
:root {
    --bg-color: white;
    --text-color: black;
    --border-color: black;
    --box-bg: white;
    --accent-color: hsl(205, 82%, 56%);
}

html.dark-mode {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --border-color: #e0e0e0;
    --box-bg: #1e1e1e;
    --accent-color: hsl(205, 82%, 65%);
}

html.dark-mode img[src*="github"] {
    filter: invert(1);
}

/* --- overall page setup --- */
html {
    scroll-behavior: smooth;
    background-color: var(--bg-color);

    background-size: 20px 20px;
    background-image:
        linear-gradient(
            to right,
            rgba(128, 128, 128, 0.2) 1px,
            transparent 1px
        ),
        linear-gradient(
            to bottom,
            rgba(128, 128, 128, 0.2) 1px,
            transparent 1px
        );

    transition: background-color 0.3s ease-out;
}

body {
    margin: 24px;
    font-family: "Courier New", Courier, monospace;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 48px);
}

main {
    flex: 1;
}

.mobile-only {
    display: none;
}

/* --- general styling --- */
section {
    margin-bottom: 128px;
}

.flat-box,
.raised-box,
.raised-button {
    background-color: var(--box-bg);
    border: 2px solid var(--border-color);
}

.raised-box {
    box-shadow: 4px 4px var(--border-color);
}

.raised-button {
    box-shadow: 4px 4px var(--border-color);
    font-weight: 400;
    color: var(--text-color);
    cursor: pointer;
    background-image: url("/assets/hatch-pattern.svg");

    transition:
        box-shadow 0.2s ease-out,
        border 0.2s ease-out,
        color 0.2s ease-out,
        font-weight 0.2s ease-out,
        background-color 0.2s ease-out,
        background-image 0.2s ease-out,
        transform 0.2s ease-out;
}

.raised-button:hover {
    box-shadow: 2px 2px var(--accent-color);
    border: 2px solid var(--accent-color);
    color: var(--bg-color);
    font-weight: 700;
    background-color: var(--text-color);
    background-image: none;
    transform: translate(2px, 2px);
}

.raised-button:active {
    box-shadow: 0px 0px var(--accent-color);
    transform: translate(4px, 4px);
    transition: none;
}

.button-text {
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.square {
    display: flex;
    justify-content: center;
    aspect-ratio: 1 / 1;
}

/* --- header --- */
header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    padding: 12px;
    margin-bottom: 24px;
    gap: 12px;
}

.header-main {
    display: flex;
    gap: 12px;
}

header nav {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

header .button-text,
.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
}

.logo {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--text-color);
    padding: 0 12px 0 12px;
}

.pressed-header-button {
    box-shadow: 2px 2px var(--accent-color);
    border: 2px solid var(--accent-color);
    color: var(--bg-color);
    font-weight: 700;
    background-color: var(--text-color);
    background-image: none;
    transform: translate(2px, 2px);
    cursor: pointer;
}

/* --- section headers --- */
.section-header {
    display: flex;
    justify-content: center;
    padding: 6px;
    margin-top: 48px;
    margin-bottom: 12px;
    letter-spacing: 0.3em;
    scroll-margin-top: 24px;
    color: var(--text-color);
    box-shadow: 0px 0px var(--accent-color);
    text-decoration: underline #00000000 wavy 2px;

    transition:
        background-color 0.2s ease-out,
        color 0.2s ease-out,
        border-color 0.2s ease-out,
        box-shadow 0.2s ease-out,
        text-decoration 0.2s ease-out;
}

.section-header h2,
p {
    margin: 0;
}

#about-section:hover #about,
#projects-section:hover #projects,
#skills-section:hover #skills {
    color: var(--accent-color);
    border-color: var(--accent-color);
    box-shadow: 4px 4px var(--accent-color);
    text-decoration: underline var(--accent-color) wavy 2px;
}

/* --- about section --- */
.about-grid {
    display: grid;
    grid-template-columns: 300px 2fr;
    gap: 12px;
    align-items: stretch;
}

.picture-box {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--box-bg);
    overflow: hidden;
}

.picture-box::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url("https://grainy-gradients.vercel.app/noise.svg");
    opacity: 0.8;
    mix-blend-mode: overlay;
    filter: contrast(300%);
    background-size: 600px;
    pointer-events: none;
    z-index: 1;

    transition: opacity 0.2s ease-out;
}

.picture-box:hover::before {
    opacity: 0;
}

.picture-box::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 8px solid var(--box-bg);
    z-index: 2;
    pointer-events: none;
}

.picture-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: grayscale(100%) contrast(130%) brightness(110%);

    transition: filter 0.2s ease-out;
}

.picture-box:hover img {
    filter: none;
}

.content-box {
    padding: 12px;
    color: var(--text-color);
}

.content-box h3 {
    margin-top: 0;
    margin-bottom: 12px;
    text-decoration: underline;
}

.picture-container {
    display: flex;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.hatch {
    background-image: url("/assets/hatch-pattern-bold.svg");
    flex: 1;
}

/* --- projects section --- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 18px;
}

.tile {
    display: flex;
    flex-direction: column;
    padding: 0;
    height: 100%;

    transition:
        border 0.2s ease-out,
        box-shadow 0.2s ease-out,
        transform 0.2s ease-out;
}

.tile-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-bottom: 2px solid var(--border-color);
    overflow: hidden;
    position: relative;

    transition: border 0.2s ease-out;
}

.tile-image::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    box-shadow: inset 0 0 0 8px var(--box-bg);
    pointer-events: none;
    transition: box-shadow 0.3s ease-out;
    z-index: 2;
}

.tile:hover .tile-image::after {
    box-shadow: inset 0 0 0 4px var(--box-bg);
}

.tile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: grayscale(70%);
    transform: scale(1);
    transition:
        filter 0.2s ease-out,
        transform 0.3s ease-out;
}

.tile:hover {
    border-color: var(--accent-color);
    box-shadow: 4px 4px var(--accent-color);
}

.tile:hover .tile-image {
    border-bottom-color: var(--accent-color);
}

.tile:hover .tile-image img {
    filter: grayscale(0%);
    transform: scale(1.05);
}

.tile-content h3 {
    transition: color 0.2s ease-out;
}

.tile:hover .tile-content h3 {
    color: var(--accent-color);
}

.tile-content {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex: 1;
    color: var(--text-color);
}

.tile-content h3 {
    margin-top: 0;
    margin-bottom: 12px;
    text-decoration: underline;
    font-size: 1.2rem;
}

.tile-content p {
    margin-bottom: 24px;
    line-height: 1.5;
    flex: 1;
}

.tile-actions {
    display: flex;
    gap: 12px;
    margin-top: auto;
}

.icon-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 45px;
    height: 45px;
    font-size: 1.2rem;
    text-decoration: none;
}

#fish-project-tile {
    cursor:
        url("/assets/cursors/cursor-fish.png") 0 0,
        auto;
}

#encrypt-project-tile {
    cursor:
        url("/assets/cursors/cursor-padlock.png") 0 0,
        auto;
}

#surge-project-tile {
    cursor:
        url("/assets/cursors/cursor-battery.png") 0 0,
        auto;
}

.tile .icon-btn {
    cursor: inherit;
}

/* --- skills section --- */
.skills-table {
    padding: 12px;
    color: var(--text-color);
}

.skills-table tr {
    text-align: center;
    vertical-align: middle;
}

.skills-table td,
.skills-table th {
    border: 2px solid var(--border-color);
}

.skills-table th {
    padding: 6px;
}

.skills-table td {
    padding: 12px;
    vertical-align: top;
}

.skills-table td > .flex-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: start;
    gap: 1rem;
    height: 100%;
}

.skill-block {
    padding: 12px;
    min-width: 64px;
    min-height: 64px;
    flex: 1 0 auto;
    box-shadow: 0px 0px var(--border-color);

    transition:
        box-shadow 0.2s ease-out,
        border-color 0.2s ease-out,
        transform 0.2s ease-out;
}

.skill-block:hover {
    box-shadow: 4px 4px var(--border-color);
    transform: translate(-4px, -4px);
    font-weight: bold;
}

.skills-table img {
    min-height: 48px;
    max-height: 48px;
    padding-bottom: 8px;
}

/* --- Footer --- */

footer {
    padding: 6px;
    margin: 24px 0 0 0;
    text-align: center;
    color: var(--text-color);
}

/* ----------------------------- */
/* --- Mobile Responsiveness --- */
/* ----------------------------- */
@media (max-width: 880px) {
    header {
        flex-direction: column;
        align-items: stretch;
    }

    .header-main {
        justify-content: space-between;
        margin-bottom: 12px;
    }

    header nav {
        justify-content: center;
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    header nav .raised-button {
        text-align: center;
        padding: 10px;
    }
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }

    .about-grid {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .picture-box {
        overflow: visible;
        max-width: 250px;
        width: 100%;
        margin: 0 auto;
    }

    .picture-box::before {
        opacity: 0;
    }

    .picture-box img {
        filter: none;
    }

    .content-box {
        height: auto;
    }

    .picture-container {
        display: flex;
        flex-direction: row;
        width: 100%;
        gap: 12px;
        aspect-ratio: auto;
        align-items: stretch;
    }

    .tile-image img {
        filter: none;
    }

    .tile:hover .tile-image img {
        transform: none;
    }

    .skills-table {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .skills-table tbody,
    .skills-table tr {
        display: contents;
    }

    .skills-table th,
    .skills-table td {
        display: block;
        width: auto;
    }

    /* reorder headers to go with their content */
    .skills-table th:nth-of-type(1) {
        order: 1;
    }
    .skills-table td:nth-of-type(1) {
        order: 2;
    }
    .skills-table th:nth-of-type(2) {
        order: 3;
    }
    .skills-table td:nth-of-type(2) {
        order: 4;
    }
    .skills-table th:nth-of-type(3) {
        order: 5;
    }
    .skills-table td:nth-of-type(3) {
        order: 6;
    }

    .skills-table td {
        margin-bottom: 24px;
    }

    .skill-block {
        box-shadow: 4px 4px var(--border-color);
        transform: translate(-4px, -4px);
        font-weight: normal;
    }

    .skill-block:hover {
        box-shadow: 4px 4px var(--border-color);
        transform: translate(-4px, -4px);
        font-weight: normal;
    }
}
