:root {
    --paper: #fffaf0;
    --paper-soft: #f4fbf8;
    --card: rgba(255, 255, 255, 0.88);
    --ink: #16243a;
    --muted: #657083;
    --teal: #0f9f9a;
    --blue: #2f6fdd;
    --coral: #ff6b5f;
    --gold: #f2b705;
    --green: #3bb273;
    --line: rgba(22, 36, 58, 0.12);
    --shadow: 0 18px 50px rgba(33, 62, 93, 0.13);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--ink);
    font-family: "Segoe UI", Arial, sans-serif;
    background:
        radial-gradient(circle at 12% 8%, rgba(47, 111, 221, 0.12), transparent 23rem),
        radial-gradient(circle at 86% 12%, rgba(255, 107, 95, 0.12), transparent 24rem),
        radial-gradient(circle at 48% 90%, rgba(15, 159, 154, 0.12), transparent 28rem),
        linear-gradient(135deg, #fffaf0, #f7fcff 46%, #fff8e5);
}

body::selection {
    background: var(--gold);
    color: var(--ink);
}

button,
input,
textarea {
    font: inherit;
}

a {
    color: inherit;
}

#neural-bg,
.ambient-grid {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

#neural-bg {
    z-index: 0;
    opacity: 0.72;
}

.ambient-grid {
    z-index: 1;
    opacity: 0.38;
    background-image:
        linear-gradient(rgba(22, 36, 58, 0.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(22, 36, 58, 0.055) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, #000, transparent 82%);
}

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem clamp(1rem, 4vw, 3rem);
    border-bottom: 1px solid var(--line);
    background: rgba(255, 250, 240, 0.82);
    backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    align-items: baseline;
    gap: 0.2rem;
    color: var(--ink);
    text-decoration: none;
    font-weight: 900;
    letter-spacing: 0;
}

.brand::before {
    content: "";
    width: 0.82rem;
    height: 0.82rem;
    border-radius: 3px;
    background: linear-gradient(135deg, var(--teal), var(--gold));
    box-shadow: 0 7px 16px rgba(15, 159, 154, 0.22);
}

.brand span {
    color: var(--teal);
}

.nav-links {
    display: flex;
    justify-content: flex-end;
    gap: clamp(0.55rem, 2vw, 1.5rem);
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
    text-decoration: none;
    transition: color 180ms ease;
}

.nav-links a:hover {
    color: var(--blue);
}

main,
footer {
    position: relative;
    z-index: 2;
}

.hero,
.section {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
}

.hero {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
    align-items: center;
    gap: clamp(2rem, 5vw, 5rem);
    padding-top: 5rem;
}

.hero-side {
    display: grid;
    gap: 1rem;
}

.section {
    padding: 5.5rem 0;
}

.eyebrow {
    margin: 0 0 0.8rem;
    color: var(--teal);
    text-transform: uppercase;
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 0.12em;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

.glitch {
    position: relative;
    max-width: 850px;
    margin-bottom: 1rem;
    color: var(--ink);
    font-size: clamp(2.6rem, 7vw, 6.4rem);
    line-height: 0.96;
    letter-spacing: 0;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    opacity: 0.22;
}

.glitch::before {
    color: var(--blue);
    transform: translate(2px, -1px);
    clip-path: inset(0 0 62% 0);
    animation: cleanGlitchA 3.4s infinite steps(2);
}

.glitch::after {
    color: var(--coral);
    transform: translate(-2px, 1px);
    clip-path: inset(58% 0 0 0);
    animation: cleanGlitchB 3.8s infinite steps(2);
}

.subtitle {
    max-width: 620px;
    color: var(--muted);
    font-size: clamp(1.05rem, 2.4vw, 1.45rem);
}

.hero-actions,
.chat-controls {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.neon-button,
.ghost-button,
.contact-button,
.chat-controls button {
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.85rem 1.15rem;
    cursor: pointer;
    color: #ffffff;
    background: linear-gradient(135deg, var(--blue), var(--teal));
    box-shadow: 0 14px 28px rgba(47, 111, 221, 0.22);
    text-decoration: none;
    font-weight: 900;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.ghost-button {
    color: var(--ink);
    border-color: rgba(47, 111, 221, 0.22);
    background: rgba(255, 255, 255, 0.72);
}

.neon-button:hover,
.ghost-button:hover,
.contact-button:hover,
.chat-controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 34px rgba(15, 159, 154, 0.2);
}

.lab-panel,
.profile-card,
.code-lab,
.project-card,
.til-panel,
.resume-qr,
.daily-grid article,
.timeline-card,
.skill-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--card);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.profile-card {
    position: relative;
    margin: 0;
    padding: 1rem;
    overflow: hidden;
    animation: floatProfile 5s ease-in-out infinite;
}

.profile-card::before {
    content: "";
    position: absolute;
    inset: -35%;
    background:
        conic-gradient(from 120deg, transparent, rgba(47, 111, 221, 0.22), transparent, rgba(15, 159, 154, 0.22), transparent),
        radial-gradient(circle, rgba(242, 183, 5, 0.16), transparent 42%);
    animation: rotateAura 8s linear infinite;
}

.profile-ring {
    position: relative;
    z-index: 1;
    aspect-ratio: 1;
    padding: 0.45rem;
    border-radius: 28px;
    background: linear-gradient(135deg, var(--blue), var(--teal), var(--gold), var(--coral));
    box-shadow: 0 18px 42px rgba(47, 111, 221, 0.18);
}

.profile-ring img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 28%;
    border: 6px solid #ffffff;
    border-radius: 23px;
    filter: saturate(1.04) contrast(1.02);
    transition: transform 350ms ease, filter 350ms ease;
}

.profile-card:hover .profile-ring img {
    transform: scale(1.035);
    filter: saturate(1.12) contrast(1.04);
}

.profile-card figcaption {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 0.2rem;
    margin-top: 0.8rem;
    padding: 0.85rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.82);
}

