:root {
    color-scheme: dark;
    --bg: #0f1115;
    --panel: rgba(255, 255, 255, 0.065);
    --panel-strong: rgba(255, 255, 255, 0.105);
    --line: rgba(255, 255, 255, 0.14);
    --text: #f5f7fb;
    --muted: #aeb6c6;
    --accent: #46d3b5;
    --accent-2: #8ab4ff;
    --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(
            circle at top left,
            rgba(70, 211, 181, 0.12),
            transparent 32rem
        ),
        radial-gradient(
            circle at 85% 15%,
            rgba(138, 180, 255, 0.12),
            transparent 28rem
        ),
        linear-gradient(
            rgba(15, 17, 21, 0.88),
            rgba(15, 17, 21, 0.88)
        ),
        url('/static/background.jpg')
            center/cover no-repeat fixed,
        var(--bg);
    color: var(--text);
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    line-height: 1.55;
}

a {
    color: inherit;
}

.modal-credits {
    margin-top: 1.2rem;
    padding-top: 0.8rem;
    border-top: 1px dashed var(--line);
    font-size: 0.88rem;
    color: var(--muted);
}

.modal-credits strong {
    color: var(--text);
    font-weight: 600;
}

.modal-credits a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cursor-light {
    position: fixed;
    inset: auto;
    width: 28rem;
    height: 28rem;
    pointer-events: none;
    border-radius: 999px;
    background:
        radial-gradient(
            circle,
            rgba(70, 211, 181, 0.12),
            transparent 68%
        );
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 180ms ease;
    z-index: 0;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1rem 0;
    backdrop-filter: blur(18px);
}

.brand {
    font-weight: 800;
    text-decoration: none;
}

.nav {
    display: flex;
    gap: 0.35rem;
    padding: 0.35rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(10, 12, 16, 0.72);
}

.nav a {
    padding: 0.55rem 0.8rem;
    color: var(--muted);
    font-size: 0.92rem;
    text-decoration: none;
    border-radius: 999px;
    transition:
        color 160ms ease,
        background 160ms ease;
}

.nav a:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
}

main {
    position: relative;
    z-index: 1;
}

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

.hero {
    min-height: calc(100vh - 4rem);
    display: grid;
    grid-template-columns:
        minmax(0, 1.35fr)
        minmax(280px, 0.65fr);
    align-items: center;
    gap: 2rem;
}

.eyebrow,
.section-kicker {
    margin: 0 0 0.6rem;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

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

h1 {
    margin-bottom: 1rem;
    max-width: 760px;
    font-size: clamp(3rem, 8vw, 6.8rem);
    line-height: 0.95;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 0;
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1.05;
    letter-spacing: 0;
}

.tagline {
    max-width: 780px;
    color: #dfe6f3;
    font-size: clamp(1.2rem, 2vw, 1.7rem);
}

.hero-description,
.section-heading p,
#contactText {
    color: var(--muted);
}

.hero-description {
    max-width: 680px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 2rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.8rem;
    padding: 0 1.25rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.07);
    text-decoration: none;
    font-weight: 600;
    transition:
        color 180ms ease,
        border-color 180ms ease,
        background 180ms ease,
        box-shadow 180ms ease;
}

.hero-actions .button:hover {
    border-color: var(--accent);
    background: var(--accent);
    color: #000000;
    box-shadow:
        0 0 18px
        rgba(70, 211, 181, 0.25);
}

.primary {
    color: #06110f;
    background: var(--accent);
    border-color: transparent;
}

.secondary {
    background: rgba(255, 255, 255, 0.07);
}

