:root {
    --color-bg: #ffffff;
    --color-bg-alt: #f5f7fb;
    --color-text: #333333;
    --color-text-muted: rgba(0, 0, 0, 0.65);
    --color-text-soft: rgba(0, 0, 0, 0.55);
    --color-accent: #4A90E2;
    --color-accent-glow: rgba(74, 144, 226, 0.35);
    --color-border-subtle: rgba(0, 0, 0, 0.06);
    --color-card: #ffffff;
    --color-input-bg: #fbfcff;
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-pill: 999px;
    --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.08);
    --header-bg: linear-gradient(to bottom, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.8));
    --header-border: rgba(0, 0, 0, 0.04);
    --dot-bg: rgba(255, 255, 255, 0.98);
    --dot-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    /* Liquid glass */
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-bg-strong: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-border-subtle: rgba(0, 0, 0, 0.06);
    --glass-blur: 20px;
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    --glass-shadow-menu: 0 16px 48px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

/* Modo oscuro */
[data-theme="dark"] {
    --color-bg: #0d1117;
    --color-bg-alt: #161b22;
    --color-text: #e6edf3;
    --color-text-muted: rgba(230, 237, 243, 0.8);
    --color-text-soft: rgba(230, 237, 243, 0.6);
    --color-accent: #58a6ff;
    --color-accent-glow: rgba(88, 166, 255, 0.25);
    --color-border-subtle: rgba(255, 255, 255, 0.08);
    --color-card: #161b22;
    --color-input-bg: #0d1117;
    --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.35);
    --header-bg: linear-gradient(to bottom, rgba(13, 17, 23, 0.92), rgba(13, 17, 23, 0.85));
    --header-border: rgba(255, 255, 255, 0.06);
    --dot-bg: rgba(22, 27, 34, 0.98);
    --dot-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    --glass-bg: rgba(22, 27, 34, 0.7);
    --glass-bg-strong: rgba(22, 27, 34, 0.9);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-subtle: rgba(255, 255, 255, 0.06);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    --glass-shadow-menu: 0 16px 48px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

.container {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 1.5rem;
    padding-left: max(1.5rem, env(safe-area-inset-left));
    padding-right: max(1.5rem, env(safe-area-inset-right));
}

/* Header */

.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    box-shadow: 0 1px 0 var(--glass-border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    min-height: 68px;
    padding: 0.35rem 0;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    flex-shrink: 0;
}

.logo-mark {
    width: 32px;
    height: 32px;
    border-radius: 40%;
    background: radial-gradient(circle at 0% 0%, #6ab5ff, #4A90E2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 700;
    font-size: 1rem;
}

.logo-text {
    color: var(--color-text-muted);
}

/* Tema: en desktop solo el del nav; en móvil solo el del header (junto a hamburguesa) */
.theme-toggle-header {
    display: none !important;
}

/* Menú móvil (outer-menu): oculto en desktop */
.outer-menu {
    display: none;
}

.nav-menu {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.2rem 0.85rem;
}

.main-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    flex: 1;
    min-width: 0;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.main-nav .nav-menu {
    grid-column: 2;
    justify-self: center;
}

.main-nav .theme-toggle-desk {
    grid-column: 3;
    justify-self: end;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    border: 1px solid var(--glass-border-subtle);
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    color: var(--color-text);
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.theme-toggle:hover {
    transform: scale(1.05);
    box-shadow: var(--glass-shadow);
}
.theme-toggle svg {
    width: 20px;
    height: 20px;
}
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* En desktop no mostrar el botón tema del header (solo el del nav) */
.theme-toggle-desk {
    display: inline-flex;
    flex-shrink: 0;
}

.nav-link {
    position: relative;
    padding: 0.5rem 0.75rem;
    color: var(--color-text-soft);
    white-space: nowrap;
    transition: color 0.18s ease-out;
    -webkit-tap-highlight-color: transparent;
}

.nav-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -0.25rem;
    width: 0;
    height: 2px;
    border-radius: 999px;
    background: var(--color-accent);
    transition: width 0.18s ease-out;
}

.nav-link:hover {
    color: var(--color-text);
}

.nav-link.is-active {
    color: var(--color-text);
}

.nav-link.is-active::after {
    width: 18px;
}

/* Secciones */

.section {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    padding: 3rem 0 2rem;
}

.section-alt {
    background: var(--color-bg-alt);
}

.section-content {
    padding: 1.5rem 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    border: 1px solid var(--glass-border-subtle);
}

.section-hero .section-content {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2.4fr);
    gap: 2rem;
    align-items: center;
    background: radial-gradient(circle at top left, rgba(74, 144, 226, 0.12), transparent 55%), var(--glass-bg);
}
[data-theme="dark"] .section-hero .section-content {
    background: radial-gradient(circle at top left, rgba(88, 166, 255, 0.08), transparent 55%), var(--glass-bg);
}

