:root {
    --primary-color: #202529;
    --border-color: #20252929;
    --bg-grid-color: rgba(255, 0, 81, 0.05);
    --accent-color: rgb(255, 0, 81);
    --accent-color-light: #f9d4de;
    --accent-color-transparent: rgba(255, 0, 81, 0.5);
    --accent-color-transparent-clear: rgba(255, 0, 81, 0.2);
    --bg-color: #f6f3ed;
    --bg-color-transparent: rgba(246, 243, 237, 0.8);
    --header-font: 'Inter', sans-serif;
    --body-font: 'Inter', sans-serif;
}

body {
    font-family: var(--body-font);
    height: 100%;
    position: relative;
    margin: 0 auto;
    padding: 0;
    background-color: var(--bg-color);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: .2px;
    overflow-x: hidden;
}

html {
    scroll-behavior: smooth;
}

a {
    color: inherit;
    position: relative;
    isolation: isolate;
    text-decoration: none;
}

*:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
    a::after {
        transition: none;
    }

    header {
        transition: none;
    }

    html {
        scroll-behavior: auto;
    }
}

@keyframes reveal-in {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes horizontal-scroll-cue {
    50% {
        transform: translateX(4px);
    }
}

.mobile-works-link {
    display: none;
}

.carousel-scroll-cue {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .carousel-scroll-cue,
    .carousel-scroll-cue.is-visible {
        transition: none;
        animation: none;
    }

    .mobile-works-link span {
        animation: none;
    }
}

#main-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    --main-grid-column-gap: 12px;
    grid-column-gap: var(--main-grid-column-gap);
    grid-row-gap: 48px;
    margin: 0 12px;
    background-image:
        linear-gradient(to right,
            var(--bg-grid-color) 0 1px,
            transparent 1px calc(100% - var(--main-grid-column-gap)),
            var(--bg-grid-color) calc(100% - var(--main-grid-column-gap)) calc(100% - var(--main-grid-column-gap) + 1px),
            transparent calc(100% - var(--main-grid-column-gap) + 1px) 100%),
        linear-gradient(to left, var(--bg-grid-color) 0 1px, transparent 1px);
    background-size: calc(12.5% + 1.5px) 100%, 100% 100%;
    background-repeat: repeat-x, no-repeat;
}

header {
    position: sticky;
    top: 0;
    grid-column: 1 / -1;
    width: 100%;
    z-index: 99;
    mix-blend-mode: difference;
    transition: transform 0.25s ease;
}

header.is-scrolled:not(.is-visible) {
    transform: translateY(-100%);
}

header .logo {
    display: flex;
    justify-content: center;
    align-content: center;
    font-family: var(--header-font);
    font-size: 12px;
    padding: 24px 0;
    margin: 0;
    text-align: center;
    width: 100%;
    font-weight: 400;

}

header .logo::after {
    display: none;
}

header .logo img {
    cursor: pointer;
    width: 62px;
    height: auto;
    filter: invert(1);
}

.project,
#about {
    grid-column: 2 / -1;
    display: grid;
    grid-template-columns: subgrid;
}

.project article {
    grid-column: 1 / 3;
    position: sticky;
    top: 24px;
    align-self: start;
    height: fit-content;
    padding-right: 12px;
    margin-bottom: 128px;
}

.project .image-grid {
    grid-column: 3 / -1;
}

/* Nav */
nav {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    grid-column: 1 / 2;
    height: calc(100vh - 149px);
    gap: 12px;
    padding-bottom: 24px;
    position: sticky;
    top: 12px;
    z-index: 100;
}

