/* Custom Styles */

.bio-text {
    flex: 1;
    max-width: 620px;
}
.profile-card {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    transition: transform 0.2s ease;
}
.profile-pic {
    width: 300px;
    height: auto;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    cursor: default;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.profile-pic:hover {
    transform: none;
    box-shadow: 0 6px 16px rgba(0,0,0,0.35);
}
.contact-info {
    display: flex;
    gap: 2rem;
    text-align: center;
    font-size: 0.9rem;
}
.contact-info div span:first-child {
    display: block;
    font-size: 0.8rem;
    color: var(--gray);
    margin-bottom: 0.3rem;
}
.contact-info a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s ease;
}
.contact-info a:hover {
    color: var(--accent);
}
.about-content {
    display: flex;
    gap: 3rem;
    align-items: flex-start;
    margin-bottom: 3rem;
}
.timeline-item {
    display: flex;
    gap: 2rem;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border);
}
.timeline-date {
    min-width: 180px;
    color: var(--gray);
    font-size: 0.9rem;
}
.timeline-details h3 {
    margin-bottom: 0.2rem;
}
.timeline-details p {
    margin-top: 0.3rem;
    color: var(--gray);
}
.social-icons {
    display: flex;
    gap: 1rem;
}
.social-icons img {
    width: 28px;
    height: 28px;
    opacity: 1;
    transition: opacity 0.2s, transform 0.2s;
}
.social-icons img:hover {
    opacity: 1;
    transform: scale(1.03);
}

@media (max-width: 768px) {
    .about-content {
        flex-direction: column;
    }
    .timeline-item {
        flex-direction: column;
        gap: 0.5rem;
    }
    .timeline-date {
        min-width: auto;
    }
}
:root {
    --font-selector: R0Y7SW50ZXItNTAw;
    --hero-font-family: "Inter", "Inter Placeholder", sans-serif;
    --hero-font-size: 42px;
    --hero-font-weight: 500;
    --hero-letter-spacing: -1.5px;
    --hero-line-height: 100%;
    --hero-text-color: #fff;
    --bg: #0f0f0f;
    --text: #ffffff;
    --accent: #ff4d4d;
    --gray: #8a8a8a;
    --border: #222222;
    --card-bg: #111111;
}

h1, h2 {
    font-family: var(--hero-font-family);
    font-size: var(--hero-font-size);
    font-weight: var(--hero-font-weight);
    letter-spacing: var(--hero-letter-spacing);
    line-height: var(--hero-line-height);
    color: var(--hero-text-color);
}

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

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    overflow-x: hidden;
}

/* Page spacing (match About page) */
body:not(.contact-body) main {
    margin-top: 2.5rem;
}

/* Navigation */
/* Pillar Navigation (overrides base nav) */
nav.nav-pillar {
    position: fixed;
    top: 1rem; left: 0; /* remove bottom stretch so pillar can shrink */
    width: 90px; /* reduced pillar width */
    padding: 0.5rem 0; /* tighter vertical padding */
    background: transparent;
    border: none;
    display: flex;
    justify-content: center;
    align-items: stretch;
    z-index: 300; /* above smooth content */
    pointer-events: none; /* allow inner to manage interactions */
    backdrop-filter: blur(10px);
    border-radius: 60px;

}

/* Top-center modifier: transforms pillar into a horizontal capsule centered at top */
nav.nav-pillar.top-center {
    left: 50%;
    transform: translateX(-50%);
    bottom: auto; /* no full height */
    height: auto;
    width: fit-content; /* horizontal capsule keeps dynamic width */
    max-width: 90%;
    padding: 0; /* inner will handle */
}

/* Place the pill below the floating header */
nav.nav-pillar.top-center.links-only {
    top: 51px;
    animation: pillIntro .6s cubic-bezier(.4,.8,.3,1) .15s both;
}

.header-floating {
    position: relative;
    z-index: 320;
}

nav.nav-pillar.top-center .nav-pillar-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    height: auto;
    padding: .7rem 1.2rem;
    border-radius: 60px;
    gap: 1.2rem;
}

nav.nav-pillar.top-center .nav-pillar-top,
nav.nav-pillar.top-center .nav-pillar-bottom {
    padding: 0;
}

nav.nav-pillar.top-center .nav-pillar-links-wrap {
    flex: 1;
    mask: none;
    overflow: visible;
}

nav.nav-pillar.top-center ul.nav-links.vertical {
    position: static;
    flex-direction: row;
    width: auto;
    gap: .8rem;
    transform: none !important;
    flex-wrap: wrap;
    justify-content: center;
}

nav.nav-pillar.top-center ul.nav-links.vertical li a {
    font-size: 0.95rem;
    padding: .46rem .75rem;
    background: transparent !important;
    border: none !important;
    backdrop-filter: none !important;
    border-radius: 0;
}

/* Links-only modifier (no avatar/button inside pill) */
nav.nav-pillar.top-center.links-only .nav-pillar-inner {
    justify-content: center;
    padding: .42rem 1.05rem;
    gap: .5rem;
}
nav.nav-pillar.top-center.links-only ul.nav-links.vertical li a {
    font-size: 0.95rem;
    padding: .4rem .65rem; 
    background: transparent !important;
    border: none !important;
    backdrop-filter: none !important;
    border-radius: 0;
}