.layout-two-columns {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 2fr);
    gap: 1.75rem;
}

.section-heading h2 {
    font-size: 1.65rem;
    margin: 0 0 0.5rem;
}

.section-heading p {
    margin: 0;
    max-width: 34rem;
    color: var(--color-text-muted);
}

.section-heading.center {
    text-align: center;
}

.section-heading.center p {
    margin-left: auto;
    margin-right: auto;
}

.section-body p {
    margin: 0 0 0.75rem;
    color: var(--color-text-muted);
}

/* Hero */

.section-hero {
    position: relative;
    overflow: hidden;
}

.hero-orb {
    position: absolute;
    top: 20%;
    right: 15%;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(74, 144, 226, 0.2) 0%, rgba(74, 144, 226, 0.05) 50%, transparent 70%);
    filter: blur(40px);
    pointer-events: none;
    z-index: 0;
}
[data-theme="dark"] .hero-orb {
    background: radial-gradient(circle, rgba(88, 166, 255, 0.15) 0%, rgba(88, 166, 255, 0.03) 50%, transparent 70%);
}

.section-hero .container {
    position: relative;
    z-index: 1;
}

/* Hint de scroll (estilo Rockstar: "Scroll for more") */
.scroll-hint {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    color: var(--color-text-soft);
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    pointer-events: none;
}
.scroll-hint-icon {
    width: 20px;
    height: 32px;
    border: 2px solid currentColor;
    border-radius: 12px;
    position: relative;
    opacity: 0.9;
}
.scroll-hint-icon::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 6px;
    background: currentColor;
    border-radius: 2px;
    animation: scroll-hint-bounce 2s ease-in-out infinite;
}
@keyframes scroll-hint-bounce {
    0%, 100% { opacity: 1; transform: translateX(-50%) translateY(0); }
    50% { opacity: 0.5; transform: translateX(-50%) translateY(6px); }
}

/* Barra de progreso de scroll (lateral, estilo cinematográfico) */
.scroll-progress {
    position: fixed;
    left: 0;
    top: 0;
    width: 3px;
    height: 100vh;
    z-index: 35;
    background: var(--color-border-subtle);
    pointer-events: none;
}
.scroll-progress-bar {
    width: 100%;
    height: 0%;
    background: var(--color-accent);
    border-radius: 0 0 3px 0;
    transform-origin: top;
    transition: height 0.08s linear;
}

/* Subrayado animado en títulos de sección */
.section-title-with-line {
    position: relative;
    display: inline-block;
}
.title-line {
    position: absolute;
    left: 0;
    bottom: -0.35rem;
    width: 100%;
    height: 3px;
    background: var(--color-accent);
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: left;
}
.section-heading.center .title-line {
    left: 50%;
    transform: scaleX(0) translateX(-50%);
    transform-origin: center;
}

.hero-kicker {
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-text-soft);
    margin: 0 0 0.8rem;
}

.hero-title {
    font-size: 2.8rem;
    line-height: 1.1;
    margin: 0 0 0.65rem;
}

.hero-title span {
    display: block;
}

.hero-title .accent {
    color: var(--color-accent);
}

.hero-subtitle {
    margin: 0 0 1.2rem;
    max-width: 30rem;
    color: var(--color-text-muted);
}

.hero-subtitle .accent {
    font-weight: 500;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 0.9rem;
}

.hero-meta {
    font-size: 0.85rem;
    color: var(--color-text-soft);
}