.subnav div {
    opacity: 0.5;
    padding: 0;
    transition: all .3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.nav-trigger {
    font: inherit;
    text-align: left;
    color: inherit;
    border: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
}

nav>div {
    flex-grow: 0;
    transition: all .5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

nav>div:first-of-type {
    flex-grow: 1;
}

.about-nav.active {
    color: var(--accent-color);
    opacity: .7;
    flex-grow: 1;
}

nav .subnav {
    transition: all .3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

nav .active .subnav div {
    opacity: .5;
}

nav .active .subnav {
    opacity: 1;
    margin-top: 64px;
}


.subnav .active {
    color: var(--accent-color);
}

nav>.active:hover .subnav div,
nav>div:first-of-type .subnav:hover div {
    padding: 6px 0;
}

@media (min-width: 768px) {
    header .logo {
        animation: reveal-in .5s ease backwards;
    }

    nav>div {
        animation: reveal-in .45s ease .75s backwards;
    }

    nav>div:nth-child(2) {
        animation-delay: .9s;
    }

    nav>div:nth-child(3) {
        animation-delay: 1.05s;
    }

    nav>div:first-of-type .subnav>div {
        animation: reveal-in .45s ease 1.55s backwards;
    }

    nav>div:first-of-type .subnav>div:nth-child(2) {
        animation-delay: 1.65s;
    }

    nav>div:first-of-type .subnav>div:nth-child(3) {
        animation-delay: 1.75s;
    }

    nav>div:first-of-type .subnav>div:nth-child(4) {
        animation-delay: 1.85s;
    }

    .project .image-grid {
        animation: reveal-in .55s ease 2.5s backwards;
    }

    .project article {
        animation: reveal-in .55s ease 3.15s backwards;
    }
}

@media (min-width: 768px) and (prefers-reduced-motion: reduce) {

    header .logo,
    nav>div,
    nav>div:first-of-type .subnav>div,
    .project .image-grid,
    .project article {
        animation: none;
    }
}

/* article */

article h2 {
    font-family: var(--header-font);
    font-size: 32px;
    margin: 0;
    padding: 0;
    width: 100%;
    font-weight: 600;
}
article h2:focus-visible {
    outline: none !important;
}

.sticky-project-title {
    display: none;
}

article .tags {
    font-size: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 6px;
}

article .tags>div::before {
    content: "· ";

}

article p {
    margin: 128px 0 64px;
    font-size: 14px;
    line-height: 18px;
    max-width: 600px;
}

/* images */
.image-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
    min-height: 100vh;
}

figure,
figure img {
    position: relative;
    width: 100%;
    height: auto;
    padding: 0;
    margin: 0;
    line-height: 0;
}

figure figcaption {
    position: absolute;
    bottom: 12px;
    right: 12px;
    font-size: 10px;
    line-height: 1;
    margin: 0;
    padding: 0;
    opacity: .3;
}

.image-grid figure.w-full {
    grid-column: 1 / 6;
}

.image-grid img {
    cursor: zoom-in;
}

.image-grid video[data-src] {
    cursor: pointer;
}

.image-grid img:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 3px;
}

img.image-expanding {
    position: fixed;
    z-index: 1001;
    top: var(--image-top);
    left: var(--image-left);
    width: var(--image-width);
    height: var(--image-height);
    max-width: none;
    margin: 0;
    object-fit: contain;
    object-position: center;
    background: transparent;
    box-shadow: none;
    transition:
        top 350ms ease,
        left 350ms ease,
        width 350ms ease,
        height 350ms ease,
        border-radius 350ms ease;
    cursor: zoom-out;
}

img.image-expanding.is-expanded {
    top: 24px;
    left: 24px;
    width: calc(100vw - 48px);
    height: calc(100vh - 48px);
    object-fit: contain;
    border-radius: 0;
}

body.image-expanded {
    overflow: hidden;
}

body.image-expanded::after {
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: var(--bg-color-transparent);
    backdrop-filter: blur(8px);
    content: "";
    animation: image-overlay-in .35s ease both;
    pointer-events: auto;
}

body.image-expanded.image-closing::after {
    animation: image-overlay-out .35s ease both;
}

@keyframes image-overlay-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes image-overlay-out {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes swipe-left {
    0% {
        transform: translateX(-50vw);
        opacity: 0;
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    img.image-expanding {
        transition-duration: 0.01ms;
    }

    body.image-expanded::after {
        animation-duration: 0.01ms;
    }
}

.image-grid figure.grid {
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
    grid-template-rows: auto;
}

#art .art-grid-image--santos {
    grid-column: 1;
    grid-row: 3;
}

#art .art-grid-image--coup {
    grid-column: 4;
    grid-row: 1;
}

#art .art-grid-image--swan {
    grid-column: 4;
    grid-row: 2;
}

