@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #f91477;
    --title-pink: rgb(249, 20, 119);
    --secondary-red: #980000;
    --secondary-violet: #390064;
    --secondary-black: #010000;
    --secondary-white: #ffffff;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
}

body {
    font-family: 'Lexend', sans-serif;
    color: var(--secondary-white);
    background: radial-gradient(circle at 20% 20%, rgba(249, 20, 119, 0.2), transparent 42%),
        radial-gradient(circle at 80% 70%, rgba(57, 0, 100, 0.35), transparent 45%),
        var(--secondary-black);
    overflow: hidden;
}

.back-home {
    position: fixed;
    top: clamp(10px, 2vh, 18px);
    left: clamp(10px, 2vw, 18px);
    display: inline-block;
    color: var(--secondary-white);
    text-decoration: none;
    z-index: 50;
    user-select: none;
}

.back-home-star {
    position: relative;
    width: clamp(88px, 11vmin, 116px);
    height: clamp(44px, 5.5vmin, 58px);
    display: grid;
    place-items: center;
    isolation: isolate;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.back-home-star::before,
.back-home-star::after {
    content: "";
    position: absolute;
    inset: 0;
    clip-path: polygon(50% 0%, 64.29% 28.57%, 100% 49.21%, 64.29% 68.25%, 50% 100%, 35.71% 68.25%, 0% 49.21%, 35.71% 28.57%);
    z-index: -1;
}

.back-home-star::before {
    background: var(--secondary-white);
}

.back-home-star::after {
    inset: 6px;
    background: var(--primary);
}

.back-home-text {
    font-size: clamp(0.42rem, 0.85vmin, 0.56rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-shadow: 0 0 8px rgba(0, 0, 0, 0.75);
    line-height: 1;
    white-space: nowrap;
}

.back-home:hover .back-home-star,
.back-home:focus-visible .back-home-star {
    transform: scale(1.12);
    filter: drop-shadow(0 0 7px rgba(249, 20, 119, 0.95));
}

.background-video {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(1.15) contrast(1.1) brightness(0.52);
    transform: scale(1.02);
    will-change: transform, filter;
    z-index: -3;
}

.video-overlay {
    position: fixed;
    inset: 0;
    z-index: -2;
    background: linear-gradient(145deg, rgba(1, 0, 0, 0.55), rgba(57, 0, 100, 0.62));
}

.atmosphere {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 16px 16px;
    opacity: 0.2;
    will-change: transform;
    animation: drift 32s linear infinite;
}

.hero-shell {
    position: relative;
    width: 100vw;
    height: 100dvh;
    display: grid;
    place-items: center;
    padding: 0;
    container-type: size;
}

.page-title {
    position: absolute;
    top: 4%;
    left: 50%;
    isolation: isolate;
    margin: 0;
    display: block;
    width: 103.125%;
    text-align: center;
    font-family: 'Lexend', sans-serif;
    font-weight: 800;
    text-transform: uppercase;
    font-size: clamp(0.8rem, 0.85cqw, 1.65rem);
    letter-spacing: 0.08em;
    color: var(--secondary-white);
    text-shadow: 0 0 clamp(8px, 1vw, 15px) rgba(249, 20, 119, 0.65), 0 0 clamp(16px, 2vw, 30px) rgba(57, 0, 100, 0.55);
    border: none;
    padding: clamp(0.75rem, 1.875vw, 1.125rem) clamp(1.125rem, 2.25vw, 1.65rem);
    z-index: 4;
    opacity: 0;
    transform: translate(-50%, -22px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.page-title::before,
.page-title::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 16px;
    clip-path: polygon(5% 0, 95% 0, 100% 50%, 95% 100%, 5% 100%, 0 50%);
    z-index: -1;
}

.page-title::before {
    background: var(--secondary-white);
}

.page-title::after {
    inset: 2px;
    background: var(--title-pink);
}

.page-title-main {
    display: block;
    font-size: clamp(1.2rem, 1.95cqw, 3.09375rem);
    line-height: 0.95;
    white-space: nowrap;
}

.page-title-sub {
    display: block;
    margin-top: 0.3rem;
    font-size: clamp(0.72rem, 0.85cqw, 1.35rem);
    line-height: 1.08;
    letter-spacing: 0.12em;
    white-space: nowrap;
}

.star-stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    padding: 0;
}

.triangle-burst {
    position: absolute;
    top: 52%;
    left: 50%;
    width: 56.5cqw;
    height: auto;
    transform: translate(-50%, -50%) translateY(26vh) scale(0.744) rotate(-14deg);
    will-change: transform, opacity;
    contain: layout paint;
    z-index: 0;
    pointer-events: auto;
    opacity: 0;
}

.triangle-burst polygon {
    fill: rgba(220, 20, 60, 0.95);
    stroke: rgba(255, 255, 255, 0.98);
    stroke-width: 2.6;
    stroke-linejoin: round;
}

.triangle-burst polygon:nth-of-type(5),
.triangle-burst polygon:nth-of-type(6) {
    transform-box: fill-box;
    transform-origin: center;
    transform: rotate(5deg);
}

.triangle-burst polygon:nth-of-type(5) {
    transform: rotate(-5deg);
}

.star-card {
    position: relative;
    z-index: 2;
    width: 33.6cqw;
    aspect-ratio: 8 / 5;
    opacity: 0;
    transform: translateY(26vh) scale(0.62) rotate(-14deg);
    will-change: transform, opacity;
    cursor: pointer;
}

.triangle-burst,
.triangle-burst polygon {
    cursor: pointer;
}

.star-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    shape-rendering: geometricPrecision;
    filter: drop-shadow(0 10px 18px rgba(1, 0, 0, 0.68));
}

.star-fill {
    fill: var(--title-pink);
}

.star-stroke {
    fill: none;
    stroke: var(--secondary-white);
    stroke-width: 4;
    stroke-linejoin: miter;
    stroke-linecap: butt;
    stroke-miterlimit: 24;
    vector-effect: non-scaling-stroke;
    stroke-dasharray: 100 100;
    stroke-dashoffset: 100;
}

.star-content {
    position: absolute;
    inset: 0;
    text-align: center;
}

.profile-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24%;
    aspect-ratio: 1 / 1;
    height: auto;
    margin: 0;
    transform: translate(-50%, -50%);
    z-index: 3;
    border-radius: 50%;
    object-fit: cover;
    border: clamp(3px, 0.5vw, 6px) solid var(--secondary-white);
    box-shadow: 0 clamp(6px, 1vw, 12px) clamp(15px, 2vw, 30px) rgba(0, 0, 0, 0.55);
}

