@font-face {
    font-family: 'Montserrat Regular';
    src: url('fonts/montserrat-regular.ttf') format('truetype');
}

@layer general-styling, visuals-for-demo;

@layer general-styling {
    :root {
	--grid-width: 12rem;
	--max-img-height: 9rem;

        color-scheme: light dark;
        interpolate-size: allow-keywords;
        --brand-blue: light-dark(hsl(220, 74%, 41%), hsl(220, 100%, 61%));
        --brand-red: light-dark(hsl(357, 68%, 53%), hsl(357, 100%, 63%));
        --brand-gradient: linear-gradient( var(--gradient-deg), var(--brand-blue), var(--brand-red) );

        @supports (background: linear-gradient(in oklch, red, blue)) {
            --brand-gradient: linear-gradient( var(--gradient-deg) in oklch, var(--brand-blue), var(--brand-red) );
        }

        --neutral-50: light-dark(hsl(30, 15%, 92%), hsl(60, 5%, 13%));
        --neutral-100: light-dark(hsl(30, 12%, 89%), hsl(60, 4%, 16%));
        --neutral-200: light-dark(hsl(30, 10%, 86%), hsl(60, 3%, 19%));
        --neutral-300: light-dark(hsl(30, 8%, 83%), hsl(60, 2%, 22%));
        --neutral-400: light-dark(hsl(30, 10%, 80%), hsl(60, 3%, 24%));
        --neutral-500: light-dark(hsl(30, 10%, 74%), hsl(60, 4%, 28%));
        --neutral-600: light-dark(hsl(30, 8%, 64%), hsl(60, 5%, 35%));
        --neutral-700: light-dark(hsl(30, 6%, 52%), hsl(60, 2%, 50%));
        --neutral-800: light-dark(hsl(30, 8%, 38%), hsl(60, 3%, 70%));
        --neutral-900: light-dark(hsl(30, 12%, 12%), hsl(60, 4%, 85%));
        --surface-1: var(--neutral-50);
        --surface-2: var(--neutral-100);
        --surface-3: var(--neutral-200);
        --surface-4: var(--neutral-300);
        --border-subtle: var(--neutral-400);
        --border-default: var(--neutral-500);
        --border-strong: var(--neutral-600);
        --text-primary: var(--neutral-900);
        --text-secondary: var(--neutral-800);
        --text-muted: var(--neutral-700);
        --text-inverse: var(--neutral-50);
        --link: inherit;
        --link-hover: var(--brand-blue);
        --link-active: var(--brand-red);
        --accent: light-dark(hsl(357, 60%, 40%), hsl(357, 60%, 40%));
        --primary: var(--brand-blue);
        /* @link https://utopia.fyi/type/calculator?c=360,18,1.2,1240,21,1.333,5,2,&s=0.75|0.5|0.25,1.5|2|3|4|6,s-l&g=s,l,xl,12 */
        --fs--2: clamp(0.7387rem, 0.7987rem + -0.0775vw, 0.7813rem);
        --fs--1: clamp(0.9375rem, 0.9182rem + 0.0857vw, 0.9846rem);
        --fs-0: clamp(1.125rem, 1.0483rem + 0.3409vw, 1.3125rem);
        --fs-1: clamp(1.35rem, 1.1865rem + 0.7265vw, 1.7496rem);
        --fs-2: clamp(1.62rem, 1.3287rem + 1.2948vw, 2.3322rem);
        --fs-3: clamp(1.944rem, 1.4675rem + 2.1178vw, 3.1088rem);
        --fs-4: clamp(2.3328rem, 1.5919rem + 3.2931vw, 4.144rem);
        --fs-5: clamp(2.7994rem, 1.6848rem + 4.9538vw, 5.524rem);
        /* @link https://utopia.fyi/space/calculator?c=360,18,1.2,1240,21,1.333,5,2,&s=0.75|0.5|0.25,1.5|2|3|4|6,s-l&g=s,l,xl,12 */
        --space-3xs: clamp(0.3125rem, 0.3125rem + 0vw, 0.3125rem);
        --space-2xs: clamp(0.5625rem, 0.5114rem + 0.2273vw, 0.6875rem);
        --space-xs: clamp(0.875rem, 0.8239rem + 0.2273vw, 1rem);
        --space-s: clamp(1.125rem, 1.0483rem + 0.3409vw, 1.3125rem);
        --space-m: clamp(1.6875rem, 1.5597rem + 0.5682vw, 2rem);
        --space-l: clamp(2.25rem, 2.0966rem + 0.6818vw, 2.625rem);
        --space-xl: clamp(3.375rem, 3.1449rem + 1.0227vw, 3.9375rem);
        --space-2xl: clamp(4.5rem, 4.1932rem + 1.3636vw, 5.25rem);
        --space-3xl: clamp(6.75rem, 6.2898rem + 2.0455vw, 7.875rem);
        --space-4xl: clamp(9rem, 8.3864rem + 2.7273vw, 10.5rem);
        /* One-up pairs */
        --space-3xs-2xs: clamp(0.3125rem, 0.1591rem + 0.6818vw, 0.6875rem);
        --space-2xs-xs: clamp(0.5625rem, 0.3835rem + 0.7955vw, 1rem);
        --space-xs-s: clamp(0.875rem, 0.696rem + 0.7955vw, 1.3125rem);
        --space-s-m: clamp(1.125rem, 0.767rem + 1.5909vw, 2rem);
        --space-m-l: clamp(1.6875rem, 1.304rem + 1.7045vw, 2.625rem);
        --space-l-xl: clamp(2.25rem, 1.5597rem + 3.0682vw, 3.9375rem);
        --space-xl-2xl: clamp(3.375rem, 2.608rem + 3.4091vw, 5.25rem);
        --space-2xl-3xl: clamp(4.5rem, 3.1193rem + 6.1364vw, 7.875rem);
        --space-3xl-4xl: clamp(6.75rem, 5.2159rem + 6.8182vw, 10.5rem);
        /* Custom pairs */
        --space-s-l: clamp(1.125rem, 0.5114rem + 2.7273vw, 2.625rem);
        --space-2xl-4xl: clamp(4.5rem, 2.0455rem + 10.9091vw, 10.5rem);
    }

    html {
        font-family: 'Montserrat Regular', Helvetica, Arial, sans-serif;
        text-size-adjust: none;
        scroll-padding-block: 9rem;

        @media (prefers-reduced-motion: no-preference) {
            scroll-behavior: smooth;
        }
    }

    body {
        margin: 2rem;
        min-block-size: 100svb;
        background-color: var(--surface-1);
        color: var(--text-primary);
        font-size: var(--fs-1);
    }

    .stop-scrolling {
      height: 100%;
      overflow: hidden;
    }

    h2::before {
        content: "- ";
    }

    h2::after {
        content: " -";
    }

    .site-header {
        font-size: var(--fs--1);
        padding-block: var(--space-s);
        border-block-end: 1px solid var(--border-subtle);
        position: sticky;
        top: 0;
        z-index: 1;
        background-color: var(--surface-1);
    }

    .site-header-inner {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-2xs) var(--space-m);
    }

    .site-logo {
        font-size: var(--fs-0);
        font-weight: 700;
        letter-spacing: -0.01em;
        text-decoration: none;
    }

    .copyright {
        margin-top: 30px;
        text-align: center;
        font-size: var(--fs-1);
    }

    .site-nav {
        display: flex;
        gap: var(--space-s);
        color: var(--brand-blue);
    }

    .indexer {
        line-height: 1.6rem;
        text-align: center;
        font-size: small;
	margin-top: 10px;
    }

    .year {
        display: block;
        width: 100%;
        text-align: center;
        padding-top: 10px;
        margin-bottom: 5px;
        border-bottom: 1px solid var(--border-subtle);
    }

    .overlay {
        background: #fff;
        margin: 0;
        padding: 20px;
        z-index: 99;
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        transition: opacity 200ms;
        visibility: hidden;
        opacity: 0;

        .mycontent {
            height: calc(100% - 100px);
        }

        .myfooter {
            border-top: 1px solid var(--border-subtle);
            padding: 5px;
            position: absolute;
            bottom: 10px;
            width: calc(100% - 40px);
            background: #fff;
        }

        .btn {
            background-color: var(--border-subtle);
            border: none;
            color: white;
            padding: 10px 25px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 16px;
            cursor: pointer;
            border-radius: 12px;
            float: right;
        }

	.btn:hover {
            opacity: .8;
	}

        .close {
            font-size: 3rem;
            position: absolute;
            top: 0;
            right: 10px;
            opacity: 0.5;
            transition: all 200ms;
            font-weight: bold;
            text-decoration: none;
            color: red;
            -webkit-text-stroke: 2px white;
            text-stroke: 2px white; /* Standard property for future-proofing */

            &:hover {
                opacity: 1;
                -webkit-text-stroke: 1px black;
                text-stroke: 1px black; /* Standard property for future-proofing */
            }
        }

        img {
            margin: 30px auto;
            border: 2px solid grey;
            max-width: 100%;
            max-height: 100%;
            object-fit: scale-down;
        }
    }

    button {
        border: none;
        background-color: transparent;
        margin: 0;
        padding: 0;
    }

        button:hover {
            cursor: pointer;
        }

    a, a:visited, a:hover, a:active {
        color: inherit;
        text-decoration: none;
    }
}