#art .art-grid-image--flower {
    grid-column: 5;
    grid-row: 1;
}

#art .art-grid-image--silver {
    grid-column: 5;
    grid-row: 2;
}

.image-grid .desktop,
.image-grid .mbl {
    background-color: #c9d2d8;
    text-align: center;
    display: flex;
    align-items: center;
}

#appletv .image-grid .mbl {
    background-color: #02111f;
}

#life360 .image-grid .desktop,
#life360 .image-grid .mbl {
    background-color: #EAD6FF;
}

.image-grid .video-player {
    position: relative;
    cursor: pointer;
}

.image-grid .desktop .video-player {
    margin: 5%;
    width: 90%;
}

.image-grid .mbl .video-player {
    margin: 5% auto;
    width: 50%;
    max-width: 300px;
    border-radius: 24px;
    overflow: hidden;
}

.video-player video {
    display: block;
    width: 100%;
    height: auto;
}

.video-pause-icon {
    position: absolute;
    bottom: 10px;
    left: 10px;
    display: flex;
    width: 26px;
    height: 26px;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: rgb(0 0 0 / 60%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 150ms ease;
}

.video-pause-icon span {
    width: 2px;
    height: 9px;
    border-radius: 1px;
    background: #fff;
}

.video-player.is-paused .video-pause-icon {
    opacity: 1;
}

.image-grid .side-by-side {
    grid-column: 1 / -1;
    grid-row: 1;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 12px;
}
.image-grid .side-by-side  img {
    object-fit: contain;
}

button {
    font-size: 12px;
    border: none;
    background-color: #ddd;
    color: #000;
    padding: 6px 8px;
    transition: background-color .2s linear;
}

.external-link-arrow {
    font-family: system-ui, sans-serif;
    font-size: inherit;
}

#about {
    grid-column: 2 / -1;
    min-height: 100vh;

}

#about section {
    grid-column: 1 / 4;
    grid-row: 1/4;
}

#about h2 {
    position: sticky;
    top: 48px;
    font-size: 128px;
    line-height: 90px;
    margin: 128px 0 0;
    z-index: 2;
}

#about p {
    margin: 62px 0 0;
}

#about figure:first-of-type {
    grid-column: 4/8;
    grid-row: 1 / 3;
}

#about figure:nth-of-type(2) {
    grid-column: 2;
    grid-row: 3;
    margin: calc(50vh - 100%) 0 50vh;
}

#about .email, #about .footer-link {
    grid-column: 4;
    grid-row: 3;
    margin-top: 100vh;
}
#about .linkedin {
    grid-column: 6;
}
#about .github {
    grid-column: 7;
}

footer {
    position: absolute;
    bottom: 0;
    right: 0;
    opacity: .05;
    z-index: -1;
    overflow: hidden;
    max-height: 50vh;
}

footer svg {
    width: 100vw;
    height: auto;
}


/* tablet - small desktop */
@media (max-width: 1200px) {

    .project article {
        grid-column: 1 / 4;
        padding-right: 0;

    }

    .project .image-grid {
        grid-column: 4 / -1;
        padding-left: 0;
        grid-template-columns: 1fr 1fr 1fr 1fr;
    }

    .image-grid figure.w-full {
        grid-column: 1 / 5;
    }

    .image-grid figure.grid {
        grid-template-columns: repeat(4, 1fr);
    }

    #art .art-grid-image--coup,
    #art .art-grid-image--swan {
        grid-column: 3;
    }

    #art .art-grid-image--flower,
    #art .art-grid-image--silver {
        grid-column: 4;
    }

}

