/* Variables */
:root {
    --white: #f9faff;
    --platinum: #e3e4e8;
    --windsurf: #2b6483;
    --marina: #5a91c7;
    --gray: #9a9a9a;
    --onyx: #3c3d44;
    --charcoal: #343c47;
    --corners: 24px 0;
    --corners-small: 10px 0;
    --base-font-size: 20px;
    --ld-background: light-dark(var(--platinum), var(--charcoal));
    --ld-text: light-dark(var(--charcoal), var(--platinum));
    --ld-projects: light-dark(var(--white), #2e313d);
    --ld-blue: light-dark(var(--windsurf), #6dadd0);
}

/* Global Overrides */
html {
    box-sizing: border-box;
    color-scheme: light dark;
}

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

/* Color Switcher */
html:has(#mode-switcher #light:checked) {
    color-scheme: light;
}

html:has(#mode-switcher #dark:checked) {
    color-scheme: dark;
}

/* Body Override */
body {
    font-size: var(--base-font-size);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans",
        "Helvetica Neue", sans-serif;
    background-color: var(--ld-background);
    color: var(--ld-text);
    margin: 0;
    padding: 0;
}

/* Image container overflow */
img {
    max-width: 100%;
}

/* Custom styling */

.wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.switch-container {
    margin-bottom: 2rem;
}

h1 {
    margin: 0;
    font-size: calc(var(--base-font-size) * 2.7);
    text-wrap: nowrap;
    margin-left: -3px;
}

h2 {
    margin: 0;
    font-size: var(--base-font-size);
    text-transform: uppercase;
    color: var(--ld-blue);
    letter-spacing: 0.1em;
    text-wrap: nowrap;
}

h3 {
    margin: 0;
    font-size: calc(var(--base-font-size) * 0.85);
    text-wrap: nowrap;
    line-height: 2;
}

p {
    line-height: 1.5;
}

a {
    color: var(--ld-blue);
}

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

img {
    border-radius: var(--corners);
}

/* SVG Social Icon Bar */

.icons {
    list-style-type: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
}

.icons svg {
    width: 36px;
    height: 36px;
}

.icon {
    fill: var(--ld-blue);
}

.icon:hover {
    fill: var(--marina);
}

/* About Me layout */

.about {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
}

.about-image {
    margin: 0 auto;
}

.about-image img {
    object-fit: cover;
    object-position: top;
    height: 260px;
    width: 300px;
    overflow: hidden;
}

/* Footer Layout */

footer {
    text-align: center;
}

h2.footer-title {
    padding: 2rem 0;
}

.footer-blocks {
    display: grid;
    grid-template-columns: 1fr;
    text-align: center;
    margin: 0 auto;
    gap: 2rem;
}

.footer-links {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

.footer-links li a {
    line-height: 2;
    font-size: calc(var(--base-font-size) * 0.85);
    font-weight: 500;
}

.footer-icons .icons .icon {
    fill: var(--ld-text);
}

.footer-icons .icons .icon:hover {
    fill: var(--marina);
}

/* Projects layout */

main {
    margin-top: 2rem;
    margin-bottom: 1rem;
    text-align: center;
}

h2.projects-title {
    padding: 2rem 0;
}

.projects {
    display: grid;
    gap: 3rem;
}

.project {
    background-color: var(--ld-projects);
    padding: 2rem;
    border-radius: var(--corners);
    display: grid;
    gap: 2rem;
}

.project-name {
    font-size: calc(var(--base-font-size) * 1.15);
    font-weight: 700;
}

.project-blurb {
    order: 2;
}

.project-image {
    order: 1;
}

.project-image img {
    padding: 0.2rem;
    border: 1px solid var(--ld-text);
    box-shadow: rgba(0, 0, 0, 0.2) 0px 4px 12px;
}

ul.stack-list {
    margin: 0;
    padding: 0;
    list-style-type: none;
    display: flex;
    flex-flow: row wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

li.stack-item {
    padding: 0.5em;
    background-color: var(--windsurf);
    border-radius: var(--corners-small);
    font-size: calc(var(--base-font-size) * 0.85);
    color: var(--white);
    font-weight: 700;
}

/* Light Dark Button */

/* Scott O'Hara toggle switch */
/* https://codepen.io/scottohara/pen/zLZwNv */

@layer switch {
    .radio-switch {
        border: none;
        padding: 0;
        white-space: nowrap;
        display: flex;
        justify-content: center;
        margin-bottom: 2rem;
    }

    .radio-switch legend {
        font-size: 2px;
        opacity: 0;
        position: absolute;
    }

    .radio-switch label {
        display: inline-block;
        line-height: 2;
        position: relative;
        z-index: 2;
        font-size: 0.9rem;
        font-weight: 700;
    }

    .radio-switch input {
        opacity: 0;
        position: absolute;
    }

    .radio-switch label:first-of-type {
        padding-right: 5em;
    }

    .radio-switch label:last-child {
        margin-left: -4.25em;
        padding-left: 5em;
    }

    .radio-switch:focus-within label:first-of-type:after {
        box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--marina);
    }

    /* making the switch UI.  */
    .radio-switch label:first-of-type:before,
    .radio-switch label:first-of-type:after {
        border: 1px solid var(--onyx);
        content: "";
        height: 2em;
        overflow: hidden;
        pointer-events: none;
        position: absolute;
        vertical-align: middle;
    }

    .radio-switch label:first-of-type:before {
        background: var(--white);
        border: 1px solid var(--onyx);
        border-radius: 100%;
        position: absolute;
        right: -0.075em;
        transform: translateX(0em);
        transition: transform 0.2s ease-in-out;
        width: 2em;
        z-index: 2;
    }

    .radio-switch label:first-of-type:after {
        background: #777;
        border-radius: 1em;
        margin: 0 1em;
        transition: background 0.2s ease-in-out;
        width: 4em;
    }

    .radio-switch input:first-of-type:checked ~ label:first-of-type:after {
        background: var(--marina);
    }

    .radio-switch input:first-of-type:checked ~ label:first-of-type:before {
        transform: translateX(-2em);
    }

    .radio-switch input:last-of-type:checked ~ label:last-of-type {
        z-index: 1;
    }
}

/* Desktop Layout */

@media (min-width: 750px) {
    :root {
        --base-font-size: 1.25rem;
    }

    .wrapper {
        padding: 5rem;
    }

    /* About */

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

    .about-text {
        text-align: left;
    }

    .about-image {
        margin: 0 0 0 auto;
    }

    .about-image img {
        max-height: 400px;
        object-fit: contain;
        height: auto;
        width: auto;
        overflow: auto;
    }

    .icons {
        justify-content: flex-start;
    }

    /* Footer */

    footer {
        text-align: left;
    }

    .footer-blocks {
        grid-template-columns: repeat(3, 1fr);
        text-align: left;
    }

    /* Radio Switch */
    .radio-switch {
        justify-content: flex-end;
    }
}

/* Desktop Layout - Projects */

@media (min-width: 850px) {
    :root {
        --base-font-size: 1.25rem;
    }

    main {
        text-align: left;
    }

    .project {
        grid-template-columns: 1fr 1fr;
    }

    .project-blurb {
        order: 1;
    }

    .project-image {
        order: 2;
    }

    ul.stack-list {
        justify-content: flex-start;
    }
}
