html {
    scroll-behavior: smooth;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── BODY & BACKGROUND ── */
body {
    background-image: 
        radial-gradient(var(--bg-mango-light) 1.5px, transparent 1.5px),
        url('images/background2.png');
    background-color: var(--bg-sunny);
    color: var(--text-dark);
    font-family: var(--font-main);
    font-size: 1rem;
    line-height: 1.65;
    overflow-x: hidden;
    background-size: 24px 24px, cover;
    padding-bottom: 60px;

    .capa-fondo-flotante {
        position: absolute;
        top: 40px;
        left: 50%;
        transform: translateX(-50%);
        width: 1170px;
        height: 1290px;
        z-index: -1;
        background: var(--glass-bg);
        backdrop-filter: blur(4px);
        border: var(--border-style);
        border-radius: 16px;
        pointer-events: none;
    }
}

/* ── LINKS ── */
a {
    color: var(--mango-deep);
    text-decoration: none;
    font-weight: 250;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--tropical-green);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ── PAGE WRAPPER ── */
.page-wrapper {
    width: 100%;
    max-width: 1150px;
    margin: 0 auto;
    padding: 0 24px;
    box-sizing: border-box;
}

/* ── DECORATIVE BACKGROUND ITEMS ── */
.decorations-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.item {
    position: absolute;
    font-size: var(--size, 1.5rem);
    opacity: 0;
    animation: floaty var(--dur, 3s) ease-in-out infinite var(--delay, 5s);
}

@keyframes floaty {
    0%, 100% { opacity: 0;   transform: translateY(0px) scale(0.7) rotate(0deg); }
    50%       { opacity: 0.6; transform: translateY(0px) scale(1.1) rotate(10deg); }
}

.it1 { top: 15%; left: 2.7%;  --dur: 5s;   --delay: 0s;   --size: 1.6rem; }
.it2 { top: 40%; left: 2.8%;  --dur: 6s;   --delay: 1.5s; --size: 1.3rem; }
.it3 { top: 65%; left: 0.5%;  --dur: 7s;   --delay: 3s;   --size: 1.5rem; }
.it4 { top: 90%; left: 2.9%;  --dur: 5.5s; --delay: 0.8s; --size: 1.2rem; }
.it5 { top: 15%; right: 2.5%; --dur: 6.5s; --delay: 4s;   --size: 1.7rem; }
.it6 { top: 40%; right: 2.8%; --dur: 4.8s; --delay: 2.2s; --size: 1.4rem; }
.it7 { top: 65%; right: 2.9%; --dur: 4.8s; --delay: 2.2s; --size: 1.4rem; }
.it8 { top: 90%; right: 2.4%; --dur: 4.8s; --delay: 2.2s; --size: 1.4rem; }

/* ── MARQUEE BAND ── */
.marquee-band {
    background: var(--mango-primary);
    color: var(--white);
    font-family: var(--font-pixel);
    font-size: 1rem;
    padding: 1px 0;
    overflow: hidden;
    white-space: nowrap;
    border-bottom: 3px solid var(--mango-deep);
    box-shadow: 0 4px 10px rgba(230, 115, 0, 0.15);
}

.marquee-band span {
    display: inline-block;
    padding-left: 100%;
    animation: marquee 25s linear infinite;
}

@keyframes marquee {
    0%   { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-100%, 0, 0); }
}

/* ── HEADER / BANNER ── */
.site-header {
    width: 100%;
    margin-top: 32px;
    margin-bottom: 20px;
}

.banner-crop-container {
    width: 100%;
    height: 160px;
    overflow: hidden;
    border: 3px solid var(--text-dark);
    border-radius: 16px;
    box-shadow: 5px 5px 0px var(--text-dark);
    background-color: var(--bg-mango-light);
}

