/* ===========================================================
   André Retorta — Portfolio
   =========================================================== */

:root {
    --bg: #0a0e1a;
    --bg-alt: #0d1322;
    --surface: #121a2e;
    --surface-2: #18223a;
    --border: rgba(255, 255, 255, 0.08);
    --text: #e8edf7;
    --text-dim: #93a1bd;
    --text-faint: #647194;
    --primary: #5b8cff;
    --primary-2: #7b5bff;
    --accent: #2ee6c5;
    --green: #2ee6a0;
    --amber: #ffb23e;
    --blue: #5b8cff;
    --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
    --radius: 16px;
    --max: 1140px;
}

[data-theme="light"] {
    --bg: #f5f7fc;
    --bg-alt: #eef2fa;
    --surface: #ffffff;
    --surface-2: #f0f4fb;
    --border: rgba(10, 20, 50, 0.10);
    --text: #131a2b;
    --text-dim: #4a5878;
    --text-faint: #8794b3;
    --shadow: 0 20px 50px -24px rgba(40, 60, 120, 0.30);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background .4s ease, color .4s ease;
}

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 { font-family: 'Space Grotesk', 'Inter', sans-serif; line-height: 1.15; }

/* ---------- Animated background ---------- */
.bg-gradient {
    position: fixed; inset: 0; z-index: -2;
    background:
        radial-gradient(closest-side at 18% 12%, rgba(91, 140, 255, 0.18), transparent 70%),
        radial-gradient(closest-side at 85% 25%, rgba(123, 91, 255, 0.16), transparent 70%),
        radial-gradient(closest-side at 60% 95%, rgba(46, 230, 197, 0.12), transparent 70%);
    animation: floatBg 16s ease-in-out infinite alternate;
}
@keyframes floatBg {
    0% { transform: translate3d(0,0,0) scale(1); }
    100% { transform: translate3d(0,-20px,0) scale(1.05); }
}
.bg-grid {
    position: fixed; inset: 0; z-index: -1;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 54px 54px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 30%, transparent 80%);
    opacity: .5;
}

/* ---------- Navbar ---------- */
.navbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    transition: background .3s ease, box-shadow .3s ease, backdrop-filter .3s;
}
.navbar.scrolled {
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.brand { font-family: 'Space Grotesk'; font-weight: 700; font-size: 1.5rem; letter-spacing: -.5px; }
.brand span { color: var(--primary); }

.nav-links { display: flex; gap: 6px; }
.nav-link {
    position: relative; padding: 8px 14px; font-size: .92rem; font-weight: 500;
    color: var(--text-dim); border-radius: 10px; transition: color .25s, background .25s;
}
.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--text); }
.nav-link.active::after {
    content: ""; position: absolute; left: 14px; right: 14px; bottom: 2px; height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--primary-2)); border-radius: 2px;
}

.nav-actions { display: flex; align-items: center; gap: 10px; }

/* ---------- Language selector ---------- */
.lang-select { position: relative; }
.lang-btn {
    display: flex; align-items: center; gap: 7px; height: 40px; padding: 0 12px;
    border-radius: 11px; border: 1px solid var(--border); background: var(--surface);
    color: var(--text); cursor: pointer; font-family: inherit; font-size: .85rem; font-weight: 600;
    transition: transform .2s, border-color .25s;
}
.lang-btn:hover { transform: translateY(-2px); border-color: var(--primary); }
.lang-caret { font-size: .65rem; color: var(--text-faint); transition: transform .25s; }
.lang-select.open .lang-caret { transform: rotate(180deg); }
.lang-menu {
    position: absolute; top: calc(100% + 8px); right: 0; min-width: 168px; list-style: none;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 6px;
    box-shadow: var(--shadow); display: grid; gap: 2px; opacity: 0; transform: translateY(-8px);
    pointer-events: none; transition: opacity .2s, transform .2s; z-index: 120;
}
.lang-select.open .lang-menu { opacity: 1; transform: translateY(0); pointer-events: auto; }
.lang-menu button {
    width: 100%; text-align: left; padding: 9px 12px; border: none; background: none; cursor: pointer;
    font-family: inherit; font-size: .9rem; color: var(--text-dim); border-radius: 8px; transition: background .2s, color .2s;
}
.lang-menu button:hover { background: var(--surface-2); color: var(--text); }
.lang-menu button.active { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); font-weight: 600; }

