:root {
    --bg: #0e0e0e;
    --bg2: #161616;
    --bg3: #1e1e1e;
    --cream: #e8d9c0;
    --cream2: #f5ede0;
    --muted: #888;
    --muted2: #555;
    --border: #262626;
    --accent: #d4a96a;
    --white: #f5f5f5;
}

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

/* Cursor personalizado SOLO si JS detecta puntero fino */
@media (pointer: fine) {

    .custom-cursor-active .cursor,
    .custom-cursor-active .cursor-ring {
        display: block;
    }

    .custom-cursor-active,
    .custom-cursor-active body,
    .custom-cursor-active a,
    .custom-cursor-active button {
        cursor: none;
    }

    /* Mantenemos el cursor nativo para que los inputs de texto sean legibles y usables */
    .custom-cursor-active input,
    .custom-cursor-active textarea,
    .custom-cursor-active select {
        cursor: auto;
    }
}

html {
    scroll-behavior: smooth;
    /* Elimina el delay de 300ms en iOS al tocar links */
    touch-action: manipulation;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--white);
    line-height: 1.6;
    overflow-x: hidden;
    /* SIN cursor: none aquí — lo gestiona el media query de arriba */
}

/* CURSOR */
.cursor {
    width: 10px;
    height: 10px;
    background: var(--cream);
    border-radius: 50%;
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 9999;
    transition: transform 0.15s ease;
    mix-blend-mode: difference;
    /* Oculto por defecto en móvil y tablet */
    display: none;
}

.cursor-ring {
    width: 36px;
    height: 36px;
    border: 1px solid var(--cream);
    border-radius: 50%;
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 9998;
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    mix-blend-mode: difference;
    /* Oculto por defecto en móvil y tablet */
    display: none;
}

body:hover .cursor {
    opacity: 1;
}

/* NAV */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 22px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(14, 14, 14, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.logo {
    font-family: 'DM Serif Display', serif;
    font-size: 20px;
    color: var(--cream);
    letter-spacing: -0.5px;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 36px;
}

.nav-links a {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s;
    /* Área de toque mínima recomendada para móvil */
    padding: 8px 0;
    -webkit-tap-highlight-color: transparent;
}

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

.hamburger {
    display: none;
    color: var(--cream);
    font-size: 22px;
    background: none;
    border: none;
    padding: 10px;
    margin: -10px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* HERO */
.hero {
    min-height: 80vh;
    display: flex;
    align-items: center;
    padding: 120px 5% 10px;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(ellipse, rgba(212, 169, 106, 0.07) 0%, transparent 70%);
    pointer-events: none;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
    max-width: 1100px;
    margin: auto;
    width: 100%;
}

.hero-eyebrow {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.hero-eyebrow::before {
    content: '';
    display: block;
    width: 32px;
    height: 1px;
    background: var(--accent);
}

h1 {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(42px, 5vw, 68px);
    line-height: 1.05;
    color: var(--cream2);
    letter-spacing: -2px;
    margin-bottom: 24px;
}

h1 em {
    font-style: italic;
    color: var(--accent);
}

.hero-desc {
    font-size: 17px;
    color: var(--muted);
    max-width: 460px;
    line-height: 1.75;
    margin-bottom: 40px;
}

.hero-desc strong {
    color: var(--white);
    font-weight: 500;
}

.hero-ctas {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: var(--cream);
    color: #0e0e0e;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    border-radius: 6px;
    letter-spacing: 0.02em;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    /* Transiciones solo en desktop */
    transition: background 0.25s;
}

@media (pointer: fine) {
    .btn-primary {
        transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }

    .btn-primary:hover {
        background: var(--cream2);
        transform: translateY(-2px);
        box-shadow: 0 12px 30px rgba(212, 169, 106, 0.2);
    }
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: transparent;
    color: var(--muted);
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    letter-spacing: 0.02em;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: border-color 0.25s, color 0.25s;
}

@media (pointer: fine) {
    .btn-ghost:hover {
        border-color: var(--cream);
        color: var(--cream);
        transform: translateY(-2px);
    }
}

/* HERO VISUAL */
.hero-visual {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-img-wrap {
    position: relative;
    width: 340px;
    height: 420px;
    border-radius: 4px;
    overflow: hidden;
}

.hero-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-img-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(14, 14, 14, 0.5) 0%, transparent 50%);
    pointer-events: none;
}

.hero-badge {
    position: absolute;
    bottom: -16px;
    right: -16px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 18px;
    font-size: 13px;
}

.hero-badge .badge-num {
    font-family: 'DM Serif Display', serif;
    font-size: 28px;
    color: var(--cream);
    display: block;
    line-height: 1;
}

.hero-badge .badge-label {
    color: var(--muted);
    font-size: 12px;
}

.hero-dot {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 10px;
    height: 10px;
    background: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.2);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(74, 222, 128, 0.05);
    }
}

/* SECTIONS */
section {
    padding: 100px 5%;
}