.hero-visual {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1.5rem;
}

.hero-avatar {
    position: relative;
    width: 210px;
    height: 210px;
}

.avatar-circle {
    position: absolute;
    inset: 10%;
    border-radius: 33%;
    background: conic-gradient(from 180deg, #4A90E2, #8bc7ff, #4A90E2, #2b6bb5);
    opacity: 0.26;
}

.avatar-inner {
    position: absolute;
    inset: 0;
    border-radius: 40%;
    background: linear-gradient(135deg, var(--color-card), var(--color-bg-alt));
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(74, 144, 226, 0.2);
    box-shadow: var(--shadow-soft);
}

.avatar-initials {
    font-size: 3.2rem;
    font-weight: 600;
    color: var(--color-text);
}

.hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.hero-tags span {
    padding: 0.35rem 0.8rem;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    background: rgba(74, 144, 226, 0.1);
    color: var(--color-text);
    border: 1px solid rgba(74, 144, 226, 0.25);
}
[data-theme="dark"] .hero-tags span {
    background: rgba(88, 166, 255, 0.12);
    border-color: rgba(88, 166, 255, 0.3);
}

/* Botones */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.4rem;
    min-height: 44px;
    border-radius: var(--radius-pill);
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.12s ease-out, box-shadow 0.12s ease-out, background-color 0.12s ease-out, border-color 0.12s ease-out;
}

.btn-primary {
    background: var(--color-accent);
    color: #ffffff;
    box-shadow: 0 12px 30px var(--color-accent-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 38px var(--color-accent-glow);
}

.btn-ghost {
    background: transparent;
    border-color: var(--color-border-subtle);
    color: var(--color-text);
}

.btn-ghost:hover {
    background: var(--color-bg-alt);
}

.btn.full-width {
    width: 100%;
}

/* Habilidades */

.skills-grid {
    margin-top: 1.25rem;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.skill-card {
    padding: 1.3rem 1.2rem;
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border-subtle);
    box-shadow: var(--glass-shadow);
}

.skill-card h3 {
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
}

.skill-card ul {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.skill-card li + li {
    margin-top: 0.25rem;
}

/* Timeline */

.timeline {
    margin-top: 1.5rem;
    position: relative;
}

.timeline::before {
    content: "";
    position: absolute;
    top: 0.2rem;
    left: 0.5rem;
    width: 2px;
    height: 100%;
    background: linear-gradient(to bottom, rgba(74, 144, 226, 0.7), transparent);
}

.timeline-item {
    display: grid;
    grid-template-columns: 1.6rem minmax(0, 1fr);
    column-gap: 1.2rem;
}

.timeline-item + .timeline-item {
    margin-top: 1.7rem;
}

.timeline-marker {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    border: 2px solid var(--color-card);
    box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.2);
    background: var(--color-accent);
    margin-top: 0.35rem;
}

.timeline-content h3 {
    margin: 0 0 0.15rem;
    font-size: 1rem;
}

.timeline-meta {
    display: inline-block;
    font-size: 0.78rem;
    color: var(--color-text-soft);
    margin-bottom: 0.5rem;
}

.timeline-content p {
    margin: 0;
    color: var(--color-text-muted);
}

/* Proyectos */

.projects-grid {
    margin-top: 1.25rem;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.project-card {
    padding: 1.3rem 1.2rem;
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border-subtle);
    box-shadow: var(--glass-shadow);
}

.project-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.project-header h3 {
    margin: 0;
    font-size: 1.02rem;
}

.project-tag {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-pill);
    background: rgba(74, 144, 226, 0.1);
    color: var(--color-text);
}

.project-card p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

/* Sección horizontal (scroll tipo Rockstar / GTA VI) */
.section-horizontal {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 0 2rem;
    overflow: hidden;
    background: var(--color-bg-alt);
}
.horizontal-section-title {
    font-size: 1.5rem;
    margin: 0 0 1.25rem;
    text-align: center;
    color: var(--color-text);
    font-weight: 600;
}
.horizontal-track {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    padding: 0 1rem;
    box-sizing: border-box;
}
.horizontal-inner {
    display: flex;
    gap: 1.5rem;
    width: max-content;
    padding: 0 2rem;
    will-change: transform;
    box-sizing: border-box;
}
.project-card-wide {
    flex: 0 0 320px;
    min-width: 280px;
    box-sizing: border-box;
}