/* Floating header containing logo + button (non-sticky with content) */
.header-floating {
    width: 100%;
    max-width: 800px;
    margin: 0.18rem auto 1.5rem auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.72rem 2rem 0 2rem;
}
.header-floating-inner {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: .65rem;
}

.nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    backdrop-filter: blur(10px);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    padding: 0;
}

.nav-toggle-bar {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    opacity: 0.9;
    transform-origin: center;
    transition: transform .18s ease, opacity .18s ease;
}

body.nav-open .nav-toggle-bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
body.nav-open .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}
body.nav-open .nav-toggle-bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.nav-mobile-only {
    display: none;
}

body.nav-open {
    overflow: hidden;
}
.header-floating .logo-floating {
    width: auto;
    height: 54px;
    margin-top: 4px;
    border-radius: 8px;
    object-fit: contain;
    box-shadow: 0 4px 12px -4px rgba(0,0,0,0.35);
    border: 0;
}
.header-floating .connect-btn {
    width: auto;
    font-size: 1.05rem; /* slight bump */
    padding: 0.9rem 1.85rem; /* more presence */
    font-weight: 400; /* keep light */
    border-radius: 50px; /* rounder pill */
    letter-spacing: -0.3px; /* optical tightening */
    box-shadow: 0 8px 22px -8px rgba(255,255,255,0.22), 0 3px 6px -2px rgba(0,0,0,0.55);
}

@media (max-width: 900px) {
    .header-floating {
        margin: .42rem auto 1rem auto;
        padding: .78rem 1.2rem 0 1.2rem;
    }
    .header-floating .logo-floating { width: auto; height: 44px; margin-top: 2px; }
    nav.nav-pillar.top-center.links-only {
        top: calc(env(safe-area-inset-top, 0px) + 67px);
    }
    nav.nav-pillar.top-center.links-only ul.nav-links.vertical li a {
        font-size: .85rem;
        padding: .48rem .65rem;
    }
}

@media (max-width: 900px) {
    #smooth-content {
        padding: 1.25rem 1rem;
    }
    .header-floating {
        margin: 0 auto 1rem auto;
        padding: .25rem 0 0 0;
    }
    .header-floating-inner {
        flex-wrap: nowrap;
        min-width: 0;
    }
    .header-floating .logo-floating {
        flex-shrink: 0;
    }
    .header-floating .connect-btn {
        display: none;
    }

    .nav-toggle {
        display: inline-flex;
        flex-shrink: 0;
        margin-left: auto;
    }

    .nav-mobile-only {
        display: block;
    }

    /* Mobile: hide nav until menu is opened */
    nav.nav-pillar.top-center.links-only {
        display: none;
        position: fixed;
        inset: 0;
        left: 0;
        top: 0;
        transform: none !important;
        animation: none !important;
        z-index: 350;
        width: 100vw;
        height: 100dvh;
        max-width: none;
        padding: calc(env(safe-area-inset-top, 0px) + 112px) 1rem 1.25rem 1rem;
        pointer-events: auto;
        border-radius: 0;
    }
    body.nav-open nav.nav-pillar.top-center.links-only {
        display: flex;
        justify-content: flex-start;
        align-items: stretch;
    }

    body.nav-open .header-floating {
        position: relative;
        z-index: 360;
    }

    body.nav-open nav.nav-pillar.top-center.links-only::before {
        content: "";
        position: absolute;
        inset: 0;
        background: rgba(15, 15, 15, 0.78);
        backdrop-filter: blur(14px);
        pointer-events: none;
    }

    /* Tablet/mobile: fullscreen stack */
    body.nav-open nav.nav-pillar.top-center.links-only .nav-pillar-inner {
        width: 100%;
        max-width: none;
        background: transparent;
        border: none;
        box-shadow: none;
        backdrop-filter: none;
        padding: 0 1.25rem;
        border-radius: 0;
        gap: .35rem;
        margin: 0;
        align-items: stretch;
    }
    body.nav-open nav.nav-pillar.top-center.links-only .nav-pillar-inner::before {
        content: none;
    }
    body.nav-open nav.nav-pillar.top-center.links-only ul.nav-links.vertical {
        flex-direction: column;
        align-items: stretch;
        gap: .25rem;
        width: 100%;
    }
    body.nav-open nav.nav-pillar.top-center.links-only ul.nav-links.vertical li a {
        text-align: left;
        opacity: 0;
        font-size: clamp(1.4rem, 2.9vw, 1.9rem);
        padding: .95rem 1rem;
        border-radius: 18px;
        animation: mobileMenuItemIn 420ms cubic-bezier(.2,.8,.2,1) both;
    }
    body.nav-open nav.nav-pillar.top-center.links-only ul.nav-links.vertical li:nth-child(1) a { animation-delay: 40ms; }
    body.nav-open nav.nav-pillar.top-center.links-only ul.nav-links.vertical li:nth-child(2) a { animation-delay: 95ms; }
    body.nav-open nav.nav-pillar.top-center.links-only ul.nav-links.vertical li:nth-child(3) a { animation-delay: 150ms; }
    body.nav-open nav.nav-pillar.top-center.links-only ul.nav-links.vertical li:nth-child(4) a { animation-delay: 205ms; }
    body.nav-open nav.nav-pillar.top-center.links-only ul.nav-links.vertical li:nth-child(5) a { animation-delay: 260ms; }
}

