/* ============================================
   Amethyst Mint Harmony — Dark Mode
   #2A3F38 · #8DF688 · #F650BD · #562F54 · #57585D
   ============================================ */
:root {
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --bg: #1B2A25;
    --surface: #2A3F38;
    --white: #FFFFFF;
    --mist: #8DF688;
    --gray: #57585D;
    --accent: #F650BD;
    --accent-bright: #FF7FD3;
    --secondary: #8DF688;
    --purple: #562F54;
    --sky: #5CC8FF;
    --sun: #FFC857;
    --ink: #F3FAF6;
    --text: #C5D3CC;
    --muted: #8E9A95;
    --line: rgba(141, 246, 136, 0.18);
    --soft: rgba(141, 246, 136, 0.07);
    --glass: rgba(27, 42, 37, 0.78);
    --glass-card: rgba(42, 63, 56, 0.65);
    --shadow: rgba(8, 14, 12, 0.5);
    --font-body: 'Inter', sans-serif;
    --font-display: 'Space Grotesk', 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

html {
    overflow-x: clip;
}

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: clip;
}

::selection {
    background: var(--accent);
    color: var(--white);
}

/* ============ Scroll-parallax grid ============ */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(var(--soft) 1px, transparent 1px),
        linear-gradient(90deg, var(--soft) 1px, transparent 1px);
    background-size: 72px 72px;
    background-position: 0 calc(var(--sy, 0) * -0.3px);
    -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 75%);
    mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 75%);
}

main,
.header,
.footer {
    position: relative;
    z-index: 1;
}

/* ============ Scroll Progress ============ */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: var(--accent);
    z-index: 1001;
    transition: width 0.08s linear;
}

/* ============ Header & Nav ============ */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 18px 6vw;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
    z-index: 1000;
}

.logo {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--ink);
    text-decoration: none;
}

.logo-dot {
    color: var(--accent);
}

.nav-link {
    color: var(--muted);
    text-decoration: none;
    margin-left: 34px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    position: relative;
    transition: color 0.2s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -6px;
    left: 0;
    background-color: var(--accent);
    transition: width 0.2s var(--ease-out);
}

.nav-link:hover,
.nav-link.active {
    color: var(--ink);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* ============ Sections — wide, airy layout ============ */
.section {
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px 6vw;
    position: relative;
}

.content {
    max-width: 1680px;
    width: 100%;
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 5vw, 4.2rem);
    font-weight: 700;
    letter-spacing: -1.5px;
    color: var(--ink);
    margin-bottom: 24px;
    display: inline-block;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--accent) 0 64px, var(--line) 64px);
}

.section-subtitle {
    font-size: 1.15rem;
    color: var(--muted);
    max-width: 640px;
    margin-bottom: 56px;
}

/* ============ Animations ============ */
.fade-in {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.fade-in-stagger {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}

.fade-in-stagger.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============ Hero ============ */
.hero {
    justify-content: flex-start;
}

.hero {
    overflow: hidden;
}

.hero-inner {
    text-align: left;
    position: relative;
    z-index: 1;
    /* --hero goes 0 -> 1 over the first viewport of scrolling */
    transform: translateY(calc(var(--hero, 0) * 80px)) scale(calc(1 - var(--hero, 0) * 0.12));
    opacity: calc(1 - var(--hero, 0) * 1.1);
    transform-origin: left center;
}

@keyframes marquee {
    to {
        transform: translateX(-50%);
    }
}

.hero-marquee {
    position: absolute;
    left: 0;
    bottom: 6vh;
    white-space: nowrap;
    font-family: var(--font-display);
    font-size: clamp(5rem, 15vw, 14rem);
    font-weight: 700;
    line-height: 1;
    color: transparent;
    -webkit-text-stroke: 1.5px var(--line);
    animation: marquee 40s linear infinite;
    pointer-events: none;
    user-select: none;
}

.hero-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 28px;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(3rem, 8.5vw, 7.5rem);
    font-weight: 700;
    letter-spacing: -3px;
    line-height: 1.02;
    color: var(--ink);
    margin-bottom: 32px;
    min-height: 1em;
}

.name-accent {
    color: var(--accent);
}

/* outer .ch reacts to the cursor (--d: 0..1); inner span plays the entrance */
.name-accent .ch {
    display: inline-block;
    color: color-mix(in srgb, var(--accent), var(--sun) calc(var(--d, 0) * 100%));
    transform: translateY(calc(var(--d, 0) * -0.14em)) scale(calc(1 + var(--d, 0) * 0.22));
    transition: transform 0.25s ease-out, color 0.25s ease-out;
}