.section-wrap {
    max-width: 1100px;
    margin: auto;
}

.section-tag {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 40px;
}

.section-tag::before {
    content: '';
    width: 24px;
    height: 1px;
    background: var(--accent);
}

h2 {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(32px, 4vw, 52px);
    color: var(--cream2);
    letter-spacing: -1.5px;
    line-height: 1.1;
    margin-bottom: 50px;
}

/* ABOUT */
#about {
    background: var(--bg2);
    border-top: 1px solid var(--border);
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: start;
}

.about-left p {
    font-size: 18px;
    color: var(--muted);
    line-height: 1.8;
    margin-bottom: 20px;
}

.about-left p strong {
    color: var(--white);
    font-weight: 500;
}

.about-right {
    padding-top: 60px;
}

.stat-row {
    display: flex;
    gap: 32px;
    padding: 28px 0;
    border-bottom: 1px solid var(--border);
}

.stat-row:first-child {
    border-top: 1px solid var(--border);
}

.stat-num {
    font-family: 'DM Serif Display', serif;
    font-size: 36px;
    color: var(--cream);
    min-width: 80px;
    line-height: 1;
}

.stat-label {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.5;
    padding-top: 4px;
}

.stat-label strong {
    display: block;
    color: var(--white);
    font-size: 15px;
    margin-bottom: 4px;
}

/* EXPERIENCE */
#experience {
    background: var(--bg2);
    border-top: 1px solid var(--border);
}

.exp-item {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 40px;
    padding: 40px 0;
    border-bottom: 1px solid var(--border);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.exp-item.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.exp-meta {
    padding-top: 4px;
}

.exp-date {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 8px;
}

.exp-company {
    font-size: 15px;
    color: var(--muted);
}

.exp-content h3 {
    font-family: 'DM Serif Display', serif;
    font-size: 22px;
    color: var(--cream2);
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}

.exp-content p {
    font-size: 15px;
    color: var(--muted);
    line-height: 1.7;
    margin-bottom: 16px;
}

.exp-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.exp-tag {
    font-size: 12px;
    font-weight: 500;
    padding: 5px 12px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 99px;
    color: var(--muted);
    letter-spacing: 0.03em;
}

/* PROJECTS */
#projects {
    background: var(--bg);
    border-top: 1px solid var(--border);
}

.projects-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.project-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border-top: 1px solid var(--border);
    min-height: 320px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;

}

.project-row.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.project-row:last-child {
    border-bottom: 1px solid var(--border);
}

.project-row:nth-child(even) .project-img {
    order: 1;
}

.project-img {
    overflow: hidden;
    background: var(--bg3);
    position: relative;
    aspect-ratio: 4 / 3;
}

.project-img img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform 0.4s ease, filter 0.4s ease;
}

@media (pointer: fine) {
    .project-row:hover .project-img img {
        transform: scale(1.04);
        filter: grayscale(0%) brightness(1);
    }
}

.project-placeholder {
    width: 100%;
    height: 100%;
    background: var(--bg3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'DM Serif Display', serif;
    font-size: 48px;
    color: var(--border);
    min-height: 280px;
}

.project-info {
    padding: 44px 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-left: 1px solid var(--border);
}

.project-row:nth-child(even) .project-info {
    border-left: none;
    border-right: 1px solid var(--border);
}

.project-num {
    font-family: 'DM Serif Display', serif;
    font-size: 15px;
    color: var(--white);
    margin-bottom: 16px;
}

.project-info h3 {
    font-family: 'DM Serif Display', serif;
    font-size: 24px;
    color: var(--cream2);
    letter-spacing: -0.5px;
    margin-bottom: 14px;
    line-height: 1.2;
}

.project-problem {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 6px;
}

.project-info p {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.7;
    margin-bottom: 20px;
}

.project-result {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #4ade80;
    margin-bottom: 22px;
}

.project-result::before {
    content: '↑';
    font-weight: 700;
}

.project-techs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 22px;
}

.project-tech {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 99px;
    color: var(--muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    /* Área de toque generosa en móvil */
    padding: 10px 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    /* Sin transition de gap — causa el delay en iOS */
}

.project-link::after {
    content: '→';
}

@media (pointer: fine) {
    .project-link {
        transition: gap 0.2s, color 0.2s;
    }

    .project-link:hover {
        gap: 14px;
        color: var(--white);
    }
}

/* SKILLS TICKER */
#skills {
    background: var(--bg);
    border-top: none;
    border-bottom: 1px solid var(--border);
    padding: 32px 0;
    overflow: hidden;
}

#skills .section-wrap {
    padding: 0 5%;
    max-width: 1100px;
    margin: 0 auto;
}

#skills h2 {
    padding: 0 5%;
    max-width: 1100px;
    margin: 0 auto 60px;
}

.skills-track-wrap {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 0 0 60px;
}

.skills-track-wrap::before,
.skills-track-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 120px;
    z-index: 2;
    pointer-events: none;
}