/* Contacto */

.contact-info p {
    margin: 0 0 0.4rem;
    font-size: 0.92rem;
}

.contact-form {
    padding: 1rem 1.1rem;
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border-subtle);
    box-shadow: var(--glass-shadow);
}

.form-feedback {
    margin-bottom: 1rem;
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}

.form-feedback.form-feedback-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #15803d;
}

[data-theme="dark"] .form-feedback.form-feedback-success {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.form-feedback.form-feedback-error {
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.25);
    color: #b91c1c;
}

[data-theme="dark"] .form-feedback.form-feedback-error {
    background: rgba(220, 38, 38, 0.15);
    color: #f87171;
}

.form-row {
    margin-bottom: 0.8rem;
}

.form-row-checkbox label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0;
    font-weight: normal;
}

.form-row label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.form-row input,
.form-row textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border-radius: 10px;
    border: 1px solid var(--color-border-subtle);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    color: var(--color-text);
    transition: border-color 0.14s ease-out, box-shadow 0.14s ease-out, background-color 0.14s ease-out;
    background: var(--color-input-bg);
}

.form-row input:focus,
.form-row textarea:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 1px var(--color-accent-glow);
    background: var(--color-card);
}

.form-note {
    margin-top: 0.4rem;
    font-size: 0.77rem;
    color: var(--color-text-soft);
}

/* Chat con IA */
.section-chat .section-content {
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}
.chat-container {
    margin-top: 0.9rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border-subtle);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    overflow: hidden;
    box-shadow: var(--glass-shadow);
}
.chat-messages {
    min-height: 220px;
    max-height: 380px;
    overflow-y: auto;
    padding: 1.25rem 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.chat-message {
    max-width: 88%;
    padding: 0.75rem 1rem;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.45;
}
.chat-message p {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}
.chat-message-user {
    align-self: flex-end;
    background: var(--color-accent);
    color: #fff;
}
.chat-message-assistant {
    align-self: flex-start;
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border-subtle);
    color: var(--color-text);
}
.chat-message-welcome {
    opacity: 0.9;
}
.chat-message-streaming .chat-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: var(--color-accent);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: chat-cursor-blink 0.8s ease-in-out infinite;
}
@keyframes chat-cursor-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}
.chat-form {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--color-border-subtle);
}
.chat-input {
    flex: 1;
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-subtle);
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--color-input-bg);
    color: var(--color-text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.chat-input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 1px var(--color-accent-glow);
}
.chat-input::placeholder {
    color: var(--color-text-soft);
}
.chat-send {
    flex-shrink: 0;
}
.chat-form.loading .chat-input,
.chat-form.loading .chat-send {
    opacity: 0.7;
    pointer-events: none;
}
.chat-disclaimer {
    margin: 0;
    padding: 0.5rem 1rem 0.75rem;
    font-size: 0.72rem;
    color: var(--color-text-soft);
    border-top: 1px solid var(--color-border-subtle);
}
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* Indicador lateral de secciones (dots pequeños y ordenados) */

.section-indicator {
    position: fixed;
    right: 1.75rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    z-index: 40;
}

.section-indicator .dot {
    width: 4px;
    height: 4px;
    padding: 4px;
    margin: 0;
    border-radius: 50%;
    border: 1px solid var(--color-border-subtle);
    background: var(--dot-bg);
    box-shadow: 0 0 0 1px var(--color-bg), var(--dot-shadow);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: content-box;
    flex-shrink: 0;
}

.section-indicator .dot:hover {
    transform: scale(1.25);
    background: var(--color-text-soft);
}

.section-indicator .dot.is-active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px var(--color-accent-glow), var(--dot-shadow);
}

/* Footer */

.main-footer {
    padding: 1.25rem 0 1.5rem;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--color-text-soft);
}

.footer-meta {
    font-variant-numeric: tabular-nums;
}

/* Responsivo */