.name-accent .ch>span {
    display: inline-block;
    opacity: 0;
    animation: rise 0.8s cubic-bezier(.2, .8, .2, 1) forwards;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(0.5em);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.hero-subtitle {
    font-size: clamp(1.05rem, 1.6vw, 1.45rem);
    font-weight: 300;
    color: var(--text);
    max-width: 720px;
    margin-bottom: 48px;
}

.hero-subtitle strong {
    color: var(--ink);
    font-weight: 600;
}

.hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 32px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font-display);
    letter-spacing: 0.5px;
    text-decoration: none;
    transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out), background 0.2s var(--ease-out);
}

.btn-primary {
    background: var(--accent);
    color: var(--white);
    box-shadow: 0 8px 24px rgba(246, 80, 189, 0.3);
}

.btn-primary:hover {
    background: var(--accent-bright);
    color: var(--bg);
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(246, 80, 189, 0.45);
}

.btn-ghost {
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line);
}

.btn-ghost:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 10px 28px var(--shadow);
}

.scroll-indicator {
    margin-top: 140px;
    text-align: left;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent);
    animation: bob 2s ease-in-out infinite;
}

@keyframes bob {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(10px);
    }
}

/* ============ About ============ */
.about-layout {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) 1.4fr;
    gap: 80px;
    align-items: start;
}

.about-side {
    position: sticky;
    top: 120px;
}

.reveal-text {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 3.6rem);
    font-weight: 600;
    letter-spacing: -1px;
    line-height: 1.2;
    max-width: 1100px;
    margin: 24px 0 72px;
}

.reveal-text .w {
    color: var(--ink);
    opacity: var(--o, 0.18);
    transition: opacity 0.15s linear;
}

.about-intro {
    font-size: 1.1rem;
    color: var(--muted);
    margin-bottom: 40px;
    max-width: 420px;
}

.github-card {
    max-width: 420px;
    padding-left: 24px;
    border-left: 2px solid var(--accent);
}

.github-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--ink);
    margin-bottom: 14px;
}

.github-card-header i {
    font-size: 1.8rem;
    color: var(--ink);
}

.github-bio {
    color: var(--accent);
    font-weight: 500;
    font-style: italic;
    margin-bottom: 18px;
}

.github-facts {
    list-style: none;
    margin-bottom: 22px;
}

.github-facts li {
    padding: 9px 0;
    border-bottom: 1px solid var(--soft);
    color: var(--muted);
    font-size: 0.95rem;
}

.github-facts li:last-child {
    border-bottom: none;
}

.github-facts strong {
    color: var(--ink);
}

.github-card-link {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

.github-card-link:hover {
    color: var(--accent-bright);
}

.about-body {
    display: flex;
    flex-direction: column;
    gap: 48px;
    max-width: 680px;
}

.about-block {
    display: flex;
    align-items: baseline;
    gap: 24px;
}

.about-label {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    flex-shrink: 0;
}

.about-block p {
    font-size: 1.15rem;
    line-height: 1.9;
    color: var(--text);
    margin: 0;
}

.about-block p strong {
    color: var(--ink);
}

/* ============ Projects (editorial rows, scroll-scrubbed) ============ */
.projects {
    padding: 120px 6vw 40px;
}

.proj {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) 1.2fr;
    gap: 80px;
    padding: 96px 0;
    border-top: 1px solid var(--line);
}

.proj-side {
    position: sticky;
    top: 120px;
    align-self: start;
}

.proj:nth-of-type(3n+2) { --accent: var(--sky); --accent-bright: #9ADCFF; }
.proj:nth-of-type(3n) { --accent: var(--sun); --accent-bright: #FFE0A0; }

.proj-no {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
}

.proj-name {
    font-family: var(--font-display);
    font-size: clamp(2.8rem, 6vw, 5.5rem);
    font-weight: 700;
    letter-spacing: -2px;
    line-height: 1;
    color: var(--ink);
    margin: 12px 0 28px;
}

.proj-desc {
    font-size: 1.1rem;
    line-height: 1.8;
    max-width: 480px;
    margin-bottom: 24px;
}

.proj-desc strong {
    color: var(--ink);
}

.proj-tags {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 28px;
}

.proj-link {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.proj-link:hover {
    color: var(--accent-bright);
    border-color: currentColor;
}

.proj-how-title {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 32px;
}

/* the line fills as you scroll through the project (--pp: 0..1) */
.proj-steps {
    list-style: none;
    position: relative;
    padding-left: 40px;
}

.proj-steps::before,
.proj-steps::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--line);
}

.proj-steps::after {
    background: var(--accent);
    transform-origin: top;
    transform: scaleY(var(--pp, 0));
}

.proj-steps li {
    display: flex;
    gap: 20px;
    padding: 28px 0;
    font-size: 1.2rem;
    line-height: 1.7;
    opacity: 0.3;
    transition: opacity 0.25s var(--ease-out);
}

.proj-steps li.active {
    opacity: 1;
    color: var(--ink);
}

.proj-steps strong {
    color: var(--ink);
}

.step-n {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    padding-top: 6px;
}

/* ============ Working On ============ */
.working-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 48px;
}