.skills-track {
    display: flex;
    gap: 16px;
    width: max-content;
    animation: skillsScroll 30s linear infinite;
}

.skills-track:hover {
    animation-play-state: paused;
}

@keyframes skillsScroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

.skill-pill {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 28px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 99px;
    white-space: nowrap;
    transition: border-color 0.25s, background 0.25s;
}

.skill-pill:hover {
    border-color: var(--accent);
    background: var(--bg);
}

.skill-pill i {
    font-size: 22px;
    color: var(--accent);
    transition: color 0.25s;
}

.skill-pill:hover i {
    color: var(--white);
}

.skill-pill-name {
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: var(--white);
    letter-spacing: 0.02em;
}

/* CONTACT */
#contact {
    background: var(--bg);
    border-top: 1px solid var(--border);
}

.contact-inner {
    max-width: 700px;
    margin: auto;
    text-align: center;
}

.contact-inner h2 {
    margin-bottom: 16px;
}

.contact-inner p {
    font-size: 18px;
    color: var(--muted);
    margin-bottom: 48px;
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 60px;
}

.contact-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 28px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: border-color 0.25s, color 0.25s;
    letter-spacing: 0.03em;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.contact-link:hover {
    border-color: var(--cream);
    color: var(--cream);
}

@media (pointer: fine) {
    .contact-link:hover {
        transform: translateY(-2px);
    }
}

.contact-link svg {
    width: 16px;
    height: 16px;
    opacity: 0.6;
}

/* FOOTER */
footer {
    padding: 28px 5%;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--muted2);
    font-size: 13px;
}

footer span {
    color: var(--muted);
}

/* SCROLL REVEAL */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.65s ease, transform 0.65s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* FLOATING CONTACT BUTTON */
.float-btn {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.float-trigger {
    width: 56px;
    height: 56px;
    background: var(--cream);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s;
    position: relative;
    z-index: 2;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.float-trigger:hover {
    transform: scale(1.1);
}

.float-trigger.open {
    background: var(--bg3);
    transform: rotate(45deg);
}

.float-trigger svg {
    width: 22px;
    height: 22px;
    color: var(--bg);
    transition: color 0.2s;
}

.float-trigger.open svg {
    color: var(--cream);
}

.float-panel {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    width: 320px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
    opacity: 0;
    transform: translateY(16px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: bottom right;
}

.float-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.float-panel h4 {
    font-family: 'DM Serif Display', serif;
    font-size: 20px;
    color: var(--cream2);
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.float-panel p {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 20px;
    line-height: 1.5;
}

/* FORM STYLES */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    color: var(--white);
    outline: none;
    transition: border-color 0.2s;
    resize: none;
    /* Evita zoom automático en iOS al hacer focus */
    font-size: max(16px, 14px);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--muted2);
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--accent);
}

.form-group textarea {
    min-height: 90px;
}

.btn-send {
    width: 100%;
    padding: 13px;
    background: var(--cream);
    color: var(--bg);
    border: none;
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.btn-send:hover {
    background: var(--cream2);
}

@media (pointer: fine) {
    .btn-send:hover {
        transform: translateY(-1px);
    }

    .btn-send:active {
        transform: scale(0.98);
    }
}

.form-success {
    display: none;
    text-align: center;
    padding: 20px 0;
}

.form-success .check {
    width: 44px;
    height: 44px;
    background: rgba(74, 222, 128, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 22px;
}

.form-success p {
    font-size: 14px;
    color: var(--muted);
    margin: 0;
}

.form-success strong {
    display: block;
    color: var(--white);
    font-size: 16px;
    margin-bottom: 4px;
}

/* CONTACT SECTION FORM */
.contact-form-wrap {
    max-width: 560px;
    margin: 0 auto;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 44px;
}

.contact-form-wrap .form-group textarea {
    min-height: 120px;
}

/* MOBILE */
@media (max-width: 768px) {
    nav {
        padding: 16px 5%;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        gap: 0;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg2);
        border-bottom: 1px solid var(--border);
        padding: 8px 5%;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a {
        /* Área de toque grande — mínimo 48px de altura */
        padding: 16px 0;
        border-bottom: 1px solid var(--border);
        font-size: 15px;
        display: block;
    }

    .hamburger {
        display: block;
    }

    .hero-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .hero-img-wrap {
        width: 220px;
        height: 280px;
    }

    .about-grid {
        grid-template-columns: 1fr;
    }

    .exp-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .project-row {
        grid-template-columns: 1fr;
    }

    .project-row:nth-child(even) .project-img {
        order: unset;
    }

    .project-info {
        border-left: none !important;
        border-right: none !important;
        border-top: 1px solid var(--border);
        padding: 28px 24px;
    }

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

    section {
        padding: 70px 5%;
    }

    h2 {
        font-size: 34px;
    }

    .contact-form-wrap {
        padding: 28px 20px;
    }

    .float-panel {
        width: 290px;
    }
}