html { scroll-behavior: smooth; }
:root {
    --bg-primary: #05060a;
    --bg-secondary: #0c0d13;
    --accent: #ffffff;
    --muted: #9fa5b5;
    --highlight: rgba(255, 255, 255, 0.12);
}

/* Open To Work - Sparkle Button - Cosmic Theme */
.sp {
    --active: 0;
    --spark: 1.8s;
    --transition: 0.3s;
    --cut: 0.1em;
    position: relative;
    text-decoration: none;
    display: inline-block;
}

.sparkle-button {
    --bg: radial-gradient(
            40% 50% at center 100%,
            hsl(220 calc(var(--active) * 40%) 50% / var(--active)),
            transparent
        ),
        radial-gradient(
            80% 100% at center 120%,
            hsl(220 calc(var(--active) * 40%) 45% / var(--active)),
            transparent
        ),
        hsl(220 calc(var(--active) * 30%) calc((var(--active) * 15%) + 8%));
    background: var(--bg);
    font-size: 1rem;
    font-weight: 600;
    font-family: "Segoe UI", "Trebuchet MS", sans-serif;
    border: 0;
    cursor: pointer;
    padding: 0.9em 1.2em;
    display: flex;
    align-items: center;
    gap: 0.25em;
    white-space: nowrap;
    border-radius: 100px;
    position: relative;
    box-shadow: 0 0 calc(var(--active) * 2em) calc(var(--active) * 0.6em) hsl(220 60% 50% / 0.4),
        0 0em 0 0 hsl(220 calc(var(--active) * 40%) calc((var(--active) * 30%) + 20%)) inset,
        0 -0.05em 0 0 hsl(220 calc(var(--active) * 40%) calc(var(--active) * 40%)) inset;
    transition: box-shadow var(--transition), scale var(--transition), background var(--transition);
    scale: calc(1 + (var(--active) * 0.05));
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.sparkle-button:active {
    scale: 0.98;
}

.sparkle path {
    color: hsl(0 0% calc((var(--active, 0) * 50%) + var(--base)));
    transform-box: fill-box;
    transform-origin: center;
    fill: currentColor;
    stroke: currentColor;
    animation-delay: calc((var(--transition) * 1.5) + (var(--delay) * 1s));
    animation-duration: 0.6s;
    transition: color var(--transition);
}

.sp:has(.sparkle-button:is(:hover, :focus-visible)) .sparkle path {
    animation-name: sp-bounce;
}

@keyframes sp-bounce {
    35%, 65% { scale: var(--scale); }
}

.sparkle path:nth-of-type(1) { --scale: 0.5; --delay: 0.1; --base: 30%; }
.sparkle path:nth-of-type(2) { --scale: 1.5; --delay: 0.2; --base: 15%; }
.sparkle path:nth-of-type(3) { --scale: 2.5; --delay: 0.35; --base: 20%; }

.sparkle-button::before {
    content: "";
    position: absolute;
    inset: -0.2em;
    z-index: -1;
    border: 0.2em solid hsl(220 50% 50% / 0.3);
    border-radius: 100px;
    opacity: var(--active, 0);
    transition: opacity var(--transition);
}

.spark {
    position: absolute;
    inset: 0;
    border-radius: 100px;
    rotate: 0deg;
    overflow: hidden;
    mask: linear-gradient(white, transparent 50%);
    animation: sp-flip calc(var(--spark) * 2) infinite steps(2, end);
}

@keyframes sp-flip {
    to { rotate: 360deg; }
}

.spark::before {
    content: "";
    position: absolute;
    width: 200%;
    aspect-ratio: 1;
    top: 0%;
    left: 50%;
    z-index: -1;
    translate: -50% -15%;
    rotate: 0;
    transform: rotate(-90deg);
    opacity: calc((var(--active)) + 0.3);
    background: conic-gradient(from 0deg, transparent 0 340deg, white 360deg);
    transition: opacity var(--transition);
    animation: sp-rotate var(--spark) linear infinite both;
}

.spark::after {
    content: "";
    position: absolute;
    inset: var(--cut);
    border-radius: 100px;
}

.backdrop {
    position: absolute;
    inset: var(--cut);
    background: var(--bg);
    border-radius: 100px;
    transition: background var(--transition);
}

@keyframes sp-rotate {
    to { transform: rotate(90deg); }
}

.sp:has(.sparkle-button:is(:hover, :focus-visible)) {
    --active: 1;
    --play-state: running;
}

.particle-pen {
    position: absolute;
    width: 200%;
    aspect-ratio: 1;
    top: 50%;
    left: 50%;
    translate: -50% -50%;
    -webkit-mask: radial-gradient(white, transparent 65%);
    mask: radial-gradient(white, transparent 65%);
    z-index: -1;
    opacity: var(--active, 0);
    transition: opacity var(--transition);
    pointer-events: none;
}

.particle {
    fill: white;
    width: calc(var(--size, 0.25) * 1rem);
    aspect-ratio: 1;
    position: absolute;
    top: calc(var(--y) * 1%);
    left: calc(var(--x) * 1%);
    opacity: var(--alpha, 1);
    animation: sp-float-out calc(var(--duration, 1) * 1s) calc(var(--delay) * -1s) infinite linear;
    transform-origin: var(--origin-x, 1000%) var(--origin-y, 1000%);
    z-index: -1;
    animation-play-state: var(--play-state, paused);
}

.particle path {
    fill: hsl(0 0% 80%);
    stroke: none;
}

.particle:nth-of-type(even) {
    animation-direction: reverse;
}

@keyframes sp-float-out {
    to { rotate: 360deg; }
}

.sp-text {
    translate: 2% -6%;
    letter-spacing: 0.01ch;
    background: linear-gradient(90deg, hsl(0 0% calc((var(--active) * 70%) + 60%)), hsl(0 0% calc((var(--active) * 70%) + 40%)));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    transition: background var(--transition);
}

.sparkle-button svg.sparkle {
    inline-size: 1.25em;
    translate: -25% -5%;
}

/* Particle positions */
.particle:nth-of-type(1) { --x: 20; --y: 30; --duration: 2.2; --delay: 0.3; --size: 0.3; --alpha: 0.8; }
.particle:nth-of-type(2) { --x: 40; --y: 20; --duration: 2.5; --delay: 0.8; --size: 0.4; --alpha: 0.6; }
.particle:nth-of-type(3) { --x: 60; --y: 35; --duration: 1.8; --delay: 0.5; --size: 0.25; --alpha: 0.9; }
.particle:nth-of-type(4) { --x: 80; --y: 25; --duration: 2.0; --delay: 1.0; --size: 0.35; --alpha: 0.7; }
.particle:nth-of-type(5) { --x: 25; --y: 60; --duration: 2.3; --delay: 0.2; --size: 0.3; --alpha: 0.8; }
.particle:nth-of-type(6) { --x: 45; --y: 70; --duration: 1.9; --delay: 0.7; --size: 0.4; --alpha: 0.6; }
.particle:nth-of-type(7) { --x: 70; --y: 55; --duration: 2.1; --delay: 0.4; --size: 0.25; --alpha: 0.9; }
.particle:nth-of-type(8) { --x: 85; --y: 65; --duration: 2.4; --delay: 0.9; --size: 0.35; --alpha: 0.7; }
.particle:nth-of-type(9) { --x: 30; --y: 45; --duration: 2.6; --delay: 0.6; --size: 0.3; --alpha: 0.8; }
.particle:nth-of-type(10) { --x: 55; --y: 50; --duration: 2.0; --delay: 0.1; --size: 0.4; --alpha: 0.6; }

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", "Trebuchet MS", sans-serif;
    background: radial-gradient(circle at top, #10121c, var(--bg-primary));
    color: var(--accent);
    min-height: 100vh;
    overflow-x: hidden;
    letter-spacing: 0.03em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    text-decoration: none;
}

header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10;
    background: rgba(5, 6, 10, 0.7);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 14px 5vw;
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(10px);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.logo {
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-size: 0.85rem;
}

nav {
    display: flex;
    gap: 28px;
    font-size: 0.9rem;
}

nav a {
    position: relative;
    padding-bottom: 4px;
    opacity: 0.9;
    transition: opacity 0.25s ease;
}

nav a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

nav a:hover,
nav a:focus-visible { opacity: 1; }
nav a:hover::after,
nav a:focus-visible::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* Enhanced button focus for accessibility */
.ghost-button:focus-visible,
.solid-button:focus-visible {
    outline: 2px solid rgba(255,255,255,0.65);
    outline-offset: 2px;
}

main {
    position: relative;
    z-index: 1;
}

section {
    padding: min(18vh, 140px) 5vw;
}

.hero {
    min-height: 100vh;
    display: grid;
    place-items: center;
    text-align: center;
    padding-top: calc(18vh + 60px);
    padding-bottom: 18vh;
}

.hero-inner {
    max-width: 760px;
    position: relative;
}

.hero h1 {
    font-size: clamp(2.8rem, 4vw, 4.5rem);
    margin: 0 0 20px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    animation: heroGlow 7s ease-in-out infinite alternate;
    text-shadow: 0 0 18px rgba(255, 255, 255, 0.18);
    line-height: 1.15;
}

.hero p {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--muted);
    margin: 0 auto 32px;
    max-width: 640px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    animation: floatButtons 12s ease-in-out infinite;
}