.summary-text {
    position: absolute;
    top: 50%;
    left: 50%;
    isolation: isolate;
    z-index: 1;
    margin: 0;
    transform: translate(-50%, -50%) scale(1);
    transform-origin: center center;

    width: 70%;
    max-width: none;
    height: auto;
    min-height: 50%;
    max-height: none;
    padding: clamp(0.8rem, 1.2vw, 1rem);

    line-height: 1.2;
    font-size: clamp(0.4rem, 0.6vw, 0.6rem);

    background: none;
    border: none;
}

.summary-text::before,
.summary-text::after {
    content: "";
    position: absolute;
    inset: 0;
    clip-path: polygon(50% 0%, 80% 20%, 100% 50%, 80% 80%, 50% 100%, 20% 80%, 0% 50%, 20% 20%);
    z-index: -1;
}

.summary-text::before {
    background: rgba(255, 255, 255, 0.98);
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.18));
}

.summary-text::after {
    inset: 5px;
    clip-path: polygon(50% 0%, 72% 28%, 100% 50%, 72% 72%, 50% 100%, 28% 72%, 0% 50%, 28% 28%);
    background: rgba(57, 0, 100, 0.90);
}

.explore-btn {
    position: absolute;
    top: 79%;
    left: 50%;
    width: clamp(120px, 6.7cqw, 170px);
    height: clamp(90px, 5.1cqw, 130px);
    margin-top: 0;
    border: none;
    background: transparent;
    color: var(--secondary-white);
    font-family: 'Lexend', sans-serif;
    font-weight: 800;
    font-size: clamp(0.72rem, 0.6cqw, 0.95rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0;
    cursor: pointer;
    display: grid;
    place-items: top;
    padding-top: 10px;
    isolation: isolate;
    transform: translateX(-50%);
    box-shadow: none;
    filter: drop-shadow(0 clamp(8px, 1.5vw, 14px) clamp(18px, 3vw, 30px) rgba(0, 0, 0, 0.5));
    transition: transform 0.24s ease, box-shadow 0.24s ease, filter 0.24s ease;
}

.explore-btn::before,
.explore-btn::after {
    content: "";
    position: absolute;
    inset: 0;
    clip-path: polygon(50% 100%, 0% 0%, 100% 0%);
    z-index: -1;
}

.explore-btn::before {
    background: var(--secondary-white);
}

.explore-btn::after {
    inset: 4px;
    background: rgba(57, 0, 100, 0.95);
}

.explore-btn:hover,
.explore-btn:focus-visible {
    transform: translateX(-50%) translateY(clamp(-2px, -0.5vh, -4px)) scale(1.04);
    box-shadow: none;
    filter: saturate(1.12) drop-shadow(0 clamp(10px, 2vw, 16px) clamp(22px, 4vw, 35px) rgba(0, 0, 0, 0.56));
    outline: none;
}

.fact-bubble {
    position: absolute;
    top: -21%;
    right: -57%;
    width: clamp(190px, 46%, 360px);
    min-height: clamp(92px, 22%, 140px);
    border-radius: 48% 52% 46% 54% / 58% 62% 38% 42%;
    border: clamp(2px, 0.3vw, 4px) solid rgba(223, 246, 255, 0.95);
    background:
        radial-gradient(circle at 20% 26%, rgba(255, 255, 255, 0.99) 0 28%, transparent 31%),
        radial-gradient(circle at 42% 18%, rgba(238, 250, 255, 0.97) 0 24%, transparent 27%),
        radial-gradient(circle at 66% 24%, rgba(229, 246, 255, 0.96) 0 30%, transparent 33%),
        radial-gradient(circle at 84% 38%, rgba(255, 233, 245, 0.92) 0 20%, transparent 23%),
        linear-gradient(165deg, rgba(255, 255, 255, 0.99), rgba(224, 244, 255, 0.97));
    color: var(--primary);
    display: grid;
    place-items: center;
    text-align: center;
    padding: clamp(0.8rem, 1.5vw, 1.3rem);
    transform: rotate(-7deg) scale(0.3);
    transform-origin: left bottom;
    opacity: 0;
    z-index: 6;
    box-shadow: 0 clamp(10px, 1.5vw, 18px) clamp(15px, 2vw, 25px) rgba(1, 0, 0, 0.45),
        0 0 clamp(8px, 1vw, 14px) rgba(140, 215, 255, 0.35),
        inset 0 0 0 clamp(1px, 0.2vw, 3px) rgba(255, 255, 255, 0.55);
}

/* Thought trail dots — 6 real elements, arcing from icon toward the cloud */
.bubble-dot {
    position: absolute;
    border-radius: 50%;
    z-index: 7;
    background: radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 1) 0%, rgba(234, 248, 255, 0.98) 60%, rgba(187, 229, 255, 0.94) 100%);
    border: clamp(2px, 0.35vw, 4px) solid rgba(232, 250, 255, 1);
    box-shadow: 0 clamp(4px, 0.7vw, 9px) clamp(10px, 1.5vw, 16px) rgba(7, 5, 28, 0.48), 0 0 clamp(8px, 1vw, 14px) rgba(142, 219, 255, 0.5), inset 0 clamp(1px, 0.15vw, 2px) clamp(3px, 0.4vw, 5px) rgba(255,255,255,0.8);
    filter: drop-shadow(0 clamp(2px, 0.35vw, 5px) clamp(4px, 0.7vw, 8px) rgba(8, 2, 24, 0.65));
    animation: dot-float 2.8s ease-in-out infinite;
}