/* Desktop only */
@media (min-width: 768px) {

    nav .subnav div {
        opacity: .25;
    }

    a::after {
        content: "";
        position: absolute;
        right: 0;
        bottom: -2px;
        left: -4px;
        height: calc(100% + 4px);
        background-color: var(--accent-color-light, #c2c1c1);
        transform: scaleX(0);
        transform-origin: left;
        transition: transform 250ms ease;
        pointer-events: none;
        z-index: -1;
    }

    button a::after {
        bottom: -6px;
        left: -8px;
        height: calc(100% + 12px);
        width: calc(100% + 16px);
        z-index: -1;
    }

    a:hover::after,
    a:focus-visible::after {
        width: calc(100% + 8px);
        transform: scaleX(1);
    }

    button:hover a::after {
        width: calc(100% + 16px);
        transform: scaleX(1);
    }

    nav .subnav div:not(.active):hover {
        opacity: 1;
    }

}

/* mobile */
@media (max-width: 767px) {

    html.mobile-project-reveal .project article,
    html.mobile-project-reveal .project .image-grid>figure {
        opacity: 0;
        transform: translateY(18px);
    }

    html.mobile-project-reveal .project article.is-revealed,
    html.mobile-project-reveal .project article:focus-within,
    html.mobile-project-reveal .project .image-grid>figure.is-revealed,
    html.mobile-project-reveal .project .image-grid>figure:focus-within {
        opacity: 1;
        transform: translateY(0);
        transition: opacity 600ms ease, transform 600ms ease;
    }

    .project {
        position: relative;
    }

    .project article {
        margin-bottom: 64px;
    }

    header .logo {
        padding: 24px 0 0;
        transition: padding 250ms ease;
    }

    header .logo img {
        width: 62px;
        filter: invert(1);
    }

    .mobile-works-link {
        display: flex;
        grid-column: 1 / -1;
        flex-direction: column;
        align-items: start;
        gap: 8px;
        padding: 0 0 12px;
        font-size: 12px;
        line-height: 1;
        color: var(--primary-color);
    }

    article h2:not(#art h2) {
        border-top: 1px solid var(--bg-grid-color);
        padding-top: 24px;
    }

    article .tags {
        gap: 8px;
    }

    article p {
        margin: 24px 0 64px;
        line-height: 22px;
    }

    #scope article p {
        margin-bottom: 0;
    }

    .image-grid {
        box-sizing: border-box;
        min-height: 0;
        padding: 0 7vw;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        scroll-padding-inline: 7vw;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .image-grid::-webkit-scrollbar {
        display: none;
    }

    .project .image-grid {
        display: flex;
        align-items: stretch;
        gap: 12px;
    }

    .project .image-grid > figure {
        flex: 0 0 78vw;
        width: 78vw;
        max-width: 78vw;
        scroll-snap-align: center;
    }

    #life360 .image-grid > figure:last-child {
        scroll-snap-align: start;
    }

    .project .image-grid > figure.grid {
        display: grid;
    }

    .carousel-scroll-cue {
        display: flex;
        grid-column: 1 / -1;
        justify-self: center;
        color: var(--primary-color);
        font-size: 20px;
        line-height: 1;
        position: absolute;
        bottom: -24px;
        right: 12px;
        opacity: 0;
        pointer-events: none;
        transition: opacity 350ms ease;
    }

    .carousel-scroll-cue.is-visible {
        opacity: 1;
        animation: horizontal-scroll-cue 1.2s ease-in-out infinite;
    }

    figure figcaption {
        color: var(--primary-color) !important;
        opacity: .5 !important;
        bottom: -14px;
        right: 0px;
        font-size: 9px;
    }

    figure:has(figcaption) {
        margin-bottom: 24px;
    }

    .image-grid .mbl .video-player {
        border-radius: 12px;
    }

    .sticky-project-title.is-visible {
        display: block;
        position: fixed;
        top: 16px;
        left: 24px;
        width: fit-content;
        padding: 8px 12px 7px 12px;
        box-sizing: border-box;
        font-family: var(--header-font);
        font-size: 14px;
        font-weight: 600;
        line-height: 1;
        z-index: 101;
        background-color: var(--bg-color-transparent);
        backdrop-filter: blur(8px);
        box-shadow: rgba(42, 42, 49, 0.1) 0px 7px 29px 0px;
        animation: swipe-left 0.3s 0s forwards cubic-bezier(0.075, 0.82, 0.165, 1);
        border: 1px solid var(--bg-grid-color);
    }

    nav {
        position: fixed;
        top: unset;
        bottom: 24px;
        left: 24px;
        width: calc(100vw - 48px);
        flex-direction: row;
        height: fit-content;
        padding: 4px;
        background-color: var(--bg-color-transparent);
        backdrop-filter: blur(8px);
        gap: 4px;
        box-shadow: rgba(42, 42, 49, 0.1) 0px 7px 29px 0px;
    }

    nav .subnav.works {
        position: fixed;
        display: block;
        margin: 0;
        bottom: 0;
        background-color: var(--bg-color);
        -webkit-backdrop-filter: blur(8px);
        backdrop-filter: blur(8px);
        padding: 4px 4px 48px;
        left: 0px;
        z-index: 0;
        transform: scaleY(0);
        transform-origin: bottom;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: transform 0.3s ease, opacity 0.3s ease, visibility 0s linear 0.3s;
    }

    nav.works-menu-open .subnav.works {
        transform: scaleY(1);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transition-delay: 0s;
        z-index: -1;
    }

    nav.works-menu-open .subnav.works>div {
        padding: 0 !important;
    }

    .subnav.works>div {
        opacity: .5;
        border: 1px solid transparent;
        transition: border 0.3s ease;
    }

    .subnav.works a {
        display: block;
    }

    .subnav.works div.active {
        border: 1px solid;
    }

    nav>div {
        height: 32px;
        text-align: center;
        line-height: 32px;
        padding: 0 12px;
        border: solid 1px var(--border-color);
        font-size: 10px;
        font-weight: 600;
        flex-grow: 0;
        width: 25%;
        position: relative;
    }

    nav>div.active,
    nav>.about-nav.active {
        background-color: var(--accent-color-transparent-clear);
        border: solid 1px var(--accent-color-transparent-clear);
        width: 50%;
        color: #000;
        opacity: 1;
    }

    nav>div>a.nav-trigger {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        text-align: center;
    }

    #main-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        background-size: calc(25% + 3px) 100%, 100% 100%;
    }

    .project,
    #about {
        grid-column: 1 / -1;
    }

    .project article,
    #about section {
        grid-column: 1 / -1;
        position: static;
        overflow: hidden;
    }

    .project .image-grid {
        grid-column: 1 / -1;
        position: static;
        overflow-x: auto;
        overflow-y: hidden;
        padding-right: 12px;
        padding-left: 12px;
        margin-right: -12px;
        margin-left: -12px;
    }

    #about section {
        overflow: visible;
    }

    #about figure:first-of-type {
        margin-top: 600px;
    }

    #about figure:nth-of-type(2) {
        grid-column: 2;
        grid-row: 3;
        margin: 0;
        width: 128px;
        margin-top: 128px;
    }

    #about h2 {
        text-align: right;
        font-size: 92px;
        line-height: 66px;
    }

    #about p {
        line-height: 22px;
    }

    #about .email, #about .linkedin, #about .github {
        margin-top: calc(100vh - 100px);
        margin-bottom: 100px;
    }
        #about .email {
        grid-column: 1;
    }

    #about .linkedin {
        grid-column: 3;
    }

    #about .github {
        grid-column: 4;
    }
}

@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
    header .logo,
    header .logo img {
        transition: none;
    }
}
