@font-face {
    font-family: 'Geist Mono';
    src: url(assets/fonts/GeistMono-Regular.woff2) format('woff2');
    font-weight: 400;
    font-display: swap;
}

/* subset with only the glyphs of "click!"; re-download from Google Fonts (text=...) if the note changes */
@font-face {
    font-family: 'Caveat';
    src: url(assets/fonts/Caveat-SemiBold-click.woff2) format('woff2');
    font-weight: 600;
    font-display: swap;
}

:root {
    /* background: from the old saseq-dev-website */
    --bg: #07060E;
    --glow: rgba(99, 141, 219, 0.15);
    --accent: #638DDB;
    /* text: t3.gg */
    --text: #fafafa;
    --subtle: #a3a3a3;
    --muted: #737373;
    --line: rgba(255, 255, 255, 0.1);
    --chip: rgba(255, 255, 255, 0.06);
    --chip-hover: rgba(99, 141, 219, 0.18);
    /* external-link icon from t3.gg, used as a mask */
    --arrow: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z"/><path d="M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z"/></svg>');
}

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

body {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1.5rem;
    background: var(--bg);
    color: var(--text);
    font-family: 'Geist Mono', ui-monospace, monospace;
    line-height: 1.5;
}

::selection {
    background: rgba(99, 141, 219, 0.2);
}

.glow {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, var(--glow) 0%, transparent 70%);
    pointer-events: none;
}

main {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

a {
    color: inherit;
    text-decoration: none;
}

h1 {
    font-size: clamp(1.375rem, 4.5vw, 2.25rem);
    font-weight: 400;
    letter-spacing: -0.025em;
    line-height: 1.8;
}

.line {
    display: block;
}

/* sized so the wordmark's caps and baseline line up with the text around it */
.logo {
    height: 1.2em;
    width: auto;
    vertical-align: -0.27em;
    animation: float 5s ease-in-out infinite;
}

/* up in 2s, back down in 3s */
@keyframes float {
    0%,
    100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-0.12em);
    }
}

.chip {
    display: inline-block;
    padding: 0.1em 0.35em;
    border-radius: 0.3em;
    line-height: 1.35;
    background: var(--chip);
    white-space: nowrap;
    transition: background-color 0.2s;
}

/* keeps "& Freelancer" together when the line wraps on mobile */
.keep {
    white-space: nowrap;
}

/* z-index keeps the popup above the footer (both are transformed by .in) */
.tags {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    max-width: 32rem;
    margin-top: 2rem;
    list-style: none;
}

.tag {
    display: block;
    padding: 0.25rem 0.625rem;
    border: 0;
    border-radius: 0.375rem;
    background: var(--chip);
    color: var(--text);
    font: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.2s, box-shadow 0.2s;
}

.chip {
    cursor: pointer;
}

.chip:hover,
.tag:hover,
.tag:focus-visible,
.tag[aria-expanded="true"] {
    background: var(--chip-hover);
}

/* focus shows as the blue fill above, not the browser ring */
.tag:focus {
    outline: none;
}

/* hand-drawn "click!" note, anchored to the whole tag list: the arrow comes up from below
   and its tip lands on the list's left edge, vertically centred (between the rows once they wrap).
   --aw = arrow width; the svg is flipped, so its tip sits at 96% / 37% of the box */
/* .tags prefix so the desktop ".tags li { position: relative }" can't override it */
.tags .hint {
    --aw: 9rem;
    position: absolute;
    inset: 0;
    color: var(--text);
    pointer-events: none;
}

.hint-arrow {
    position: absolute;
    right: calc(100% + 0.25rem);
    top: 50%;
    width: var(--aw);
    stroke-width: 3.9;
    translate: 0 -37%;
    scale: 1 -1;
}