.working-intro {
    font-size: 1.15rem;
    color: var(--muted);
    max-width: 640px;
}

.working-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.working-item {
    display: flex;
    flex-direction: column;
    gap: 14px;
    font-size: 1.05rem;
    color: var(--text);
    padding: 28px;
    background: var(--glass-card);
    border: 1px solid var(--line);
    border-top: 3px solid var(--accent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.2s var(--ease-out), border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

.working-item:hover,
.working-item.active {
    transform: translateY(-6px);
    border-color: var(--mist);
    box-shadow: 0 14px 30px var(--shadow);
    color: var(--ink);
}

.working-item strong {
    color: var(--ink);
}

.working-index {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1;
    color: var(--accent);
}

/* ============ Tech Stack (rows slide with scroll, colour in at centre) ============ */
.stack {
    overflow: hidden;
}

.stack-row {
    padding: 36px 0;
    opacity: 0.35;
    transition: opacity 0.3s var(--ease-out);
}

.stack-row.active {
    opacity: 1;
}

.stack-label {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent);
}

/* --rp: 0..1 as the row crosses the screen; --dir flips direction per row */
.stack-track {
    display: flex;
    flex-wrap: wrap;
    gap: 24px 64px;
    margin-top: 16px;
    transform: translateX(calc((0.5 - var(--rp, 0.5)) * 160px * var(--dir)));
}

.stack-item {
    display: flex;
    align-items: center;
    gap: 20px;
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 5vw, 4.4rem);
    font-weight: 700;
    letter-spacing: -1.5px;
    color: var(--ink);
}

.stack-item i {
    font-size: 0.9em;
    filter: grayscale(1);
    transition: filter 0.3s ease, transform 0.2s var(--ease-out);
}

.stack-row.active .stack-item i,
.stack-item:hover i {
    filter: none;
}

.stack-item:hover i {
    transform: scale(1.15) rotate(-6deg);
}

.stack-footnote {
    margin-top: 48px;
    font-size: 1.05rem;
    color: var(--muted);
}

.stack-footnote strong {
    color: var(--ink);
}

/* ============ Contact ============ */
.social-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 28px;
}

.social-card {
    display: flex;
    align-items: center;
    padding: 32px 36px;
    background: var(--surface);
    border: 1px solid var(--line);
    text-decoration: none;
    color: var(--ink);
    transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}

.social-card:hover {
    transform: translateY(-6px);
    border-color: var(--accent);
    box-shadow: 0 20px 48px rgba(246, 80, 189, 0.18);
}

.contact-icon {
    font-size: 2.6rem;
    margin-right: 22px;
    display: flex;
    color: var(--accent);
    flex-shrink: 0;
}

.social-info {
    text-align: left;
}

.social-info h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.social-info p {
    font-size: 0.92rem;
    color: var(--muted);
    margin: 0;
}