/* 6th dot — smallest, farthest from cloud (near the icon) */
.bubble-dot--6 {
    width: clamp(7px, 0.8vmin, 12px);
    height: clamp(7px, 0.8vmin, 12px);
    left: -126%;
    bottom: -112%;
    animation-delay: 0s;
    animation-duration: 2.45s;
    opacity: 0.7;
}

/* 5th dot */
.bubble-dot--5 {
    width: clamp(9px, 1vmin, 15px);
    height: clamp(9px, 1vmin, 15px);
    left: -98%;
    bottom: -88%;
    animation-delay: 0.1s;
    animation-duration: 2.6s;
    opacity: 0.78;
}

/* 4th dot */
.bubble-dot--4 {
    width: clamp(10px, 1.1vmin, 16px);
    height: clamp(10px, 1.1vmin, 16px);
    left: -76%;
    bottom: -64%;
    animation-delay: 0.2s;
    animation-duration: 2.8s;
    opacity: 0.84;
}

/* 3rd dot */
.bubble-dot--3 {
    width: clamp(14px, 1.6vmin, 22px);
    height: clamp(14px, 1.6vmin, 22px);
    left: -56%;
    bottom: -42%;
    animation-delay: 0.35s;
    animation-duration: 2.9s;
    opacity: 0.9;
}

/* 2nd dot */
.bubble-dot--2 {
    width: clamp(18px, 2.1vmin, 30px);
    height: clamp(18px, 2.1vmin, 30px);
    left: -38%;
    bottom: -22%;
    animation-delay: 0.5s;
    animation-duration: 3.1s;
    opacity: 0.96;
}

