/* Rustic mini portfolio — aged paper, bento, ink heatmap */

:root {
    --paper: #ebe6dc;
    --paper-deep: #e0d9cc;
    --ink: #1a1814;
    --ink-soft: #3d3a34;
    --muted: #57524a;
    --link: #1a1814;
    --wash: rgba(26, 24, 20, 0.035);
    --heat-0: rgba(26, 24, 20, 0.07);
    --heat-1: rgba(26, 24, 20, 0.22);
    --heat-2: rgba(26, 24, 20, 0.4);
    --heat-3: rgba(26, 24, 20, 0.62);
    --heat-4: rgba(26, 24, 20, 0.88);
    --sheet-pad: clamp(0.85rem, 3vw, 2rem);
    --bento-max: 58rem;
    --bento-gap: 1.5rem;
    --cell-bg: rgba(247, 243, 235, 0.55);
    --cell-radius: 0.65rem;
    --cell-pad: clamp(0.7rem, 1.3vw, 1rem);
}

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

html {
    height: 100%;
}

body {
    min-height: 100%;
    min-height: 100dvh;
    font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-size: clamp(0.8rem, 0.76rem + 0.2vw, 0.9rem);
    line-height: 1.5;
    color: var(--ink);
    background: var(--paper-deep);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

/* —— Atmosphere —— */
.paper {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(120% 80% at 12% 8%, rgba(255, 252, 245, 0.55), transparent 55%),
        radial-gradient(90% 70% at 88% 92%, rgba(120, 110, 95, 0.12), transparent 50%),
        linear-gradient(165deg, var(--paper) 0%, var(--paper-deep) 48%, #d8d0c2 100%);
}

.paper__wash {
    position: absolute;
    inset: -10%;
    background:
        radial-gradient(ellipse 50% 40% at 70% 20%, var(--wash), transparent 60%),
        radial-gradient(ellipse 45% 35% at 20% 75%, rgba(26, 24, 20, 0.04), transparent 55%);
    animation: wash-breathe 14s ease-in-out infinite;
}

.paper__foxing {
    position: absolute;
    inset: -12%;
    opacity: 0.55;
    mix-blend-mode: multiply;
    background-image:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 500 500' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='turbulence' baseFrequency='0.011' numOctaves='2' seed='7' result='n'/%3E%3CfeColorMatrix in='n' type='matrix' values='0 0 0 0 0.46  0 0 0 0 0.33  0 0 0 0 0.17  0 0 0 0.9 0' result='c'/%3E%3CfeComponentTransfer in='c'%3E%3CfeFuncA type='gamma' amplitude='1' exponent='4.2' offset='0'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg viewBox='0 0 340 340' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='f2'%3E%3CfeTurbulence type='turbulence' baseFrequency='0.02' numOctaves='2' seed='42' result='n'/%3E%3CfeColorMatrix in='n' type='matrix' values='0 0 0 0 0.32  0 0 0 0 0.24  0 0 0 0 0.14  0 0 0 0.85 0' result='c'/%3E%3CfeComponentTransfer in='c'%3E%3CfeFuncA type='gamma' amplitude='1' exponent='5' offset='0'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f2)'/%3E%3C/svg%3E");
    background-size: 620px 620px, 300px 300px;
    background-position: 15% 10%, 70% 80%;
}

.paper__grain {
    position: absolute;
    inset: -6%;
    opacity: 0.5;
    mix-blend-mode: multiply;
    background-image: url("assets/grain.png?v=1");
    background-size: 64px 64px;
    background-repeat: repeat;
}

.paper__vignette {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(140% 90% at 8% 4%, rgba(69, 52, 30, 0.1), transparent 45%),
        radial-gradient(130% 100% at 96% 100%, rgba(40, 30, 18, 0.16), transparent 50%),
        radial-gradient(120% 100% at 50% 50%, transparent 58%, rgba(26, 20, 12, 0.22) 100%);
    mix-blend-mode: multiply;
}

@keyframes wash-breathe {
    0%,
    100% {
        opacity: 0.85;
        transform: translate3d(0, 0, 0) scale(1);
    }
    50% {
        opacity: 1;
        transform: translate3d(1.5%, -1%, 0) scale(1.02);
    }
}

/* —— Sheet / bento —— */
.sheet {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 100dvh;
    margin: 0;
    padding: var(--sheet-pad);
    display: flex;
    align-items: center;
    justify-content: center;
}

.bento {
    width: min(100%, var(--bento-max));
    display: grid;
    grid-template-columns: 1.1fr 1fr 1fr;
    grid-template-rows: auto auto auto auto;
    grid-template-areas:
        "identity activity activity"
        "identity work badges"
        "projects projects projects"
        "cta cta cta";
    gap: var(--bento-gap);
}

/* no borders, no fills — sections are just spacing on the page */
.bento--framed .tile,
.bento--seamless .tile {
    padding: var(--cell-pad);
    background: transparent;
    border-radius: 0;
}

.tile {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(0.55rem);
    animation: rise-in 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.tile--identity {
    grid-area: identity;
    gap: 1.1rem;
    animation-delay: 0.06s;
}

.tile--activity {
    grid-area: activity;
    animation-delay: 0.12s;
}

.tile--work {
    grid-area: work;
    animation-delay: 0.18s;
}

.tile--badges {
    grid-area: badges;
    animation-delay: 0.24s;
}

.tile--badges .tile__head {
    justify-content: flex-start;
}

.tile--projects {
    grid-area: projects;
    animation-delay: 0.34s;
}

.tile--cta {
    grid-area: cta;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    animation-delay: 0.48s;
}

.project-stack {
    flex: 1 1 auto;
    min-width: 0;
    margin-top: 0.3rem;
    position: relative;
    min-height: 6.2rem;
    padding-bottom: 0.15rem;
}

.project-stack-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.project-arrow {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border: none;
    background: transparent;
    color: var(--muted);
    padding: 0;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
}

.project-arrow svg {
    display: block;
    width: 0.85rem;
    height: 0.85rem;
}

.project-arrow:hover,
.project-arrow:focus-visible {
    color: var(--ink);
    outline: none;
}

.project-arrow--prev:hover,
.project-arrow--prev:focus-visible {
    transform: translateX(-2px);
}

.project-arrow--next:hover,
.project-arrow--next:focus-visible {
    transform: translateX(2px);
}

.project-arrow:disabled {
    opacity: 0.3;
    cursor: default;
}

.project-arrow:disabled:hover {
    transform: none;
}

.project-stack__item {
    position: absolute;
    inset: 0;
    padding: 0.65rem 0.75rem;
    background: transparent;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.project-stack__item.is-active {
    opacity: 1;
    pointer-events: auto;
    z-index: 2;
}

@keyframes rise-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .paper__wash,
    .paper__grain,
    .tile {
        animation: none;
    }

    .tile {
        opacity: 1;
        transform: none;
    }

    .heatmap-skeleton::after {
        animation: none;
    }

    .heatmap .heatmap-day {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .badge-skeleton__dot::after {
        animation: none;
    }

    .badge-stack > .badge-stack__item {
        animation: none;
        opacity: 1;
    }
}

/* —— Identity —— */
.identity__photo {
    width: clamp(4.5rem, 9vw, 5.75rem);
    height: clamp(4.5rem, 9vw, 5.75rem);
    object-fit: cover;
    border-radius: 0.5rem;
    filter: grayscale(1) contrast(1.05);
}

.identity__name {
    font-size: clamp(1.35rem, 1.1rem + 0.9vw, 1.75rem);
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.identity__line {
    margin-top: 0.5rem;
    color: var(--ink-soft);
    font-size: 0.95em;
}

.identity__links {
    margin-top: 0.75rem;
    font-size: 0.9em;
    color: var(--muted);
}

.dot {
    margin: 0 0.28em;
    color: var(--muted);
    user-select: none;
}

/* —— Links —— */
a {
    color: var(--link);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
    text-decoration-color: rgba(26, 24, 20, 0.35);
    transition: text-decoration-color 0.2s ease, color 0.2s ease;
}

a:hover,
a:focus-visible {
    color: var(--ink);
    text-decoration-color: var(--ink);
    outline: none;
}

/* —— Tile chrome —— */
.tile__label {
    font-size: 0.88em;
    font-weight: 400;
    font-style: italic;
    color: var(--muted);
    letter-spacing: 0.01em;
}

.tile__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
}

.tile__meta {
    font-size: 0.82em;
    color: var(--muted);
    white-space: nowrap;
}

.job__title {
    margin-top: 0.45rem;
    font-size: 1.05em;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.job__meta {
    margin-top: 0.15rem;
    color: var(--muted);
    font-size: 0.9em;
}

.proof__row {
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    gap: 0.5rem;
}

.proof__title {
    font-size: 1.02em;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.proof__links {
    flex-shrink: 0;
    font-size: 0.84em;
    color: var(--muted);
}

.proof__blurb {
    margin-top: 0.35rem;
    color: var(--ink-soft);
    font-size: 0.9em;
}

.foot__cta {
    font-size: 0.95em;
    font-style: italic;
}

/* —— Heatmap —— */
.heatmap-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.heatmap-link:hover {
    text-decoration: none;
}

.heatmap-wrap {
    overflow-x: auto;
    padding-bottom: 0.15rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.heatmap-wrap::-webkit-scrollbar {
    display: none;
}

.heatmap-scroll {
    display: flex;
    flex-direction: column;
    min-width: max-content;
}

.heatmap-body {
    position: relative;
    min-height: 75px;
}

.heatmap-skeleton {
    position: absolute;
    inset: 0;
    display: flex;
    gap: 2px;
    overflow: hidden;
    opacity: 1;
    transition: opacity 0.4s ease;
}

.heatmap-skeleton.is-hidden {
    opacity: 0;
}

.heatmap-skeleton .heatmap-day {
    background: var(--heat-1);
}

.heatmap-skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 25%, rgba(255, 252, 245, 0.8) 50%, transparent 75%);
    animation: skeleton-shimmer 2s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.heatmap {
    display: flex;
    gap: 2px;
    position: relative;
}

.heatmap .heatmap-day {
    opacity: 0;
    transform: scale(0.5);
    animation: heatmap-day-in 0.4s ease forwards;
}

@keyframes heatmap-day-in {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.heatmap-week {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.heatmap-day {
    width: 9px;
    height: 9px;
    border-radius: 1.5px;
    background: var(--heat-0);
}

.heatmap-day--l1 {
    background: var(--heat-1);
}

.heatmap-day--l2 {
    background: var(--heat-2);
}

.heatmap-day--l3 {
    background: var(--heat-3);
}

.heatmap-day--l4 {
    background: var(--heat-4);
}

.heatmap-fallback {
    margin-top: 0.5rem;
    font-size: 0.85em;
    color: var(--muted);
    font-style: italic;
}

/* —— Badge stack —— */
.badge-stack-body {
    position: relative;
    width: 100%;
    height: 4.75rem;
    margin-top: 0.35rem;
}

.badge-stack {
    position: absolute;
    inset: 0;
}

.badge-skeleton {
    position: absolute;
    inset: 0;
    opacity: 1;
    transition: opacity 0.4s ease;
}

.badge-skeleton.is-hidden {
    opacity: 0;
}

.badge-stack__item.badge-skeleton__dot {
    background: var(--heat-1);
    filter: none;
    -webkit-mask-image: radial-gradient(circle, #000 0%, #000 15%, transparent 62%);
    mask-image: radial-gradient(circle, #000 0%, #000 15%, transparent 62%);
}

.badge-skeleton__dot::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 25%, rgba(255, 252, 245, 0.8) 50%, transparent 75%);
    animation: skeleton-shimmer 1.8s ease-in-out infinite;
}

.badge-skeleton__dot:nth-child(1)::after {
    animation-delay: 0s;
}

.badge-skeleton__dot:nth-child(2)::after {
    animation-delay: 0.2s;
}

.badge-skeleton__dot:nth-child(3)::after {
    animation-delay: 0.4s;
}

.badge-stack__item {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4.25rem;
    height: 4.25rem;
    margin: -2.125rem 0 0 -2.125rem;
    background: transparent;
    text-decoration: none;
    filter: grayscale(1) contrast(1.08);
    transition:
        transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
        filter 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}

.badge-stack > .badge-stack__item {
    opacity: 0;
    animation: badge-in 0.4s ease forwards;
}

@keyframes badge-in {
    to {
        opacity: 1;
    }
}

.badge-stack__item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.badge-stack__item:nth-child(1) {
    z-index: 3;
    transform: translate(-1.15rem, 0.15rem) rotate(-8deg);
}

.badge-stack__item:nth-child(2) {
    z-index: 2;
    transform: translate(0.1rem, -0.2rem) rotate(2deg);
}

.badge-stack__item:nth-child(3) {
    z-index: 1;
    transform: translate(1.25rem, 0.2rem) rotate(9deg);
}

.badge-stack__item:nth-child(1):hover,
.badge-stack__item:nth-child(1):focus-visible {
    z-index: 4;
    transform: translate(-1.15rem, -0.35rem) rotate(-8deg) scale(1.06);
}

.badge-stack__item:nth-child(2):hover,
.badge-stack__item:nth-child(2):focus-visible {
    z-index: 4;
    transform: translate(0.1rem, -0.55rem) rotate(2deg) scale(1.06);
}

.badge-stack__item:nth-child(3):hover,
.badge-stack__item:nth-child(3):focus-visible {
    z-index: 4;
    transform: translate(1.25rem, -0.3rem) rotate(9deg) scale(1.06);
}

.badge-stack__item:hover,
.badge-stack__item:focus-visible {
    filter: grayscale(0) contrast(1.05);
    outline: none;
}

@media (prefers-reduced-motion: reduce) {
    .badge-stack__item {
        transition: filter 0.2s ease;
        will-change: auto;
    }

    .badge-stack__item:nth-child(1):hover,
    .badge-stack__item:nth-child(1):focus-visible {
        transform: translate(-1.15rem, 0.15rem) rotate(-8deg);
    }

    .badge-stack__item:nth-child(2):hover,
    .badge-stack__item:nth-child(2):focus-visible {
        transform: translate(0.1rem, -0.2rem) rotate(2deg);
    }

    .badge-stack__item:nth-child(3):hover,
    .badge-stack__item:nth-child(3):focus-visible {
        transform: translate(1.25rem, 0.2rem) rotate(9deg);
    }
}

.badge-fallback {
    margin-top: 0.35rem;
    font-size: 0.85em;
    color: var(--muted);
    font-style: italic;
}

/* —— Responsive —— */
@media (max-width: 820px) {
    .bento {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto auto auto auto auto auto;
        grid-template-areas:
            "identity identity"
            "activity activity"
            "work badges"
            "projects projects"
            "cta cta";
        min-height: auto;
    }

    .tile--identity {
        flex-direction: row;
        align-items: flex-start;
        justify-content: flex-start;
    }

    .tile--work,
    .tile--badges {
        justify-content: flex-start;
    }

    .tile--cta {
        align-items: flex-start;
        justify-content: center;
    }

    .project-stack {
        min-height: 6.7rem;
    }

    .heatmap-day {
        width: 8px;
        height: 8px;
    }
}

@media (max-width: 540px) {
    .bento {
        grid-template-columns: 1fr;
        grid-template-areas:
            "identity"
            "activity"
            "work"
            "badges"
            "projects"
            "cta";
        gap: 0.55rem;
    }

    .tile--identity {
        flex-direction: column;
    }

    .badge-stack {
        height: 5rem;
    }

    .project-stack {
        min-height: 7.1rem;
    }
}

@media (max-height: 720px) and (min-width: 821px) {
    .project-stack {
        min-height: 5.9rem;
    }

    .heatmap-day {
        width: 7px;
        height: 7px;
    }

    .identity__photo {
        width: 4rem;
        height: 4rem;
    }
}
