:root {
    --card-max-width: 800px;
    --transition-speed: 0.3s;
}

body {
    background-color: var(--page-bg);
    color: var(--text-color);
    font-family: 'JetBrains Mono', monospace;
    transition: background-color var(--transition-speed), color var(--transition-speed);
    margin: 0;
    padding-top: 2rem;
    padding-bottom: 5rem;
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.02em;
}

.tech-font {
    font-family: 'JetBrains Mono', monospace;
}

.container {
    max-width: var(--card-max-width);
}

.top-controls {
    display: none;
    /* Removed in favor of header-controls-pill */
}

.card {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

h1,
.h2 {
    margin-bottom: 0.5rem !important;
    /* Altura controlada */
    line-height: 1.2;
}

.profile-banner {
    height: 150px;
    background-image: var(--banner-img);
    background-size: cover;
    background-position: center;
    position: relative;
}

.profile-photo-container {
    margin-top: -75px;
    padding-left: 1.5rem;
    position: relative;
    z-index: 5;
}

.profile-photo {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 4px solid var(--card-bg);
    object-fit: cover;
}

.profile-info {
    padding: 1rem 1.5rem;
}


.line-height-1 {
    line-height: 1;
}

.experience-item,
.education-item {
    padding: 1.5rem 0;
}

.experience-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

/* code.js compatibility */
.jzpXKPEeRZlDwTJsfWKfHLXzQkHaoCkTwBUnnk {
    display: block;
    overflow: visible;
}

/* Header Controls Pill - Glassmorphism Refined */
.header-controls-pill {
    display: flex;
    align-items: center;
    background: rgba(30, 35, 40, 0.6) !important;
    /* Unified Translucent Gray */
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 50px;
    padding: 0 16px;
    height: 40px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 180px;
    justify-content: space-between;
    margin-bottom: 0.5rem !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    color: white !important;
    /* Ensure readable icons/text */
}

.header-controls-pill:hover {
    background: rgba(30, 35, 40, 0.75) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
    transform: translateY(-1px);
}

/* Ensure buttons inside pill are forced to white */
.header-controls-pill .lang-btn,
.header-controls-pill .pill-btn {
    color: white !important;
}

.header-controls-pill .lang-btn.active {
    background: rgba(255, 255, 255, 0.15);
}

/* Light/Dark theme independent style for the pill */
.theme--light .header-controls-pill:hover,
.theme--dark .header-controls-pill:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.pill-divider {
    width: 1px;
    height: 14px;
    background: rgba(255, 255, 255, 0.15);
}

.theme--light .pill-divider {
    background: rgba(0, 0, 0, 0.1);
}

.pill-btn,
.lang-btn {
    background: transparent;
    border: none;
    padding: 0;
    width: 32px;
    /* Smaller buttons (32px instead of 36px) */
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: inherit;
}

.lang-btn {
    font-size: 0.7rem;
    font-weight: 700;
    width: 28px;
    opacity: 0.5;
    color: var(--text-color);
}

.lang-btn.active {
    opacity: 1;
    background: rgba(255, 255, 255, 0.08);
}

.theme--light .lang-btn.active {
    background: rgba(0, 0, 0, 0.05);
}

.pill-btn:hover,
.lang-btn:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 0 0 10px rgba(255, 255, 255, 0.05);
}

.theme--light .pill-btn:hover,
.theme--light .lang-btn:hover {
    background: rgba(0, 0, 0, 0.04);
}

.pill-btn svg {
    stroke-width: 1.5px;
    transition: all 0.2s ease;
}

.contact-info-list {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.contact-info-list a {
    justify-content: flex-end;
}

.contact-hover {
    transition: opacity 0.2s ease, transform 0.2s ease;
    line-height: 1.5 !important;
    min-height: 24px !important;
    padding-bottom: 4px !important;
    margin-bottom: 0px !important;
}

.contact-hover:hover {
    opacity: 0.8;
    transform: translateX(-4px);
}

@media screen and (max-width: 768px) {
    .contact-hover:hover {
        transform: translateX(4px);
    }
}


.link-white,
.color-inherit {
    color: inherit;
    text-decoration: none;
}

.link-white:hover {
    text-decoration: underline;
}

.border-bottom {
    border-bottom-color: var(--border-color) !important;
}

/* CONTACT LINKS - BASE (SIN COLORES) */
.contact-links {
    display: flex;
    gap: 10px;
}

.contact-link {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    text-decoration: none;
}

.contact-link i {
    font-size: 16px;
}

.contact-link:hover {
    transform: translateY(-1px);
}

/* CONTACT LINKS ALINEADOS A LA DERECHA */
.contact-links-right {
    justify-content: flex-end;
}

.contact-links {
    display: flex;
    gap: 14px;
}

.contact-link {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    font-size: 18px;
    transition: all 0.2s ease;
}

.contact-link:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-2px);
}

.mobile-break {
    display: none;
}