.ghost-button,
.solid-button {
    padding: 12px 26px;
    border-radius: 999px;
    font-size: 0.95rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease;
    position: relative;
    isolation: isolate;
}

.ghost-button {
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: transparent;
}

.ghost-button:hover {
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(255,255,255,0.06);
}

.solid-button {
    background: var(--accent);
    color: var(--bg-primary);
}

.solid-button:hover {
    background: rgba(255, 255, 255, 0.85);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0,0,0,0.35);
}

/* GitHub Button - Cosmic Star Design */
.github-btn {
    --gh-light: var(--accent);
    --gh-dark: var(--bg-secondary);
    --gh-accent: var(--muted);
    font-family: "Segoe UI", "Trebuchet MS", sans-serif;
    cursor: pointer;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    line-height: 1;
    font-size: 1rem;
    border-radius: 1rem;
    outline: 2px solid transparent;
    outline-offset: 6px;
    color: var(--gh-light);
    text-decoration: none;
}

.github-btn:active {
    outline-color: var(--gh-accent);
}

.github-btn:focus-visible {
    outline-color: var(--gh-accent);
    outline-style: dashed;
}

.github-btn::before {
    content: "";
    position: absolute;
    z-index: 0;
    height: 200%;
    max-height: 100px;
    aspect-ratio: 1;
    margin: auto;
    background: white;
    clip-path: polygon(
        100% 50%, 91.48% 56.57%, 97.55% 65.45%, 87.42% 69.07%, 90.45% 79.39%,
        79.7% 79.7%, 79.39% 90.45%, 69.07% 87.42%, 65.45% 97.55%, 56.57% 91.48%,
        50% 100%, 43.43% 91.48%, 34.55% 97.55%, 30.93% 87.42%, 20.61% 90.45%,
        20.3% 79.7%, 9.55% 79.39%, 12.58% 69.07%, 2.45% 65.45%, 8.52% 56.57%,
        0% 50%, 8.52% 43.43%, 2.45% 34.55%, 12.58% 30.93%, 9.55% 20.61%,
        20.3% 20.3%, 20.61% 9.55%, 30.93% 12.58%, 34.55% 2.45%, 43.43% 8.52%,
        50% 0%, 56.57% 8.52%, 65.45% 2.45%, 69.07% 12.58%, 79.39% 9.55%,
        79.7% 20.3%, 90.45% 20.61%, 87.42% 30.93%, 97.55% 34.55%, 91.48% 43.43%
    );
    animation: star-rotate 4s linear infinite;
    opacity: 0.1;
}