.banner-png {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* ── NAVIGATION ── */
.site-nav {
    margin: 20px 0;
    background: var(--glass-bg);
    backdrop-filter: blur(1px);
    border: var(--border-style);
    border-radius: 12px;
    padding: 12px 20px;
}

.site-nav ul {
    display: flex;
    justify-content: center;
    align-items: center;
    list-style: none;
    gap: 20px;
    flex-wrap: wrap;
}

.site-nav a {
    font-family: var(--font-pixel);
    font-size: 1.3rem;
    color: var(--text-dark);
    padding: 5px 15px;
    border-radius: 6px;
    border: 2px solid transparent;
}

/* ── NAV BUTTONS ── */
.button {
    font-size: 1.2rem;
    cursor: pointer;
    position: relative;
    font-family: var(--font-pixel);
    font-weight: bold;
    line-height: 1;
    padding: 1px;
    transform: translate(-4px, -4px);
    outline: 2px solid transparent;
    outline-offset: 5px;
    border-radius: 9999px;
    background-color: var(--stone-800);
    color: var(--stone-800);
    transition: transform 150ms ease, box-shadow 150ms ease;
    text-align: center;
    box-shadow:
        0.5px 0.5px 0 0 var(--stone-800), 1px 1px 0 0 var(--stone-800), 1.5px 1.5px 0 0 var(--stone-800), 2px 2px 0 0 var(--stone-800), 2.5px 2.5px 0 0 var(--stone-800), 3px 3px 0 0 var(--stone-800),
        0 0 0 2px var(--stone-50), 0.5px 0.5px 0 2px var(--stone-50), 1px 1px 0 2px var(--stone-50), 1.5px 1.5px 0 2px var(--stone-50), 2px 2px 0 2px var(--stone-50), 2.5px 2.5px 0 2px var(--stone-50), 3px 3px 0 2px var(--stone-50), 3.5px 3.5px 0 2px var(--stone-50), 4px 4px 0 2px var(--stone-50);
}

.button:hover {
    transform: translate(0, 0);
    box-shadow: 0 0 0 2px var(--stone-50);
}

.button:active,
.button:focus-visible {
    outline-color: var(--btn-mango-primary);
}

.button:focus-visible {
    outline-style: dashed;
}

.button > div {
    position: relative;
    pointer-events: none;
    background-color: var(--btn-mango-primary);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 9999px;
}

.button > div::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    opacity: 0.5;
    background-image: radial-gradient(rgb(255 255 255 / 80%) 20%, transparent 20%), radial-gradient(rgb(255 255 255 / 100%) 20%, transparent 20%);
    background-position: 0 0, 4px 4px;
    background-size: 8px 8px;
    mix-blend-mode: hard-light;
    animation: dots 0.5s infinite linear;
}

.button > div > span {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.1rem;
    gap: 0.25rem;
    filter: drop-shadow(0 -1px 0 rgba(255, 255, 255, 0.25));
}

.button > div > span:active {
    transform: translateY(2px);
}

@keyframes dots {
    0%   { background-position: 0 0, 4px 4px; }
    100% { background-position: 8px 0, 12px 4px; }
}

/* ── THREE COLUMN LAYOUT ── */
.content-container {
    display: grid;
    grid-template-columns: 210px 1fr 190px;
    gap: 20px;
    align-items: start;
}

/* ── SIDEBAR & WIDGETS ── */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.widget {
    background: var(--white);
    border: 2px solid var(--text-dark);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 4px 4px 0px var(--text-dark);
}

.widget-title {
    background: var(--bg-mango-light);
    border-bottom: 2px solid var(--text-dark);
    padding: 7px 14px;
    font-family: var(--font-pixel);
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--mango-deep);
    display: flex;
    align-items: center;
    gap: 6px;
}

.widget-img {
    width: 100%;
    height: auto;
    display: block;
    border-bottom: 2px dashed var(--bg-mango-light);
    background: #fff7eb;
}

.widget-body {
    padding: 14px 16px;
    font-size: 0.9rem;
}

.profile-name {
    font-family: var(--font-cursive);
    font-size: 1.6rem;
    text-align: center;
    margin-bottom: 10px;
    color: var(--mango-deep);
}

.info-table {
    width: 100%;
    font-size: 0.85rem;
    border-collapse: collapse;
}

.info-table td {
    padding: 3px 0;
    vertical-align: top;
}

.info-key {
    font-weight: bold;
    color: var(--text-muted);
    width: 42%;
}

.account-link-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 7px;
    font-size: 0.9rem;
}

/* ── MAIN CONTENT SEGMENTS ── */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.caja-segmento {
    background: var(--white);
    border: 3px solid var(--text-dark);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 5px 5px 0px var(--text-dark);
}

.titulo-segmento {
    background: linear-gradient(to right, var(--mango-primary), var(--sunny-yellow));
    color: var(--white);
    padding: 12px 22px;
    font-family: var(--font-pixel);
    /* Aplicado Clamp globalmente al estilo Sammwy */
    font-size: clamp(1rem, 4vw, 1.4rem);
    text-shadow: 2px 2px 0px var(--text-dark);
    border-bottom: 3px solid var(--text-dark);
    letter-spacing: 0.02em;
}

.contenido-caja {
    padding: 20px 22px;
    font-size: 0.95rem;
    line-height: 1.7;
}

.contenido-caja p {
    margin-bottom: 10px;
    color: var(--text-dark);
}

.contenido-caja p:last-child {
    margin-bottom: 0;
}

.contenido-caja h4 {
    margin: 14px 0 6px;
    color: var(--mango-deep);
    border-bottom: 1px solid var(--bg-mango-light);
    padding-bottom: 4px;
}

.contenido-caja ul {
    margin-left: 18px;
    margin-bottom: 12px;
}

/* ── TECH STACK ── */
.tech-group {
    margin-bottom: 14px;
}

.tech-group:last-child {
    margin-bottom: 0;
}

.tech-subtitle {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.custom-tag {
    background: var(--bg-mango-light);
    border: 1px solid var(--mango-primary);
    color: var(--text-dark);
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: bold;
}

/* ── COUNTERS & MISC ── */
.contador {
    text-align: center;
    font-family: var(--font-pixel);
    font-size: 1.9rem;
    letter-spacing: 6px;
    background: var(--text-dark);
    color: var(--sunny-yellow);
    padding: 6px 10px;
    border-radius: 6px;
}

.widget-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
}

