:root {
    --primary-color: #2c3e50;
    --accent-color: #2ecc71;
    --card-bg: #ffffff;
    --text-color: #333;
    --muted-text: #5d6d7e;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

body {
    background: linear-gradient(-45deg, #1a2a6c, #b21f1f, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Skip Navigation Link */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: #fff;
    padding: 12px 24px;
    border-radius: 0 0 8px 8px;
    font-weight: 600;
    text-decoration: none;
    z-index: 9999;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 0;
}

/* Shared Components */
.container {
    background-color: var(--card-bg);
    width: 100%;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    overflow: hidden;
    position: relative;
}

.lang-switch {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px;
    border-radius: 20px;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.lang-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.4rem;
    opacity: 0.6;
    transition: opacity 0.3s, transform 0.2s;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.lang-btn:hover {
    opacity: 1;
    transform: scale(1.5);
}

.lang-btn.active {
    opacity: 1;
    transform: scale(1.2);
}

.lang-btn:focus-visible,
.link-btn:focus-visible,
.action-btn:focus-visible,
.project-links a:focus-visible,
.close-modal:focus-visible,
.project-thumb:focus-visible {
    outline: 3px solid #fdbb2d;
    outline-offset: 3px;
}

/* Home Page Specific */
.home-container {
    max-width: 650px;
    text-align: center;
    padding-bottom: 30px;
}

.header {
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
    height: 130px;
    position: relative;
}

.profile-pic {
    width: 130px;
    height: 130px;
    background-color: #ddd;
    border-radius: 50%;
    border: 5px solid var(--card-bg);
    position: absolute;
    bottom: -65px;
    left: 50%;
    transform: translateX(-50%);
    background-image: url('img/profile.webp');
    background-size: cover;
    background-position: center;
}

.content {
    margin-top: 75px;
    padding: 0 25px;
}

h1 {
    font-size: 1.6rem;
    color: var(--primary-color);
    margin-bottom: 5px;
    font-weight: 700;
}

.subtitle {
    color: #555;
    font-size: 0.95rem;
    margin-bottom: 20px;
    font-weight: 500;
}

.bio {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #666;
    margin-bottom: 25px;
    text-align: justify;
}

.skills-section h2 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    color: #595959;
}

.skills-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 30px;
}

.skill-tag {
    background-color: #f1f3f5;
    color: var(--primary-color);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid #e1e4e8;
    transition: transform 0.2s;
}

.skill-tag:hover {
    transform: scale(1.05);
    background-color: #e2e6ea;
}

.links-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.link-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background-color: var(--primary-color);
    color: white;
    padding: 14px;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.link-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
    filter: brightness(1.1);
}

/* Link button color classes (replaces inline styles) */
.link-instagram { background-color: #C13584; }
.link-whatsapp { background-color: #128C7E; }
.link-email { background-color: #c5221f; }
.link-portfolio { background-color: #333; }

.icon { margin-right: 10px; font-size: 1.1rem; }

.footer {
    margin-top: 0;
    padding: 20px 25px;
    font-size: 0.75rem;
    color: #717171;
    text-align: center;
}

/* Portfolio Page Specific */
.portfolio-container {
    max-width: 980px;
}

.portfolio-container .header {
    height: auto;
    padding: 42px 28px 30px;
    color: #fff;
    text-align: center;
}

.portfolio-container .header h1 {
    font-size: clamp(1.6rem, 2.5vw, 2.3rem);
    margin-bottom: 8px;
    color: #fff;
}

.portfolio-container .header .subtitle {
    font-size: 1rem;
    opacity: 0.95;
    max-width: 760px;
    margin: 0 auto;
    line-height: 1.55;
    color: #fff;
}

.portfolio-container .content {
    margin-top: 0;
    padding: 28px;
}

.actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 22px;
    justify-content: center;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    filter: brightness(1.07);
}

.primary { background-color: var(--primary-color); }

.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.project-card {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 18px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(44, 62, 80, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 22px rgba(44, 62, 80, 0.13);
}

.project-tag {
    display: inline-block;
    margin-bottom: 10px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    background: #edf2f7;
    color: #334155;
    text-align: center;
}

.project-card h2 {
    font-size: 1.08rem;
    margin-bottom: 8px;
    color: var(--primary-color);
    text-align: center;
}

.project-card p {
    font-size: 0.96rem;
    color: var(--muted-text);
    line-height: 1.65;
    margin-bottom: 16px;
}

.project-thumb {
    display: block;
    margin-bottom: 14px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #dbe3ea;
    box-shadow: 0 4px 10px rgba(44, 62, 80, 0.1);
}

.project-thumb img {
    display: block;
    width: 100%;
    height: 210px;
    object-fit: cover;
    transition: transform 0.25s ease;
}

.project-thumb:hover img {
    transform: scale(1.03);
}

/* Image fallback when load fails */
.img-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 210px;
    background: #f3f4f6;
    color: #9ca3af;
    font-size: 0.9rem;
    font-weight: 500;
}

.project-links {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.project-links a {
    text-decoration: none;
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 8px 10px;
    border-radius: 8px;
    transition: filter 0.2s;
    min-width: 100px;
    text-align: center;
}

.project-links a:hover {
    filter: brightness(1.08);
}

.demo { background: var(--accent-color); }
.visit { background: #2563eb; }

/* Empty state for projects */
.empty-state,
.projects-error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--muted-text);
    font-size: 1rem;
}

.projects-error {
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
}

/* Loading state for projects */
.projects-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--muted-text);
    font-size: 1rem;
}

.projects-loading::before {
    content: '';
    display: block;
    width: 32px;
    height: 32px;
    margin: 0 auto 12px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.image-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    z-index: 1000;
}

.image-modal.open {
    display: flex;
}

.image-modal-content {
    position: relative;
    width: min(96vw, 1100px);
}

.image-modal img {
    width: 100%;
    max-height: 86vh;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: #111827;
}

.close-modal {
    position: absolute;
    top: -42px;
    right: 0;
    background: #fff;
    color: #111827;
    border: none;
    border-radius: 999px;
    width: 34px;
    height: 34px;
    font-size: 1.1rem;
    cursor: pointer;
    font-weight: 700;
}

@media (min-width: 1024px) {
    .links-container {
        align-items: center;
    }
    .links-container .link-btn {
        width: 400px;
        max-width: 100%;
    }
}

@media (max-width: 640px) {
    .projects-grid { grid-template-columns: 1fr; }
    .portfolio-container .content { padding: 20px; }
    .portfolio-container .header { padding: 44px 18px 22px; }
    .action-btn { min-width: 220px; }
    .close-modal { top: -38px; }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

/* 404 Error Page */
.error-page {
    text-align: center;
    padding: 60px 30px;
}

.error-code {
    font-size: 4rem;
    margin-bottom: 10px;
}

.error-message {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 30px;
}

.error-link {
    display: inline-flex;
    max-width: 280px;
    margin: 0 auto;
}