.github-btn:hover::before {
    opacity: 1;
}

.github-btn > div {
    padding: 2px;
    border-radius: 1rem;
    background-color: var(--gh-accent);
    transform: translate(-4px, -4px);
    transition: all 150ms ease;
    box-shadow:
        0.5px 0.5px 0 0 var(--gh-accent),
        1px 1px 0 0 var(--gh-accent),
        1.5px 1.5px 0 0 var(--gh-accent),
        2px 2px 0 0 var(--gh-accent),
        2.5px 2.5px 0 0 var(--gh-accent),
        3px 3px 0 0 var(--gh-accent),
        0 0 0 2px var(--gh-dark),
        0.5px 0.5px 0 2px var(--gh-dark),
        1px 1px 0 2px var(--gh-dark),
        1.5px 1.5px 0 2px var(--gh-dark),
        2px 2px 0 2px var(--gh-dark),
        2.5px 2.5px 0 2px var(--gh-dark),
        3px 3px 0 2px var(--gh-dark),
        3.5px 3.5px 0 2px var(--gh-dark),
        4px 4px 0 2px var(--gh-dark),
        0 0 0 4px var(--gh-light),
        0.5px 0.5px 0 4px var(--gh-light),
        1px 1px 0 4px var(--gh-light),
        1.5px 1.5px 0 4px var(--gh-light),
        2px 2px 0 4px var(--gh-light),
        2.5px 2.5px 0 4px var(--gh-light),
        3px 3px 0 4px var(--gh-light),
        3.5px 3.5px 0 4px var(--gh-light),
        4px 4px 0 4px var(--gh-light);
}

