:root {
    --sand: #f6efe5;
    --cream: #fffaf3;
    --ink: #0f172a;
    --accent: #79a8d8;
    --accent-deep: #4b7cae;
    --mist: #eef4fb;
    --line: #ddded8;
    --card: rgba(255, 255, 255, 0.82);
}

html {
    scroll-behavior: smooth;
}

body {
    background:
        radial-gradient(circle at top left, rgba(121, 168, 216, 0.14), transparent 28%),
        radial-gradient(circle at 85% 10%, rgba(255, 255, 255, 0.9), transparent 18%),
        linear-gradient(180deg, #f6efe5 0%, #f8f2e9 38%, #f5ede3 100%);
    min-height: 100vh;
}

.page-noise {
    pointer-events: none;
    position: fixed;
    inset: 0;
    background-image: radial-gradient(rgba(15, 23, 42, 0.04) 0.7px, transparent 0.7px);
    background-size: 14px 14px;
    opacity: 0.14;
    z-index: -1;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -3rem;
    z-index: 60;
    border-radius: 999px;
    background: #0f172a;
    color: white;
    padding: 0.8rem 1.1rem;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 1rem;
}

.site-header {
    position: fixed;
    inset: 1rem 0 auto;
    z-index: 40;
}

#site-nav.nav-scrolled {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
}

.nav-link {
    position: relative;
}

.nav-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -0.4rem;
    width: 100%;
    height: 1px;
    background: rgba(15, 23, 42, 0.55);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
}

.nav-link:hover::after {
    transform: scaleX(1);
}

.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    gap: 1rem;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.95), rgba(246, 239, 229, 0.98));
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.is-hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-orbit {
    width: 5rem;
    height: 5rem;
    border-radius: 999px;
    border: 1px solid rgba(75, 124, 174, 0.2);
    border-top-color: rgba(75, 124, 174, 0.95);
    animation: spin 1s linear infinite;
}

.loading-text {
    font-size: 0.92rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(15, 23, 42, 0.62);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, var(--accent-deep), var(--accent));
    box-shadow: 0 0 24px rgba(121, 168, 216, 0.4);
}

.cursor-dot,
.cursor-ring {
    pointer-events: none;
    position: fixed;
    top: 0;
    left: 0;
    border-radius: 999px;
    transform: translate(-50%, -50%);
    transition: opacity 0.2s ease;
    z-index: 90;
}

.cursor-dot {
    width: 8px;
    height: 8px;
    background: rgba(75, 124, 174, 0.9);
}

.cursor-ring {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(75, 124, 174, 0.3);
}

.hero-aurora {
    position: absolute;
    width: 24rem;
    height: 24rem;
    border-radius: 999px;
    filter: blur(30px);
    opacity: 0.45;
}

.hero-aurora-left {
    top: 4rem;
    left: -8rem;
    background: radial-gradient(circle at center, rgba(121, 168, 216, 0.4), transparent 60%);
}

.hero-aurora-right {
    top: 3rem;
    right: -5rem;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.9), transparent 56%);
}

.hero-orbit-card {
    position: relative;
    height: 100%;
}

#hero-particles {
    border-radius: 38px;
    opacity: 0.8;
}

.section-shell {
    width: min(1180px, 92vw);
    margin: 0 auto;
    padding: 4.5rem 0 1.5rem;
}

.section-head {
    max-width: 48rem;
}

.section-kicker,
.eyebrow {
    display: inline-flex;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent-deep);
}

.section-title {
    margin-top: 1rem;
    font-family: "Sora", sans-serif;
    font-size: clamp(2rem, 4vw, 3.6rem);
    line-height: 1.06;
    color: #020617;
}

.section-copy {
    margin-top: 1.1rem;
    font-size: 1rem;
    line-height: 2;
    color: rgba(15, 23, 42, 0.7);
}

.panel-card {
    border: 1px solid rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.84);
    border-radius: 32px;
    padding: 1.6rem;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.07);
    backdrop-filter: blur(14px);
}

.soft-card {
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(248, 250, 252, 0.9));
    border-radius: 24px;
    padding: 1.25rem;
}

.skill-pill,
.filter-chip,
.topic-chip {
    border-radius: 999px;
    border: 1px solid rgba(121, 168, 216, 0.18);
    background: rgba(121, 168, 216, 0.1);
    padding: 0.65rem 0.95rem;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--accent-deep);
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.skill-pill:hover,
.filter-chip:hover,
.topic-chip:hover {
    transform: translateY(-1px);
    background: rgba(121, 168, 216, 0.16);
    border-color: rgba(121, 168, 216, 0.32);
}

.filter-chip.is-active {
    background: #0f172a;
    color: white;
    border-color: #0f172a;
}

.project-card {
    border: 1px solid rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.86);
    border-radius: 34px;
    padding: 1.3rem;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.07);
    transition: transform 0.28s ease, box-shadow 0.28s ease, opacity 0.28s ease;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 24px 54px rgba(15, 23, 42, 0.1);
}

.project-card.is-hidden {
    display: none;
}

.timeline-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.25rem;
    align-items: flex-start;
}