@media (min-width: 601px) and (max-width: 900px) {
    body.nav-open nav.nav-pillar.top-center.links-only ul.nav-links.vertical li a {
        font-size: clamp(1.75rem, 3.7vw, 2.35rem);
        padding: 1.05rem 1.1rem;
    }
}

@media (max-width: 480px) {
    nav.nav-pillar.top-center .nav-pillar-inner,
    nav.nav-pillar.top-center.links-only .nav-pillar-inner {
        padding: .4rem .7rem;
    }
    nav.nav-pillar.top-center.links-only ul.nav-links.vertical li a {
        font-size: .78rem;
        padding: .46rem .6rem;
    }
    .header-floating .connect-btn {
        font-size: .9rem;
        padding: .6rem .95rem;
    }
}

/* Remove left padding when centered version active (utility) */
body:has(nav.nav-pillar.top-center) {
    padding-left: 2rem; /* revert earlier large shift */
}

.nav-pillar-inner {
    pointer-events: auto;
    width: 100%;
    height: auto;
    margin: auto;
    padding: 0.55rem 0.55rem 0.65rem 0.55rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem; 
    border-radius: 48px;
    background: linear-gradient(160deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
    backdrop-filter: blur(14px) saturate(150%);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 6px 24px -6px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.05) inset, 0 2px 4px -1px rgba(0,0,0,0.4);
    position: relative;
    overflow: hidden;
}

.nav-pillar-inner::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 10%, rgba(255,255,255,0.12), transparent 60%);
    pointer-events: none;
}

.nav-pillar-top, .nav-pillar-bottom {
    display: flex;
    justify-content: center;
    align-items: center;
}

.nav-pillar-top {
    padding-top: .4rem;
}

.nav-pillar-bottom {
    padding-bottom: .4rem;
}

.nav-pillar-links-wrap {
    flex: 1;
    position: relative;
    overflow: hidden; /* we will translate inner list */
    mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.65) 8%, rgba(0,0,0,0.85) 85%, transparent 100%);
}

ul.nav-links.vertical {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0;
    padding: 0;
    margin: 0;
    list-style: none;
    position: absolute;
    top: 0; left: 0; right: 0;
    will-change: transform;
}

ul.nav-links.vertical li a {
    display: block;
    width: 100%;
    text-align: center;
    font-size: 1rem;
    letter-spacing: -0.6px;
    padding: .38rem .2rem; /* more compact vertical links */
    border-radius: 0;
    background: transparent;
    border: none;
    backdrop-filter: none;
    position: relative;
    transition: color .3s, transform .3s;
}

ul.nav-links.vertical li a:hover,
ul.nav-links.vertical li a.active {
    color: var(--accent);
    transform: none !important; /* remove lift */
}

/* Minimal underline indicator */
ul.nav-links.vertical li a::after {
    content: "";
    position: absolute;
    left: 25%;
    right: 25%;
    bottom: 2px;
    height: 2px;
    background: var(--accent);
    opacity: 0;
    transform: scaleX(.4);
    transform-origin: center;
    transition: opacity .3s, transform .4s cubic-bezier(.4,.8,.3,1);
    border-radius: 2px;
}
ul.nav-links.vertical li a:hover::after,
ul.nav-links.vertical li a.active::after {
    opacity: 1;
    transform: scaleX(1);
}

/* Avatar + button tweaks inside pillar */
.nav-pillar .avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 16px -4px rgba(0,0,0,0.6);
    border: 2px solid rgba(255,255,255,0.15);
}

.nav-pillar .connect-btn {
    width: 100%;
    font-size: .7rem;
    padding: .6rem .5rem;
    background: linear-gradient(90deg, #ffffff, #dcdcdc);
    color: #000;
    border-radius: 40px;
    box-shadow: 0 4px 18px -4px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,0,0,0.25) inset;
}

/* Prevent layout shift when vertical scrollbar appears/disappears */
html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