.github-btn:hover > div {
    transform: translate(0, 0);
    box-shadow:
        0 0 0 0 var(--gh-accent),
        0 0 0 0 var(--gh-accent),
        0 0 0 0 var(--gh-accent),
        0 0 0 0 var(--gh-accent),
        0 0 0 0 var(--gh-accent),
        0 0 0 0 var(--gh-accent),
        0 0 0 2px var(--gh-dark),
        0 0 0 2px var(--gh-dark),
        0 0 0 2px var(--gh-dark),
        0 0 0 2px var(--gh-dark),
        0 0 0 2px var(--gh-dark),
        0 0 0 2px var(--gh-dark),
        0 0 0 2px var(--gh-dark),
        0 0 0 2px var(--gh-dark),
        0 0 0 2px var(--gh-dark),
        0 0 0 4px var(--gh-light),
        0 0 0 4px var(--gh-light),
        0 0 0 4px var(--gh-light),
        0 0 0 4px var(--gh-light),
        0 0 0 4px var(--gh-light),
        0 0 0 4px var(--gh-light),
        0 0 0 4px var(--gh-light),
        0 0 0 4px var(--gh-light),
        0 0 0 4px var(--gh-light);
}

.github-btn > div > div {
    position: relative;
    pointer-events: none;
    border-radius: calc(1rem - 2px);
    background-color: var(--gh-dark);
}

.github-btn > div > div::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 1rem;
    opacity: 0.1;
    background-size: 8px 8px;
    mix-blend-mode: hard-light;
    box-shadow: inset 0 0 0 1px var(--gh-dark);
    animation: dots 0.4s infinite linear;
    transition: opacity 150ms ease;
}

.github-btn > div > div > div {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    gap: 0.25rem;
    filter: drop-shadow(0 -1px 0 var(--gh-dark));
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.github-btn > div > div > div:hover {
    filter: drop-shadow(0 -1px 0 rgba(255, 255, 255, 0.1));
}

.github-btn > div > div > div:active {
    transform: translateY(2px);
}

@keyframes star-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes dots {
    0% { background-position: 0 0, 4px 4px; }
    100% { background-position: 8px 0, 12px 4px; }
}

.section-title {
    font-size: 1.6rem;
    text-transform: uppercase;
    letter-spacing: 0.32em;
    margin-bottom: 40px;
    position: relative;
    display: inline-block;
    padding-right: 28px;
    overflow: hidden;
}

.section-title::before {
    content: "";
    position: absolute;
    top: 0;
    left: -140%;
    width: 140%;
    height: 100%;
    background: linear-gradient(120deg, transparent 20%, rgba(255, 255, 255, 0.55) 50%, transparent 80%);
    opacity: 0.7;
    animation: headingSweep 6.8s ease-in-out infinite;
    pointer-events: none;
}

.section-title::after {
    content: "";
    position: absolute;
    bottom: -14px;
    left: 0;
    width: 140px;
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.4), transparent);
    animation: underlinePulse 5s ease-in-out infinite;
    pointer-events: none;
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 36px;
    align-items: start;
}