.profile-card figcaption strong {
    color: var(--ink);
    font-size: 1.08rem;
}

.profile-card figcaption span {
    color: var(--teal);
    font-weight: 800;
}

.lab-panel {
    display: grid;
    gap: 1rem;
    padding: 1.25rem;
}

.panel-row,
.quote-box,
.scanline-card {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(244, 251, 248, 0.86), rgba(255, 255, 255, 0.9));
}

.panel-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.panel-row strong {
    color: var(--blue);
}

.quote-box span,
.til-panel span {
    color: var(--coral);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.quote-box p,
.til-panel p {
    margin: 0.55rem 0 0;
    color: var(--ink);
    line-height: 1.6;
}

.status-dot {
    display: inline-block;
    width: 0.65rem;
    height: 0.65rem;
    margin-right: 0.5rem;
    border-radius: 999px;
    background: var(--green);
    box-shadow: 0 0 0 6px rgba(59, 178, 115, 0.12);
    animation: blink 1.4s infinite;
}

.section-heading {
    margin-bottom: 2rem;
}

.section-heading h2 {
    margin: 0;
    color: var(--ink);
    font-size: clamp(2rem, 5vw, 3.75rem);
}

.timeline {
    display: grid;
    gap: 1rem;
    position: relative;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 1rem;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 3px;
    border-radius: 999px;
    background: linear-gradient(var(--blue), var(--teal), var(--gold));
}

.timeline-card {
    position: relative;
    width: calc(100% - 3rem);
    margin-left: 3rem;
    padding: 1.1rem;
    color: inherit;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    max-height: 5.7rem;
    transition: max-height 260ms ease, transform 220ms ease, border-color 220ms ease;
}

.timeline-card::before {
    content: "";
    position: absolute;
    left: -2.54rem;
    top: 1.35rem;
    width: 0.9rem;
    height: 0.9rem;
    border: 3px solid #ffffff;
    border-radius: 999px;
    background: var(--blue);
    box-shadow: 0 8px 18px rgba(47, 111, 221, 0.22);
}

.timeline-card.is-open {
    max-height: 14rem;
    border-color: rgba(15, 159, 154, 0.5);
}

.timeline-card:hover {
    transform: translateX(0.35rem);
    border-color: rgba(47, 111, 221, 0.38);
}

.year {
    color: var(--coral);
    font-weight: 900;
}

.timeline-card h3,
.project-card h3,
.skill-card h3,
.daily-grid h3 {
    margin: 0.35rem 0 0.5rem;
}

.timeline-card p,
.skill-card p,
.project-card p,
.daily-grid p {
    color: var(--muted);
    line-height: 1.6;
}

.timeline-card small {
    color: var(--teal);
    font-weight: 800;
}

.skills-grid,
.project-grid,
.daily-grid,
.contact-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.skill-card,
.project-card,
.daily-grid article {
    padding: 1rem;
    transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.skill-card:hover,
.project-card:hover,
.daily-grid article:hover {
    transform: translateY(-0.45rem);
    border-color: rgba(47, 111, 221, 0.35);
    box-shadow: 0 22px 55px rgba(33, 62, 93, 0.16);
}

.skill-icon {
    width: 54px;
    height: 54px;
    margin-bottom: 0.85rem;
    position: relative;
}

.python-icon::before,
.python-icon::after {
    content: "";
    position: absolute;
    width: 31px;
    height: 23px;
    border-radius: 13px 13px 6px 6px;
    background: var(--blue);
}

.python-icon::after {
    right: 0;
    bottom: 3px;
    background: var(--gold);
    transform: rotate(180deg);
}

.java-icon::before {
    content: "";
    position: absolute;
    left: 12px;
    bottom: 5px;
    width: 30px;
    height: 22px;
    border: 3px solid var(--coral);
    border-top: 0;
    border-radius: 0 0 12px 12px;
}

.java-icon::after {
    content: "~";
    position: absolute;
    left: 15px;
    top: 1px;
    color: var(--blue);
    font-size: 2rem;
    font-weight: 900;
}

.sql-icon::before {
    content: "";
    position: absolute;
    inset: 7px 8px;
    border: 3px solid var(--teal);
    border-radius: 50% / 18%;
}

.sql-icon::after {
    content: "";
    position: absolute;
    left: 8px;
    right: 8px;
    top: 22px;
    height: 18px;
    border-left: 3px solid var(--teal);
    border-right: 3px solid var(--teal);
}

.ml-icon::before {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 999px;
    background: radial-gradient(circle, var(--gold), var(--teal));
}

.progress {
    height: 0.55rem;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(22, 36, 58, 0.08);
}

.progress span {
    display: block;
    width: var(--level);
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--blue), var(--teal), var(--gold));
    animation: loadBar 1.4s ease-out both;
}

