/* ========================================
   THEME TOKENS
======================================== */
:root {
    --bg: #0b0f1a;
    --card: #0f172a;
    --muted: #94a3b8;
    --text: #e5e7eb;
    --brand: #22d3ee;
    --brand-2: #a78bfa;
    --accent: #38bdf8;
    --radius: 18px;
    --max: 1100px;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

/* ========================================
   RESET / BASE
======================================== */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
a { color: inherit; }
.sr-only {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    border: 0; overflow: hidden; clip: rect(0, 0, 0, 0);
}

/* ========================================
   BACKGROUND FX
======================================== */
.bg {
    position: fixed; inset: 0; z-index: -2; overflow: hidden;
}
.bg:before {
    content: "";
    position: absolute; inset: -20% -10% -10% -20%;
    filter: blur(60px) saturate(1.1); opacity: 0.55;
    background:
            radial-gradient(60vw 60vw at 10% 20%, rgba(34, 211, 238, 0.35), transparent 60%),
            radial-gradient(40vw 40vw at 80% 10%, rgba(167, 139, 250, 0.25), transparent 60%),
            radial-gradient(45vw 45vw at 80% 75%, rgba(56, 189, 248, 0.25), transparent 55%),
            radial-gradient(35vw 35vw at 20% 80%, rgba(168, 85, 247, 0.2), transparent 55%);
    animation: float 28s ease-in-out infinite alternate;
}
.bg-grid {
    position: fixed; inset: 0; z-index: -1; opacity: 0.15;
    background-image:
            linear-gradient(#ffffff12 1px, transparent 1px),
            linear-gradient(90deg, #ffffff12 1px, transparent 1px);
    background-size: 50px 50px, 50px 50px;
    background-position: -25px -25px;
    -webkit-mask-image: radial-gradient(80% 60% at 50% 40%, #000 65%, transparent 100%);
    mask-image: radial-gradient(80% 60% at 50% 40%, #000 65%, transparent 100%);
}
@keyframes float { to { transform: translate3d(0, -2rem, 0) scale(1.02); } }

/* ========================================
   LAYOUT / NAV
======================================== */
.container { width: min(100%, var(--max)); margin-inline: auto; padding-inline: 20px; }
header.header {
    position: sticky; top: 0; z-index: 10;
    backdrop-filter: saturate(1.2) blur(10px);
    background: #0b0f1acc; border-bottom: 1px solid #ffffff14;
}
.nav { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.brand { display: flex; gap: 12px; align-items: center; font-weight: 800; letter-spacing: .2px; }
.logo {
    width: 36px; height: 36px; border-radius: 12px;
    background: conic-gradient(from 180deg, var(--brand), var(--brand-2), var(--accent), var(--brand));
    box-shadow: 0 6px 22px #00000050;
}
.nav a {
    padding: 10px 14px; border-radius: 12px; text-decoration: none; color: var(--text); opacity: .8;
}
.nav a.active, .nav a:hover { opacity: 1; background: #ffffff10; }

/* ========================================
   HERO
======================================== */
.hero {
    display: grid; grid-template-columns: 1.2fr .8fr;
    gap: 36px; align-items: center; padding: 60px 0 40px;
}
.hero h1 {
    font-family: "Plus Jakarta Sans", Inter, sans-serif;
    font-size: clamp(2rem, 4.2vw, 3.4rem);
    line-height: 1.1; margin: 0 0 14px;
}
.text-gradient {
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--muted); margin: 0 0 20px; }

.tag {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 8px 12px; border: 1px solid #ffffff22; border-radius: 999px;
    font-size: .9rem; background: #0b0f1acc;
}
.tag .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 16px var(--brand); }

.cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.btn {
    appearance: none; border: none; border-radius: 14px;
    padding: 12px 16px; font-weight: 700; letter-spacing: .2px; cursor: pointer; box-shadow: var(--shadow);
}
.btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #0b0f1a; }
.btn.ghost   { background: #0b0f1acc; color: var(--text); border: 1px solid #ffffff22; }

.btn.sm   { padding: 8px 12px; font-size: .9rem; border-radius: 10px; box-shadow: none; }
.btn.icon { padding: 6px 10px; border-radius: 999px; line-height: 1; }

.hero .card {
    background: #0c1222d9; border: 1px solid #ffffff1e; border-radius: var(--radius);
    padding: 16px; box-shadow: var(--shadow);
}
.stats {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 12px; margin-top: 12px;
}
.stat {
    padding: 14px; border-radius: 14px; text-align: center;
    background: #0b1223cc; border: 1px solid #ffffff14;
}
.stat .k { font-size: 1.6rem; font-weight: 800; }
.stat .l { font-size: .85rem; color: var(--muted); }

/* ========================================
   SECTIONS / TYPOGRAPHY
======================================== */
section { padding: 70px 0; }
h2.section-title {
    font-family: "Plus Jakarta Sans", Inter, sans-serif;
    font-size: clamp(1.4rem, 2.6vw, 2rem);
    margin: 0 0 18px;
}
p.lead { color: var(--muted); max-width: 75ch; }

/* ========================================
   GRID HELPERS
======================================== */
.grid { display: grid; gap: 18px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

/* ========================================
   ABOUT
======================================== */
.group-title {
    margin: 12px 0 6px;
    font-size: 0.95rem;
    color: #cbd5e1;
    font-weight: 700;
}

.list-compact {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px;
}
.list-compact li {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
}

.list-bullets {
    margin: 8px 0 0;
    padding-left: 18px;
    color: #cfd7e3;
}
.list-bullets li { margin: 6px 0; }

.meter {
    --level: 3;
    width: 120px;
    height: 8px;
    border-radius: 999px;
    background: #ffffff14;
    position: relative;
    overflow: hidden;
}
.meter::after {
    content: "";
    position: absolute;
    inset: 0;
    width: calc((var(--level) / 5) * 100%);
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
    border-radius: inherit;
    box-shadow: 0 0 12px #22d3ee33 inset;
}

/* ========================================
   CARDS
======================================== */
.card {
    position: relative;
    background: linear-gradient(180deg, #0f172a, #0b1022);
    border: 1px solid #ffffff12;
    border-radius: var(--radius);
    overflow: hidden;
}
.card:hover .shine { opacity: 1; }

.thumb {
    aspect-ratio: 16/9; width: 100%;
    background: #0b1223; display: block; overflow: hidden;
}
.thumb > canvas, .thumb > img {
    width: 100%; height: 100%; display: block; object-fit: cover;
}

.card-body { padding: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; }
.chip  { padding: 6px 10px; border-radius: 999px; background: #ffffff12; font-size: .78rem; }

.chip.sm {
    padding: 4px 8px; font-size: .75rem; border-radius: 8px;
    background: #ffffff10; border: 1px solid #ffffff20;
}

.proj-details .chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.chip.xs {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    width: auto;
    max-width: max-content;
    padding: 2px 8px;
    font-size: 0.72rem;
    line-height: 1.1;
    border-radius: 8px;
    background: #ffffff10;
    border: 1px solid #ffffff20;
    box-shadow: none;
}

.shine {
    position: absolute; inset: 0;
    background: radial-gradient(600px 200px at var(--mx, 50%) -10%, #ffffff12, transparent 45%);
    opacity: 0; transition: opacity .25s;
}

/* ========================================
   Projects Carousel
======================================== */
.proj-carousel { position: relative; margin-top: 8px; }
.proj-viewport { overflow: hidden; width: 100%; }
.proj-track {
    display: flex;
    gap: var(--gap, 16px);
    will-change: transform;
    transform: translateX(0);
}

.proj-slide { flex: 0 0 var(--slide-w, 320px); } /* width set by JS */
.proj-slide .card { height: 100%; }

/* arrows */
.proj-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    display: grid; place-items: center;
    width: 34px; height: 34px; border-radius: 999px;
    border: 1px solid #ffffff26; background: #0b0f1ae6; color: #e5e7eb;
    cursor: pointer; z-index: 2;
}
#projPrev { left: 6px; }
#projNext { right: 6px; }

#projCarousel { --visible: 3; --gap: 16px; }
@media (max-width: 979.98px) { #projCarousel { --visible: 2; } }
@media (max-width: 679.98px) { #projCarousel { --visible: 1; } }

.shine {
    position: absolute;
    inset: 0;
    background: radial-gradient(600px 200px at var(--mx, 50%) -10%, #ffffff12, transparent 45%);
    opacity: 0;
    transition: opacity .25s;
    pointer-events: none;
}

/* ========================================
   MODAL (PROJECT POPUP)
======================================== */
.modal {
    position: fixed; inset: 0; z-index: 50;
    display: none; place-items: center;
    background: #0008; padding: 20px;
}
.modal.open { display: grid; }

.modal-card {
    width: min(100%, 1400px);
    background: #0a0f1f;
    border: 1px solid #ffffff1a;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 40px 130px #00000088;
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border-bottom: 1px solid #ffffff12;
}
.modal-content { padding: 16px; }
.modal-close {
    appearance: none; border: 0; cursor: pointer;
    background: #ffffff14; color: #fff; border-radius: 12px; padding: 8px 10px;
}

.proj-layout {
    display: grid; gap: 20px; grid-template-columns: 1.8fr 1fr;
}
.proj-details { display: grid; gap: 14px; }
.proj-summary { color: #cfd7e3; margin: 0; }
.proj-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.proj-caption {
    margin-top: 10px;
    font-size: 0.95rem;
    color: #cfd7e3;
    line-height: 1.5;
    background: #0b1223;
    border: 1px solid #ffffff14;
    border-radius: 10px;
    padding: 10px 12px;
}

.proj-extra { margin-top: 8px; }

/* ========================================
   CAROUSEL (INSIDE MODAL)
   - consistent 16:9 viewport
   - images use object-fit: contain (no cropping)
======================================== */
.carousel {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: #0b1223;
    border: 1px solid #ffffff14;
}
.carousel-viewport {
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 82vh;
    overflow: hidden;
}
.carousel-track { display: flex; transition: transform .4s ease; will-change: transform; }
.carousel-slide { min-width: 100%; user-select: none; }
.carousel-slide img {
    width: 100%; height: 100%; display: block; object-fit: contain; background: #0b1223;
}

/* carousel controls */
.carousel .nav {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: space-between;
    pointer-events: none; padding: 0 8px;
}
.carousel .nav button {
    pointer-events: auto;
    background: #0b0f1ae6; border: 1px solid #ffffff26; color: #e5e7eb;
}
.carousel-dots {
    position: absolute; left: 0; right: 0; bottom: 10px;
    display: flex; gap: 6px; justify-content: center;
}
.carousel-dot {
    width: 8px; height: 8px; border-radius: 999px;
    background: #ffffff33; border: 1px solid #ffffff55; cursor: pointer;
}
.carousel-dot.active { background: #e5e7eb; }

/* ========================================
   ABOUT / SKILLS
======================================== */
.skills { display: flex; flex-wrap: wrap; gap: 10px; }
.skill  {
    padding: 10px 12px; border-radius: 12px;
    background: #0b1223; border: 1px solid #ffffff14;
    font-weight: 600; font-size: .9rem;
}

/* ========================================
   TIMELINE (CV)
======================================== */
.timeline { position: relative; margin: 20px 0; }
.timeline:before {
    content: ""; position: absolute; left: 18px; top: 0; bottom: 0; width: 2px; background: #ffffff1a;
}
.tl-item { position: relative; padding-left: 48px; margin: 18px 0; }
.tl-item:before {
    content: ""; position: absolute; left: 10px; top: .6rem;
    width: 18px; height: 18px; border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    box-shadow: 0 0 0 4px #0b0f1a;
}
.tl-item.current:before { background: linear-gradient(135deg, var(--accent), var(--brand)); }
.tl-item h3 { margin: .1rem 0 .2rem; font-size: 1.05rem; }
.tl-item .meta { color: var(--muted); font-size: .9rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.badge {
    display: inline-block; font-size: .72rem; padding: 2px 8px; border-radius: 999px;
    background: #ffffff14; color: #eaf2ff; border: 1px solid #ffffff22;
}
.tl-highlights { margin: 8px 0 0; padding-left: 18px; color: #cdd6e2; }
.tl-highlights li { margin: 4px 0; }

.org-link {
    color: var(--brand);
    text-decoration: none;
    cursor: pointer;
    position: relative;
    display: inline-block;
    transition: transform 0.25s ease;
}

.org-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
    opacity: 0.8;
}

.org-link:hover {
    color: var(--brand);
    transform: translateY(-1px);
}

.org-link:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* ========================================
   CONTACT
======================================== */
form.contact { display: grid; gap: 12px; max-width: 680px; }
.field { display: grid; gap: 6px; }
.field input, .field textarea {
    width: 100%; padding: 12px 14px; border-radius: 12px;
    border: 1px solid #ffffff24; background: #0a1224; color: var(--text);
}
.field textarea { min-height: 120px; resize: vertical; }

#contactSubmit {
    position: relative;
    display: inline-grid;
    grid-auto-flow: column;
    align-items: center;
    gap: 10px;
}

#contactSubmit .btn-progress {
    width: 1rem; height: 1rem;
    border-radius: 50%;
    border: 2px solid #0b0f1a;
    border-top-color: #0b0f1a00;
    display: none;
}

#contactSubmit.is-loading .btn-progress {
    display: inline-block;
    animation: spin 0.8s linear infinite;
}

#contactSubmit .btn-done { display: none; }
#contactSubmit.is-loading .btn-label { opacity: 0.7; }
#contactSubmit.is-success .btn-label { display: none; }
#contactSubmit.is-success .btn-progress { display: none; }
#contactSubmit.is-success .btn-done { display: inline; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ========================================
   FOOTER
======================================== */
footer {
    padding: 40px 0; color: #9aa4b3;
    border-top: 1px solid #ffffff12; background: #080c16cc; backdrop-filter: blur(6px);
}
.footer { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: center; }
.pill   { border: 1px solid #ffffff24; border-radius: 999px; padding: 4px 10px; font-size: .78rem; color: #cbd5e1; }

.footer-legal {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    color: #9aa4b3;
    line-height: 1.5;
}

.footer-legal .learnmore {
    display: block;
    margin-top: 6px;
}

.footer-legal a {
    color: var(--brand);
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s ease, color 0.2s ease;
}

.footer-legal a:hover {
    color: var(--brand-2);
    transform: translateY(-1px);
}

/* ========================================
   SCROLL REVEAL
======================================== */
[data-reveal] {
    opacity: 0; transform: translateY(12px);
    transition: all .6s cubic-bezier(.2,.8,.2,1);
}
[data-reveal].visible { opacity: 1; transform: none; }

/* ========================================
   RESPONSIVE
======================================== */
@media (max-width: 1200px) {
    .proj-layout { grid-template-columns: 1.6fr 1fr; }
}

@media (max-width: 980px) {
    .hero { grid-template-columns: 1fr; }
    .grid.cols-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
    .proj-layout { grid-template-columns: 1fr; }
    .carousel-viewport { max-height: 70vh; }
}
@media (max-width: 680px) {
    .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
}

/* ========================================
   PRINT / REDUCED MOTION
======================================== */
@media print {
    header, .bg, .bg-grid, .cta, .modal, footer, nav { display: none !important; }
    body { background: #fff; color: #0b0f1a; }
    .card, .stat, .skill { border: 1px solid #0002; }
    a { color: #0b0f1a; }
}
@media (prefers-reduced-motion: reduce) {
    .bg:before { animation: none; }
    [data-reveal] { transition: none; }
}

/* ============================
   NAV: Hamburger + Mobile Panel
============================ */
.header { position: sticky; top: 0; z-index: 50; }
.nav { display: flex; align-items: center; justify-content: space-between; }

.nav-links { display: flex; gap: 8px; }

.hamburger {
    display: none;
    position: relative;
    width: 44px; height: 44px;
    border: 1px solid #ffffff24;
    background: #0b0f1acc;
    border-radius: 12px;
    cursor: pointer;
}
.hamburger-box { position: absolute; inset: 0; display: grid; place-items: center; }
.hamburger-inner,
.hamburger-inner::before,
.hamburger-inner::after {
    width: 22px; height: 2px; background: #e5e7eb; border-radius: 1px; display: block; transition: transform .25s, opacity .25s;
}
.hamburger-inner::before,
.hamburger-inner::after { content: ""; position: relative; display: block; }
.hamburger-inner::before { transform: translateY(-6px); }
.hamburger-inner::after  { transform: translateY(6px); }
.hamburger.is-active .hamburger-inner { transform: rotate(45deg); }
.hamburger.is-active .hamburger-inner::before { transform: rotate(90deg); }
.hamburger.is-active .hamburger-inner::after  { opacity: 0; transform: rotate(0) translateY(0); }

.nav-panel {
    position: absolute; inset-inline: 0; top: 100%;
    background: #0b0f1acc;
    backdrop-filter: saturate(1.2) blur(10px);
    border-bottom: 1px solid #ffffff14;
    box-shadow: 0 10px 30px #0006;
    transform-origin: top;
    transform: scaleY(0.98);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}
.nav-panel.open {
    opacity: 1;
    transform: scaleY(1);
    pointer-events: auto;
}
.nav-panel nav {
    display: grid;
    gap: 4px;
    padding: 10px 16px 16px;
}
.nav-panel a {
    display: block;
    padding: 12px 10px;
    border-radius: 10px;
    color: var(--text);
    text-decoration: none;
    opacity: .9;
}
.nav-panel a:hover,
.nav-panel a.active { background: #ffffff10; opacity: 1; }

@media (max-width: 900px) {
    .hamburger { display: inline-block; }
    .nav-links { display: none; }

    .hero { grid-template-columns: 1fr; gap: 20px; padding: 32px 0 20px; }
    section { padding: clamp(36px, 8vw, 56px) 0; }
    .container { padding-inline: clamp(14px, 5vw, 22px); }
    .hero h1 { font-size: clamp(1.8rem, 7vw, 2.4rem); }
}

.body-lock { overflow: hidden; touch-action: none; }