/* 1st dot — largest, closest to the main cloud */
.bubble-dot--1 {
    width: clamp(26px, 3.1vmin, 40px);
    height: clamp(26px, 3.1vmin, 40px);
    left: -22%;
    bottom: -2%;
    animation-delay: 0.6s;
    animation-duration: 3.4s;
    opacity: 1;
}

@keyframes dot-float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-6px); }
}

.fact-text {
    font-family: 'Lexend', sans-serif;
    font-weight: 700;
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    line-height: 1.28;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    animation: splash-wobble 2.2s ease-in-out infinite;
}

.fact-text.swap {
    animation: none;
    transform: scale(0.66) rotate(-7deg);
    opacity: 0;
}

body.ready .page-title {
    opacity: 1;
    transform: translate(-50%, 0);
}

body.ready .star-card {
    animation: star-arrive 1.22s cubic-bezier(0.2, 0.95, 0.2, 1.01) forwards;
}

body.ready .triangle-burst {
    animation: triangle-arrive 1.22s cubic-bezier(0.2, 0.95, 0.2, 1.01) forwards;
}

body.ready .star-stroke {
    animation: trace-star 1.3s ease-out 0.2s forwards;
}

body.ready .fact-bubble {
    animation: bubble-in 0.65s cubic-bezier(0.1, 1.2, 0.35, 1) 0.94s forwards,
        bubble-float 4.8s ease-in-out 1.6s infinite;
}

body.from-intro .hero-shell {
    animation: pop-entry 0.9s ease-out;
}

body.to-portfolio {
    animation: stage-fade 1.1s ease forwards;
}

body.to-portfolio .background-video {
    transition: filter 1.1s ease, transform 1.1s ease;
    filter: brightness(0.22) contrast(1.2);
    transform: scale(1.08);
}

body.to-portfolio .star-card {
    animation: star-spin-out 1.05s cubic-bezier(0.4, 0, 0.8, 0.6) forwards;
}

body.to-portfolio .triangle-burst {
    animation: triangle-spin-out 1.05s cubic-bezier(0.4, 0, 0.8, 0.6) forwards;
}

@keyframes star-arrive {
    0% {
        opacity: 0;
        transform: translateY(26vh) scale(0.62) rotate(-14deg);
    }
    55% {
        opacity: 1;
        transform: translateY(-1.2vh) scale(1.04) rotate(1.5deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
    }
}

@keyframes triangle-arrive {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(26vh) scale(0.744) rotate(-14deg);
    }
    55% {
        opacity: 1;
        transform: translate(-50%, -50%) translateY(-1.2vh) scale(1.248) rotate(1.5deg);
    }
    72% {
        opacity: 1;
        transform: translate(-50%, -50%) translateY(0.35vh) scale(1.188) rotate(-0.8deg);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) translateY(0) scale(1.2) rotate(0deg);
    }
}

@keyframes trace-star {
    to {
        stroke-dasharray: 100 0;
        stroke-dashoffset: 0;
    }
}

@keyframes bubble-in {
    to {
        opacity: 1;
        transform: rotate(-7deg) scale(1);
    }
}

@keyframes bubble-float {
    0%,
    100% {
        transform: translateY(0) rotate(-7deg);
    }
    50% {
        transform: translateY(-5px) rotate(-5deg);
    }
}

@keyframes splash-wobble {
    0%,
    100% {
        transform: rotate(-6deg) scale(0.98);
    }
    50% {
        transform: rotate(5deg) scale(1.03);
    }
}

@keyframes stage-fade {
    to {
        opacity: 0;
    }
}

@keyframes star-spin-out {
    0% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: scale(0) rotate(1080deg);
    }
}

@keyframes triangle-spin-out {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0) rotate(1080deg);
    }
}

@keyframes drift {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(-16px);
    }
}

@keyframes pop-entry {
    from {
        filter: blur(8px);
    }
    to {
        filter: blur(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .atmosphere,
    .fact-text,
    body.ready .triangle-burst,
    body.ready .star-card,
    body.ready .star-stroke,
    body.ready .fact-bubble,
    body.from-intro .hero-shell,
    body.to-portfolio .triangle-burst,
    body.to-portfolio .star-card {
        animation: none !important;
    }

    .page-title,
    .star-card,
    .fact-bubble {
        opacity: 1 !important;
        transform: none !important;
    }

    .triangle-burst {
        opacity: 1 !important;
        transform: translate(-50%, -50%) scale(1.2) !important;
    }
}