.card {
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025));
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 24px;
    border-radius: 18px;
    box-shadow: 0 24px 54px rgba(0, 0, 0, 0.45);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    will-change: transform;
}

.card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 28px 60px rgba(0, 0, 0, 0.55);
    border-color: rgba(255,255,255,0.14);
}

.card p {
    color: var(--muted);
    line-height: 1.7;
    margin: 0;
}

.timeline {
    position: relative;
    padding-left: 32px;
    border-left: 1px dashed rgba(255, 255, 255, 0.25);
    display: grid;
    gap: 28px;
}

.timeline-item {
    position: relative;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: -41px;
    top: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.6);
    animation: beacon 3.5s ease-in-out infinite;
}

.timeline-item h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.timeline-item p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 28px;
}

.project-card {
    position: relative;
    overflow: hidden;
}

.project-card h3 {
    margin: 0 0 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-size: 1rem;
    position: relative;
    animation: titlePulse 9s ease-in-out infinite;
}

.project-card p {
    color: var(--muted);
    margin-bottom: 14px;
}

.project-card a, .openwork-cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.project-card a::after {
    content: "\2192";
    transition: transform 0.3s ease;
}

.project-card a:hover {
    opacity: 1;
}

.project-card a:hover::after {
    transform: translateX(4px);
}


.mission-grid, .openwork-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
}

/* Details/accordion styling for My Story */
details.story {
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 0;
    box-shadow: 0 24px 54px rgba(0, 0, 0, 0.45);
}
details.story[open] { border-color: rgba(255,255,255,0.14); }
details.story > summary {
    list-style: none;
    cursor: pointer;
    padding: 20px 24px;
    font-size: 1.2rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    position: relative;
}
details.story > summary::marker { display: none; }
details.story > summary::after {
    content: "+";
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 600;
    opacity: 0.7;
}
details.story[open] > summary::after { content: "−"; }
.story-content {
    padding: 0 24px 24px;
    color: var(--muted);
}
.story-content h3 { margin: 18px 0 8px; font-size: 1rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.story-content p { margin: 0 0 14px; line-height: 1.8; }

.stat {
    font-size: 2.4rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.stat-label {
    color: var(--muted);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-size: 0.75rem;
}

footer {
    padding: 40px 5vw;
    text-align: center;
    color: var(--muted);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(5, 6, 10, 0.85);
    backdrop-filter: blur(6px);
}

.pulse-ring {
    position: absolute;
    inset: -40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.06);
    animation: pulse 4s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 0.1;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.35;
    }
    100% {
        transform: scale(0.8);
        opacity: 0.1;
    }
}

@keyframes headingSweep {
    0% {
        transform: translateX(0%);
        opacity: 0;
    }
    30% {
        opacity: 0.6;
    }
    50% {
        opacity: 0.8;
    }
    100% {
        transform: translateX(140%);
        opacity: 0;
    }
}

@keyframes underlinePulse {
    0%, 100% {
        transform: scaleX(0.9);
        opacity: 0.3;
    }
    50% {
        transform: scaleX(1.04);
        opacity: 0.55;
    }
}

@keyframes driftNebula {
    0% {
        transform: scale(1) translate3d(0, 0, 0) rotate(0deg);
    }
    50% {
        transform: scale(1.05) translate3d(-2%, -1%, 0) rotate(2deg);
    }
    100% {
        transform: scale(1.08) translate3d(2%, 2%, 0) rotate(-1deg);
    }
}

@keyframes gridSpin {
    0% {
        transform: rotate(0deg) scale(1.1);
    }
    100% {
        transform: rotate(360deg) scale(1.1);
    }
}

@keyframes meteorFall {
    0% {
        opacity: 0;
        transform: rotate(var(--meteor-rotation, 18deg)) translate3d(0, 0, 0);
    }
    15% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: rotate(var(--meteor-rotation, 18deg)) translate3d(var(--meteor-shift-x, 60vw), var(--meteor-shift-y, 75vh), 0);
    }
}