.hero-panel,
.skill-card,
.project-card,
.contact-list {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

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

.metric {
    padding: 1.1rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
}

.metric span {
    display: block;
    font-size: 2rem;
    font-weight: 900;
}

.metric small {
    color: var(--muted);
}

.about-section {
    display: grid;
    grid-template-columns:
        minmax(0, 1.2fr)
        minmax(280px, 0.8fr);
    align-items: center;
    gap: 3rem;
}

.about-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.about-content .section-kicker {
    margin-bottom: 0.5rem;
}

.about-content h2 {
    margin-bottom: 1.5rem;
}

.about-description {
    max-width: 100%;
}

.about-description p {
    margin: 0 0 1.4rem;
    color: #ffffff;
    font-size: clamp(1.05rem, 1.5vw, 1.25rem);
    line-height: 1.8;
    font-weight: 400;
}

.about-description p:last-child {
    margin-bottom: 0;
}

.about-photo {
    width: 100%;
    max-width: 420px;
    justify-self: end;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.about-photo img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
}

.split {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    gap: 2rem;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 2rem;
    margin-bottom: 1.6rem;
}

.section-heading p {
    max-width: 420px;
    margin-bottom: 0.25rem;
}

.skills-grid,
.projects-grid {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.skill-card,
.project-card {
    position: relative;
    overflow: hidden;
    padding: 1.15rem;
    transform: translateZ(0);
    transition:
        transform 180ms ease,
        border-color 180ms ease,
        background 180ms ease,
        box-shadow 180ms ease;
}

.skill-card:hover,
.project-card:hover,
.project-card.is-waiting {
    transform:
        translateY(-4px)
        scale(1.012);
    border-color:
        rgba(70, 211, 181, 0.45);
    background: var(--panel-strong);
}

.skill-icon {
    display: inline-flex;
    width: 2.4rem;
    height: 2.4rem;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    border-radius: 12px;
    color: #081411;
    background:
        linear-gradient(
            135deg,
            var(--accent),
            var(--accent-2)
        );
    font-weight: 900;
}

.skill-card h3,
.project-card h3 {
    margin-bottom: 0.45rem;
}

.skill-card p,
.project-card p {
    color: var(--muted);
}

.details,
.tech-list,
.modal-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 1rem;
}

.details span,
.tech-list span,
.modal-tech span {
    padding: 0.28rem 0.55rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: #dce5f5;
    font-size: 0.78rem;
    background: rgba(255, 255, 255, 0.06);
}

.project-card {
    min-height: 230px;
    cursor: pointer;
}

.project-cover {
    height: 120px;
    margin: -0.3rem -0.3rem 1rem;
    border-radius: 14px;
    overflow: hidden;
    background:
        linear-gradient(
            135deg,
            rgba(70, 211, 181, 0.24),
            rgba(138, 180, 255, 0.2)
        ),
        #151a22;
}

.project-cover img,
.project-cover video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.project-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: rgba(255, 255, 255, 0.62);
    font-weight: 800;
}

.hover-progress {
    position: absolute;
    left: 1rem;
    right: 1rem;
    bottom: 0.8rem;
    height: 3px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0;
}

.hover-progress::before {
    content: "";
    display: block;
    width: 0;
    height: 100%;
    background: var(--accent);
}

.project-card.is-waiting .hover-progress {
    opacity: 1;
}

.project-card.is-waiting .hover-progress::before {
    animation:
        hold-progress
        2.5s
        linear
        forwards;
}

@keyframes hold-progress {
    to {
        width: 100%;
    }
}

.contact {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
}

.contact-form {
    display: grid;
    gap: 1rem;
    max-width: 48rem;
    margin-top: 1.5rem;
}

.contact-field {
    display: grid;
    gap: 0.45rem;
    color: var(--muted);
    transition: color 180ms ease;
}

.contact-field input,
.contact-field textarea {
    width: 100%;
    padding: 0.8rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
    font: inherit;
    transition:
        border-color 180ms ease,
        background 180ms ease,
        box-shadow 180ms ease,
        transform 180ms ease;
}

.contact-field:hover,
.contact-field:focus-within {
    color: var(--text);
}

.contact-field input:hover,
.contact-field textarea:hover {
    border-color: rgba(70, 211, 181, 0.7);
    background: rgba(70, 211, 181, 0.08);
    box-shadow: 0 0 0 3px rgba(70, 211, 181, 0.1);
    transform: translateY(-4px) scale(1.012);
}

.contact-field textarea {
    resize: vertical;
}

.contact-field input:focus,
.contact-field textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.contact-form .button {
    justify-self: start;
    cursor: pointer;
}

.contact-form .button:hover:not(:disabled) {
    border-color: var(--accent);
    background: var(--accent);
    color: #000000;
    box-shadow: 0 8px 24px rgba(70, 211, 181, 0.22);
    transform: translateY(-4px) scale(1.012);
}

.contact-form .button:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
}

.contact-form .button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.contact-form .button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.contact-form-status {
    min-height: 1.5em;
    margin: 0;
    color: var(--muted);
}

.contact-form-status[data-state="success"] {
    color: #83d6a5;
}

.contact-form-status[data-state="error"] {
    color: #ff9a9a;
}

.modal[hidden] {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(12px);
}