/* Alineación de la columna de contacto una línea abajo (debajo del nombre) */
/* REMOVED: .contact-align-top */

@media screen and (max-width: 768px) {
    /* REMOVED: .contact-align-top */
}

/* Para que el botón se comporte como un link */
.btn-link-style {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    /* Hereda el color del tema */
    cursor: pointer;
    display: flex;
    align-items: center;
}

.contact-link-item {
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
}

.contact-link-item:hover {
    opacity: 0.7;
    color: var(--primary-color);
    /* O el color que uses para destacar */
}


.contact-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    /* O el tamaño que prefieras */
    height: 35px;
    border-radius: 50%;
    /* Tus colores de fondo aquí */
}

@media screen and (max-width: 768px) {

    /* Main Layout: 2 columns to 1 centered */
    .profile-info {
        text-align: center;
        padding: 1.5rem 1rem;
    }

    .profile-info .row {
        flex-direction: column !important;
        align-items: center !important;
    }

    /* Fixed position for the pill at the very top */
    .header-controls-pill {
        position: absolute !important;
        top: 10px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        z-index: 1000 !important;
        margin: 0 !important;
        min-width: 180px;
    }

    .profile-info .col-md-8,
    .profile-info .col-md-4 {
        width: 100% !important;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    /* Centered photo */
    .profile-photo-container {
        display: flex;
        justify-content: center;
        padding-left: 0;
        margin-top: -80px;
    }

    .profile-photo {
        width: 150px;
        height: 150px;
        margin-top: 50px;
    }

    /* Group titles: flex-wrap and center */
    .job-titles {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0 10px;
        margin-bottom: 1rem;
    }

    .job-titles .profile-subtitle {
        margin-bottom: 0.25rem !important;
        white-space: nowrap;
    }

    /* Contact section: center as block, align left internally */
    .contact-info-list {
        align-items: flex-start !important;
        /* Internal alignment */
        display: inline-flex !important;
        /* Block behavior */
        flex-direction: column;
        text-align: left !important;
        margin: 1.5rem auto 0;
        gap: 8px;
    }

    .contact-info-list a {
        justify-content: flex-start !important;
        width: auto !important;
        font-size: 0.9rem;
    }

    .contact-info-list a span {
        order: 2;
        /* Text after icon */
    }

    .contact-info-list a svg {
        order: 1;
        /* Icon before text */
    }

    /* Optimize spacing */
    .card-body {
        padding: 1.25rem !important;
    }

    .experience-item,
    .education-item {
        padding: 1rem 0;
    }

    .h2,
    h1 {
        font-size: 1.5rem !important;
    }
}


.border-radius-custom {
    border-radius: 12px !important;
    /* Bordes redondeados más suaves */
}

/* Estilo base del botón clonando la estética de la card */
.custom-contact-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background-color: var(--card-bg);
    /* Igual que la tarjeta */
    color: var(--text-color);
    border: 1px solid var(--border-color);
    /* Mismo borde que la tarjeta */
    border-radius: 8px;
    /* Mismo redondeo */
    transition: all var(--transition-speed);
    cursor: pointer;
    flex: 1;
    /* Para que midan lo mismo en mobile */
}

/* Efecto hover sutil */
.custom-contact-btn:hover {
    filter: brightness(1.2);
    /* Brilla un poquito al pasar el mouse */
    border-color: var(--text-color);
    /* El borde se nota un poco más */
    color: var(--text-color);
}

/* Ajustes de iconos y texto */
.contact-icon-wrapper {
    margin-right: 8px;
    display: flex;
    align-items: center;
    font-size: 1.1rem;
}

.btn-text {
    font-size: 0.85rem;
    font-weight: 600;
}

.theme-toggle-btn-style {
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    transition: transform 0.2s ease, background 0.2s ease;
    color: white;
}

.theme-toggle-btn-style:hover {
    transform: scale(1.1);
}