@keyframes heroGlow {
    0% {
        text-shadow: 0 0 12px rgba(255, 255, 255, 0.16);
        transform: translateY(0px) scale(1);
    }
    50% {
        text-shadow: 0 0 22px rgba(255, 255, 255, 0.32);
        transform: translateY(-4px) scale(1.01);
    }
    100% {
        text-shadow: 0 0 14px rgba(255, 255, 255, 0.2);
        transform: translateY(0px) scale(1);
    }
}

@keyframes titlePulse {
    0% {
        letter-spacing: 0.12em;
        opacity: 0.85;
    }
    50% {
        letter-spacing: 0.18em;
        opacity: 1;
    }
    100% {
        letter-spacing: 0.12em;
        opacity: 0.85;
    }
}

@keyframes floatButtons {
    0% {
        transform: translateY(0px) scale(1);
    }
    50% {
        transform: translateY(-6px) scale(1.01);
    }
    100% {
        transform: translateY(0px) scale(1);
    }
}

@keyframes beacon {
    0% {
        box-shadow: 0 0 6px rgba(255, 255, 255, 0.2);
        transform: scale(0.95);
    }
    50% {
        box-shadow: 0 0 16px rgba(255, 255, 255, 0.55);
        transform: scale(1.1);
    }
    100% {
        box-shadow: 0 0 6px rgba(255, 255, 255, 0.2);
        transform: scale(0.95);
    }
}

#cosmic-background {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

#cosmic-background::before {
    content: "";
    position: absolute;
    width: 180%;
    height: 180%;
    top: -40%;
    left: -40%;
    background:
        radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.08), transparent 54%),
        radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.05), transparent 55%);
    filter: blur(40px);
    opacity: 0.45;
    animation: driftNebula 32s ease-in-out infinite alternate;
}

#cosmic-background::after {
    content: "";
    position: absolute;
    inset: -60%;
    background:
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 70px),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 70px);
    opacity: 0.08;
    animation: gridSpin 60s linear infinite;
}

#starfield {
    width: 100%;
    height: 100%;
    display: block;
}

#intro-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: opacity 0.6s ease, filter 0.6s ease;
}

#intro-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
    filter: blur(3px);
}

.intro-text {
    font-size: clamp(2.2rem, 6vw, 5rem);
    letter-spacing: 0.22em;
    text-transform: uppercase;
    font-weight: 700;
    text-rendering: geometricPrecision;
    -webkit-font-smoothing: antialiased;
    text-shadow: 0 0 18px rgba(255, 255, 255, 0.35);
}

