/* Stitch-inspired design tokens (works with Bootstrap + data-theme) */
:root {
    --stitch-radius-pill: 9999px;
    --stitch-radius-card: 1rem;
    --stitch-glow-soft: 0 0 24px rgba(255, 255, 255, 0.18);
    --stitch-glow-strong: 0 0 32px rgba(255, 255, 255, 0.35);
    --stitch-nav-h: 4rem;
}

html[data-theme="light"] {
    --stitch-bg-radial: radial-gradient(ellipse 80% 60% at 50% 20%, #f0f4f8 0%, #e2e8f0 45%, #cbd5e1 100%);
    --stitch-surface: rgba(255, 255, 255, 0.85);
    --stitch-surface-2: rgba(241, 245, 249, 0.95);
    --stitch-border: rgba(15, 23, 42, 0.12);
    --stitch-text: #0f172a;
    --stitch-muted: #64748b;
    --stitch-cta-bg: #e2e8f0;
    --stitch-cta-text: #0f172a;
    --stitch-line-input: rgba(15, 23, 42, 0.35);
}

html[data-theme="dark"],
html:not([data-theme="light"]) {
    --stitch-bg-radial: radial-gradient(ellipse 90% 70% at 50% 15%, #1a1a1f 0%, #0a0a0c 55%, #000000 100%);
    --stitch-surface: rgba(24, 24, 28, 0.75);
    --stitch-surface-2: rgba(18, 18, 22, 0.9);
    --stitch-border: rgba(255, 255, 255, 0.12);
    --stitch-text: #f8fafc;
    --stitch-muted: #94a3b8;
    --stitch-cta-bg: #e5e5e5;
    --stitch-cta-text: #111827;
    --stitch-line-input: rgba(255, 255, 255, 0.45);
}

.portfolio-site {
    scroll-behavior: smooth;
}

.portfolio-site.has-mobile-dock {
    padding-bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 768px) {
    .portfolio-site.has-mobile-dock {
        padding-bottom: 0;
    }
}

/* ---------- Nav ---------- */
.site-header .navbar.stitch-nav {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--stitch-border);
    background: var(--stitch-surface) !important;
    box-shadow: none;
}

.site-header .navbar.stitch-nav .navbar-brand {
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--stitch-text) !important;
    text-decoration: none;
}

.site-header .navbar.stitch-nav .nav-link {
    color: var(--stitch-muted) !important;
    text-decoration: none;
    font-weight: 500;
}

.site-header .navbar.stitch-nav .nav-link:hover,
.site-header .navbar.stitch-nav .nav-link:focus-visible {
    color: var(--stitch-text) !important;
}

.site-header .navbar.stitch-nav .navbar-toggler {
    border-color: var(--stitch-border);
}

html:not([data-theme="light"]) .site-header .navbar.stitch-nav .navbar-toggler-icon {
    filter: invert(1) brightness(1.1);
}

.lang-switch {
    display: inline-flex;
    border-radius: var(--stitch-radius-pill);
    border: 1px solid var(--stitch-border);
    overflow: hidden;
    font-size: 0.75rem;
    font-weight: 600;
}

.lang-switch a {
    padding: 0.35rem 0.65rem;
    color: var(--stitch-muted);
    text-decoration: none !important;
}

.lang-switch a:hover {
    color: var(--stitch-text);
}

.lang-switch a.is-active {
    background: rgba(66, 179, 255, 0.2);
    color: var(--stitch-text);
}

html[data-theme="light"] .lang-switch a.is-active {
    background: rgba(11, 31, 58, 0.1);
}

/* ---------- Hero ---------- */
#hero.stitch-hero {
    position: relative;
    min-height: calc(100vh - var(--stitch-nav-h));
    min-height: calc(100dvh - var(--stitch-nav-h));
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 2rem;
    padding-bottom: 3rem;
    background: var(--stitch-bg-radial);
    color: var(--stitch-text);
}

#hero.stitch-hero .hero-inner {
    max-width: 42rem;
    margin: 0 auto;
}

#hero.stitch-hero h1 {
    font-size: clamp(2rem, 6vw, 3.25rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--stitch-text);
}

#hero.stitch-hero .hero-role {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    color: var(--stitch-muted);
    font-weight: 500;
}

#hero.stitch-hero .hero-lead {
    color: var(--stitch-muted);
    font-size: 1.05rem;
    line-height: 1.65;
}

#hero.stitch-hero .hero-badge {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border-radius: var(--stitch-radius-pill);
    border: 1px solid var(--stitch-border);
    color: var(--stitch-muted);
    font-size: 0.8rem;
    margin-bottom: 1.25rem;
}

.btn-stitch-primary {
    border-radius: var(--stitch-radius-pill);
    padding: 0.65rem 1.5rem;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: var(--stitch-cta-bg) !important;
    color: var(--stitch-cta-text) !important;
    border: none !important;
    box-shadow: var(--stitch-glow-soft);
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-stitch-primary:hover,
.btn-stitch-primary:focus-visible {
    box-shadow: var(--stitch-glow-strong);
    transform: translateY(-1px);
    color: var(--stitch-cta-text) !important;
}

.btn-stitch-ghost {
    border-radius: var(--stitch-radius-pill);
    padding: 0.6rem 1.25rem;
    font-weight: 500;
    border: 1px solid var(--stitch-border) !important;
    color: var(--stitch-text) !important;
    background: transparent !important;
    text-decoration: none !important;
}

.btn-stitch-ghost:hover {
    border-color: rgba(66, 179, 255, 0.5) !important;
}

/* ---------- Sections ---------- */
.section-band {
    position: relative;
    background: var(--stitch-surface-2);
    color: var(--stitch-text);
}

.section-band-alt {
    background: transparent;
}

.section-title {
    font-size: clamp(1.35rem, 3vw, 1.75rem);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--stitch-text);
    margin-bottom: 1.5rem;
}