.centro {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.centro img {
    border: 2px solid var(--text-dark);
    border-radius: 4px;
    max-height: 31px;
}

/* ── FOOTER ── */
.site-footer {
    margin-top: 48px;
    text-align: center;
    border-top: var(--border-style);
    padding-top: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ── BLOG / SUBPAGES ── */
.capa-fondo-flotante-blog {
    margin: 48px auto;
    max-width: 900px;
    width: 92%;
    height: auto;
    padding: 48px 52px;
    box-sizing: border-box;
    background: var(--glass-bg);
    backdrop-filter: blur(4px);
    border: var(--border-style);
    border-radius: 16px;
    box-shadow: 0 4px 32px rgba(180, 120, 20, 0.07);
}

.capa-fondo-flotante-blog * {
    pointer-events: auto;
}

.blog-main-title {
    font-family: var(--font-pixel);
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    color: var(--text-dark);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.blog-divider {
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.15);
    margin: 36px 0;
    width: 100%;
}

.blog-minimal-item {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 32px;
    align-items: start;
    margin: 40px 0;
}

.blog-date {
    font-family: var(--font-pixel);
    font-size: 0.9rem;
    color: var(--text-muted);
    padding-top: 6px;
}

.blog-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.blog-title {
    margin: 0;
    line-height: 1.2;
}

.blog-title a {
    font-family: var(--font-main);
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-dark);
    text-decoration: none;
}

.blog-title a:hover {
    color: var(--mango-deep);
}

.blog-tags {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    font-family: var(--font-main);
}

.blog-tag-category {
    color: #ff4a4a;
    font-weight: bold;
    font-size: 0.85rem;
}

.blog-tag-item {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.blog-excerpt {
    font-size: 0.92rem;
    line-height: 1.65;
    color: var(--text-dark);
    max-width: 680px;
}

.blog-more-link {
    color: #ff4a4a;
    font-weight: bold;
    font-size: 0.9rem;
    display: inline-block;
    text-decoration: none;
    transition: transform 0.2s ease, color 0.15s ease;
}

.blog-more-link:hover {
    color: var(--text-dark);
    text-decoration: none;
    transform: translateX(4px);
}

/* ── PROJECTS ── */
.projects-grid {
    display: grid;
    /* Ajustado a auto-fill y minmax exacto para reordenado fluido estilo Sammwy */
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
    margin: 32px 0;
}

.project-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.project-card:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.1);
}

.project-tag {
    font-family: var(--font-pixel);
    font-size: 0.85rem;
    color: #ff4a4a;
    text-transform: uppercase;
}

.project-title {
    font-family: var(--font-main);
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-dark);
    margin: 0;
}

.project-description {
    font-size: 0.88rem;
    line-height: 1.65;
    color: var(--text-dark);
    margin: 0;
    flex-grow: 1;
}

.project-links {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 6px;
}

.project-github-link {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
}

.project-github-link:hover {
    color: var(--text-dark);
    text-decoration: underline;
}

/* ── INTERESTS ── */
.interests-container {
    display: flex;
    flex-direction: column;
    gap: 28px;
    margin: 32px 0;
}

.interest-box {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 24px;
    align-items: start;
    padding-bottom: 28px;
    border-bottom: 1px dashed rgba(0,0,0,0.1);
}

.interest-box:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.interest-box-title {
    font-family: var(--font-pixel);
    font-size: 1rem;
    color: #ff4a4a;
    text-transform: uppercase;
    margin: 0;
    padding-top: 4px;
}

.interest-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.interest-content h3 {
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: bold;
    color: var(--text-dark);
    margin: 0;
}

.interest-content p {
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--text-dark);
    margin: 0;
}

.interest-mini-list {
    margin-top: 8px;
}

.interest-mini-list span {
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--text-muted);
}

.interest-mini-list ul {
    margin: 6px 0 0 16px;
    padding: 0;
    list-style-type: square;
    color: var(--text-dark);
    font-size: 0.88rem;
}

.interest-mini-list li {
    margin-bottom: 3px;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    /* Grilla a 1 columna pura */
    .content-container {
        grid-template-columns: 1fr;
    }

    /* El toque maestro del orden de apilado */
    .sidebar--right { order: 3; }
    .main-content    { order: 2; }
    .sidebar:not(.sidebar--right) { order: 1; }

    .blog-minimal-item {
        grid-template-columns: 1fr;
        gap: 10px;
        margin: 32px 0;
    }

    .blog-date {
        font-size: 0.85rem;
        padding-top: 0;
    }

    .interest-box {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .interest-box-title {
        border-bottom: 1px dashed rgba(0,0,0,0.1);
        padding-bottom: 5px;
    }

    .capa-fondo-flotante-blog {
        padding: 28px 22px;
    }
}

@media (max-width: 600px) {
    .page-wrapper { padding: 0 14px; }
    /* Eliminamos la sobreescritura de grid-columns aquí para que auto-fill siga trabajando maravillosamente */
}