.code-lab {
    margin-top: 1rem;
    overflow: hidden;
}

.window-bar {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--line);
    background: #ffffff;
}

.window-bar span {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 999px;
    background: var(--coral);
}

.window-bar span:nth-child(2) {
    background: var(--gold);
}

.window-bar span:nth-child(3) {
    background: var(--teal);
}

.window-bar strong {
    margin-left: 0.5rem;
    color: var(--muted);
}

.code-layout {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 1rem;
    padding: 1rem;
}

pre {
    margin: 0;
    overflow: auto;
    min-height: 260px;
    padding: 1rem;
    color: #17324d;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f6fbff;
}

.demo-console {
    display: grid;
    gap: 0.8rem;
}

.demo-console label {
    color: var(--teal);
    font-weight: 900;
}

textarea,
input {
    width: 100%;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
}

textarea {
    min-height: 115px;
    resize: vertical;
    padding: 0.8rem;
}

input {
    padding: 0.75rem;
}

output {
    min-height: 5.2rem;
    padding: 0.9rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
    background: var(--paper-soft);
}

.project-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grade-dashboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.55rem;
    margin: 1rem 0;
}

.grade-dashboard div {
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f7fbff;
}

.grade-dashboard span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
}

.grade-dashboard strong {
    color: var(--blue);
}

.chatbox {
    display: grid;
    grid-template-rows: 230px auto;
    gap: 0.8rem;
}

.chat-log {
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fcfa;
}

