/* Currículum Javier Tarrazona — estilo moderno */

:root {
    --bg: #f8fafc;
    --bg-alt: #eef2ff;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #475569;
    --border: #e2e8f0;
    --accent: #4f46e5;
    --accent-2: #0891b2;
    --accent-soft: rgba(79, 70, 229, 0.1);
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .12);
    --shadow-hover: 0 2px 4px rgba(15, 23, 42, .05), 0 22px 40px -18px rgba(79, 70, 229, .35);
    --radius: 18px;
    --maxw: 1140px;
    --web: #2563eb;
    --escritorio: #7c3aed;
    --android: #059669;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b1020;
        --bg-alt: #10172b;
        --surface: #141c31;
        --text: #e2e8f0;
        --muted: #94a3b8;
        --border: #1f2a44;
        --accent: #818cf8;
        --accent-2: #22d3ee;
        --accent-soft: rgba(129, 140, 248, 0.14);
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .5);
        --shadow-hover: 0 22px 40px -18px rgba(129, 140, 248, .35);
        --web: #60a5fa;
        --escritorio: #a78bfa;
        --android: #34d399;
    }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.02em; margin: 0; }

.icon { width: 1.15em; height: 1.15em; flex: none; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

.skip {
    position: absolute; left: -999px; top: 8px; z-index: 100;
    background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px;
}
.skip:focus { left: 8px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ---------- Navegación ---------- */
.nav {
    position: fixed; inset: 0 0 auto 0; z-index: 50;
    transition: background .25s, box-shadow .25s;
}
.nav.is-scrolled {
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    box-shadow: 0 1px 0 var(--border);
}
.nav__inner {
    max-width: var(--maxw); margin: 0 auto; padding: 14px 20px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { font-weight: 800; font-size: 1.15rem; color: var(--text); letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand span { color: var(--accent); }

.nav__menu { display: flex; align-items: center; gap: 4px; }
.nav__menu a {
    padding: 8px 12px; border-radius: 10px; color: var(--muted);
    font-weight: 500; font-size: .94rem;
}
.nav__menu a:hover { color: var(--text); background: var(--accent-soft); text-decoration: none; }
.nav__menu .nav__cta {
    display: inline-flex; align-items: center; gap: 6px; margin-left: 8px;
    background: var(--text); color: var(--bg); font-weight: 600;
}
.nav__menu .nav__cta:hover { background: var(--accent); color: #fff; }

.nav__toggle {
    display: none; width: 42px; height: 42px; border-radius: 12px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    cursor: pointer; place-items: center;
}

/* ---------- Botones ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 20px; border-radius: 12px; font: inherit; font-weight: 600; font-size: .97rem;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    cursor: pointer; transition: transform .15s, box-shadow .2s, background .2s, border-color .2s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); border-color: var(--accent); }
.btn--primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff; border-color: transparent;
}
.btn--primary:hover { box-shadow: var(--shadow-hover); border-color: transparent; }
.btn--ghost { background: transparent; }
.btn[disabled] { opacity: .6; cursor: progress; transform: none; }

/* ---------- Portada ---------- */
.hero {
    position: relative; overflow: hidden;
    min-height: 92vh; display: flex; align-items: center;
    padding: 120px 0 72px;
}
.hero__bg {
    position: absolute; inset: 0; z-index: -1;
    background:
        radial-gradient(700px 420px at 15% 20%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
        radial-gradient(600px 400px at 90% 30%, color-mix(in srgb, var(--accent-2) 18%, transparent), transparent 70%),
        linear-gradient(var(--bg), var(--bg));
}
.hero__bg::after {
    content: ""; position: absolute; inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 75%);
    opacity: .6;
}
.eyebrow {
    margin: 0 0 12px; color: var(--accent); font-weight: 700;
    font-size: .8rem; letter-spacing: .12em; text-transform: uppercase;
}
.hero h1 { font-size: clamp(2.8rem, 8vw, 5.6rem); font-weight: 800; letter-spacing: -0.04em; }
.grad {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__lead { max-width: 620px; font-size: clamp(1.05rem, 2.2vw, 1.3rem); color: var(--muted); margin: 20px 0 32px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero__facts {
    list-style: none; padding: 0; margin: 56px 0 0;
    display: flex; flex-wrap: wrap; gap: 14px;
}
.hero__facts li {
    padding: 14px 18px; border-radius: 14px; border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 70%, transparent);
    backdrop-filter: blur(6px);
}
.hero__facts strong { display: block; font-size: 1.05rem; }
.hero__facts span { color: var(--muted); font-size: .85rem; }

/* ---------- Secciones ---------- */
.section { padding: 96px 0; }
.section--alt { background: var(--bg-alt); }
.section__head { max-width: 720px; margin-bottom: 44px; }
.section__head h2, .contact h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; }
.section__lead { color: var(--muted); font-size: 1.06rem; margin: 14px 0 0; }

/* Sobre esta web */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.feature {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 28px; box-shadow: var(--shadow);
}
.feature__icon {
    display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px;
    background: var(--accent-soft); color: var(--accent); font-size: 1.3rem; margin-bottom: 18px;
}
.feature h3 { font-size: 1.15rem; margin-bottom: 8px; }
.feature p { margin: 0; color: var(--muted); }

/* Trayectoria */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
    content: ""; position: absolute; left: 23px; top: 8px; bottom: 8px; width: 2px;
    background: linear-gradient(var(--accent), var(--accent-2));
    opacity: .35; border-radius: 2px;
}
.timeline__item { position: relative; padding-left: 72px; margin-bottom: 20px; }
.timeline__item:last-child { margin-bottom: 0; }
.timeline__dot {
    position: absolute; left: 0; top: 14px;
    display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
    background: var(--surface); border: 2px solid var(--accent); color: var(--accent); font-size: 1.2rem;
}
.timeline__card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px 24px; box-shadow: var(--shadow);
}
.timeline__when { margin: 0 0 4px; color: var(--accent); font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.timeline__card h3 { font-size: 1.12rem; margin-bottom: 6px; }
.timeline__card p:last-child { margin: 0; color: var(--muted); }

/* Trabajos */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.filter {
    display: inline-flex; align-items: center; gap: 8px;
    font: inherit; font-weight: 600; font-size: .94rem;
    padding: 9px 16px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--border); background: var(--surface); color: var(--muted);
    transition: all .2s;
}
.filter span {
    font-size: .78rem; padding: 1px 8px; border-radius: 999px;
    background: var(--accent-soft); color: var(--accent);
}
.filter:hover { color: var(--text); border-color: var(--accent); }
.filter.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }
.filter.is-active span { background: color-mix(in srgb, var(--bg) 20%, transparent); color: var(--bg); }

.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.project {
    display: flex; flex-direction: column; text-align: left; padding: 0; font: inherit; color: inherit;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; cursor: pointer; box-shadow: var(--shadow);
    transition: transform .25s ease, box-shadow .25s, border-color .25s;
}
.project:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.project[hidden] { display: none; }
.project__img { display: block; aspect-ratio: 5 / 4; overflow: hidden; background: var(--bg-alt); }
.project__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.project:hover .project__img img { transform: scale(1.05); }
.project__body { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 20px; }
.project__title { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.project__text { color: var(--muted); font-size: .92rem; }

.tag {
    align-self: flex-start; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
    padding: 3px 10px; border-radius: 999px;
    color: var(--web); background: color-mix(in srgb, var(--web) 12%, transparent);
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag--escritorio { color: var(--escritorio); background: color-mix(in srgb, var(--escritorio) 12%, transparent); }
.tag--android { color: var(--android); background: color-mix(in srgb, var(--android) 12%, transparent); }

/* Habilidades */
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.skill {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 22px 24px; box-shadow: var(--shadow);
}
.skill__top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.skill__top h3 { font-size: 1.1rem; }
.skill__top span { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.skill__bar { height: 8px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; }
.skill__bar span {
    display: block; height: 100%; width: 0; border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transition: width 1.1s cubic-bezier(.2, .7, .2, 1);
}
.skill.is-visible .skill__bar span { width: var(--nivel); }
.skill p { margin: 14px 0 0; color: var(--muted); font-size: .93rem; }

.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 28px 0 0; }
.chips__label { color: var(--muted); font-weight: 600; margin-right: 4px; }
.chip {
    padding: 5px 12px; border-radius: 999px; font-size: .88rem; font-weight: 500;
    background: var(--surface); border: 1px solid var(--border);
}

/* Contacto */
.contact { display: grid; grid-template-columns: 1fr 1.2fr; gap: 48px; align-items: start; }
.contact__list { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 10px; }
.contact__list a {
    display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 500;
    padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
}
.contact__list a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.contact__list .icon { color: var(--accent); }

.form {
    display: grid; gap: 16px; padding: 28px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: .9rem; }
.form input, .form textarea {
    font: inherit; font-weight: 400; color: var(--text);
    padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg);
    transition: border-color .2s, box-shadow .2s;
}
.form textarea { resize: vertical; min-height: 130px; }
.form input:-webkit-autofill,
.form input:-webkit-autofill:hover,
.form input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text);
    box-shadow: 0 0 0 1000px var(--bg) inset;
    caret-color: var(--text);
}
.form input:focus, .form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.form .btn { justify-self: start; }
.trampa { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form { position: relative; }
.form__status { margin: 0; font-weight: 500; min-height: 1.6em; }
.form__status.is-ok { color: var(--android); }
.form__status.is-error { color: #dc2626; }

/* ---------- Pie ---------- */
.footer { border-top: 1px solid var(--border); padding: 40px 0; }
.footer__inner {
    max-width: var(--maxw); margin: 0 auto; padding: 0 20px;
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
}
.footer p { margin: 0; }
.footer__brand { font-weight: 800; }
.footer__brand span { color: var(--accent); }
.footer__links { display: flex; flex-wrap: wrap; gap: 18px; }
.footer__links a { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.footer__links a:hover { color: var(--accent); }
.footer__copy { color: var(--muted); font-size: .9rem; }
.footer__copy a { color: var(--text); font-weight: 600; }

/* ---------- Ventana de proyecto ---------- */
.modal {
    width: min(1040px, calc(100% - 32px)); max-height: calc(100dvh - 32px);
    padding: 0; border: 1px solid var(--border); border-radius: 22px;
    background: var(--surface); color: var(--text); overflow: hidden;
    box-shadow: 0 40px 80px -20px rgba(0, 0, 0, .45);
}
.modal[open] { display: grid; grid-template-columns: 1.5fr 1fr; animation: aparecer .25s ease; }
.modal::backdrop { background: rgba(2, 6, 23, .65); backdrop-filter: blur(4px); }
@keyframes aparecer { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.modal__close {
    position: absolute; top: 12px; right: 12px; z-index: 3;
    width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 1.1rem;
    border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.modal__gallery { position: relative; background: #0b1020; min-height: 280px; }
.modal__track {
    display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory;
    scrollbar-width: none;
}
.modal__track::-webkit-scrollbar { display: none; }
.modal__track img {
    flex: 0 0 100%; width: 100%; height: 100%; max-height: calc(100dvh - 34px);
    object-fit: contain; scroll-snap-align: center;
}
.modal__nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 1.2rem;
    border: 0; background: rgba(255, 255, 255, .9); color: #0f172a; cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .3);
}
.modal__nav--prev { left: 12px; }
.modal__nav--next { right: 12px; }
.modal__nav[disabled] { opacity: 0; pointer-events: none; }
.modal__count {
    position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); margin: 0;
    padding: 3px 12px; border-radius: 999px; font-size: .82rem; font-weight: 600;
    background: rgba(0, 0, 0, .55); color: #fff;
}
.modal__body { padding: 32px 28px; overflow-y: auto; max-height: calc(100dvh - 34px); display: flex; flex-direction: column; gap: 12px; }
.modal__body h3 { font-size: 1.5rem; padding-right: 40px; }
.modal__body h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-top: 8px; }
#modal-desc p { margin: 0 0 10px; color: var(--muted); }
.modal__body .chips { margin: 0; }
.modal__body .btn { align-self: flex-start; margin-top: 8px; }

/* ---------- Animaciones al hacer scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }
html:not(.js) .skill__bar span { width: var(--nivel); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .contact { grid-template-columns: 1fr; gap: 32px; }
    .modal[open] { grid-template-columns: 1fr; overflow-y: auto; }
    .modal__gallery { height: 46vh; }
    .modal__track img { max-height: 46vh; }
    .modal__body { max-height: none; overflow: visible; }
}

@media (max-width: 820px) {
    .nav__toggle { display: grid; }
    .nav__menu {
        position: absolute; top: 64px; left: 16px; right: 16px;
        flex-direction: column; align-items: stretch; gap: 2px; padding: 10px;
        background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
        box-shadow: var(--shadow); display: none;
    }
    .nav__menu.is-open { display: flex; }
    .nav__menu a { padding: 12px 14px; }
    .nav__menu .nav__cta { margin: 6px 0 0; justify-content: center; }
}

@media (max-width: 600px) {
    .section { padding: 72px 0; }
    .wrap { padding: 0 16px; }
    .hero { min-height: auto; padding: 112px 0 56px; }
    .hero__facts { margin-top: 40px; }
    .form { padding: 20px; }
    .form__row { grid-template-columns: 1fr; }
    .timeline__item { padding-left: 60px; }
    .timeline::before { left: 19px; }
    .timeline__dot { width: 40px; height: 40px; font-size: 1rem; }
    .projects { grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
    .skills { grid-template-columns: 1fr; }
    .g-recaptcha { transform: scale(.9); transform-origin: 0 0; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition: none !important; animation: none !important; }
    .js .reveal { opacity: 1; transform: none; }
    .skill__bar span { width: var(--nivel); }
}