@keyframes pillIntro {
    0% { opacity: 0; transform: translateX(-50%) translateY(-8px) scale(.96); }
    60% { opacity: 1; transform: translateX(-50%) translateY(2px) scale(1.01); }
    100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

@keyframes mobileMenuItemIn {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Responsive fallback: collapse pillar to top bar on phones */
@media (max-width: 600px) {
    nav.nav-pillar {
        position: sticky;
        width: 100%;
        inset: 0 0 auto 0;
        padding: .75rem 1rem;
    }
    .nav-pillar-inner {
        flex-direction: row;
        height: auto;
        border-radius: 30px;
        padding: .6rem .8rem;
        gap: 1rem;
    }
    .nav-pillar-links-wrap {
        mask: none;
        overflow: visible;
        flex: 1;
    }
    ul.nav-links.vertical {
        position: static;
        flex-direction: row;
        justify-content: center;
        gap: .6rem;
        transform: none !important;
        flex-wrap: wrap;
        row-gap: .35rem;
    }
    ul.nav-links.vertical li a {
        font-size: .65rem;
        padding: .5rem .8rem;
    }
    body { padding-left: 2rem; }
}

@media (max-width: 600px) {
    nav.nav-pillar.top-center {
        left: 0;
        transform: none;
        width: 100%;
    }
    nav.nav-pillar.top-center .nav-pillar-inner {
        width: 100%;
        justify-content: center;
    }
    body:has(nav.nav-pillar.top-center) {
        padding-left: 1.2rem;
    }
}

/* Mobile override: use fullscreen burger overlay (wins over the <=900px sticky fallback above) */
@media (max-width: 600px) {
    nav.nav-pillar.top-center.links-only {
        position: fixed;
        inset: 0;
        left: 0;
        top: 0;
        transform: none !important;
        animation: none !important;
        width: 100vw;
        height: 100dvh;
        max-width: none;
        display: none;
        padding: calc(env(safe-area-inset-top, 0px) + 112px) 1rem 1.25rem 1rem;
        z-index: 350;
        pointer-events: auto;
        border-radius: 0;
    }

    body.nav-open nav.nav-pillar.top-center.links-only {
        display: flex;
        justify-content: center;
        align-items: flex-start;
    }

    body.nav-open nav.nav-pillar.top-center.links-only::before {
        content: "";
        position: absolute;
        inset: 0;
        background: rgba(15, 15, 15, 0.78);
        backdrop-filter: blur(14px);
        pointer-events: none;
    }

    body.nav-open nav.nav-pillar.top-center.links-only .nav-pillar-inner {
        width: min(92vw, 420px);
        max-width: 420px;
        margin: 0 auto;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        padding: 0 !important;
        border-radius: 0 !important;
        overflow: visible;
    }

    body.nav-open nav.nav-pillar.top-center.links-only .nav-pillar-inner::before {
        content: none;
    }

    body.nav-open nav.nav-pillar.top-center.links-only ul.nav-links.vertical {
        flex-direction: column;
        align-items: stretch;
        gap: .25rem;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    body.nav-open nav.nav-pillar.top-center.links-only ul.nav-links.vertical li a {
        opacity: 0;
        font-size: 1.28rem;
        padding: 1.05rem 1.1rem;
        border-radius: 18px;
        animation: mobileMenuItemIn 420ms cubic-bezier(.2,.8,.2,1) both;
    }

    body.nav-open nav.nav-pillar.top-center.links-only ul.nav-links.vertical li:nth-child(1) a { animation-delay: 40ms; }
    body.nav-open nav.nav-pillar.top-center.links-only ul.nav-links.vertical li:nth-child(2) a { animation-delay: 95ms; }
    body.nav-open nav.nav-pillar.top-center.links-only ul.nav-links.vertical li:nth-child(3) a { animation-delay: 150ms; }
    body.nav-open nav.nav-pillar.top-center.links-only ul.nav-links.vertical li:nth-child(4) a { animation-delay: 205ms; }
    body.nav-open nav.nav-pillar.top-center.links-only ul.nav-links.vertical li:nth-child(5) a { animation-delay: 260ms; }
}

@media (prefers-reduced-motion: reduce) {
    body.nav-open nav.nav-pillar.top-center.links-only ul.nav-links.vertical li a {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.avatar:hover {
    transform: scale(1.03);
}

/* Mobile-only: reduce spacing between nav and page content
   This overrides the default main margin-top on small screens so
   the header/nav sits closer to the page content without affecting desktop. */
@media (max-width: 600px) {
    body:not(.contact-body) main {
        margin-top: 0.2rem; /* further reduced for tighter mobile layout */
    }
    /* Scope header spacing adjustments only to the listed non-front pages */
    body:has(.blog-list) .header-floating,
    body:has(.projects-list) .header-floating,
    body:has(.technologies-page) .header-floating,
    body:has(#about) .header-floating {
        margin-bottom: 0.2rem;
        /* NOTE: removed margin-top to avoid moving the nav; spacing below the nav
           will be handled by page-level padding (see .blog-list/.projects-list/etc.) */
    }
    /* Note: .hero overrides have been removed for the homepage per request. */
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.nav-links a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 0.8rem;
    transition: all 0.2s ease;
    position: relative;
}

.nav-links a::after {
    display: none;
}

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

.connect-btn {
    background: linear-gradient(135deg,#ffffff,#dcdcdc);
    color: #000;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 32px;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: color .35s, transform .35s, box-shadow .5s;
    box-shadow: 0 4px 12px rgba(255,255,255,0.12), 0 2px 4px -1px rgba(0,0,0,0.4);
}

.connect-btn::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,#f2f2f2,#d0d0d0);
    opacity: 0;
    transition: opacity .55s cubic-bezier(.4,.25,.2,1);
    pointer-events: none;
    z-index: 0;
}

.connect-btn:hover {
    transform: translateY(-2px);
}
.connect-btn:hover::after { 
    opacity: 0.3;
    background: linear-gradient(135deg,#e3e3e3,#a4a4a4);

}

.connect-btn:active {
    transform: translateY(0);
    box-shadow: 0 3px 8px -2px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,0,0,0.15) inset;
}

.connect-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 0;
    margin-bottom: 3rem;
}

.hero.hero-home {
    margin-top: 7rem;
    margin-bottom: 7rem;
}

.hero .hero-title-home {
    font-size: 4rem;
}

.hero .hero-intro-home {
    font-size: 1rem;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}

.hero p {
    max-width: 600px;
    margin: 0 auto 2rem;
    color: #ffffff;
    font-size: 0.95rem;
}

.hero .social-icons {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.hero .social-icons img {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

.hero .social-icons img.hero-social-icon {
    width: 26px;
    height: 26px;
    opacity: 1;
}

/* GSAP handles hero reveal */

/* Selected Work */
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-title h2 {
    font-size: 1.5rem;
}

.section-title .view-all {
    color: var(--gray);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.section-title .view-all:hover {
    color: var(--text);
}

/* GSAP handles section title reveal */

/* Recent Writing */
.posts-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.post-item {
    /* Cap each card at one-third of the row so 3 fill it and wrap;
       with 1 or 2 posts the row stays centered instead of looking empty. */
    flex: 1 1 280px;
    max-width: calc((100% - 3rem) / 3);
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
    color: inherit;
    display: block;
}

/* Count-aware sizing so a short row never looks empty. */

/* Two posts: each takes half the row (centered). */
.posts-grid:has(.post-item:first-child:nth-last-child(2)) .post-item {
    max-width: calc((100% - 1.5rem) / 2);
}

/* One post: a wide horizontal banner (image left, text right). */
.posts-grid .post-item:only-child {
    flex-basis: 100%;
    max-width: 100%;
    margin: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
    align-items: stretch;
}

.posts-grid .post-item:only-child .post-image {
    height: 100%;
    min-height: 300px;
    max-height: 380px;
}

.posts-grid .post-item:only-child .post-info {
    align-self: center;
    padding: 1.5rem;
}

/* GSAP handles post-item reveal */

.post-item:hover {
    transform: none;
    box-shadow: 0 6px 16px rgba(0,0,0,0.35);
}

.post-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    transition: filter 0.2s ease;
}

.post-item:hover .post-image {
    filter: brightness(0.78);
}

.post-info {
    padding: 1rem;
}

.post-info .date {
    font-size: 0.8rem;
    color: var(--gray);
    margin-bottom: 0.5rem;
}

.post-info h3 {
    font-size: 1.2rem;
    letter-spacing: 0.2px;
    margin-bottom: 0.3rem;
    line-height: 1.3;
    color: var(--text);
}

.post-excerpt {
    font-size: 0.85rem;
    color: var(--gray);
    margin-top: 0.4rem;
}

/* Writing List */
.blog-list {
    margin-top: 0;
    padding-top: 5.5rem;
}

.section-subtitle {
    color: var(--gray);
    margin-top: 0.4rem;
    font-size: 0.95rem;
}

/* Projects List */
.projects-list {
    margin-top: 0;
    padding-top: 5.5rem;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    margin: 2rem 0 3rem;
}

.project-card {
    background: radial-gradient(120% 120% at 0% 0%, rgba(255,77,77,0.12), rgba(17,17,17,0.9));
    border: 1px solid rgba(192,192,192,0.35);
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
    transition: box-shadow 0.2s ease;
    min-height: 480px;
}

.project-card:hover {
    box-shadow: 0 10px 28px rgba(0,0,0,0.45);
}

/* Featured layout: first card spans both rows on the left,
   the other two stack (each half height) on the right. */
.project-grid:has(.project-card.featured) {
    grid-template-rows: repeat(2, minmax(0, 1fr));
}

.project-card.featured {
    grid-row: 1 / span 2;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.project-card.featured .project-card-image {
    flex: 1;
    height: auto;
    min-height: 420px;
}

.project-grid:has(.project-card.featured) .project-card:not(.featured) {
    min-height: 0;
}

.project-grid:has(.project-card.featured) .project-card:not(.featured) .project-card-image {
    height: 200px;
}

.project-card-image {
    width: 100%;
    height: 280px;
    object-fit: cover;
    transition: filter 0.2s ease;
}

.project-card:hover .project-card-image {
    filter: brightness(0.78);
}

.project-card-body {
    padding: 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.project-card-body h2,
.project-card-body h3 {
    font-size: 1.24rem;
    letter-spacing: 0.2px;
    line-height: 1.35;
}

.project-excerpt {
    font-size: 0.9rem;
    color: var(--gray);
}

/* Project Post */
.project {
    max-width: 800px;
    margin: 0 auto;
}

.project-content {
    overflow-wrap: anywhere;
}

.project-meta {
    color: var(--gray);
    margin: 0.5rem 0 1rem;
    font-size: 0.95rem;
}

.project-meta::after {
    content: none;
}

.technologies-inline {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.technologies-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tech-tag {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text);
    transition: all 0.2s ease;
    cursor: default;
}

.tech-tag:hover {
    background-color: #1a1a1a;
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}

.project-hero {
    width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 1rem 0 2rem;
}

.project-content p {
    margin-bottom: 1rem;
    color: var(--text);
}

.project-content a,
.post-content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.project-content a:hover,
.post-content a:hover {
    opacity: 0.8;
}

.project-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 1rem 0;
}

.project-content h2,
.project-content h3 {
    margin: 2rem 0 0.75rem;
}

.project-content h2 {
    font-size: 34px;
}

.project-content ul,
.project-content ol {
    margin: 0.75rem 0 1.25rem 1.25rem;
}

.project-content li {
    margin-bottom: 0.4rem;
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    font-size: 0.75rem;
    color: var(--text);
    background: rgba(255,255,255,0.08);
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

/* Technologies */
.technologies-page {
    margin-top: 0;
    padding-top: 5.5rem;
}

.technologies-page .section-title {
    margin-bottom: 3.25rem;
}

.technologies-page .section-subtitle {
    max-width: 720px;
    line-height: 1.6;
}

.tech-section-title {
    font-size: 1.5rem;
    margin-bottom: 1.4rem;
    letter-spacing: -0.3px;
    line-height: 1.15;
}

.programming-section {
    margin-top: 3rem;
}

.tech-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.6rem;
}

.tech-column {
    border-bottom: 1px solid var(--border);
}

.tech-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 90px;
    padding: 0.65rem 0;
    border-top: 1px solid var(--border);
}

.tech-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: linear-gradient(140deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
    color: #cdd5ff;
    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.55px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.tech-copy h3,
.tech-row-plain h3 {
    font-size: 1.18rem;
    font-weight: 600;
    letter-spacing: -0.2px;
    margin: 0;
    line-height: 1.2;
}

.tech-copy p {
    margin: 0.15rem 0 0;
    color: var(--gray);
    font-size: 0.86rem;
    line-height: 1.35;
}

.tech-row-plain {
    align-items: center;
    min-height: 74px;
}

/* Blog Post */
.post {
    max-width: 800px;
    margin: 0 auto;
}

.post-content {
    overflow-wrap: anywhere;
}

.post-meta {
    color: var(--gray);
    margin: 0.5rem 0 1.5rem;
}

.post-hero {
    width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 1rem 0 2rem;
}

.post-content p {
    margin-bottom: 1rem;
    color: var(--text);
}

.post-content h2,
.post-content h3 {
    margin: 2rem 0 0.75rem;
}

.post-content ul,
.post-content ol {
    margin: 0.75rem 0 1.25rem 1.25rem;
}

.post-content li {
    margin-bottom: 0.4rem;
}

.back-link {
    display: inline-block;
    /* add spacing from the floating header/nav */
    margin: 2rem 0 1.5rem;
    color: var(--text);
    text-decoration: none;
    opacity: 0.8;
}

.back-link:hover {
    opacity: 1;
}

/* Responsive tweaks for back-link spacing */
@media (min-width: 900px) {
    .back-link {
        margin-top: 3.5rem; /* more breathing room on wider screens */
    }
}

@media (max-width: 600px) {
    .back-link {
        margin-top: 1.8rem; /* compact but still separated on small screens */
    }
}

/* Footer */
footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--gray);
    text-align: center;
}

.footer-logo {
    width: 48px;
    height: auto;
    object-fit: contain;
}

.footer-social {
    display: flex;
    gap: 1rem;
    margin-top: 0.2rem;
}

.footer-social img {
    width: 18px;
    height: 18px;
    opacity: 0.85;
}

.section-spacer {
    height: 4rem;
}

.header-spacer {
    height: 2rem;
}

/* Mobile: reduce top paddings for page sections to bring headings closer to nav */
@media (max-width: 600px) {
    /* Use a single consistent top padding so page headers align under the nav */
    .blog-list,
    .projects-list,
    .technologies-page {
        padding-top: 1.6rem;
    }
    /* Reduce generic spacers used across pages */
    .header-spacer {
        height: 0.6rem;
    }
    .section-spacer {
        height: 1rem;
    }
    /* Ensure About page uses the same top spacing as other pages by
       removing its internal header spacer on small screens */
    #about .header-spacer {
        height: 0;
        display: none;
    }
}

/* Page load fade (non-flicker) */
.page-fade .hero,
.page-fade #projects,
.page-fade #writing,
.page-fade #about,
.page-fade #experience,
.page-fade #education,
.page-fade .blog-list,
.page-fade .projects-list,
.page-fade .technologies-page,
.page-fade .post,
.page-fade .project,
.page-fade footer {
    animation: sectionFade 0.7s cubic-bezier(.22,.72,.15,1) both;
    filter: blur(8px);
}

/* Stagger section fades (collective per section) */
.page-fade .hero { animation-delay: 0.05s; }
.page-fade #projects { animation-delay: 0.15s; }
.page-fade #writing { animation-delay: 0.25s; }
.page-fade #about { animation-delay: 0.10s; }
.page-fade #experience { animation-delay: 0.20s; }
.page-fade #education { animation-delay: 0.30s; }
.page-fade .blog-list { animation-delay: 0.10s; }
.page-fade .projects-list { animation-delay: 0.10s; }
.page-fade .technologies-page { animation-delay: 0.10s; }
.page-fade .post { animation-delay: 0.10s; }
.page-fade .project { animation-delay: 0.10s; }
.page-fade footer { animation-delay: 0.45s; }

@keyframes sectionFade {
    0%   { opacity: 0; transform: translateY(8px); filter: blur(8px); }
    100% { opacity: 1; transform: translateY(0);   filter: blur(0); }
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.5rem;
    }
    .project-grid {
        grid-template-columns: 1fr;
    }

    /* Writing cards stack full-width on mobile instead of capped thirds */
    .post-item,
    .posts-grid:has(.post-item:first-child:nth-last-child(2)) .post-item,
    .posts-grid .post-item:only-child {
        flex-basis: 100%;
        max-width: 100%;
    }

    /* Single-post banner collapses to a normal stacked card on mobile */
    .posts-grid .post-item:only-child {
        display: block;
        grid-template-columns: none;
        margin: 0;
    }

    .posts-grid .post-item:only-child .post-image {
        height: 200px;
        min-height: 0;
    }

    /* Stack all cards in a single column on mobile — no featured span */
    .project-grid:has(.project-card.featured) {
        grid-template-rows: none;
    }

    .project-card.featured {
        grid-row: auto;
    }

    .project-card.featured .project-card-image {
        height: 200px;
        flex: none;
        min-height: 0;
    }

    /* Improve section titles + descriptions on smaller screens */
    .section-title {
        /* keep heading and CTA on a single line when possible */
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .section-title h2 {
        /* make section headings more balanced on mobile */
        font-size: 1.9rem;
        line-height: 1.05;
        margin: 0;
        letter-spacing: -0.4px;
    }

    .section-title .view-all {
        font-size: 0.9rem;
        align-self: center;
        margin-left: 0.5rem;
    }

    .section-subtitle {
        font-size: 0.95rem;
        color: var(--gray);
        max-width: 100%;
        margin: 0;
    }

    /* Card adjustments so titles/descriptions don't overlap or get pushed off */
    .project-card,
    .post-item {
        min-height: auto;
    }

    .project-card-image,
    .post-image {
        height: 200px;
        object-fit: cover;
    }

    .project-card-body h2,
    .project-card-body h3,
    .post-info h3 {
        font-size: 1.25rem;
        line-height: 1.2;
    }

    .project-card-body .project-excerpt,
    .post-excerpt {
        font-size: 0.95rem;
    }

    /* Make global heading sizes responsive on small screens to avoid layout issues */
    h1, h2 {
        /* Keep mobile headings larger so they remain prominent */
        font-size: clamp(1.8rem, 5.2vw, 2.6rem);
    }

    /* Ensure page-level H1s are prominent on small screens */
    .projects-list h1,
    .blog-list h1,
    .technologies-page h1,
    #about h1,
    .not-found-title {
        font-size: clamp(2.2rem, 6vw, 3.2rem);
        margin: 0 0 0.5rem 0; /* reset top margin and keep bottom spacing */
        line-height: 1.05;
    }

    .tech-columns {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .programming-section {
        margin-top: 2.3rem;
    }

    .tech-section-title {
        font-size: 1.3rem;
        margin-bottom: 0.85rem;
    }

    .tech-copy h3,
    .tech-row-plain h3 {
        font-size: 1.05rem;
    }

    .tech-row {
        min-height: 82px;
        padding: 0.55rem 0;
    }

    .tech-row-plain {
        min-height: 68px;
    }
}

/* Smooth scroll wrapper */
#smooth-wrapper {
    position: fixed;
    inset: 0;
    overflow: hidden;
    width: 100%;
    height: 100%;
}
#smooth-content {
    will-change: transform;
    width: 100%;
    min-height: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

/* On touch devices, native momentum scrolling is already smooth. The JS
   rAF/transform "virtual scroll" fights it (main-thread work gets
   deprioritized mid-gesture on iOS Safari, so the transform visibly lags
   behind the finger), so let content flow natively instead of being pinned. */
@media (pointer: coarse) {
    /* body's padding/max-width (including the body:has(nav...) padding-left
       overrides elsewhere in this file) were always inert before: every
       direct child (nav, #smooth-wrapper) was position:fixed, which ignores
       the parent's box model and sizes against the viewport instead. Now
       that #smooth-wrapper is in normal flow, that dead CSS would stack on
       top of #smooth-content's own padding and shrink the page — cancel all
       of it (important needed to beat the higher-specificity :has() rules)
       so the visible layout is unchanged. */
    body {
        padding: 0 !important;
        max-width: none !important;
        margin: 0 !important;
    }
    #smooth-wrapper {
        position: static;
        inset: auto;
        overflow: visible;
        width: auto;
        height: auto;
    }
    #smooth-content {
        will-change: auto;
        transform: none !important;
        /* Base rule's min-height:100% can't resolve once the wrapper is
           auto-height instead of fixed/100%; pin it directly so short pages
           (e.g. 404) still fill the viewport and keep the footer anchored. */
        min-height: 100dvh;
    }
}

.page-content {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#about {
    padding-top: 5.5rem;
}

@media (max-width: 600px) {
    /* Keep About header spacing consistent with Projects/Writing/Technologies */
    #about {
        padding-top: 1.6rem;
    }
}

.contact-body {
  min-height: 100dvh;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.contact-body #smooth-wrapper,
.contact-body #smooth-content {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.contact-body .page-content {
    flex: 1 1 auto;
}

.contact-body .header-floating,
.contact-body footer {
  flex: 0 0 auto;
}

.contact-body #contact {
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 0 1rem;
  min-height: 0;
    width: 100%;
}