.modal-shell {
    position: relative;
    width: min(1040px, 100%);
    max-height: min(780px, calc(100vh - 2rem));
    display: grid;
    grid-template-columns:
        minmax(0, 1.45fr)
        minmax(260px, 0.55fr);
    grid-template-rows:
        minmax(0, 1fr)
        auto;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #11151c;
    box-shadow:
        0 30px 90px
        rgba(0, 0, 0, 0.6);
}

.modal-close {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    z-index: 2;
    width: 2.35rem;
    height: 2.35rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
    background: rgba(0, 0, 0, 0.42);
    cursor: pointer;
    font-size: 1.4rem;
}

.modal-media {
    min-height: 340px;
    display: grid;
    place-items: center;
    background: #050608;
}

.modal-media img,
.modal-media video {
    width: 100%;
    height: 100%;
    max-height: calc(100vh - 9rem);
    object-fit: contain;
}

.modal-info {
    padding: 2rem 1.4rem 1.4rem;
    overflow: auto;
}

.modal-info h3 {
    font-size: 1.7rem;
    line-height: 1.1;
}

.project-link {
    display: inline-flex;
    margin-top: 1rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 800;
}

.modal-controls {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
}

.modal-controls button {
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    font-size: 1.5rem;
}


/* =========================================
   VISTA PREVIA DE CERTIFICADOS (ADAPTABLE)
   ========================================= */

.certificates-preview {
    position: relative;
    width: fit-content;
    max-width: min(900px, 100%);
    max-height: 60vh;
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #050608;
    box-shadow: var(--shadow);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        transform 180ms ease,
        border-color 180ms ease,
        box-shadow 180ms ease;
}

.certificates-preview:hover {
    transform: translateY(-4px);
    border-color:
        rgba(70, 211, 181, 0.5);
    box-shadow:
        0 24px 70px
        rgba(0, 0, 0, 0.5);
}

.certificates-preview:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.certificates-preview img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
    background: #050608;
}

.certificates-preview-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.2rem;
    background:
        linear-gradient(
            to top,
            rgba(0, 0, 0, 0.82),
            rgba(0, 0, 0, 0)
        );
    color: var(--text);
    font-weight: 800;
    pointer-events: none;
}

.certificates-preview-overlay span {
    padding: 0.55rem 1rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
}

.certificates-button {
    cursor: pointer;
}


/* =========================================
   VISOR INDEPENDIENTE DE CERTIFICADOS (ADAPTABLE)
   ========================================= */

.certificate-modal-shell {
    width: auto;
    max-width: min(92vw, 1100px);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.certificate-modal-media {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #050608;
    padding: 1rem;
    overflow: hidden;
}

.certificate-modal-media img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(80vh - 4rem);
    object-fit: contain;
    background: #050608;
}


@media (max-width: 840px) {

    .site-header,
    .section {
        width: min(100% - 1rem, 1120px);
    }

    .site-header {
        align-items: flex-start;
    }

    .nav {
        max-width: 100%;
        overflow: auto;
    }

    .about-section {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .about-photo {
        justify-self: center;
        max-width: 420px;
    }

    .section-heading,
    .hero,
    .split,
    .contact,
    .modal-shell {
        grid-template-columns: 1fr;
    }

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

    .certificates-preview {
        max-height: 58vh;
    }

    .certificates-preview img {
        max-height: 58vh;
    }

}


@media (max-width: 560px) {

    .section {
        padding: 3.5rem 0;
    }

    .site-header {
        position: static;
    }

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

    .hero {
        min-height: auto;
        padding-top: 2rem;
    }

    .about-section {
        gap: 2rem;
    }

    .about-photo {
        width: 100%;
        max-width: 360px;
    }

    .modal {
        padding: 0;
    }

    .modal-shell {
        min-height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .modal-media {
        min-height: 300px;
    }

    .certificates-preview {
        width: 100%;
        max-height: 360px;
        border-radius: 16px;
    }

    .certificates-preview img {
        max-height: 360px;
    }

    .certificates-preview-overlay {
        padding: 1rem;
    }

    .certificates-preview-overlay span {
        padding: 0.5rem 0.85rem;
        font-size: 0.9rem;
    }


    /* VISOR DE CERTIFICADOS EN MÓVIL */

    .certificate-modal-shell {
        width: 100%;
        max-width: 100vw;
        max-height: 100vh;
        min-height: 100vh;
        border-radius: 0;
    }

    .certificate-modal-media {
        min-height: 300px;
    }

    .certificate-modal-media img {
        max-height: calc(100vh - 6rem);
    }

}