@media print {
    @page {
        margin: 0 !important;
        size: A4 portrait;
    }

    html.theme--dark {
        --print-bg-color: #1b1f23;
        --print-text-color: #ffffff;
    }

    html:not(.theme--dark) {
        --print-bg-color: #fdf2e2;
        --print-text-color: #000000;
    }

    /* Force background rendering and reset transitions */
    html,
    body {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        height: 100% !important;
        background-color: var(--print-bg-color) !important;
        color: var(--print-text-color) !important;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        transition: none !important;
        animation: none !important;
    }

    .container,
    .print-page {
        background-color: var(--print-bg-color) !important;
    }

    .card,
    .profile-info {
        background-color: var(--print-bg-color) !important;
        color: var(--print-text-color) !important;
        border: none !important;
        border-radius: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
    }

    /* PRINT PAGE WRAPPER */
    .print-page {
        width: 100%;
        height: 297mm;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        box-sizing: border-box;
        padding: 0 0mm;
        page-break-inside: avoid;
        page-break-after: always;
        overflow: hidden;
    }

    .print-page:last-child {
        page-break-after: auto;
    }

    .print-page>.card {
        width: 100%;
        max-width: 200mm;
    }

    /* Canvas propagation */
    .container {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 auto !important;
        padding: 8mm 0 !important;
    }

    .card-body {
        padding: 1.5rem 2rem !important;
    }

    /* Hide unnecessary elements */
    .profile-photo-container,
    .profile-banner,
    .top-controls,
    #theme-toggle-btn,
    #download-cv-btn,
    .lang-switch,
    .toast-container,
    .experience-logo:not([src*="unlam"]),
    button,
    .no-print {
        display: none !important;
    }

    .page-break {
        display: block !important;
        page-break-before: always !important;
        break-before: page !important;
        height: 8mm !important;
    }

    /* Reset spacing for all common elements */
    [class*="mb-"],
    [class*="mt-"],
    [class*="pb-"],
    [class*="pt-"] {
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Personal info layout (2 columns) */
    .profile-info {
        padding: 0.75rem 1.5rem !important;
        text-align: left !important;
    }

    /* REMOVED: .contact-align-top print override */

    .profile-info .row {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: flex-start !important;
        justify-content: space-between !important;
    }

    .profile-info .col-md-8 {
        width: 65% !important;
        flex: 0 0 65% !important;
        max-width: 65% !important;
        text-align: left !important;
    }

    .profile-info .col-md-4 {
        width: 35% !important;
        flex: 0 0 35% !important;
        max-width: 35% !important;
        margin-top: 0 !important;
        text-align: right !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-end !important;
    }

    .contact-info-list {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-end !important;
        text-align: right !important;
        margin-top: 0 !important;
        width: 100% !important;
    }

    .contact-info-list a {
        justify-content: flex-end !important;
        width: 100% !important;
    }

    .contact-info-list p:not(.d-print-none):not(.no-print),
    .contact-info-list a:not(.d-print-none):not(.no-print),
    .profile-subtitle:not(.d-print-none):not(.no-print) {
        margin-bottom: 0px !important;
        line-height: 1.5 !important;
        min-height: 24px !important;
        display: flex !important;
        align-items: center !important;
    }

    /* Typography fixes */
    h1,
    h2,
    h3,
    h4,
    .h2,
    .h4,
    .h5 {
        color: var(--print-text-color) !important;
    }

    .text-muted,
    .text-secondary {
        color: var(--print-text-color) !important;
        opacity: 1 !important;
    }

    a {
        text-decoration: none !important;
        color: var(--print-text-color) !important;
    }

    h2[data-i18n="experience_title"] {
        margin-top: 0 !important;
    }

    /* Theme specific print fixes */
    html.theme--dark .experience-logo {
        filter: brightness(0) invert(1);
    }
}

html.is-printing .card {
    margin-bottom: 0 !important;
}

html.is-printing .card-body {
    padding: 0.3rem 1.5rem !important;
    /* Slightly tighter */
}

html.is-printing h2 {
    margin-bottom: 0.15rem !important;
    padding-bottom: 0.1rem !important;
}

html.is-printing .experience-item,
html.is-printing .education-item {
    padding: 0.15rem 0 !important;
    /* Tighter items */
}

html.is-printing .experience-item .d-flex>div {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    width: 100%;
}

html.is-printing .experience-item h3 {
    width: auto !important;
    margin-bottom: 2px !important;
    order: 1;
}

html.is-printing .experience-item p[data-i18n*="_date"] {
    margin-bottom: 0 !important;
    order: 2;
}

html.is-printing .experience-item h4 {
    margin-bottom: 0 !important;
    width: 100% !important;
    order: 3;
}

html.is-printing .experience-item .mb-3 {
    margin-bottom: 0.2rem !important;
}

/* Global normalization for header columns alignment (Web & Print) */
.profile-subtitle:not(.d-print-none):not(.no-print),
.contact-info-list p:not(.d-print-none):not(.no-print),
.contact-info-list a:not(.d-print-none):not(.no-print) {
    margin-bottom: 0px !important;
    padding-bottom: 4px !important;
    line-height: 1.4 !important;
    min-height: 24px !important;
    display: flex;
    align-items: center;
}

html.is-printing {
    font-size: 0.95rem !important;
    /* Slightly smaller font to compensate for margins */
}

@media print {

    /* Force Left alignment for the name and info in print */
    .profile-info {
        text-align: left !important;
    }

    .profile-info h1,
    .profile-info .h2 {
        text-align: left !important;
        display: block !important;
        width: 100% !important;
    }

    .profile-subtitle,
    .contact-info-list p,
    .contact-info-list a {
        padding-bottom: 0px !important;
        /* Perfect flush alignment for print */
    }
}

/* Specific overrides for is-printing simulation */
html.is-printing .profile-info {
    padding: 0.5rem 1.5rem !important;
    text-align: left !important;
}