.not-found {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 4rem 1rem;
}

body:not(.contact-body) main.not-found {
    margin-top: 0;
}

.not-found-card {
    width: min(640px, 100%);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    text-align: center;
    background: linear-gradient(150deg, rgba(255,255,255,0.05), rgba(255,255,255,0.015));
    backdrop-filter: blur(10px);
}

.not-found-code {
    font-size: 0.75rem;
    letter-spacing: 0.16em;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--gray);
    margin-bottom: 0.75rem;
}

.not-found-title {
    font-size: var(--hero-font-size);
    font-weight: var(--hero-font-weight);
    letter-spacing: var(--hero-letter-spacing);
    line-height: 1.05;
    margin-bottom: 0.9rem;
}

.not-found-copy {
    font-size: 0.98rem;
    line-height: 1.6;
    color: #d1d1d1;
    max-width: 48ch;
    margin: 0 auto;
}

.not-found-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.not-found-link {
    display: inline-block;
    text-decoration: none;
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 500;
    letter-spacing: -0.1px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 999px;
    padding: 0.55rem 1rem;
    transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.not-found-link:hover {
    transform: translateY(-1px);
    border-color: var(--accent);
    color: var(--accent);
}

/* Cinematic page reveal */
.cinematic-reveal {
  /* start state before animation kicks in */
  opacity: 0;
  transform: translateY(10px) scale(.985);
  filter: blur(12px);
  animation:
    revealEase .9s cubic-bezier(.22,.72,.15,1) .05s both,
    vignetteFade .9s ease-out .05s both;
  position: relative;
  isolation: isolate; /* keep pseudo-elements contained */
}

/* Soft blur + scale settle + opacity */
@keyframes revealEase {
  0%   { opacity: 0; filter: blur(12px); transform: translateY(10px) scale(.985); }
  35%  { opacity: 1; filter: blur(6px);  transform: translateY(2px)  scale(.995); }
  60%  { opacity: 1; filter: blur(2px);  transform: translateY(0)    scale(1.002); }
  100% { opacity: 1; filter: blur(0);    transform: translateY(0)    scale(1); }
}

/* Subtle vignette easing out, like exposure settling */
@keyframes vignetteFade {
  0%   { box-shadow: inset 0 0 180px rgba(0,0,0,.45); }
  40%  { box-shadow: inset 0 0 120px rgba(0,0,0,.28); }
  100% { box-shadow: inset 0 0 0 rgba(0,0,0,0); }
}

/* Shutter wipe layer */
.cinematic-reveal::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,.75) 0%,
    rgba(0,0,0,.55) 20%,
    rgba(0,0,0,0) 55%,
    rgba(0,0,0,.55) 80%,
    rgba(0,0,0,.75) 100%
  );
  transform: translateY(0);
  filter: blur(2px);
  pointer-events: none;
  z-index: 2;
  animation: shutterWipe .6s cubic-bezier(.2,.8,.2,1) .05s both;
}