.portfolio-region {
    padding-block: var(--space-xl);
}

.portfolio-wrapper {
    inline-size: min(100% - 2rem, 960px);
    margin-inline: auto;
}

ul[role="list"] {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tag-list {
    font-size: var(--fs--2);
    color: var(--text-muted);
    margin-block-start: var(--space-3xs);

    li {
        padding: 0.25em 0.75em;
        border: 1px solid var(--border-subtle);
        border-radius: 100vmax;
    }
}

img,
picture,
iframe {
    pointer-events: none;
    display: block;
    block-size: auto;
    max-inline-size: 100%;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--grid-width)), 1fr));
    gap: var(--space-m);
}

.portfolio-card {
    display: grid;
    grid-template-rows: auto 1fr;
    block-size: 100%;
    background-color: var(--surface-2);
    border-radius: 0.75rem;
    overflow: hidden;
    width: var(--grid-width);
    background-color: transparent;
}

.portfolio-card {
    animation: card-in 1s forwards paused;

    @container style(--in-view: true) {
        animation-play-state: running;
    }
}

@keyframes portfolio-card-in {
    0% {
        opacity: 0;
        translate: 0 50px;
    }

    100% {
        opacity: 1;
        translate: 0;
    }
}

.card-image {
    margin: 0 auto;
    height: var(--max-img-height);
    object-fit: cover;
    border: 1px solid var(--border-subtle); 
    border-radius: 0.75rem;
}