.theme-toggle {
    width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text); cursor: pointer; font-size: 1rem;
    display: grid; place-items: center; transition: transform .2s, background .25s;
}
.theme-toggle:hover { transform: translateY(-2px); }

.menu-toggle { display: none; flex-direction: column; gap: 5px; width: 42px; height: 42px;
    border: 1px solid var(--border); background: var(--surface); border-radius: 11px; cursor: pointer;
    align-items: center; justify-content: center; }
.menu-toggle span { width: 20px; height: 2px; background: var(--text); border-radius: 2px; transition: .3s; }
.menu-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 9px; padding: 13px 24px;
    border-radius: 12px; font-weight: 600; font-size: .95rem; cursor: pointer;
    border: 1px solid transparent; transition: transform .2s, box-shadow .25s, background .25s;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff;
    box-shadow: 0 10px 30px -10px rgba(91, 140, 255, .6);
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 16px 36px -10px rgba(91, 140, 255, .7); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { transform: translateY(-3px); border-color: var(--primary); }

/* ---------- Hero ---------- */
.hero { position: relative; min-height: 100vh; display: flex; align-items: center; padding-top: 90px; }
.hero-inner { display: grid; grid-template-columns: 1.35fr .9fr; gap: 48px; align-items: center; width: 100%; }
.hero-greeting { color: var(--primary); font-weight: 600; letter-spacing: 2px; text-transform: uppercase; font-size: .85rem; }
.hero-name { font-size: clamp(2.6rem, 6vw, 4.4rem); font-weight: 800; letter-spacing: -1.5px; margin: 8px 0; }
.hero-role { font-size: clamp(1.2rem, 3vw, 1.9rem); font-weight: 600; color: var(--text-dim); min-height: 1.6em; }
.typed { background: linear-gradient(90deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.cursor { color: var(--primary); animation: blink 1s steps(2) infinite; font-weight: 400; }
@keyframes blink { 50% { opacity: 0; } }
.hero-summary { color: var(--text-dim); max-width: 560px; margin: 20px 0 30px; font-size: 1.02rem; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-socials { display: flex; gap: 12px; margin-top: 30px; }
.hero-socials a {
    width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
    background: var(--surface); border: 1px solid var(--border); color: var(--text-dim);
    font-size: 1.05rem; transition: transform .2s, color .25s, border-color .25s;
}
.hero-socials a:hover { transform: translateY(-4px); color: var(--primary); border-color: var(--primary); }

.hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stat-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 26px 22px; text-align: center; box-shadow: var(--shadow);
    transition: transform .3s, border-color .3s;
}
.stat-card:hover { transform: translateY(-6px); border-color: var(--primary); }
.stat-num { display: block; font-family: 'Space Grotesk'; font-size: 2.6rem; font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text;
    background-clip: text; -webkit-text-fill-color: transparent; }
.stat-label { color: var(--text-faint); font-size: .85rem; font-weight: 500; }

.scroll-down {
    position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
    color: var(--text-faint); animation: bounce 2s infinite; font-size: 1.1rem;
}
@keyframes bounce { 0%,100% { transform: translate(-50%,0); } 50% { transform: translate(-50%,8px); } }

/* ---------- Sections ---------- */
.section { padding: 100px 0; }
.section-alt { background: var(--bg-alt); }
.section-head { text-align: center; margin-bottom: 56px; }
.section-tag { color: var(--primary); font-weight: 600; letter-spacing: 1.5px; font-size: .82rem; text-transform: uppercase; }
.section-title { font-size: clamp(1.9rem, 4vw, 2.8rem); font-weight: 700; letter-spacing: -1px; margin-top: 8px; }
.section-subtitle { color: var(--text-dim); max-width: 560px; margin: 14px auto 0; font-size: .98rem; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.about-text p { color: var(--text-dim); margin-bottom: 16px; }
.about-text strong { color: var(--text); }
.about-meta { margin-top: 24px; display: grid; gap: 12px; }
.about-meta div { display: flex; align-items: center; gap: 12px; color: var(--text-dim); font-weight: 500; }
.about-meta i { color: var(--primary); width: 20px; }

.skill-block { margin-bottom: 26px; }
.skill-block h3 { font-size: 1rem; display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-green { background: var(--green); box-shadow: 0 0 12px var(--green); }
.dot-amber { background: var(--amber); box-shadow: 0 0 12px var(--amber); }
.dot-blue { background: var(--blue); box-shadow: 0 0 12px var(--blue); }
.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chip {
    padding: 7px 14px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 30px; font-size: .85rem; color: var(--text-dim); font-weight: 500;
    transition: transform .2s, color .25s, border-color .25s;
}
.chip:hover { transform: translateY(-3px); color: var(--text); border-color: var(--primary); }

/* ---------- Timeline ---------- */
.timeline { position: relative; max-width: 860px; margin: 0 auto; padding-left: 32px; }
.timeline::before {
    content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px;
    background: linear-gradient(var(--primary), var(--primary-2), transparent);
}
.tl-item { position: relative; margin-bottom: 28px; }
.tl-item::before {
    content: ""; position: absolute; left: -31px; top: 26px; width: 14px; height: 14px;
    border-radius: 50%; background: var(--bg); border: 3px solid var(--primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent);
}
.tl-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 22px 24px; box-shadow: var(--shadow); transition: transform .3s, border-color .3s;
}
.tl-card:hover { transform: translateX(6px); border-color: var(--primary); }
.tl-top { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.tl-role { font-size: 1.15rem; font-weight: 700; }
.tl-date { font-size: .82rem; color: var(--primary); font-weight: 600; white-space: nowrap; background: color-mix(in srgb, var(--primary) 12%, transparent); padding: 4px 12px; border-radius: 20px; }
.tl-org { color: var(--text-dim); font-weight: 500; margin: 2px 0 14px; font-size: .95rem; }
.tl-org i { color: var(--text-faint); margin-right: 6px; }
.tl-points { list-style: none; display: grid; gap: 9px; }
.tl-points li { position: relative; padding-left: 20px; color: var(--text-dim); font-size: .92rem; }
.tl-points li::before { content: "▹"; position: absolute; left: 0; color: var(--primary); }
.tl-tech { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.tl-tech span { font-size: .74rem; padding: 4px 10px; border-radius: 6px; background: var(--surface-2); color: var(--text-faint); border: 1px solid var(--border); }

/* ---------- Portfolio ---------- */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 22px; }
.project-card {
    display: flex; flex-direction: column; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); padding: 24px;
    box-shadow: var(--shadow); transition: transform .3s, border-color .3s; color: inherit;
}
.project-card:hover { transform: translateY(-6px); border-color: var(--primary); }
.project-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.project-top i { font-size: 1.4rem; color: var(--text); }
.project-date { font-size: .78rem; color: var(--text-faint); font-weight: 600; }
.project-title { font-size: 1.12rem; font-weight: 700; line-height: 1.35; margin-bottom: 10px; }
.project-desc { color: var(--text-dim); font-size: .9rem; line-height: 1.6; flex: 1; }
.project-tags { display: flex; flex-wrap: wrap; gap: 7px; margin: 16px 0; }
.project-tags span { font-size: .72rem; padding: 4px 10px; border-radius: 6px; background: var(--surface-2); color: var(--text-faint); border: 1px solid var(--border); }
.project-link { display: inline-flex; align-items: center; gap: 8px; color: var(--primary); font-weight: 600; font-size: .9rem; }
.project-link i { transition: transform .2s; }
.project-card:hover .project-link i { transform: translateX(4px); }
.projects-empty { grid-column: 1 / -1; text-align: center; color: var(--text-faint); padding: 32px; }
.projects-cta { text-align: center; margin-top: 38px; }

/* ---------- Education ---------- */
.edu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.edu-col-title { display: flex; align-items: center; gap: 10px; font-size: 1.2rem; margin-bottom: 20px; }
.edu-col-title i { color: var(--primary); }
.edu-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    padding: 18px 20px; margin-bottom: 14px; transition: transform .25s, border-color .25s;
}
.edu-card:hover { transform: translateY(-4px); border-color: var(--primary); }
.edu-card h4 { font-size: 1.02rem; }
.edu-org { color: var(--text-dim); font-size: .9rem; margin: 3px 0; }
.edu-date { color: var(--text-faint); font-size: .82rem; font-weight: 500; }

.lang-list { display: grid; gap: 14px; }
.lang-row { display: grid; grid-template-columns: 90px 1fr 44px; align-items: center; gap: 12px; font-size: .9rem; color: var(--text-dim); }
.lang-row b { text-align: right; color: var(--text); font-size: .82rem; }
.lang-bar { height: 7px; background: var(--surface-2); border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.lang-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 10px; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 48px; align-items: start; }
.contact-intro p { color: var(--text-dim); margin-bottom: 24px; max-width: 420px; }
.contact-cards { display: grid; gap: 12px; }
.contact-card {
    display: flex; align-items: center; gap: 16px; padding: 16px 18px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    transition: transform .25s, border-color .25s;
}
.contact-card:hover { transform: translateX(6px); border-color: var(--primary); }
.contact-card i { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center;
    background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); font-size: 1.1rem; }
.contact-card span { display: block; font-size: .78rem; color: var(--text-faint); }
.contact-card b { font-size: .94rem; font-weight: 600; }

.contact-form { display: grid; gap: 16px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.contact-form label { display: grid; gap: 7px; font-size: .85rem; font-weight: 500; color: var(--text-dim); }
.contact-form input, .contact-form textarea {
    font-family: inherit; font-size: .95rem; padding: 12px 14px; border-radius: 11px;
    background: var(--bg); border: 1px solid var(--border); color: var(--text); transition: border-color .25s;
}
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--primary); }
.contact-form textarea { resize: vertical; }
.contact-form .btn { justify-content: center; margin-top: 4px; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 30px 0; background: var(--bg-alt); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--text-faint); font-size: .9rem; }
.footer-socials { display: flex; gap: 12px; }
.footer-socials a { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
    background: var(--surface); border: 1px solid var(--border); color: var(--text-dim); transition: color .25s, transform .2s; }