.bubble {
    width: fit-content;
    max-width: 88%;
    padding: 0.65rem 0.75rem;
    border: 1px solid rgba(15, 159, 154, 0.2);
    border-radius: 12px;
    color: var(--ink);
    background: #ffffff;
    line-height: 1.45;
}

.bubble.user {
    align-self: flex-end;
    color: #ffffff;
    background: linear-gradient(135deg, var(--blue), var(--teal));
}

.viz {
    height: 240px;
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    padding: 1rem 0.25rem;
}

.viz button {
    flex: 1;
    height: var(--bar);
    min-height: 48px;
    border: 0;
    border-radius: 10px 10px 0 0;
    color: #ffffff;
    background: linear-gradient(180deg, var(--teal), var(--blue));
    cursor: pointer;
    font-weight: 900;
    transition: transform 180ms ease, filter 180ms ease;
}

.viz button:nth-child(2) {
    background: linear-gradient(180deg, var(--gold), var(--coral));
}

.viz button:nth-child(3) {
    background: linear-gradient(180deg, var(--green), var(--teal));
}

.viz button:hover {
    transform: scaleY(1.08);
    filter: saturate(1.12) brightness(1.04);
}

.chart-readout {
    min-height: 1.5rem;
}

.daily-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.daily-grid article span {
    color: var(--coral);
    font-weight: 900;
}

.til-panel {
    margin-top: 1rem;
    padding: 1.2rem;
}

.contact-grid {
    grid-template-columns: 1fr 1fr;
    align-items: center;
}

.contact-buttons {
    display: grid;
    gap: 0.8rem;
}

.contact-button {
    display: block;
    text-align: center;
}

button.contact-button {
    width: 100%;
    font: inherit;
    cursor: pointer;
}

.contact-button:nth-child(2) {
    background: linear-gradient(135deg, var(--blue), var(--coral));
}

.contact-button:nth-child(3) {
    background: linear-gradient(135deg, var(--ink), var(--blue));
}

.contact-button:nth-child(4) {
    background: linear-gradient(135deg, #25d366, var(--teal));
}

.contact-button:nth-child(5) {
    background: linear-gradient(135deg, #0a66c2, var(--blue));
}

.resume-qr {
    display: grid;
    justify-items: center;
    gap: 0.8rem;
    padding: 1.25rem;
    text-decoration: none;
}

#qrcode,
.qr-fallback {
    width: 192px;
    height: 192px;
    display: grid;
    place-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
}

.qr-fallback {
    grid-template-columns: repeat(9, 1fr);
    gap: 4px;
}

.qr-fallback i {
    aspect-ratio: 1;
    background: var(--teal);
}

footer {
    padding: 2rem 1rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    background: rgba(255, 255, 255, 0.7);
    text-align: center;
}

@keyframes cleanGlitchA {
    0%, 88%, 100% { transform: translate(2px, -1px); }
    90% { transform: translate(-5px, -1px); }
    92% { transform: translate(4px, 1px); }
}

@keyframes cleanGlitchB {
    0%, 84%, 100% { transform: translate(-2px, 1px); }
    86% { transform: translate(5px, 1px); }
    88% { transform: translate(-4px, -1px); }
}

@keyframes blink {
    50% { opacity: 0.45; }
}

@keyframes loadBar {
    from { width: 0; }
}

@keyframes floatProfile {
    0%, 100% { transform: translateY(0) rotate(-0.4deg); }
    50% { transform: translateY(-10px) rotate(0.4deg); }
}

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

@media (max-width: 900px) {
    .hero,
    .code-layout,
    .contact-grid {
        grid-template-columns: 1fr;
    }

    .skills-grid,
    .project-grid,
    .daily-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .topbar {
        position: absolute;
        align-items: flex-start;
    }

    .nav-links {
        gap: 0.6rem;
        font-size: 0.82rem;
    }

    .hero {
        padding-top: 8rem;
    }

    .skills-grid,
    .project-grid,
    .daily-grid {
        grid-template-columns: 1fr;
    }

    .grade-dashboard {
        grid-template-columns: 1fr;
    }
}