/* sits under where the arrow starts */
.hint-text {
    position: absolute;
    top: calc(50% + var(--aw) * 0.207 + 0.125rem);
    left: calc(-0.75rem - var(--aw));
    font-family: 'Caveat', cursive;
    font-size: 3rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    rotate: -6deg;
    /* "written" left to right while the arrow draws; negative insets leave room for glyph overhang */
    clip-path: inset(-20% 110% -20% -10%);
    animation: write 0.7s 1s cubic-bezier(0.45, 0, 0.55, 1) forwards;
}

/* the arrow draws itself after the page entrance.
   gap (1.1) is longer than the path and the offset starts inside it, so no
   zero-length dash (= round-cap dot) shows at either end before drawing */
.hint-arrow path {
    stroke-dasharray: 1 1.1;
    stroke-dashoffset: 1.05;
    animation: draw 0.6s 1s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

.hint-arrow .hint-head {
    animation-duration: 0.2s;
    animation-delay: 1.55s;
}

@keyframes draw {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes write {
    to {
        clip-path: inset(-20% -10% -20% -10%);
    }
}

/* popup: wipes open from top-left to bottom-right (fast, then easing out), then the content fades in.
   display: none when closed (not visibility), so closed popups don't make the page scroll on mobile;
   allow-discrete + @starting-style (below the browser popup) keep the open/close animations */
.pop {
    --open: 0.6s;
    --text-in: 0.45s;
    display: none;
    position: absolute;
    top: calc(100% + 0.75rem);
    left: 50%;
    width: min(22rem, calc(100vw - 3rem));
    padding: 1.25rem;
    border-radius: 0.75rem;
    background: #151827;
    z-index: 1; /* above the "click!" note, which stays visible */
    scroll-margin-bottom: 1.5rem;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
    text-align: left;
    translate: -50%;
    clip-path: inset(0 100% 100% 0 round 0.75rem);
    transition: clip-path 0.3s cubic-bezier(0.7, 0, 0.84, 0), display 0.3s allow-discrete;
}

/* invisible spacer: lets the page scroll a little past the popup's bottom edge */
.pop::after {
    content: '';
    position: absolute;
    top: 100%;
    width: 1px;
    height: 1.5rem;
}

.pop.open {
    display: block;
    clip-path: inset(0 0 0 0 round 0.75rem);
    transition: clip-path var(--open) cubic-bezier(0.16, 1, 0.3, 1);
}

.pop > * {
    opacity: 0;
    transition: opacity 0.15s;
}

.pop.open > * {
    opacity: 1;
    transition: opacity 0.3s var(--text-in);
}

/* video popup: thumbnail with a play button, swapped for the YouTube player on click */
.pop--video {
    width: min(24rem, calc(100vw - 3rem));
}

.video {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    padding: 0;
    border: 0;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #000;
    cursor: pointer;
}

.video img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* play button: white disc + triangle */
button.video::before,
button.video::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    translate: -50% -50%;
    transition: scale 0.2s, background-color 0.2s;
}

button.video::before {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: var(--text);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

button.video::after {
    width: 1.1rem;
    height: 1.25rem;
    margin-left: 0.15rem;
    background: var(--bg);
    clip-path: polygon(0 0, 100% 50%, 0 100%);
}

button.video:hover::before,
button.video:focus-visible::before {
    scale: 1.08;
    background: #fff;
}

button.video:focus-visible {
    outline: 1px solid var(--accent);
    outline-offset: 4px;
}

.video-title {
    margin-top: 1rem;
    font-size: 1rem;
    line-height: 1.4;
}

.video-meta {
    margin-top: 0.25rem;
    color: var(--muted);
    font-size: 0.8125rem;
    letter-spacing: 0.05em;
}

.pop-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.5rem 0.875rem;
    border-radius: 0.5rem;
    background: var(--chip);
    font-size: 0.875rem;
    transition: background-color 0.2s;
}

.pop-cta:hover,
.pop-cta:focus-visible {
    background: var(--chip-hover);
}

/* shopify popup: a mini browser that "loads" the app page.
   open: window springs out of the tag -> url types itself -> progress bar runs -> page fades in -> stars light up */
.pop--browser {
    width: min(24rem, calc(100vw - 3rem));
    padding: 0;
    clip-path: none;
    opacity: 0;
    scale: 0.92;
    transform-origin: 50% 0;
    transition: opacity 0.15s, scale 0.15s, display 0.15s allow-discrete;
}

.pop--browser.open {
    clip-path: none;
    opacity: 1;
    scale: 1;
    transition: opacity 0.2s, scale 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* the browser stages its own content, so skip the shared fade */
.pop--browser > *,
.pop--browser.open > * {
    opacity: 1;
    transition: none;
}

/* where the open transitions start from, since the popup comes in from display: none */
@starting-style {
    .pop.open {
        clip-path: inset(0 100% 100% 0 round 0.75rem);
    }

    .pop.open > * {
        opacity: 0;
    }

    .pop--browser.open {
        clip-path: none;
        opacity: 0;
        scale: 0.92;
    }
}

.browser-bar {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem 0;
    border-radius: 0.75rem 0.75rem 0 0;
    background: #0f1120;
}

.browser-dots {
    display: flex;
    gap: 0.375rem;
    align-self: center;
    padding-bottom: 0.25rem;
}

.browser-dots i {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
}

.browser-tab {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    max-width: 12rem;
    padding: 0.4rem 0.75rem;
    border: 0;
    border-radius: 0.5rem 0.5rem 0 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 0.75rem;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.2s, background-color 0.2s;
}

.browser-tab img {
    width: 0.875rem;
    height: 0.875rem;
    border-radius: 0.2rem;
}

.browser-tab:hover {
    color: var(--text);
}

.browser-tab[aria-selected="true"] {
    background: #151827;
    color: var(--text);
}

.browser-tab:focus-visible {
    outline: 1px solid var(--accent);
    outline-offset: -1px;
}

.browser-url {
    position: relative;
    margin: 0.5rem 0.75rem 0;
    padding: 0.375rem 0.625rem;
    border-radius: 0.5rem;
    background: var(--chip);
    color: var(--subtle);
    font-size: 0.75rem;
    line-height: 1.5;
}

/* monospace, so 1ch = one character: steps(--n) types it letter by letter */
.url {
    display: inline-block;
    width: 0;
    overflow: hidden;
    border-right: 1px solid transparent;
    white-space: nowrap;
    vertical-align: bottom;
}

.open .url {
    animation:
        type 0.7s steps(var(--n)) 0.25s forwards,
        caret 0.5s step-end 0.25s 4;
}

/* page-load progress bar */
.browser-url::after {
    content: '';
    position: absolute;
    left: 0.5rem;
    bottom: 0;
    width: 0;
    height: 2px;
    border-radius: 1px;
    background: var(--accent);
}

.open .browser-url::after {
    animation: load 0.7s 0.7s ease-out forwards;
}

.browser-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.25rem 1.25rem 1.5rem;
    text-align: center;
}

.open .browser-page {
    animation: page-in 0.45s 1.25s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* same gentle float as the logo */
.page-icon {
    width: 3.5rem;
    height: 3.5rem;
    box-shadow: 0 10px 30px rgba(99, 141, 219, 0.25);
    animation: float 5s ease-in-out infinite;
}

.page-name {
    margin-top: 0.875rem;
    font-size: 1.125rem;
}

.page-by {
    color: var(--muted);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.page-desc {
    max-width: 18rem;
    margin-top: 0.625rem;
    color: var(--subtle);
    font-size: 0.8125rem;
    line-height: 1.5;
}

.page-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.625rem;
    color: var(--muted);
    font-size: 0.75rem;
}

.stars {
    letter-spacing: 0.1em;
}

.stars i {
    display: inline-block;
    font-style: normal;
    color: var(--accent);
}

/* stars light up one by one once the page is in */
.open .stars i {
    animation: star 0.35s calc(1.5s + var(--i) * 0.08s) cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.browser-page .pop-cta {
    margin-top: 1rem;
}

@keyframes type {
    to {
        width: calc(var(--n) * 1ch);
    }
}

@keyframes caret {
    0% {
        border-color: var(--text);
    }
    50% {
        border-color: transparent;
    }
}

@keyframes load {
    85% {
        width: calc(100% - 1rem);
        opacity: 1;
    }
    to {
        width: calc(100% - 1rem);
        opacity: 0;
    }
}

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

@keyframes star {
    from {
        color: var(--muted);
        scale: 0.5;
    }
}

/* wide screens: popup starts at the left edge of its tag
   (below 62rem the "Discord Bots" one would overflow, so it stays centred under the tags) */
@media (min-width: 62rem) {
    .tags li {
        position: relative;
    }

    .pop {
        left: 0;
        translate: none;
    }

    .pop--browser {
        transform-origin: 0 0;
    }
}

.pop-title {
    margin-bottom: 0.5rem;
    color: var(--muted);
    font-size: 0.8125rem;
    letter-spacing: 0.05em;
}

.pop-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin: 0 -0.625rem;
    padding: 0.5rem 0.625rem;
    border-radius: 0.5rem;
    font-size: 1.125rem;
    transition: background-color 0.2s;
}

.pop-link:hover,
.pop-link:focus-visible {
    background: var(--chip-hover);
}

/* radius matches the corners baked into the project logos */
.pop-icon {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 33%;
    background: var(--chip);
}

/* external-link arrow */
.pop-link::after,
.pop-cta::after {
    content: '';
    width: 0.875rem;
    height: 0.875rem;
    margin-left: auto;
    background: var(--muted);
    mask: var(--arrow) center / contain no-repeat;
    transition: background-color 0.2s, transform 0.2s;
}

.pop-link:hover::after,
.pop-link:focus-visible::after,
.pop-cta:hover::after,
.pop-cta:focus-visible::after {
    background: var(--text);
    transform: translate(2px, -2px);
}

footer {
    display: flex;
    justify-content: center;
    gap: 1.25rem;
    width: min(20rem, 100%);
    margin-top: 4rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
    font-size: 0.875rem;
    letter-spacing: 0.05em;
}

footer a {
    color: var(--muted);
    transition: color 0.2s;
}

footer a:hover,
footer a:focus-visible {
    color: var(--text);
}

a:focus-visible {
    outline: 1px solid var(--accent);
    outline-offset: 4px;
}

/* staggered entrance, same timing as t3.gg */
.in {
    opacity: 0;
    animation: fade-in-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* below ~800px the single tag row leaves no room for the note,
   so tags wrap 2 + 2 and the note shrinks */
@media (max-width: 50rem) {
    .tags {
        max-width: 18rem;
    }

    .tags .hint {
        --aw: 3.75rem;
        translate: 0 0.5rem;
    }

    /* no room left of the block here, so the tip moves in under "AI integrations",
       landing in the gap between the two rows just before "MCP" */
    .hint-arrow {
        right: auto;
        left: calc(2.75rem - var(--aw) * 0.96);
        stroke-width: 5;
    }

    .hint-text {
        left: calc(2.5rem - var(--aw));
        font-size: 1.625rem;
    }
}

@media (max-width: 34rem) {
    .tag {
        font-size: 0.8125rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .in,
    .logo,
    .hint-text,
    .hint-arrow path {
        animation: none;
        opacity: 1;
        stroke-dashoffset: 0;
        clip-path: none;
    }

    .pop,
    .pop > * {
        transition: none !important;
    }

    .pop--browser *,
    .pop--browser *::after {
        animation: none !important;
    }

    .url {
        width: auto;
    }
}