.section-grid-bg {
    background-image:
        linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
    background-size: 32px 32px;
}

html:not([data-theme="light"]) .section-grid-bg {
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
}

.glow-card {
    border-radius: var(--stitch-radius-card);
    padding: 1.25rem 1.35rem;
    background: var(--stitch-surface);
    border: 1px solid var(--stitch-border);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 8px 40px rgba(0, 0, 0, 0.25);
}

html[data-theme="light"] .glow-card {
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
}

/* Timeline stitch */
.stitch-timeline {
    position: relative;
    padding-left: 1.5rem;
}

.stitch-timeline::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0.35rem;
    width: 2px;
    background: linear-gradient(180deg, rgba(66, 179, 255, 0.2), rgba(66, 179, 255, 0.55));
}

.stitch-timeline .timeline-node {
    position: relative;
    padding-bottom: 1.75rem;
}

.stitch-timeline .timeline-node::before {
    content: "";
    position: absolute;
    left: -1.2rem;
    top: 0.35rem;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--stitch-surface-2);
    border: 2px solid #42b3ff;
    box-shadow: 0 0 12px rgba(66, 179, 255, 0.5);
}

.stitch-timeline .timeline-node:last-child {
    padding-bottom: 0;
}

/* Tech stack */
.tech-stack-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (min-width: 992px) {
    .tech-stack-grid {
        gap: 1.25rem;
    }
}

.tech-stack-card h4 {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--stitch-muted);
    margin-bottom: 0.75rem;
}

.tech-stack-card .tech-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
}

.tech-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.35));
}

html[data-theme="light"] .tech-icon {
    filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.15));
}

.tech-icon-label {
    font-size: 0.7rem;
    color: var(--stitch-muted);
    max-width: 4.5rem;
    line-height: 1.2;
}

/* ---------- Contact ---------- */
#contacto.contact-stitch {
    background: var(--stitch-bg-radial);
    color: var(--stitch-text);
}

.contact-stitch .contact-heading {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--stitch-text);
}

/* Mobile: underline inputs */
@media (max-width: 767.98px) {
    .form-stitch-lines .form-field {
        margin-bottom: 1.5rem;
    }

    .form-stitch-lines label {
        display: block;
        font-size: 0.85rem;
        color: var(--stitch-muted);
        margin-bottom: 0.35rem;
    }

    .form-stitch-lines .form-control {
        border: none;
        border-radius: 0;
        border-bottom: 1px solid var(--stitch-line-input);
        background: transparent !important;
        color: var(--stitch-text) !important;
        padding-left: 0;
        box-shadow: none !important;
    }

    .form-stitch-lines .form-control:focus {
        border-color: #42b3ff;
        box-shadow: none !important;
    }

    .form-stitch-lines textarea.form-control {
        min-height: 6rem;
    }
}

/* Desktop: boxed two columns */
@media (min-width: 768px) {
    .form-stitch-lines {
        display: none !important;
    }

    .form-stitch-boxed .form-control {
        background: var(--stitch-surface) !important;
        border: 1px solid var(--stitch-border) !important;
        color: var(--stitch-text) !important;
        border-radius: 0.65rem;
    }

    .form-stitch-boxed .form-control:focus {
        border-color: #42b3ff !important;
        box-shadow: 0 0 0 3px rgba(66, 179, 255, 0.2);
    }
}

.social-row a {
    color: var(--stitch-text);
    text-decoration: none !important;
}

.social-row a:hover {
    color: #42b3ff;
}

.social-row .social-icon {
    width: 2rem;
    height: 2rem;
    margin-bottom: 0.25rem;
}

/* ---------- Dock ---------- */
.site-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0.5rem 0.5rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
    background: var(--stitch-surface);
    border-top: 1px solid var(--stitch-border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.site-dock a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    font-size: 0.65rem;
    color: var(--stitch-muted);
    text-decoration: none !important;
    padding: 0.35rem;
    border-radius: 0.5rem;
}

.site-dock a .dock-icon {
    font-size: 1.15rem;
    line-height: 1;
}

.site-dock a.is-active {
    color: var(--stitch-text);
    background: rgba(66, 179, 255, 0.12);
}

@media (min-width: 768px) {
    .site-dock {
        display: none !important;
    }
}

/* ---------- Footer ---------- */
.site-footer-stitch {
    border-top: 1px solid var(--stitch-border);
    background: var(--stitch-surface-2);
    color: var(--stitch-muted);
}

.site-footer-stitch a {
    color: var(--stitch-muted);
    text-decoration: none !important;
}

.site-footer-stitch a:hover {
    color: var(--stitch-text);
}

/* ---------- Skill / achievement cards ---------- */
.stitch-skill-card {
    border-radius: var(--stitch-radius-card);
    padding: 1.15rem 1.25rem;
    background: var(--stitch-surface);
    border: 1px solid var(--stitch-border);
}

html:not([data-theme="light"]) .stitch-skill-card {
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.2);
}

/* Chips sobre mí */
#techChips .badge {
    border: 1px solid var(--stitch-border);
}

/* Theme button in nav */
.site-header button[data-theme-toggle] {
    border-radius: var(--stitch-radius-pill);
}

section {
    scroll-margin-top: calc(var(--stitch-nav-h) + 0.5rem);
}