.timeline-badge {
    display: grid;
    place-items: center;
    width: 4rem;
    height: 4rem;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(121, 168, 216, 0.2), rgba(255, 255, 255, 0.85));
    border: 1px solid rgba(121, 168, 216, 0.25);
    font-family: "Sora", sans-serif;
    font-weight: 700;
    color: var(--accent-deep);
    box-shadow: 0 14px 30px rgba(121, 168, 216, 0.14);
}

.timeline-content {
    border: 1px solid rgba(255, 255, 255, 0.88);
    background: rgba(255, 255, 255, 0.84);
    border-radius: 30px;
    padding: 1.45rem;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.06);
}

.assistant-cta {
    display: grid;
    gap: 1.8rem;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.9);
    background:
        radial-gradient(circle at top right, rgba(121, 168, 216, 0.16), transparent 32%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(238, 244, 251, 0.82));
    border-radius: 38px;
    padding: 2rem;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}

@media (min-width: 900px) {
    .assistant-cta {
        grid-template-columns: 1.15fr 0.85fr;
    }
}

.form-field {
    display: grid;
    gap: 0.65rem;
}

.form-field span {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(15, 23, 42, 0.55);
}

.form-field input,
.form-field textarea,
.chat-form textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.96);
    padding: 1rem 1.05rem;
    color: var(--ink);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-field input:focus,
.form-field textarea:focus,
.chat-form textarea:focus {
    border-color: rgba(121, 168, 216, 0.45);
    box-shadow: 0 0 0 5px rgba(121, 168, 216, 0.12);
}

.gallery-modal {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: none;
    place-items: center;
    padding: 1.25rem;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(10px);
}

.gallery-modal.is-open {
    display: grid;
}

.gallery-modal-card {
    position: relative;
    width: min(780px, 94vw);
    border-radius: 32px;
    border: 1px solid rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.95);
    padding: 1.25rem;
    box-shadow: 0 30px 70px rgba(15, 23, 42, 0.22);
}

.gallery-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.95);
}

.chat-shell {
    border: 1px solid rgba(255, 255, 255, 0.88);
    background: rgba(255, 255, 255, 0.88);
    border-radius: 34px;
    padding: 1rem;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(14px);
}

.chat-toolbar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: space-between;
    padding: 0.75rem 0.75rem 1rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

@media (min-width: 760px) {
    .chat-toolbar {
        flex-direction: row;
        align-items: center;
    }
}

.chat-feed {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 34rem;
    max-height: 60vh;
    overflow-y: auto;
    padding: 1rem 0.75rem;
}

.chat-bubble {
    max-width: 85%;
    border-radius: 28px;
    padding: 1rem 1rem 1rem 1.1rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.chat-bubble.assistant {
    align-self: flex-start;
    border: 1px solid rgba(121, 168, 216, 0.16);
    background: linear-gradient(180deg, rgba(238, 244, 251, 0.92), rgba(255, 255, 255, 0.95));
}

.chat-bubble.user {
    align-self: flex-end;
    background: #0f172a;
    color: white;
}

.chat-bubble.streaming {
    position: relative;
}

.chat-meta {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.55rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(15, 23, 42, 0.45);
}

.chat-bubble.user .chat-meta {
    color: rgba(255, 255, 255, 0.55);
}

.chat-form {
    border-top: 1px solid rgba(15, 23, 42, 0.06);
    padding: 1rem 0.75rem 0.5rem;
}

.chat-actions {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    margin-top: 0.8rem;
}

@media (min-width: 760px) {
    .chat-actions {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.prompt-card {
    display: block;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.88);
    padding: 0.95rem 1rem;
    text-align: left;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.prompt-card:hover {
    transform: translateY(-1px);
    border-color: rgba(121, 168, 216, 0.3);
}

.typing-indicator {
    display: inline-flex;
    gap: 0.35rem;
    align-items: center;
}

.typing-indicator span {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
    background: rgba(75, 124, 174, 0.65);
    animation: pulse 1s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.18s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.36s;
}

@keyframes pulse {
    0%, 80%, 100% {
        opacity: 0.25;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-2px);
    }
}

.markdown-body {
    color: inherit;
    font-size: 0.95rem;
    line-height: 1.85;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body pre,
.markdown-body blockquote {
    margin: 0.7rem 0;
}

.markdown-body ul,
.markdown-body ol {
    padding-left: 1.3rem;
}

.markdown-body code {
    background: rgba(15, 23, 42, 0.08);
    border-radius: 8px;
    padding: 0.15rem 0.4rem;
    font-size: 0.88em;
}

.chat-bubble.user .markdown-body code {
    background: rgba(255, 255, 255, 0.14);
}

.code-block-wrap {
    position: relative;
    margin-top: 1rem;
}

.code-copy {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.8);
    color: white;
    padding: 0.35rem 0.7rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.markdown-body pre {
    overflow-x: auto;
    border-radius: 18px;
    background: #111827;
    padding: 1rem;
}

.back-to-top {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 35;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.2rem;
    height: 3.2rem;
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.88);
    color: white;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.18);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

@media (max-width: 767px) {
    .timeline-card {
        grid-template-columns: 1fr;
    }

    .timeline-badge {
        width: 3.3rem;
        height: 3.3rem;
    }

    .chat-bubble {
        max-width: 100%;
    }

    .cursor-dot,
    .cursor-ring {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .cursor-dot,
    .cursor-ring {
        display: none;
    }
}