.footer-socials a:hover { color: var(--primary); transform: translateY(-3px); }

/* ---------- Back to top ---------- */
.back-to-top {
    position: fixed; bottom: 28px; right: 28px; width: 48px; height: 48px; border-radius: 13px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff;
    display: grid; place-items: center; opacity: 0; pointer-events: none; transform: translateY(20px);
    transition: opacity .3s, transform .3s; z-index: 90; box-shadow: 0 12px 30px -10px rgba(91,140,255,.6);
}
.back-to-top.show { opacity: 1; pointer-events: auto; transform: translateY(0); }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity .7s ease, transform .7s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .hero-inner { grid-template-columns: 1fr; gap: 40px; }
    .hero-stats { max-width: 420px; }
    .about-grid, .edu-grid, .contact-grid { grid-template-columns: 1fr; gap: 36px; }
}
@media (max-width: 720px) {
    .nav-links {
        position: fixed; top: 72px; right: 0; width: min(78vw, 300px); height: calc(100vh - 72px);
        flex-direction: column; gap: 6px; padding: 24px; background: var(--bg-alt);
        border-left: 1px solid var(--border); transform: translateX(100%); transition: transform .3s ease;
    }
    .nav-links.open { transform: translateX(0); }
    .nav-link { padding: 14px 16px; border-radius: 12px; }
    .nav-link.active::after { display: none; }
    .nav-link.active { background: var(--surface); }
    .menu-toggle { display: flex; }
    .section { padding: 72px 0; }
    .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
    .hero-stats { grid-template-columns: 1fr 1fr; }
    .hero-socials a { width: 42px; height: 42px; }
}