/* Tablet */
@media (max-width: 960px) {
    .section {
        padding: 2.75rem 0 1.75rem;
    }

    .section-hero .section-content,
    .layout-two-columns {
        grid-template-columns: minmax(0, 1fr);
    }

    .hero-visual {
        align-items: flex-start;
        margin-top: 1.25rem;
    }

    .hero-avatar {
        width: 180px;
        height: 180px;
    }

    .avatar-initials {
        font-size: 2.8rem;
    }

    .hero-orb {
        width: 240px;
        height: 240px;
        right: 10%;
    }

    .skills-grid,
    .projects-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .section-heading h2 {
        font-size: 1.6rem;
    }

    .horizontal-section-title {
        font-size: 1.4rem;
        margin-bottom: 1.5rem;
    }

    .project-card-wide {
        flex: 0 0 280px;
        min-width: 260px;
    }

    .horizontal-inner {
        gap: 1.2rem;
        padding: 0 1.5rem;
    }
}

/* Menú móvil: estilo circular (checkbox + hamburger que gira a X) */
@media (max-width: 640px) {
    .outer-menu {
        display: block;
        position: relative;
        z-index: 2;
    }

    /* Botón tema: mismo tamaño exacto que el hamburger (40×40 con border-box) */
    .theme-toggle-header {
        display: inline-flex !important;
        margin-left: auto;
        margin-right: 0.15rem;
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        box-sizing: border-box;
    }

    .theme-toggle-desk {
        display: none !important;
    }

    .main-header .header-inner {
        position: relative;
        z-index: 60;
        background: var(--header-bg);
        justify-content: flex-start;
        gap: 0.2rem;
    }

    .main-header .header-inner .logo {
        margin-right: 0;
    }

    /* Ocultar nav desktop en móvil */
    .main-nav {
        display: none !important;
    }

    /* Checkbox invisible: mismo tamaño que el botón tema (40×40) */
    .outer-menu .checkbox-toggle {
        position: absolute;
        top: 0;
        left: 0;
        z-index: 51;
        cursor: pointer;
        width: 40px;
        height: 40px;
        margin: 0;
        opacity: 0;
        box-sizing: border-box;
    }

    /* Hamburger: 3 líneas que al estar checked se convierten en X */
    .outer-menu .checkbox-toggle:checked + .hamburger > div {
        transform: rotate(135deg);
    }
    .outer-menu .checkbox-toggle:checked + .hamburger > div:before,
    .outer-menu .checkbox-toggle:checked + .hamburger > div:after {
        top: 0;
        transform: rotate(90deg);
    }
    .outer-menu .checkbox-toggle:checked + .hamburger > div:after {
        opacity: 0;
    }
    .outer-menu .checkbox-toggle:hover + .hamburger {
        box-shadow: inset 0 0 0 1px var(--color-border-subtle);
    }
    .outer-menu .checkbox-toggle:checked:hover + .hamburger > div {
        transform: rotate(225deg);
    }

    .outer-menu .hamburger {
        position: relative;
        z-index: 50;
        width: 40px;
        height: 40px;
        padding: 0.4em;
        box-sizing: border-box;
        background: var(--glass-bg);
        backdrop-filter: blur(var(--glass-blur));
        -webkit-backdrop-filter: blur(var(--glass-blur));
        border: 1px solid var(--glass-border-subtle);
        border-radius: var(--radius-md);
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
        cursor: pointer;
        transition: box-shadow 0.3s ease, background 0.3s ease;
        backface-visibility: hidden;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .outer-menu .hamburger > div {
        position: relative;
        flex: none;
        width: 18px;
        height: 2px;
        background: var(--color-text);
        border-radius: 1px;
        transition: transform 0.4s ease;
    }
    .outer-menu .hamburger > div:before,
    .outer-menu .hamburger > div:after {
        content: '';
        position: absolute;
        z-index: 1;
        top: -6px;
        left: 0;
        width: 100%;
        height: 2px;
        background: inherit;
        border-radius: 1px;
        transition: transform 0.4s ease;
    }
    .outer-menu .hamburger > div:after {
        top: 6px;
    }

    /* Panel del menú: liquid glass, debajo del header */
    .outer-menu .menu {
        position: fixed;
        top: 60px;
        left: 12px;
        right: 12px;
        max-height: 0;
        overflow: hidden;
        pointer-events: none;
        visibility: hidden;
        z-index: 45;
        border-radius: 0 0 var(--radius-lg) var(--radius-lg);
        transition: max-height 0.35s ease, visibility 0.35s ease, opacity 0.25s ease;
    }

    .outer-menu .checkbox-toggle:checked ~ .menu {
        max-height: min(85vh, 420px);
        pointer-events: auto;
        visibility: visible;
        overflow: visible;
    }

    .outer-menu .menu-circle {
        width: 100%;
        color: var(--color-text);
        background: var(--glass-bg-strong);
        backdrop-filter: blur(var(--glass-blur)) saturate(180%);
        -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
        border: 1px solid var(--glass-border);
        border-top: none;
        border-radius: 0 0 var(--radius-lg) var(--radius-lg);
        box-shadow: var(--glass-shadow-menu);
        display: flex;
        align-items: flex-start;
        justify-content: center;
    }

    .outer-menu .menu-inner {
        text-align: center;
        width: 100%;
        padding: 1rem 1.5rem 1.75rem;
        opacity: 0;
        transition: opacity 0.2s ease;
        flex: none;
    }

    .outer-menu .checkbox-toggle:checked ~ .menu .menu-inner {
        opacity: 1;
    }

    .outer-menu .menu-list {
        list-style: none;
        padding: 0;
        margin: 0;
        display: block;
    }

    .outer-menu .menu-list li {
        padding: 0;
        margin: 0;
        font-size: 1.15rem;
        display: block;
    }

    .outer-menu .menu-list li + li {
        margin-top: 0.5rem;
    }

    .outer-menu .menu-list .nav-link {
        position: relative;
        display: inline-block;
        padding: 0.4rem 0;
        color: var(--color-text);
        transition: color 0.3s ease;
    }

    .outer-menu .menu-list .nav-link:hover {
        color: var(--color-accent);
    }

    .outer-menu .menu-list .nav-link:after {
        content: '';
        position: absolute;
        z-index: 1;
        bottom: 0.1em;
        left: 0;
        width: 0;
        height: 2px;
        background: var(--color-accent);
        transition: width 0.3s ease;
    }

    .outer-menu .menu-list .nav-link:hover:after {
        width: 100%;
    }

    .outer-menu .menu-list .nav-link.is-active {
        color: var(--color-accent);
    }
    .outer-menu .menu-list .nav-link.is-active:after {
        width: 100%;
    }
}

/* Con el menú abierto se permite scroll en la página */

/* Móvil grande / tablet pequeña */
@media (max-width: 720px) {
    .container {
        padding-left: max(1.5rem, env(safe-area-inset-left));
        padding-right: max(1.5rem, env(safe-area-inset-right));
    }

    .section-content {
        margin-left: 0.5rem;
        margin-right: 0.5rem;
    }

    .skills-grid,
    .projects-grid {
        margin-left: 0.25rem;
        margin-right: 0.25rem;
    }

    .scroll-progress {
        display: none;
    }

    .scroll-hint {
        bottom: 1.25rem;
        font-size: 0.7rem;
        letter-spacing: 0.15em;
    }

    .header-inner {
        gap: 1.25rem;
        min-height: 60px;
        padding: 0.35rem 0;
    }

    .nav-link {
        padding: 0.45rem 0.85rem;
    }

    .logo {
        font-size: 0.85rem;
    }

    .logo-mark {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }

    .section {
        padding: 2.5rem 0 1.5rem;
    }

    .section-content {
        padding: 1.25rem 1.15rem;
    }

    .section-heading h2 {
        font-size: 1.45rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    .hero-avatar {
        width: 160px;
        height: 160px;
    }

    .avatar-initials {
        font-size: 2.4rem;
    }

    .hero-orb {
        width: 200px;
        height: 200px;
        top: 15%;
        right: 5%;
    }

    .hero-actions .btn {
        padding: 0.65rem 1.2rem;
        font-size: 0.85rem;
    }

    .section-indicator {
        right: max(1rem, env(safe-area-inset-right));
        gap: 0.3rem;
    }

    .section-indicator .dot {
        width: 3px;
        height: 3px;
        padding: 3px;
    }

    .skills-grid,
    .projects-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 1rem;
    }

    .skill-card,
    .project-card {
        padding: 1.1rem 1rem;
    }

    .timeline-item {
        grid-template-columns: 1.2rem minmax(0, 1fr);
        column-gap: 1rem;
    }

    .section-horizontal {
        padding: 2rem 0 2rem;
        min-height: 180vh;
    }

    .horizontal-track {
        padding: 0 1.25rem;
    }

    .horizontal-section-title {
        font-size: 1.25rem;
        margin-bottom: 1.25rem;
    }

    .project-card-wide {
        flex: 0 0 260px;
        min-width: 240px;
    }

    .horizontal-inner {
        gap: 1rem;
        padding: 0 1.25rem;
    }

    .chat-messages {
        min-height: 180px;
        max-height: 50vh;
        max-height: 50dvh;
        padding: 1rem;
    }

    .chat-message {
        max-width: 92%;
        padding: 0.65rem 0.9rem;
        font-size: 0.85rem;
    }

    .chat-form {
        flex-wrap: wrap;
        padding: 0.6rem 0.75rem;
    }

    .chat-input {
        flex: 1 1 100%;
        min-width: 0;
        padding: 0.65rem 0.85rem;
    }

    .chat-send {
        flex: 1 1 auto;
        min-width: 80px;
    }

    .contact-form {
        padding: 0.85rem 1rem;
    }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
        padding: 1rem 0;
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .main-footer {
        padding: 1.2rem 0;
    }
}

/* Móvil pequeño */
@media (max-width: 480px) {
    .container {
        padding-left: max(1.25rem, env(safe-area-inset-left));
        padding-right: max(1.25rem, env(safe-area-inset-right));
    }

    .section-content {
        margin-left: 0.5rem;
        margin-right: 0.5rem;
    }

    .skills-grid,
    .projects-grid {
        margin-left: 0.25rem;
        margin-right: 0.25rem;
    }

    .header-inner {
        flex-wrap: wrap;
    }

    .main-nav .nav-link {
        font-size: 1rem;
    }

    .section {
        padding: 2rem 0 1.25rem;
    }

    .section-content {
        padding: 1.1rem 0.95rem;
    }

    .section-heading h2 {
        font-size: 1.3rem;
    }

    .section-heading p,
    .section-body p {
        font-size: 0.9rem;
    }

    .hero-kicker {
        font-size: 0.7rem;
        letter-spacing: 0.15em;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .hero-subtitle {
        font-size: 0.9rem;
        margin-bottom: 1.25rem;
    }

    .hero-avatar {
        width: 140px;
        height: 140px;
    }

    .avatar-initials {
        font-size: 2rem;
    }

    .hero-tags span {
        padding: 0.3rem 0.6rem;
        font-size: 0.72rem;
    }

    .hero-orb {
        width: 160px;
        height: 160px;
    }

    .section-indicator {
        right: max(0.9rem, env(safe-area-inset-right));
        gap: 0.25rem;
    }

    .section-indicator .dot {
        width: 3px;
        height: 3px;
        padding: 3px;
    }

    .section-horizontal {
        min-height: 200vh;
    }

    .horizontal-track {
        padding: 0 1.25rem;
    }

    .horizontal-section-title {
        font-size: 1.15rem;
    }

    .project-card-wide {
        flex: 0 0 220px;
        min-width: 200px;
    }

    .chat-messages {
        min-height: 160px;
        max-height: 45dvh;
    }

    .btn {
        padding: 0.65rem 1.2rem;
        font-size: 0.85rem;
    }
}

/* Orientación horizontal en móvil (menos altura) */
@media (max-height: 500px) and (orientation: landscape) {
    .section {
        min-height: auto;
        padding: 2.5rem 0 1.5rem;
    }

    .section-hero .section-content {
        gap: 2rem;
    }

    .hero-avatar {
        width: 120px;
        height: 120px;
    }

    .avatar-initials {
        font-size: 1.75rem;
    }

    .scroll-hint {
        display: none;
    }
}