.reveal-on-scroll {
    opacity: 0;
    transform: translateY(34px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Toast for copy feedback */
#toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%) translateY(20px);
    background: rgba(255,255,255,0.08);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.18);
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
    z-index: 1000;
    backdrop-filter: blur(6px);
}
#toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Back to top button */
#backtotop {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #000;
    background: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    box-shadow: 0 10px 24px rgba(0,0,0,0.35);
    opacity: 0;
    transform: translateY(14px);
    transition: opacity .25s ease, transform .25s ease;
    z-index: 900;
}
#backtotop.show { opacity: 1; transform: translateY(0); }
#backtotop:focus-visible { outline: 2px solid rgba(255,255,255,0.65); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* Text Animations */
.glitch {
    position: relative;
    overflow: hidden;
}
.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    left: 0; top: 0;
    width: 100%;
    color: var(--accent);
    mix-blend-mode: screen;
    opacity: 0.12;
    clip-path: inset(0 0 0 0);
    animation: glitchShift 2.4s infinite ease-in-out;
}
.glitch::before { transform: translate(1px, -1px); filter: drop-shadow(0 0 6px #fff); }
.glitch::after { transform: translate(-1px, 1px); filter: drop-shadow(0 0 4px #aaa); animation-delay: 1.2s; }
@keyframes glitchShift {
    0%, 92%, 100% { clip-path: inset(0 0 0 0); opacity: 0.08; }
    10% { clip-path: inset(10% 0 0 0); opacity: 0.16; }
    20% { clip-path: inset(0 0 65% 0); opacity: 0.22; }
    30% { clip-path: inset(40% 0 0 0); opacity: 0.18; }
    40% { clip-path: inset(0 0 30% 0); opacity: 0.12; }
    50% { clip-path: inset(60% 0 0 0); opacity: 0.2; }
    60% { clip-path: inset(0 0 10% 0); opacity: 0.14; }
    70% { clip-path: inset(25% 0 25% 0); opacity: 0.18; }
    80% { clip-path: inset(0 0 50% 0); opacity: 0.16; }
}

.shimmer {
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.18) 45%, rgba(255,255,255,0) 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: shimmerSweep 2.8s ease-in-out infinite;
}
@keyframes shimmerSweep {
    0% { background-position: -60% 0; }
    50% { background-position: 60% 0; }
    100% { background-position: 160% 0; }
}

/* Title: starlight flicker + subtle skew */
.starlight {
    animation: starlightFlicker 5.5s ease-in-out infinite;
    text-shadow: 0 0 12px rgba(255,255,255,0.22);
    will-change: transform, text-shadow;
}
@keyframes starlightFlicker {
    0%, 100% { transform: skewX(0deg) scale(1); text-shadow: 0 0 12px rgba(255,255,255,0.22); }
    12% { transform: skewX(-0.6deg) scale(1.01); text-shadow: 0 0 16px rgba(255,255,255,0.28); }
    24% { transform: skewX(0.5deg) scale(1.005); text-shadow: 0 0 22px rgba(255,255,255,0.35); }
    38% { transform: skewX(-0.4deg) scale(1.01); text-shadow: 0 0 18px rgba(255,255,255,0.30); }
    52% { transform: skewX(0.3deg) scale(1.008); text-shadow: 0 0 20px rgba(255,255,255,0.32); }
    68% { transform: skewX(-0.3deg) scale(1.006); text-shadow: 0 0 16px rgba(255,255,255,0.28); }
    84% { transform: skewX(0.2deg) scale(1.004); text-shadow: 0 0 14px rgba(255,255,255,0.26); }
}

/* Smooth readable text fade */
.softfade { opacity: 0; transform: translateY(10px); }
.softfade.visible { opacity: 1; transform: translateY(0); transition: opacity 700ms ease, transform 700ms ease; }

/* Animated Email Button */
.animated-button {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 36px;
    border: 4px solid;
    border-color: transparent;
    font-size: 0.95rem;
    background-color: transparent;
    border-radius: 100px;
    font-weight: 600;
    color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
    cursor: pointer;
    overflow: hidden;
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.animated-button svg {
    position: absolute;
    width: 24px;
    fill: var(--accent);
    z-index: 9;
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.animated-button .arr-1 {
    right: 16px;
}

.animated-button .arr-2 {
    left: -25%;
}

.animated-button .circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.animated-button .text {
    position: relative;
    z-index: 1;
    transform: translateX(-12px);
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.animated-button:hover {
    box-shadow: 0 0 0 12px transparent;
    color: var(--bg-primary);
    border-radius: 12px;
}

.animated-button:hover .arr-1 {
    right: -25%;
}

.animated-button:hover .arr-2 {
    left: 16px;
}

.animated-button:hover .text {
    transform: translateX(12px);
}

.animated-button:hover svg {
    fill: var(--bg-primary);
}

.animated-button:active {
    scale: 0.95;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.4);
}

.animated-button:hover .circle {
    width: 220px;
    height: 220px;
    opacity: 1;
    background-color: var(--accent);
}

.animated-button:focus-visible {
    outline: 2px solid rgba(255,255,255,0.65);
    outline-offset: 2px;
}

@media (max-width: 720px) {
    nav {
        display: none;
    }

    header {
        justify-content: center;
    }

    .hero {
        padding-top: calc(22vh + 40px);
    }

    .hero h1 {
        letter-spacing: 0.08em;
    }

    .section-title {
        letter-spacing: 0.18em;
        font-size: 1.3rem;
    }
}