/* Wipe moves up quickly and slightly overshoots */
@keyframes shutterWipe {
  0%   { transform: translateY(0); opacity: .9; }
  70%  { transform: translateY(-101%); opacity: .6; }
  100% { transform: translateY(-101%); opacity: 0; }
}

/* Optional: staggered children inside the contact section */
.contact-stagger > * {
  opacity: 0;
  transform: translateY(6px);
  filter: blur(8px);
  animation: staggerUp .6s cubic-bezier(.22,.72,.15,1) both;
}
.contact-stagger > *:nth-child(1) { animation-delay: .18s; }
.contact-stagger > *:nth-child(2) { animation-delay: .26s; }
.contact-stagger > *:nth-child(3) { animation-delay: .34s; }
.contact-stagger > *:nth-child(4) { animation-delay: .42s; }
.contact-stagger > *:nth-child(5) { animation-delay: .50s; }

@keyframes staggerUp {
  0%   { opacity: 0; transform: translateY(8px); filter: blur(8px); }
  100% { opacity: 1; transform: translateY(0);   filter: blur(0); }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .page-fade .hero,
    .page-fade #projects,
    .page-fade #writing,
    .page-fade #about,
    .page-fade #experience,
    .page-fade #education,
    .page-fade .blog-list,
    .page-fade .post,
    .page-fade footer {
        animation: none !important;
    }
  .cinematic-reveal,
  .contact-stagger > * {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
  .cinematic-reveal::after { display: none !important; }
}

@media (max-width: 768px) {
    .not-found-copy {
        font-size: 0.95rem;
    }
}

/* Deter casual image saving/dragging (friction only, not real protection) */
img {
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    user-drag: none;
}