/* ============ Footer ============ */
.footer {
    text-align: center;
    padding: 36px;
    font-size: 0.85rem;
    color: var(--muted);
    border-top: 1px solid var(--line);
    background: var(--glass);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* ============ Responsive ============ */
@media (max-width: 1100px) {
    .about-layout,
    .working-layout,
    .proj {
        grid-template-columns: 1fr;
        gap: 48px;
    }

    .about-side,
    .working-side,
    .proj-side {
        position: static;
    }

    .about-intro,
    .working-intro,
    .github-card {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .section {
        padding: 110px 6vw 64px;
    }

    .stack, .contact {
        padding-top: 72px;
        padding-bottom: 72px;
    }

    .hero-title {
        font-size: clamp(2.6rem, 13vw, 4rem);
        letter-spacing: -1.5px;
    }

    .hero-cta .btn {
        flex: 1 1 100%;
        justify-content: center;
        text-align: center;
    }

    .scroll-indicator {
        display: none;
    }

    .section-subtitle {
        font-size: 1rem;
        margin-bottom: 36px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        padding: 10px 6vw 0;
    }

    .nav {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        width: 100%;
    }

    .nav-link {
        margin: 0;
        padding: 12px 0;
        font-size: 0.68rem;
        letter-spacing: 1px;
    }

    .nav-link::after {
        bottom: 6px;
    }

    .about-layout,
    .working-layout,
    .proj {
        gap: 32px;
    }

    .about-block {
        padding: 22px;
        gap: 14px;
    }

    .social-grid {
        grid-template-columns: 1fr;
    }

    .footer {
        padding: 28px 6vw;
    }
}

/* ============ Reduced Motion ============ */
@media (prefers-reduced-motion: reduce) {

    .fade-in,
    .fade-in-stagger {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .scroll-indicator {
        animation: none;
    }

    .name-accent .ch>span {
        animation-duration: 0.01s;
    }

    .stack-track {
        transform: none;
    }

    .hero-inner,
    .hero-marquee {
        animation: none;
        transform: none;
        opacity: 1;
    }

    .reveal-text .w,
    .proj-steps li,
    .working-item,
    .stack-row {
        opacity: 1;
    }
}

/* ---------- UX polish ---------- */
.skip-link { position: absolute; left: 16px; top: -60px; z-index: 2000; padding: 10px 16px; background: var(--accent); color: var(--white); font-family: var(--font-mono); text-decoration: none; transition: top 0.15s var(--ease-out); }
.skip-link:focus { top: 12px; }

:focus-visible { outline: 2px solid var(--mist); outline-offset: 4px; }

.btn:active, .social-card:active, .proj-link:active { transform: scale(0.97); transition-duration: 0.1s; }

@media (hover: none) {
    .btn:hover, .social-card:hover, .working-item:hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .btn:hover, .btn:active, .social-card:hover, .social-card:active, .working-item:hover, .working-item.active { transform: none; }
}

/* Short sections: size to content so no dead space between them */
.stack, .contact { min-height: auto; padding-top: 120px; padding-bottom: 120px; }
.working-item code { font-family: var(--font-mono); font-size: 0.9em; color: var(--mist); }

/* ---------- Imprint ---------- */
.legal { max-width: 720px; margin: 0 auto; padding: 120px 6vw 64px; position: relative; z-index: 1; }
.legal h1 { font-family: var(--font-display); font-size: clamp(2.4rem, 9vw, 4.2rem); font-weight: 700; letter-spacing: -1.5px; color: var(--accent); margin-bottom: 40px; display: inline-block; position: relative; }
.legal h1::after { content: ''; position: absolute; bottom: -10px; left: 0; width: 100%; height: 2px; background: linear-gradient(90deg, var(--accent) 0 64px, var(--line) 64px); }
.legal h2 { border-left: 3px solid var(--purple); padding-left: 12px; }
.legal h2 { font-family: var(--font-display); font-size: 1.25rem; color: var(--ink); margin: 28px 0 8px; }
.legal a { color: var(--mist); }
.footer a { color: var(--mist); display: inline-block; padding: 8px 0; }

/* ---------- Phone: nothing wider than the viewport, vertical scroll only ---------- */
@media (max-width: 768px) {
    .stack-track { gap: 16px 32px; transform: translateX(calc((0.5 - var(--rp, 0.5)) * 40px * var(--dir))); }
    .stack-item { font-size: clamp(1.8rem, 9vw, 2.6rem); gap: 12px; }
    .proj { padding: 56px 0; }
    .proj-name { font-size: clamp(2.4rem, 13vw, 3.5rem); }
    .proj-steps { padding-left: 24px; }
    .proj-steps li { font-size: 1rem; gap: 14px; padding: 18px 0; }
    .working-list { grid-template-columns: 1fr; }
    .working-item { padding: 22px; }
    .social-card { padding: 22px; min-width: 0; }
    .social-info { min-width: 0; overflow-wrap: anywhere; }
    .about-block { flex-direction: column; gap: 8px; }
    .about-block p { font-size: 1.02rem; line-height: 1.75; }
    .hero-subtitle { font-size: 1.02rem; }
    .section-title { letter-spacing: -1px; }
    .reveal-text { margin: 16px 0 40px; letter-spacing: -0.5px; }
    .legal { padding-top: 130px; }
}

/* Inline links ignore transform; make them pressable like the buttons */
.proj-link, .github-card-link, .footer a { display: inline-block; }
.proj-link:active, .github-card-link:active, .nav-link:active { transform: scale(0.97); transition-duration: 0.1s; }