.portfolio-item {
    --in-view: true;
}

.portfolio-item {
    --in-view: false;
    animation: portfolio-item-in-view both;
    animation-timeline: view();
    animation-range: entry 0% entry 40%;
}

.portfolio-card {
    @supports (animation-timeline: view()) {
        @media (prefers-reduced-motion: no-preference) {
            animation: portfolio-card-in 1s both;
            animation-play-state: paused;
            animation-delay: calc(var(--stagger, 0) * 0.25s);

            @container style(--in-view: true) {
                animation-play-state: running;
            }
        }
    }
}

/* for the staggered animation */
.portfolio-grid {
    --min-col-size: 12rem;
    --gap: 1rem;

    container: portfolio / inline-size;

    display: grid;
    justify-items: center;
    grid-template-columns: repeat( 
        auto-fit, 
        minmax(min(var(--min-col-size), 100%), 1fr) 
    );
}

/* 2 cols + 1 gap */
@container portfolio (width > calc(12rem * 2 + 1rem)) {
  .portfolio-item:nth-child(2n) {
    --stagger: 1;
  }
}

/* 3 cols + 2 gaps */
@container portfolio (width > calc(12rem * 3 + 1rem * 2)) {
  .portfolio-item:nth-child(3n + 1) {
    --stagger: 0;
  }
  .portfolio-item:nth-child(3n + 2) {
    --stagger: 1;
  }
  .portfolio-item:nth-child(3n + 3) {
    --stagger: 2;
  }
}

/* 4 cols + 3 gaps */
@container portfolio (width > calc(12rem * 4 + 1rem * 2)) {
  .portfolio-item:nth-child(4n + 1) {
    --stagger: 0;
  }
  .portfolio-item:nth-child(4n + 2) {
    --stagger: 1;
  }
  .portfolio-item:nth-child(4n + 3) {
    --stagger: 2;
  }
  .portfolio-item:nth-child(4n + 4) {
    --stagger: 3;
  }
}

/* 5 cols + 3 gaps */
@container portfolio (width > calc(12rem * 5 + 1rem * 2)) {
  .portfolio-item:nth-child(5n + 1) {
    --stagger: 0;
  }
  .portfolio-item:nth-child(5n + 2) {
    --stagger: 1;
  }
  .portfolio-item:nth-child(5n + 3) {
    --stagger: 2;
  }
  .portfolio-item:nth-child(5n + 4) {
    --stagger: 3;
  }
  .portfolio-item:nth-child(5n + 5) {
    --stagger: 4;
  }
}

@keyframes portfolio-item-in-view {
    from {
        --in-view: false;
    }

    to {
        --in-view: true;
    }
}

@keyframes portfolio-card-reveal {
    from {
        opacity: 0;
        translate: 0 1rem;
        scale: 0.96;
    }

    to {
        opacity: 1;
        translate: 0 0;
        scale: 1;
    }
}
